]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoqemu: backup: Fix handling of backing store for backup target images
Peter Krempa [Tue, 31 Mar 2020 13:43:46 +0000 (15:43 +0200)]
qemu: backup: Fix handling of backing store for backup target images

We always tried to install backing store for the image even if it didn't
make sense, e.g. for a full backup into a raw image. Additionally we
didn't record the backing file into the qcow2 metadata so the image
itself contained the diff of data but reading from it would be
incomplete as it depends on the backing image.

This patch fixes both issues by carefully installing the correct backing
file when appropriate and also recording it into the metadata when
creating the image.

https://bugzilla.redhat.com/show_bug.cgi?id=1813310

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoConvert all remaining Markdown files to reStructuredText
Andrea Bolognani [Tue, 14 Apr 2020 10:59:04 +0000 (12:59 +0200)]
Convert all remaining Markdown files to reStructuredText

We've adopted reStructuredText as the primary markup language for
our documentation and, given that both GitLab and GitHub can render
documents in this format just fine, it makes sense to get rid of
the few last remaining bits of Markdown and standardize on
reStructuredText across the board.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolibvirt-stream: Convert to the g_autofree usage
Seeteena Thoufeek [Mon, 13 Apr 2020 12:49:26 +0000 (18:19 +0530)]
libvirt-stream: Convert to the g_autofree usage

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agodriver: Yet 1 more g_autofree conversion change
Seeteena Thoufeek [Mon, 13 Apr 2020 12:48:57 +0000 (18:18 +0530)]
driver: Yet 1 more g_autofree conversion change

This is the last missing g_autofree conversion change in the module after
commit 1e2ae2e311c took care of the VIR_AUTOFREE conversion.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agotravis: Remove usage of 'sudo'
Andrea Bolognani [Fri, 10 Apr 2020 08:28:22 +0000 (10:28 +0200)]
travis: Remove usage of 'sudo'

Travis CI reports

  root: deprecated key sudo (The key `sudo` has no effect anymore.)

so let's drop it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotravis: Deduplicate build instructions
Andrea Bolognani [Fri, 10 Apr 2020 08:16:47 +0000 (10:16 +0200)]
travis: Deduplicate build instructions

All information, except for osx_image image, is identical between
the two jobs so we can avoid repeating it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoREADME-hacking: Drop from the git repository
Andrea Bolognani [Mon, 6 Apr 2020 10:02:39 +0000 (12:02 +0200)]
README-hacking: Drop from the git repository

The newly-introduced CONTRIBUTING.rst serves the same purposes and
lives in the path where most people would look for it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoCONTRIBUTING: Add entry point for new contributors
Andrea Bolognani [Mon, 6 Apr 2020 09:56:58 +0000 (11:56 +0200)]
CONTRIBUTING: Add entry point for new contributors

It's generally expected that a git repository will contain this file,
which serves as an entry point for people interested in contributing
to the project.

In our case, we have extensive documentation available on the
website which we don't want to duplicate, so let's just point people
there.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: fix iteration in virSocketAddrResolveService
Nikolay Shirokovskiy [Mon, 13 Apr 2020 13:48:43 +0000 (16:48 +0300)]
util: fix iteration in virSocketAddrResolveService

getaddrinfo returns linked list. Fix iteration accordingly.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoconf: during PCI hotplug, require that the controller support hotplug
Laine Stump [Mon, 6 Apr 2020 03:44:16 +0000 (23:44 -0400)]
conf: during PCI hotplug, require that the controller support hotplug

Before this patch we would simply rely on QEMU failing to attach the
device. Since we have a flag in the address set telling us which
controllers support hotplug, we can fail the operation sooner.

This also assures that when hotplugging with no provided PCI address,
that we skip any controllers with hotplug='off', and attempt to assign
the device to a controller that not only supports hotplug, but also
has it enabled.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: check HOTPLUGGABLE connect flag when validating a PCI address
Laine Stump [Mon, 6 Apr 2020 02:57:43 +0000 (22:57 -0400)]
conf: check HOTPLUGGABLE connect flag when validating a PCI address

The HOTPLUGGABLE flag is set for appropriates buses in a PCI address
set, and thnis patch updates virDomainPCIAddressFlagsCompatible() to
check the HOTPLUGGABLE flag when searching for a suitable bus/slot for
a device. No devices request HOTPLUGGABLE though (yet), so there is no
observable effect.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu/conf: set HOTPLUGGABLE connect flag during PCI address set init
Laine Stump [Mon, 6 Apr 2020 02:40:37 +0000 (22:40 -0400)]
qemu/conf: set HOTPLUGGABLE connect flag during PCI address set init

virDomainPCIAddressBusSetModel() is called for each PCI controller
when building an address set prior to assiging PCI addresses to
devices.

This patch adds a new argument, allowHotplug, to that function that
can be set to false if we know for certain that a particular
controller won't support hotplug

The most interesting case is in qemuDomainPCIAddressSetCreate(), where
the config of each existing controller is available while building the
address set, so we can appropriately set allowHotplug = false when the
user has "hotplug='off'" in the config of a controller that normally
would support hotplug. In all other cases, it is set to true or false
in accordance with the capability of the controller model.

So far we aren't doing anything with this bus flag in the address set.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: simplify logic when checking for AUTOASSIGN PCI addresses
Laine Stump [Sun, 5 Apr 2020 22:01:43 +0000 (18:01 -0400)]
conf: simplify logic when checking for AUTOASSIGN PCI addresses

Old behavior: If the address was manually provided by config, copy
device AUTOASSIGN flag into the bus flag, and then later on in the
function *always* check for a match of the flags (which will always
match if the address came from config, since we just copied it).

New behavior: Don't mess with the bus flags - just directly check if
the AUTOASSIGN flag matches in bus and dev, but only make the check if
the address didn't come from config (i.e. it was auto-assigned by
libvirt).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf/qemu: s/VIR_PCI_CONNECT_HOTPLUGGABLE/VIR_PCI_CONNECT_AUTOASSIGN/g
Laine Stump [Sun, 5 Apr 2020 21:16:55 +0000 (17:16 -0400)]
conf/qemu: s/VIR_PCI_CONNECT_HOTPLUGGABLE/VIR_PCI_CONNECT_AUTOASSIGN/g

When the HOTPLUGGABLE flag was originally added, it was set for all
the PCI controllers that accepted hotplugged devices, and requested
for all devices that were auto-assigned to a controller. While we're
still autoassigning to the same list of controllers, those controllers
may or may not support hotplug, so let's use the flag that fits what
we're actually doing.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: add new PCI_CONNECT flag AUTOASSIGN
Laine Stump [Mon, 23 Mar 2020 02:32:49 +0000 (22:32 -0400)]
conf: add new PCI_CONNECT flag AUTOASSIGN

This new flag will be set for any controller that we decide can have
devices assigned to it automatically during PCI device assignment. In
the past PCI_CONNECT_TYPE_HOTPLUGGABLE was used for this purpose, but
that is overloading that flag, and no longer technically correct; what
we *really* want is to auto-assign devices to any pcie-root-port or
pcie-switch-downstream-port regardless of whether or not that
controller happens to have hotplug enabled.

This patch just adds the flag, but doesn't use it at all. Note that
the numbering of all the other flags was changed in order to insert
the new flag near the beginning of the list; that doesn't cause any
problem because the connect flags aren't stored anywhere between runs
of libvirtd.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: mention hotplug='off' in news.xml
Laine Stump [Thu, 5 Mar 2020 20:17:41 +0000 (15:17 -0500)]
docs: mention hotplug='off' in news.xml

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: hook up pcie-root-port hotplug='off' option
Laine Stump [Wed, 4 Mar 2020 03:22:14 +0000 (22:22 -0500)]
qemu: hook up pcie-root-port hotplug='off' option

If a pcie-root-port or pcie-downstream-port has hotplug='off' in its
<target> subelement, and if the qemu binary supports the hotplug=false
option, then it will be added to the commandline for the pcie
controller. This controller will then not allow any hotplug/unplug of
devices while the guest is running (and the hotplug capability won't
be advertised to the guest OS, so the guest OS also won't present
unplugging of PCI devices as an option).

  <controller type='pci' model='pcie-root-port'>
    <target hotplug='off'/>
  </controller>

For any PCI controllers other than pcie-downstream-port and
pcie-root-port, of for qemu binaries that don't support the hotplug
commandline option, an error will be logged during validation.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: new attribute "hotplug" for pci controllers
Laine Stump [Tue, 3 Mar 2020 17:23:52 +0000 (12:23 -0500)]
conf: new attribute "hotplug" for pci controllers

a <controller type='pci'...> element can now have a "hotplug"
attribute in the <target> subelement. This is intended to control
whether or not the slot(s) of the controller support
hotplugging/unplugging a device:

   <controller type='pci' model='pcie-root-port'>
     <target hotplug='off'/>
   </controller>

The default value of hotplug is "on".

Since support for configuring such an option is hypervisor-dependent
(and will vary among different types of PCI controllers even on a
single hypervisor), no validation is done in this patch - that
validation will be done in the patch that wires support for the
setting into the hypervisor.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: new capabilities flag pcie-root-port.hotplug
Laine Stump [Thu, 27 Feb 2020 20:22:59 +0000 (15:22 -0500)]
qemu: new capabilities flag pcie-root-port.hotplug

This caps flag is set when the qemu binary supports the option
"hotplug" for pcie-root-port, ioh3420 (Intel pcie-root-port) and
xio3130-downstream (Intel pcie-downstream-port). If it's available,
it's possible to disable hotplugging/unplugging devices on a
particular port by adding ",hotplug=off" to the qemu device
commandline. This option first appears in qemu-5.0.0.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoformatdomain.html.in: document emulator/vcpu pin delay
Daniel Henrique Barboza [Thu, 9 Apr 2020 19:45:17 +0000 (16:45 -0300)]
formatdomain.html.in: document emulator/vcpu pin delay

In a guest with only one vcpu, when pinning the emulator in say CPU184
and the vcpu0 in CPU0 of the host, the user might expect that only
CPU0 and CPU184 of the host will be used by the guest.

The reality is that Libvirt takes some time to honor the emulator
and vcpu pinning, taking care of NUMA constraints first. This will
result in other CPUs of the host being potentially used by the
QEMU thread until the emulator/vcpu pinning is done. The user
then might be confused by the output of 'virsh cpu-stats' in this
scenario, showing around 200 microseconds of cycles being spent
in other CPUs.

Let's document this behavior, which is explained in detail in
Libvirt commit v5.0.0-199-gf136b83139, in the cputune section
of formatdomain.html.in.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoxenconfig: Add support for max_event_channels
Jim Fehlig [Tue, 7 Apr 2020 23:33:26 +0000 (17:33 -0600)]
xenconfig: Add support for max_event_channels

Add support in the domXML<->native config converter for max_event_channels.
The parser and formater functions for max_grant_frames were reworked to
also parse max_event_channels. In doing so the xenbus controller is added
earlier in the config parsing, requiring a small adjustment to one of the
existing tests. Include a new test for the event channel conversion.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agolibxl: Add support for max_event_channels
Jim Fehlig [Tue, 7 Apr 2020 23:15:04 +0000 (17:15 -0600)]
libxl: Add support for max_event_channels

Add support for setting event_channels in libxl domain config object and
include a test to check that it is properly converted from XML to libxl
domain config.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: Add a new xenbus controller option for event channels
Jim Fehlig [Tue, 7 Apr 2020 22:37:09 +0000 (16:37 -0600)]
conf: Add a new xenbus controller option for event channels

Event channels are like PV interrupts and in conjuction with grant frames
form a data transfer mechanism for PV drivers. They are also used for
inter-processor interrupts. Guests with a large number of vcpus and/or
many PV devices many need to increase the maximum default value of 1023.
For this reason the native Xen config format supports the
'max_event_channels' setting. See xl.cfg(5) man page for more details.

Similar to the existing maxGrantFrames option, add a new xenbus controller
option 'maxEventChannels', allowing to adjust the maximum value via libvirt.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitdm: Add missing entries
Andrea Bolognani [Wed, 1 Apr 2020 10:14:58 +0000 (12:14 +0200)]
gitdm: Add missing entries

One new company has contributed to libvirt since the last time
the gitdm configuration was updated.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: add link to bug tracker against each download
Daniel P. Berrangé [Thu, 9 Apr 2020 13:51:59 +0000 (14:51 +0100)]
docs: add link to bug tracker against each download

Help people to see where to report bugs when they download a libvirt
release.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: update for rename of libvirt-jenkins.ci repository
Daniel P. Berrangé [Thu, 9 Apr 2020 13:47:51 +0000 (14:47 +0100)]
docs: update for rename of libvirt-jenkins.ci repository

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: style git mirror links less prominently
Daniel P. Berrangé [Thu, 9 Apr 2020 13:45:42 +0000 (14:45 +0100)]
docs: style git mirror links less prominently

To discourage people from using the git mirror links, style them in a
smaller italic font, with plain colour.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: point to gitlab as primary git repo host
Daniel P. Berrangé [Thu, 9 Apr 2020 13:42:24 +0000 (14:42 +0100)]
docs: point to gitlab as primary git repo host

Change the download page so that gitlab is referred to as the primary
git host and libvirt.org is related to mirror status.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: point users to gitlab for issue tracking
Daniel P. Berrangé [Thu, 9 Apr 2020 13:40:47 +0000 (14:40 +0100)]
docs: point users to gitlab for issue tracking

Currently we use the "Virtualization Tools" product in Red Hat Bugzilla
for issue tracking upstream. This changes to point people to GitLab for
issue tracking.

Note that Bugzilla still has plenty of bugs present against libvirt.
Triaging these to determine what is still valid will be a separate
exercise. Bugzilla will be locked to prevent creation of new issues
meanwhile.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: list settings required in creating a new git repo
Daniel P. Berrangé [Wed, 8 Apr 2020 16:36:05 +0000 (17:36 +0100)]
docs: list settings required in creating a new git repo

The libvirt project has alot of git repositories, and they must all be
configured in the same way, more or less. This page documents the
settings changes that I have made in GitLab and GitHub when configuring
projects, both as a reminder for myself, and to help anyone else doing
the same in future. Also included is info about the repo mirroring on
the libvirt.org server.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: add 'edit this page' link to footer of every page
Daniel P. Berrangé [Wed, 8 Apr 2020 15:18:58 +0000 (16:18 +0100)]
docs: add 'edit this page' link to footer of every page

To encourage contributors to make changes to the main website, add a
footer link to every page which links to the corresponding source file
in git. With gitlab, they are able to edit content directly in the web
browser and then submit a merge request. This gives a way to contribute
content that is arguably easier than our wiki which requires manual
account creation, while this will also benefit from maintainer review.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agocpu_map: Distinguish Cascadelake-Server from Skylake-Server
Jiri Denemark [Thu, 26 Mar 2020 20:55:14 +0000 (21:55 +0100)]
cpu_map: Distinguish Cascadelake-Server from Skylake-Server

The signatures of these two CPU model differ only in stepping as both
report family 6 and model 85. Skylake-Server uses stepping 4 or less and
Cascadelake-Server uses stepping 5..7.

https://bugzilla.redhat.com/show_bug.cgi?id=1761678

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocputest: Add data for Intel(R) Xeon(R) Gold 6130 CPU
Jiri Denemark [Thu, 17 Oct 2019 08:01:29 +0000 (10:01 +0200)]
cputest: Add data for Intel(R) Xeon(R) Gold 6130 CPU

Skylake-Server with family 6, model 85, stepping 4, which is currently
mis-detected as Cascadelake-Server CPU model.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocputest: Add data for Intel(R) Xeon(R) Platinum 9242 CPU
Jiri Denemark [Tue, 17 Mar 2020 21:38:21 +0000 (22:38 +0100)]
cputest: Add data for Intel(R) Xeon(R) Platinum 9242 CPU

Cascadelake-Server with family 6, model 85, stepping 7.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Add support for stepping part of CPU signature
Jiri Denemark [Thu, 26 Mar 2020 19:34:56 +0000 (20:34 +0100)]
cpu_x86: Add support for stepping part of CPU signature

CPU models defined in the cpu_map can use signature/@stepping attribute
to match a limited set of stepping numbers. The value is a bitmap for
bits 0..15 each corresponding to a single stepping value. For example,
stepping='4-6,9' will match 4, 5, 6, and 9. Omitting the attribute is
equivalent to stepping='0-15'.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Don't check return value of x86ModelCopy
Jiri Denemark [Thu, 26 Mar 2020 15:16:49 +0000 (16:16 +0100)]
cpu_x86: Don't check return value of x86ModelCopy

Thanks to glib allocation functions which abort on OOM the function
cannot ever return NULL.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Replace 32b signatures in virCPUx86Model with a struct
Jiri Denemark [Thu, 26 Mar 2020 15:16:00 +0000 (16:16 +0100)]
cpu_x86: Replace 32b signatures in virCPUx86Model with a struct

The CPU models in our cpu_map define their signatures using separate
family and model numbers. Let's store the signatures in the same way in
our runtime representation of the cpu_map.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Introduce virCPUx86SignatureFromCPUID
Jiri Denemark [Thu, 26 Mar 2020 13:57:47 +0000 (14:57 +0100)]
cpu_x86: Introduce virCPUx86SignatureFromCPUID

It can be used for separating family, model, and stepping numbers from a
single 32b integer as reported by CPUID.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Introduce virCPUx86SignaturesFree
Jiri Denemark [Thu, 26 Mar 2020 14:23:28 +0000 (15:23 +0100)]
cpu_x86: Introduce virCPUx86SignaturesFree

The function will be used for freeing virCPUx86Signatures structure
introduced later in this series.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Move and rename x86FormatSignatures
Jiri Denemark [Thu, 26 Mar 2020 14:14:41 +0000 (15:14 +0100)]
cpu_x86: Move and rename x86FormatSignatures

Later in this series the function will work on a newly introduced
virCPUx86Signatures structure. Let's move it to the place where all
related functions will be added and rename the function as
virCPUx86SignaturesFormat for easier review of the virCPUx86Signatures
patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Move and rename x86ModelHasSignature
Jiri Denemark [Thu, 26 Mar 2020 14:12:26 +0000 (15:12 +0100)]
cpu_x86: Move and rename x86ModelHasSignature

Later in this series the function will work on a newly introduced
virCPUx86Signatures structure. Let's move it to the place were all
related functions will be added and rename the function as
virCPUx86SignaturesMatch for easier review of the virCPUx86Signatures
patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Move and rename x86ModelCopySignatures
Jiri Denemark [Thu, 26 Mar 2020 14:07:42 +0000 (15:07 +0100)]
cpu_x86: Move and rename x86ModelCopySignatures

Later in this series the function will work on a newly introduced
virCPUx86Signatures structure. Let's move it to the place were all
related functions will be added and rename the function as
virCPUx86SignaturesCopy for easier review of the virCPUx86Signatures
patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86CopyMigratable
Jiri Denemark [Wed, 25 Mar 2020 17:50:15 +0000 (18:50 +0100)]
cpu_x86: Use g_auto* in virCPUx86CopyMigratable

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86ExpandFeatures
Jiri Denemark [Wed, 25 Mar 2020 10:32:57 +0000 (11:32 +0100)]
cpu_x86: Use g_auto* in virCPUx86ExpandFeatures

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86Translate
Jiri Denemark [Wed, 25 Mar 2020 10:32:44 +0000 (11:32 +0100)]
cpu_x86: Use g_auto* in virCPUx86Translate

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86UpdateLive
Jiri Denemark [Wed, 25 Mar 2020 09:30:10 +0000 (10:30 +0100)]
cpu_x86: Use g_auto* in virCPUx86UpdateLive

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86Update
Jiri Denemark [Wed, 25 Mar 2020 10:32:09 +0000 (11:32 +0100)]
cpu_x86: Use g_auto* in virCPUx86Update

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86UpdateHostModel
Jiri Denemark [Wed, 25 Mar 2020 15:06:18 +0000 (16:06 +0100)]
cpu_x86: Use g_auto* in x86UpdateHostModel

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86Baseline
Jiri Denemark [Wed, 25 Mar 2020 09:34:09 +0000 (10:34 +0100)]
cpu_x86: Use g_auto* in virCPUx86Baseline

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86GetHost
Jiri Denemark [Wed, 25 Mar 2020 09:33:48 +0000 (10:33 +0100)]
cpu_x86: Use g_auto* in virCPUx86GetHost

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86CheckFeature
Jiri Denemark [Wed, 25 Mar 2020 10:31:29 +0000 (11:31 +0100)]
cpu_x86: Use g_auto* in virCPUx86CheckFeature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86Encode
Jiri Denemark [Wed, 25 Mar 2020 09:33:27 +0000 (10:33 +0100)]
cpu_x86: Use g_auto* in x86Encode

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86EncodePolicy
Jiri Denemark [Wed, 25 Mar 2020 10:30:43 +0000 (11:30 +0100)]
cpu_x86: Use g_auto* in x86EncodePolicy

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86Decode
Jiri Denemark [Wed, 25 Mar 2020 09:29:54 +0000 (10:29 +0100)]
cpu_x86: Use g_auto* in x86Decode

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86Compare
Jiri Denemark [Wed, 25 Mar 2020 10:30:24 +0000 (11:30 +0100)]
cpu_x86: Use g_auto* in virCPUx86Compare

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86Compute
Jiri Denemark [Wed, 25 Mar 2020 09:33:03 +0000 (10:33 +0100)]
cpu_x86: Use g_auto* in x86Compute

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86DataParse
Jiri Denemark [Wed, 25 Mar 2020 09:32:47 +0000 (10:32 +0100)]
cpu_x86: Use g_auto* in virCPUx86DataParse

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86LoadMap
Jiri Denemark [Wed, 25 Mar 2020 13:52:01 +0000 (14:52 +0100)]
cpu_x86: Use g_auto* in virCPUx86LoadMap

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86ModelParse
Jiri Denemark [Wed, 25 Mar 2020 10:29:36 +0000 (11:29 +0100)]
cpu_x86: Use g_auto* in x86ModelParse

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86ModelFromCPU
Jiri Denemark [Wed, 25 Mar 2020 10:29:14 +0000 (11:29 +0100)]
cpu_x86: Use g_auto* in x86ModelFromCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86FeatureParse
Jiri Denemark [Wed, 25 Mar 2020 09:45:40 +0000 (10:45 +0100)]
cpu_x86: Use g_auto* in x86FeatureParse

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86VendorParse
Jiri Denemark [Wed, 25 Mar 2020 09:38:04 +0000 (10:38 +0100)]
cpu_x86: Use g_auto* in x86VendorParse

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86DataToCPU
Jiri Denemark [Wed, 25 Mar 2020 09:29:39 +0000 (10:29 +0100)]
cpu_x86: Use g_auto* in x86DataToCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation in virCPUx86GetModels
Jiri Denemark [Wed, 25 Mar 2020 17:41:48 +0000 (18:41 +0100)]
cpu_x86: Use glib allocation in virCPUx86GetModels

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPUx86Map
Jiri Denemark [Wed, 25 Mar 2020 13:49:57 +0000 (14:49 +0100)]
cpu_x86: Use glib allocation for virCPUx86Map

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPUx86Model
Jiri Denemark [Wed, 25 Mar 2020 10:28:13 +0000 (11:28 +0100)]
cpu_x86: Use glib allocation for virCPUx86Model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPUx86Feature
Jiri Denemark [Wed, 25 Mar 2020 09:40:29 +0000 (10:40 +0100)]
cpu_x86: Use glib allocation for virCPUx86Feature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPUx86Vendor
Jiri Denemark [Wed, 25 Mar 2020 09:37:29 +0000 (10:37 +0100)]
cpu_x86: Use glib allocation for virCPUx86Vendor

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPU{,x86}Data
Jiri Denemark [Wed, 25 Mar 2020 09:28:26 +0000 (10:28 +0100)]
cpu_x86: Use glib allocation for virCPU{,x86}Data

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Drop noTSX hint for incompatible CPUs
Jiri Denemark [Tue, 24 Mar 2020 22:35:44 +0000 (23:35 +0100)]
cpu_x86: Drop noTSX hint for incompatible CPUs

The hint was introduced a long time ago when broken TSX implementation
was found in Haswell and Broadwell CPUs. Since then many more CPUs with
TSX were introduced and and disabled due to TAA vulnerability.

Thus the hint is not very useful and I think removing it is a better
choice then updating it to cover all current noTSX models.

This partially reverts:
commit 7f127ded657b24e0e55cd5f3539ef5b2dc935908
    cpu: Rework cpuCompare* APIs

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: documentation for virtio packed option
Bjoern Walk [Mon, 6 Apr 2020 13:13:27 +0000 (15:13 +0200)]
docs: documentation for virtio packed option

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: command: support for virtio packed option
Bjoern Walk [Mon, 6 Apr 2020 13:13:26 +0000 (15:13 +0200)]
qemu: command: support for virtio packed option

Pass the packed option on the QEMU command line of the capability for
packed virtqueues is detected and the parameter is set explicitly.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: domain: support for virtio packed option
Bjoern Walk [Mon, 6 Apr 2020 13:13:25 +0000 (15:13 +0200)]
conf: domain: support for virtio packed option

Expose the virtio parameter for packed virtqueues as an optional libvirt
XML attribute to virtio-backed devices, e.g.:

    <interface type='user'>
      <mac address='00:11:22:33:44:55'/>
      <model type='virtio'/>
      <driver packed='on'/>
    </interface>

If the attribute is omitted, the default value for this attribute is 'off' and
regular split virtqueues are used.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: capabilities: add 'packed' capability
Bjoern Walk [Mon, 6 Apr 2020 13:13:24 +0000 (15:13 +0200)]
qemu: capabilities: add 'packed' capability

Add the capability for QEMU's packed virtqueues for virtio that supposedly have
better cache utilization and performance compared to the default split queues.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: capabilities: update qemu-4.2 capabilities for s390x
Bjoern Walk [Tue, 24 Mar 2020 11:34:28 +0000 (12:34 +0100)]
qemu: capabilities: update qemu-4.2 capabilities for s390x

Update s390x capabilities for QEMU 4.2 with the actual GA version for
QEMU and on the latest z15 machine.

This picks up the new blockdev capability, so we need to refresh a bunch
of test cases as well.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: virdaemon: fix waiting for child processes
Rafael Fonseca [Wed, 8 Apr 2020 12:12:54 +0000 (14:12 +0200)]
util: virdaemon: fix waiting for child processes

Unlike `waitpid`, `virProcessWait` only returns -1 (error) or 0
(success), so comparing that to `pid` will always be false and the
parent will report failure with:

error : main:851 : Failed to fork as daemon: No such file or directory

even though the grandchild process is succesfully running. Note that the
errno message is misleading: it was last set when trying to find a
restart state file.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reported-by: Marcin Krol <hawk@tld-linux.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainSnapshotPrepare: use local dom_disk variable
Yi Li [Tue, 7 Apr 2020 12:10:29 +0000 (20:10 +0800)]
qemuDomainSnapshotPrepare: use local dom_disk variable

Replace vm->def->disks[i] with dom_disk variable which is
initialized to the same disk.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: Update hacking.rst
Andrea Bolognani [Mon, 6 Apr 2020 14:59:48 +0000 (16:59 +0200)]
docs: Update hacking.rst

This organizes the existing contents into sections, tweaks some parts
a bit and adds links to the pages where the contents that were ripped
out of hacking.rst now live, either inline or in the catch-all "further
reading" section depending on what makes more sense.

The result is that it's now possible to consume this page, which is
the entry point for new contributors, in just a few minutes, and then
drill down further based on factors such as the familiarity with the
open source development model or mail-based workflows.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add best-practices.rst
Andrea Bolognani [Mon, 6 Apr 2020 13:58:47 +0000 (15:58 +0200)]
docs: Add best-practices.rst

These guidelines should already be familiar to people who have
contributed to other open source projects, so it doesn't make much
sense for them to be so prominent. Move them to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add submitting-patches.rst
Andrea Bolognani [Mon, 6 Apr 2020 13:42:17 +0000 (15:42 +0200)]
docs: Add submitting-patches.rst

This is a relatively lengthy part with lots of details, which many
people who are familiar with a mail-based development workflow will
already know and which will become obsolete once we move to GitLab.
Move the contents to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add advanced-tests.rst
Andrea Bolognani [Mon, 6 Apr 2020 13:38:22 +0000 (15:38 +0200)]
docs: Add advanced-tests.rst

This part contains a lot of useful tips, but presenting all of them
at the same time obfuscated the central message which is, 'make check'
and 'make syntax-check' must pass after each patch in a series. Let's
move them to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add committer-guidelines.rst
Andrea Bolognani [Mon, 6 Apr 2020 13:00:48 +0000 (15:00 +0200)]
docs: Add committer-guidelines.rst

While it's good to have these rules written down for reference, they
apply exclusively to committers, who by definition are familiar with
the project and probably work on it daily, so there's no need to have
them front and center when a separate page will do.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add developer-tooling.rst
Andrea Bolognani [Mon, 6 Apr 2020 12:47:01 +0000 (14:47 +0200)]
docs: Add developer-tooling.rst

This part describes entirely optional tooling, so it makes sense not
to have it advertised too prominently. Move it to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add programming-languages.rst
Andrea Bolognani [Mon, 6 Apr 2020 12:45:11 +0000 (14:45 +0200)]
docs: Add programming-languages.rst

Most new contributors are probably going to modify existing code rather
than introducing all-new programs and scripts, and even when the latter
happen they'll hopefully get a feel for which programming languages are
considered acceptable for the project by looking at what's already in
the repo. Make this part less prominent by moving it to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add coding-style.rst
Andrea Bolognani [Mon, 6 Apr 2020 12:43:56 +0000 (14:43 +0200)]
docs: Add coding-style.rst

This part represents the biggest chunk of the existing hacking.rst, and
despite that its utility is very limited because 'make syntax-check'
already guarantees most of the rules are followed over time.

Until the glorious day we finally codify our coding style completely
into a configuration for a tool such as clang-format and thus no longer
need a plain English description of it, move this part to a separate
page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add glib-adoption.rst
Andrea Bolognani [Mon, 6 Apr 2020 12:40:58 +0000 (14:40 +0200)]
docs: Add glib-adoption.rst

This part is very specific and doesn't quite fit into the "coding
style" section, so let's move it to its own page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Convert hacking.html to reStructuredText
Andrea Bolognani [Mon, 6 Apr 2020 10:30:17 +0000 (12:30 +0200)]
docs: Convert hacking.html to reStructuredText

The conversion has been performed by using pandoc as a first pass,
and then tweaking the result manually until it looked satisfactory.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogithub: skip lockdown of old issues/prs
Daniel P. Berrangé [Tue, 7 Apr 2020 16:50:54 +0000 (17:50 +0100)]
github: skip lockdown of old issues/prs

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogithub: enable lockdown of issues and merge requests
Daniel P. Berrangé [Fri, 3 Apr 2020 10:23:15 +0000 (11:23 +0100)]
github: enable lockdown of issues and merge requests

Libvirt uses GitHub as an automated read-only mirror. The goals were to
have a disaster recovery backup for libvirt.org, a way to make it easy
for people to clone their own private copy of libvirt Git, and finally
as a way to interact with apps like Travis.

The project description was set to a message telling people that we
don't respond to pull requests. This was quite a negative message to
potential contributors, and also did not give them any guidance about
the right way to submit to libvirt. Many also missed the description and
submitted issues or pull requests regardless.

It is possible to disable the issue tracker in GitHub, but there is no
way to disable merge requests. Disabling the issue tracker would also
leave the problem of users not being given any positive information
about where they should be reporting instead.

There is a fairly new 3rd party application built for GitHub that
provides a bot which auto-responds to both issues and merge requests,
closing and locking them, with a arbitrary comment:

   https://github.com/apps/repo-lockdown

This commit adds a suitable configuration file for libvirt, which
tries to give a positive response to user's issue/pullreq and guide
them to the desired contribution path on GitLab.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Make auto dump path generation embed driver aware
Michal Privoznik [Tue, 24 Mar 2020 17:07:19 +0000 (18:07 +0100)]
qemu: Make auto dump path generation embed driver aware

So far, libvirt generates the following path for automatic dumps:

  $autoDumpPath/$id-$shortName-$timestamp

where $autoDumpPath is where libvirt stores dumps of guests (e.g.
/var/lib/libvirt/qemu/dump), $id is domain ID and $shortName is
shortened version of domain name. So for instance, the generated
path may look something like this:

  /var/lib/libvirt/qemu/dump/1-QEMUGuest-2020-03-25-10:40:50

While in case of embed driver the following path would be
generated by default:

  $root/lib/libvirt/qemu/dump/1-QEMUGuest-2020-03-25-10:40:50

which is not clashing with other embed drivers, we allow users to
override the default and have all embed drivers use the same
prefix. This can create clashing paths. Fortunately, we can reuse
the approach for machined name generation
(v6.1.0-178-gc9bd08ee35) and include part of hash of the root in
the generated path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Make memory path generation embed driver aware
Michal Privoznik [Mon, 23 Mar 2020 12:33:32 +0000 (13:33 +0100)]
qemu: Make memory path generation embed driver aware

So far, libvirt generates the following path for memory:

  $memoryBackingDir/$id-$shortName/ram-nodeN

where $memoryBackingDir is the path where QEMU mmaps() memory for
the guest (e.g. /var/lib/libvirt/qemu/ram), $id is domain ID
and $shortName is shortened version of domain name. So for
instance, the generated path may look something like this:

  /var/lib/libvirt/qemu/ram/1-QEMUGuest/ram-node0

While in case of embed driver the following path would be
generated by default:

  $root/lib/qemu/ram/1-QEMUGuest/ram-node0

which is not clashing with other embed drivers, we allow users to
override the default and have all embed drivers use the same
prefix. This can create clashing paths. Fortunately, we can reuse
the approach for machined name generation
(v6.1.0-178-gc9bd08ee35) and include part of hash of the root in
the generated path.

Note, the important change is in qemuGetMemoryBackingBasePath().
The rest is needed to pass driver around.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Make hugepages path generation embed driver aware
Michal Privoznik [Fri, 20 Mar 2020 18:27:26 +0000 (19:27 +0100)]
qemu: Make hugepages path generation embed driver aware

So far, libvirt generates the following path for hugepages:

  $mnt/libvirt/qemu/$id-$shortName

where $mnt is the mount point of hugetlbfs corresponding to
hugepages of desired size (e.g. /dev/hugepages), $id is domain ID
and $shortName is shortened version of domain name. So for
instance, the generated path may look something like this:

  /dev/hugepages/libvirt/qemu/1-QEMUGuest

But this won't work with embed driver really, because if there
are two instances of embed driver, and they both want to start a
domain with the same name and with hugepages, both drivers will
generate the same path which is not desired. Fortunately, we can
reuse the approach for machined name generation
(v6.1.0-178-gc9bd08ee35) and include part of hash of the root in
the generated path.

Note, the important change is in qemuGetBaseHugepagePath(). The
rest is needed to pass driver around.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoRevert "qemu_conf: Track embed root dir"
Michal Privoznik [Mon, 23 Mar 2020 07:59:29 +0000 (08:59 +0100)]
Revert "qemu_conf: Track embed root dir"

This reverts commit 06a19921b6a522cd7b4d352c9320909752947de3.

What I haven't realized when writing this ^^ commit is that the
virQEMUDriver structure already stores the root directory path.
And since the pointer is immutable it can be accessed right from
the structure and thus there is no need to duplicate it in the
driver config.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemuDomainGetMachineName: Access embeddedRoot from driver rather than cfg
Michal Privoznik [Mon, 23 Mar 2020 07:48:38 +0000 (08:48 +0100)]
qemuDomainGetMachineName: Access embeddedRoot from driver rather than cfg

The cfg->root is going away, therefore get the info right from
the driver structure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirDomainDriverGenerateMachineName: Factor out embed path hashing
Michal Privoznik [Fri, 20 Mar 2020 18:52:32 +0000 (19:52 +0100)]
virDomainDriverGenerateMachineName: Factor out embed path hashing

The code that generates "qemu-embed-$hash" is going to be useful
in more places. Separate it out into a function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: Move virDomainGenerateMachineName to hypervisor/
Michal Privoznik [Fri, 20 Mar 2020 17:14:22 +0000 (18:14 +0100)]
conf: Move virDomainGenerateMachineName to hypervisor/

The virDomainGenerateMachineName() function doesn't belong in
src/conf/ really, because it has nothing to do with domain XML
parsing. It landed there because of lack of better place in the
past. But now that we have src/hypervisor/ the function should
live there. At the same time, the function name is changed to
match new location.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Drop two layers of nesting of memoryBackingDir
Michal Privoznik [Thu, 26 Mar 2020 09:46:41 +0000 (10:46 +0100)]
qemu: Drop two layers of nesting of memoryBackingDir

Initially introduced in v3.10.0-rc1~172.

When generating a path for memory-backend-file or -mem-path, qemu
driver will use the following pattern:

  $memoryBackingDir/libvirt/qemu/$id-$shortName

where $memoryBackingDir defaults to /var/lib/libvirt/qemu/ram but
can be overridden in qemu.conf. Anyway, the "/libvirt/qemu/" part
looks redundant, because it's already contained in the default,
or creates unnecessary nesting if overridden in qemu.conf.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: Drop virQEMUDriverIsPrivileged()
Michal Privoznik [Tue, 31 Mar 2020 15:42:43 +0000 (17:42 +0200)]
qemu: Drop virQEMUDriverIsPrivileged()

Introduced in v1.2.17-rc1~121, the assumption was that the
driver->privileged is immutable at the time but it might change
in the future. Well, it did not ever since. It is still immutable
variable. Drop the needless accessor then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agotests: Fix virQEMUDriverConfigNew() calling with respect to @root
Michal Privoznik [Mon, 23 Mar 2020 08:55:54 +0000 (09:55 +0100)]
tests: Fix virQEMUDriverConfigNew() calling with respect to @root

The virQEMUDriverConfigNew() accepts path to root directory for
embed mode as an argument. If the argument is not NULL it uses
the passed value as prefix for some internal paths (e.g.
cfg->libDir). If it is NULL though, it looks if the other
argument, @privileged is true or false and generates internal
paths accordingly. But when calling the function from the test
suite, instead of passing NULL for @root, an empty string is
passed. Fortunately, this doesn't create a problem because in
both problematic cases the generated paths are "fixed" to point
somewhere into build dir or the code which is tested doesn't
access them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agocpu: Use g_autoptr and g_autofree in cpu.c
Seeteena Thoufeek [Mon, 6 Apr 2020 13:24:06 +0000 (18:54 +0530)]
cpu: Use g_autoptr and g_autofree in cpu.c

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>