]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agodocs: Adjust formatting for virConnectGetAllDomainStats output
John Ferlan [Tue, 6 Dec 2016 13:41:42 +0000 (08:41 -0500)]
docs: Adjust formatting for virConnectGetAllDomainStats output

Adjust the spacing a bit in order to generate 'cleaner' looking output.
This matches what virDomainMemoryStats does and it creates text/code boxes
in order to list each of the stats for each category.

8 years agodocs: Rebuild apihtml docs when source changes
John Ferlan [Tue, 6 Dec 2016 13:38:46 +0000 (08:38 -0500)]
docs: Rebuild apihtml docs when source changes

When changing one of the src/libvirt-*.c files to alter the docs, the
adjusted files weren't being built.  Added them into APIBUILD_STAMP and
then added that to the html/index.html rule which is used for the
$(apihtml_generated) generated rule.

Also, for clean we can remove the html/*.html files

8 years agocgroup: Use system reported "unlimited" value for comparison
Viktor Mihajlovski [Tue, 6 Dec 2016 12:03:29 +0000 (13:03 +0100)]
cgroup: Use system reported "unlimited" value for comparison

With kernel 3.18 (since commit 3e32cb2e0a12b6915056ff04601cf1bb9b44f967)
the "unlimited" value for cgroup memory limits has changed once again as
its byte value is now computed from a page counter.
The new "unlimited" value reported by the cgroup fs is therefore 2**51-1
pages which is (VIR_DOMAIN_MEMORY_PARAM_UNLIMITED - 3072). This results
e.g. in virsh memtune displaying 9007199254740988 instead of unlimited
for the limits.

This patch uses the value of memory.limit_in_bytes from the cgroup
memory root which is the system's "real" unlimited value for comparison.

See also libvirt commit 231656bbeb9e4d3bedc44362784c35eee21cf0f4 for the
history for kernel 3.12 and before.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
8 years agonss: Introduce libvirt-guest module
Michal Privoznik [Tue, 29 Nov 2016 12:48:53 +0000 (13:48 +0100)]
nss: Introduce libvirt-guest module

So far the NSS module looks up only hostnames as provided by
guests themselves. However, there are some cases where this is
not enough: e.g. when there's a fresh new guest being installed
(with some generic hostname) say from a live ISO image; or some
(older) systems don't advertise their hostname in DHCP
transactions at all.
In cases like that it would be helpful if we translate domain
name as seen by libvirt too so that users can:

  # virsh start $dom && ssh $dom

In order to achieve that new libvirt-guest module is introduced,
while older libvirt module maintains its current behaviour (that
is translating guest provided names into IP addresses).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonss: Move address lookup code into a separate function
Michal Privoznik [Tue, 6 Dec 2016 11:54:43 +0000 (12:54 +0100)]
nss: Move address lookup code into a separate function

The part of the code that iterates over an array of JSON values
is going to be re-used. Instead of copying it over, move it to a
separate function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonss: Move address appending code into a separate function
Michal Privoznik [Sun, 4 Dec 2016 12:05:43 +0000 (13:05 +0100)]
nss: Move address appending code into a separate function

The part of the code that appends found IP address into a list is
going to be re-used. Instead of copying it over, move it to a
separate function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonss: Use macro to generate public API names
Michal Privoznik [Sun, 4 Dec 2016 10:56:44 +0000 (11:56 +0100)]
nss: Use macro to generate public API names

The name of the exported functions for an NSS module is quite
fixed, it is derived from the module name:

  _nss_$module_$function

Since we will create another NSS module with very similar
implementation we might as well generate the function names at
the compile time.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonetwork: Track MAC address map
Michal Privoznik [Mon, 28 Nov 2016 16:56:14 +0000 (17:56 +0100)]
network: Track MAC address map

Now that we have a module that's able to track
<domain, mac addres list> pairs, hook it up into
our network driver.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoutil: Introduce virMACMap module
Michal Privoznik [Fri, 25 Nov 2016 06:30:30 +0000 (07:30 +0100)]
util: Introduce virMACMap module

This module will be used to track:

  <domain, mac address list>

pairs. It will be important to know these mappings without
libvirt connection (that is from a JSON file), because NSS
module will use those to provide better host name translation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoutil: Introduce virFileRewriteStr
Michal Privoznik [Mon, 28 Nov 2016 08:00:55 +0000 (09:00 +0100)]
util: Introduce virFileRewriteStr

There are couple of places where we have a string and want to
save it to a file. Atomically. In all those places we use
virFileRewrite() but also implement the very same callback which
takes the string and write it into temp file. This makes no
sense. Unify the callbacks and move them to one place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirstring: Introduce virStringListRemove
Michal Privoznik [Mon, 28 Nov 2016 13:38:58 +0000 (14:38 +0100)]
virstring: Introduce virStringListRemove

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirstring: Introduce virStringListAdd
Michal Privoznik [Fri, 25 Nov 2016 14:43:53 +0000 (15:43 +0100)]
virstring: Introduce virStringListAdd

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonssmock: Prefer free() over VIR_FREE()
Michal Privoznik [Tue, 29 Nov 2016 13:59:25 +0000 (14:59 +0100)]
nssmock: Prefer free() over VIR_FREE()

Problem with VIR_FREE() is that we are not linking
libvirt-utils.so to our mock libs therefore there will be an
unresolved symbol. Fortunately, nsstest that eventually links
with the nssmock links also with libvirt-utils.so and thus the
symbol is resolved after all. However, if one wants to run the
test binary under valgrind it is impossible to do so. Because of
the unresolved symbol.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonetwork: Don't unlock non-locked network driver
Michal Privoznik [Mon, 28 Nov 2016 15:45:12 +0000 (16:45 +0100)]
network: Don't unlock non-locked network driver

In dd7bfb2cdc5d I've removed locking of the network driver upon
it's allocation. However, I forgot to remove one location of the
driver unlock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodocs: Add NEWS description for group_name support in iotune
John Ferlan [Mon, 5 Dec 2016 23:30:10 +0000 (18:30 -0500)]
docs: Add NEWS description for group_name support in iotune

8 years agovirsh: Add group name to blkdeviotune output
John Ferlan [Sun, 2 Oct 2016 12:42:31 +0000 (08:42 -0400)]
virsh: Add group name to blkdeviotune output

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

Add the ability to set/display the group_name for block device iotune

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Add the group name option to the iotune command line
John Ferlan [Sat, 1 Oct 2016 13:35:09 +0000 (09:35 -0400)]
qemu: Add the group name option to the iotune command line

Add in the block I/O throttling group parameter to the command line
if supported. If not supported, fail command creation.

Add the xml2argvtest for testing.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoconf: Add support for blkiotune group_name option
John Ferlan [Sat, 1 Oct 2016 13:01:06 +0000 (09:01 -0400)]
conf: Add support for blkiotune group_name option

Modify _virDomainBlockIoTuneInfo and rng schema to support the group_name
option for iotune throttling. Document the new value.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Add support for parsing iotune group setting
John Ferlan [Mon, 31 Oct 2016 21:22:59 +0000 (17:22 -0400)]
qemu: Add support for parsing iotune group setting

Add support to read/parse the iotune group setting for qemu.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Adjust various bool BlockIoTune set_ values into a single mask
John Ferlan [Mon, 7 Nov 2016 14:49:22 +0000 (09:49 -0500)]
qemu: Adjust various bool BlockIoTune set_ values into a single mask

Rather than have multiple bool values, create a single enum with bits
representing what fields are set. Fields are generally set in groups
of 3 (read, write, total).

8 years agoqemu: Alter qemuMonitorJSONSetBlockIoThrottle command logic
John Ferlan [Mon, 7 Nov 2016 19:46:09 +0000 (14:46 -0500)]
qemu: Alter qemuMonitorJSONSetBlockIoThrottle command logic

Currently we build the JSON object for the "block_set_io_throttle"
command using the knowledge that a NULL for a support*Options boolean
would essentially ignore the rest of the arguments.

This may not work properly if some capability was backported, plus it just
looks rather ugly. So instead, build the "base" arguments and then if
the support*Option bool capability is set, add in the arguments on the fly.

Then append those arguments to the basic command and send to qemu.

8 years agoqemu: Adjust maxparams logic for qemuDomainGetBlockIoTune
John Ferlan [Mon, 7 Nov 2016 13:43:01 +0000 (08:43 -0500)]
qemu: Adjust maxparams logic for qemuDomainGetBlockIoTune

Rather than using negative logic and setting the maxparams to a lesser
value based on which capabilities exist, alter the logic to modify the
maxparams based on a base value plus the found capabilities. Reduces the
chance that some backported feature produces an incorrect value.

8 years agocaps: Add new capability for the iotune group name
John Ferlan [Mon, 7 Nov 2016 11:19:50 +0000 (06:19 -0500)]
caps: Add new capability for the iotune group name

Add the capability to detect if the qemu binary can support the feature
to use throttling.group.

8 years agoinclude: Add new "group_name" definition for iotune throttling
John Ferlan [Mon, 31 Oct 2016 21:22:57 +0000 (17:22 -0400)]
include: Add new "group_name" definition for iotune throttling

Add the new field to support sharing I/O throttling quota between
multiple drives.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agocpu: Add support for pku and ospke Intel features for Memory Protection Keys
Lin Ma [Fri, 25 Nov 2016 08:44:30 +0000 (16:44 +0800)]
cpu: Add support for pku and ospke Intel features for Memory Protection Keys

qemu commit: f74eefe0
https://lwn.net/Articles/667156/

Signed-off-by: Lin Ma <lma@suse.com>
8 years agocpu: Add support for more AVX512 Intel features
Lin Ma [Thu, 24 Nov 2016 09:50:08 +0000 (17:50 +0800)]
cpu: Add support for more AVX512 Intel features

These features are included:
AVX512DQ, AVX512IFMA, AVX512BW, AVX512VL, AVX512VBMI, AVX512_4VNNIW and
AVX512_4FMAPS.

qemu commits: cc728d14 and 95ea69fb

Signed-off-by: Lin Ma <lma@suse.com>
8 years agostorage: Fix type PLOOP type check for storageVolUpload
John Ferlan [Fri, 2 Dec 2016 19:58:23 +0000 (14:58 -0500)]
storage: Fix type PLOOP type check for storageVolUpload

Commit id '03e750f3' added support for checking the PLOOP type; however,
it used 'target.type' which no storage code ever fills in, so it will
never be set.  Change to just vol->type (could use vol->target.format
as well).

8 years agotests: add test cases for address conflicts
Marc Hartmayer [Wed, 30 Nov 2016 11:47:05 +0000 (12:47 +0100)]
tests: add test cases for address conflicts

Add test cases for address conflicts between disks and hostdevs that are
using drive addresses.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoconf: add global check for duplicate drive addresses
Marc Hartmayer [Wed, 30 Nov 2016 11:47:04 +0000 (12:47 +0100)]
conf: add global check for duplicate drive addresses

Add a global check for duplicate drive addresses. This will fix the
problem of duplicate disk and hostdev drive addresses.

Example for duplicate drive addresses:
<disk>
  ...
  <target name='sda'/>
</disk>
<disk>
  ...
  <target name='sdb'/>
  <address type='drive' controller=0 bus=0 target=0 unit=0/>
</disk>

Another example:
<hostdev mode='subsystem' type='scsi' managed='no'>
  <source>
  ...
  </source>
  <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</hostdev>
<hostdev mode='subsystem' type='scsi' managed='no'>
  <source>
  ...
  </source>
  <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</hostdev>

Unfortunately the fixes (1b08cc170a84077afd4d15f4639a9a2cf398e9a2,
8d46386bfe01b84982e25e915ad9cfbae5cf4cb1) weren't enough to catch these
cases and it isn't possible to add additional checks in
virDomainDeviceDefPostParseInternal() for SCSI hostdevs or
virDomainDiskDefAssignAddress() for SCSI/IDE/FDC/SATA disks without
adding another parse flag (virDomainDefParseFlags) to disable this
validation while updating or detaching a disk or hostdev.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: don't use duplicate disk addresses
Marc Hartmayer [Wed, 30 Nov 2016 11:47:03 +0000 (12:47 +0100)]
tests: don't use duplicate disk addresses

Don't use duplicate disk addresses in test cases unless it's useful. At
least the test case will break once we have a check for uniqueness of
addresses at time of domain definition.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agoconf: virDomainDriveAddressIsUsedByDisk: Rename type to bus_type
Marc Hartmayer [Wed, 30 Nov 2016 11:47:02 +0000 (12:47 +0100)]
conf: virDomainDriveAddressIsUsedByDisk: Rename type to bus_type

Comparing the parameter 'type' against the member 'bus' instead of
against the member 'type' is quite confusing. Rename the parameter
'type' to 'bus_type' to clarify its meaning.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoconf: simplify functions virDomainSCSIDriveAddressIsUsedBy*()
Marc Hartmayer [Wed, 30 Nov 2016 11:47:01 +0000 (12:47 +0100)]
conf: simplify functions virDomainSCSIDriveAddressIsUsedBy*()

Pass the virDomainDeviceDriveAddress as a struct instead of individual
arguments. Reworked the function descriptions.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoFix version number
Andrea Bolognani [Mon, 5 Dec 2016 07:47:50 +0000 (08:47 +0100)]
Fix version number

The next release will be the first one of 2017, so the
version number will be 3.0.0 rather than 2.6.0.

8 years agoPost-release version bump to 2.6.0
Andrea Bolognani [Mon, 5 Dec 2016 07:44:22 +0000 (08:44 +0100)]
Post-release version bump to 2.6.0

8 years agoNEWS: Add release date for 2.5.0
Andrea Bolognani [Mon, 5 Dec 2016 07:38:09 +0000 (08:38 +0100)]
NEWS: Add release date for 2.5.0

8 years agoRelease of libvirt-2.5.0
Daniel Veillard [Sun, 4 Dec 2016 21:07:38 +0000 (22:07 +0100)]
Release of libvirt-2.5.0

* po/*.po*

8 years agoFix minor typos osstest/frozen/xen-4.8-testing
Yuri Chornoivan [Thu, 1 Dec 2016 20:50:08 +0000 (22:50 +0200)]
Fix minor typos

8 years agoqemuDomainAttachNetDevice: pass mq and vectors for vhost-user with multiqueue
gaohaifeng [Thu, 1 Dec 2016 06:01:18 +0000 (14:01 +0800)]
qemuDomainAttachNetDevice: pass mq and vectors for vhost-user with multiqueue

Two reasons:
1.in none hotplug, we will pass it. We can see from libvirt function
qemuBuildVhostuserCommandLine
2.qemu will use this vetcor num to init msix table. If we don't pass, qemu
will use default value, this will cause VM can only use default value
interrupts at most.

Signed-off-by: gaohaifeng <gaohaifeng.gao@huawei.com>
8 years agonews: Remove full stop at the end of the sentence
Martin Kletzander [Thu, 1 Dec 2016 12:40:09 +0000 (13:40 +0100)]
news: Remove full stop at the end of the sentence

To stay consistent.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agonews: Add "more PCIe less legacy PCI" to list of new features
Laine Stump [Wed, 30 Nov 2016 23:00:51 +0000 (18:00 -0500)]
news: Add "more PCIe less legacy PCI" to list of new features

8 years agoRefresh translations from zanata
Daniel P. Berrange [Thu, 1 Dec 2016 11:40:04 +0000 (11:40 +0000)]
Refresh translations from zanata

8 years agoNEWS: Remove end-of-sentence period
Andrea Bolognani [Thu, 1 Dec 2016 11:23:08 +0000 (12:23 +0100)]
NEWS: Remove end-of-sentence period

None of the other sentences in the file ends with the period,
and we want to maintain a consistent style.

8 years agoqemu: Prevent detaching SCSI controller used by hostdev
Eric Farman [Tue, 29 Nov 2016 21:40:16 +0000 (22:40 +0100)]
qemu: Prevent detaching SCSI controller used by hostdev

Consider the following XML snippets:

  $ cat scsicontroller.xml
      <controller type='scsi' model='virtio-scsi' index='0'/>
  $ cat scsihostdev.xml
      <hostdev mode='subsystem' type='scsi'>
        <source>
          <adapter name='scsi_host0'/>
          <address bus='0' target='8' unit='1074151456'/>
        </source>
      </hostdev>

If we create a guest that includes the contents of scsihostdev.xml,
but forget the virtio-scsi controller described in scsicontroller.xml,
one is silently created for us.  The same holds true when attaching
a hostdev before the matching virtio-scsi controller.
(See qemuDomainFindOrCreateSCSIDiskController for context.)

Detaching the hostdev, followed by the controller, works well and the
guest behaves appropriately.

If we detach the virtio-scsi controller device first, any associated
hostdevs are detached for us by the underlying virtio-scsi code (this
is fine, since the connection is broken).  But all is not well, as the
guest is unable to receive new virtio-scsi devices (the attach commands
succeed, but devices never appear within the guest), nor even be
shutdown, after this point.

While this is not libvirt's problem, we can prevent falling into this
scenario by checking if a controller is being used by any hostdev
devices.  The same is already done for disk elements today.

Applying this patch and then using the XML snippets from earlier:

  $ virsh detach-device guest_01 scsicontroller.xml
  error: Failed to detach device from scsicontroller.xml
  error: operation failed: device cannot be detached: device is busy

  $ virsh detach-device guest_01 scsihostdev.xml
  Device detached successfully

  $ virsh detach-device guest_01 scsicontroller.xml
  Device detached successfully

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoqemu: assign VFIO devices to PCIe addresses when appropriate
Laine Stump [Wed, 2 Nov 2016 00:40:27 +0000 (20:40 -0400)]
qemu: assign VFIO devices to PCIe addresses when appropriate

Although nearly all host devices that are assigned to guests using
VFIO ("<hostdev>" devices in libvirt) are physically PCI Express
devices, until now libvirt's PCI address assignment has always
assigned them addresses on legacy PCI controllers in the guest, even
if the guest's machinetype has a PCIe root bus (e.g. q35 and
aarch64/virt).

This patch tries to assign them to an address on a PCIe controller
instead, when appropriate. First we do some preliminary checks that
might allow setting the flags without doing any extra work, and if
those conditions aren't met (and if libvirt is running privileged so
that it has proper permissions), we perform the (relatively) time
consuming task of reading the device's PCI config to see if it is an
Express device. If this is successful, the connect flags are set based
on the result, but if we aren't able to read the PCI config (most
likely due to the device not being present on the system at the time
of the check) we assume it is (or will be) an Express device, since
that is almost always the case anyway.

8 years agoqemu: propagate virQEMUDriver object to qemuDomainDeviceCalculatePCIConnectFlags
Laine Stump [Thu, 3 Nov 2016 20:33:32 +0000 (16:33 -0400)]
qemu: propagate virQEMUDriver object to qemuDomainDeviceCalculatePCIConnectFlags

If libvirtd is running unprivileged, it can open a device's PCI config
data in sysfs, but can only read the first 64 bytes. But as part of
determining whether a device is Express or legacy PCI,
qemuDomainDeviceCalculatePCIConnectFlags() will be updated in a future
patch to call virPCIDeviceIsPCIExpress(), which tries to read beyond
the first 64 bytes of the PCI config data and fails with an error log
if the read is unsuccessful.

In order to avoid creating a parallel "quiet" version of
virPCIDeviceIsPCIExpress(), this patch passes a virQEMUDriverPtr down
through all the call chains that initialize the
qemuDomainFillDevicePCIConnectFlagsIterData, and saves the driver
pointer with the rest of the iterdata so that it can be used by
qemuDomainDeviceCalculatePCIConnectFlags(). This pointer isn't used
yet, but will be used in an upcoming patch (that detects Express vs
legacy PCI for VFIO assigned devices) to examine driver->privileged.

8 years agoutil: new function virPCIDeviceGetConfigPath()
Laine Stump [Sat, 19 Nov 2016 19:30:03 +0000 (14:30 -0500)]
util: new function virPCIDeviceGetConfigPath()

The path to the config file for a PCI device is conventiently stored
in a virPCIDevice object, but that object's contents aren't directly
visible outside of virpci.c, so we need to have an accessor function
for it if anyone needs to look at it.

8 years agoutil: new function virFileLength()
Laine Stump [Thu, 17 Nov 2016 17:18:27 +0000 (12:18 -0500)]
util: new function virFileLength()

This new function just calls fstat() (if provided with a valid fd) or
stat() (if fd is -1) and returns st_size (or -1 if there is an
error). We may decide we want this function to be more complex, and
handle things like block devices - this is a placeholder (that works)
for any more complicated function.

8 years agovirt-gnutls.m4: fixed check for gnutls_rnd and gnutls_cipher_encrypt
Nikos Mavrogiannopoulos [Fri, 25 Nov 2016 15:51:13 +0000 (16:51 +0100)]
virt-gnutls.m4: fixed check for gnutls_rnd and gnutls_cipher_encrypt

8 years agodocs: improve release numbering rule for minor numbers
Boris Fiuczynski [Wed, 30 Nov 2016 12:04:04 +0000 (13:04 +0100)]
docs: improve release numbering rule for minor numbers

Adding first build of year minor number reset to 0.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agocpu: Add alternative feature spellings to CPU map
Jiri Denemark [Tue, 29 Nov 2016 19:39:13 +0000 (20:39 +0100)]
cpu: Add alternative feature spellings to CPU map

We can't change feature names for compatibility reasons even if they
contain typos or other software uses different names for the same
features. By adding alternative spellings in our CPU map we at least
allow anyone to grep for them and find the correct libvirt's name.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Remove useless comments from CPU map
Jiri Denemark [Tue, 29 Nov 2016 19:38:07 +0000 (20:38 +0100)]
cpu: Remove useless comments from CPU map

They didn't really help anything.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: error out on USB ports out of range
Ján Tomko [Mon, 28 Nov 2016 10:05:22 +0000 (11:05 +0100)]
qemu: error out on USB ports out of range

My overly sophisticated address reservation code forgot
to add an error message for user-requested ports out of range.

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

8 years agotests: Fix USB ports in usb-redir-filter
Ján Tomko [Mon, 28 Nov 2016 09:53:14 +0000 (10:53 +0100)]
tests: Fix USB ports in usb-redir-filter

This test case references ports 4 and 5 on the PIIX3 UHCI
controller which only has two.

8 years agovirt-aa-helper: fix parsing security labels by introducing VIR_DOMAIN_DEF_PARSE_SKIP_...
Christian Ehrhardt [Mon, 21 Nov 2016 14:40:23 +0000 (15:40 +0100)]
virt-aa-helper: fix parsing security labels by introducing VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL

When virt-aa-helper parses xml content it can fail on security labels.

It fails by requiring to parse active domain content on seclabels that
are not yet filled in.

Testcase with virt-aa-helper on a minimal xml:
 $ cat << EOF > /tmp/test.xml
<domain type='kvm'>
    <name>test-seclabel</name>
    <uuid>12345678-9abc-def1-2345-6789abcdef00</uuid>
    <memory unit='KiB'>1</memory>
    <os><type arch='x86_64'>hvm</type></os>
    <seclabel type='dynamic' model='apparmor' relabel='yes'/>
    <seclabel type='dynamic' model='dac' relabel='yes'/>
</domain>
EOF
 $ /usr/lib/libvirt/virt-aa-helper -d -r -p 0 \
   -u libvirt-12345678-9abc-def1-2345-6789abcdef00 < /tmp/test.xml

Current Result:
 virt-aa-helper: error: could not parse XML
 virt-aa-helper: error: could not get VM definition
Expected Result is a valid apparmor profile

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Guido Günther <agx@sigxcpu.org>
8 years agodocs: Update news
Jiri Denemark [Fri, 25 Nov 2016 10:27:36 +0000 (11:27 +0100)]
docs: Update news

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoConsolidate documentation of virDomainMigrate{,ToURI}{,2,3}
Jiri Denemark [Fri, 25 Nov 2016 10:11:37 +0000 (11:11 +0100)]
Consolidate documentation of virDomainMigrate{,ToURI}{,2,3}

Only the latest APIs are fully documented and the documentation of the
older variants (which are just limited versions of the new APIs anyway)
points to the newest APIs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoEnhance documentation of virDomainMigrateFlags
Jiri Denemark [Thu, 24 Nov 2016 15:32:19 +0000 (16:32 +0100)]
Enhance documentation of virDomainMigrateFlags

The enhanced documentation of VIR_MIGRATE_RDMA_PIN_ALL fixes
https://bugzilla.redhat.com/show_bug.cgi?id=1373783

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodaemon: Install virt-guest-shutdown.target properly
Michal Privoznik [Tue, 29 Nov 2016 15:28:05 +0000 (16:28 +0100)]
daemon: Install virt-guest-shutdown.target properly

When trying to install libvirtd from sources I've noticed the
following failure:

/usr/bin/install: cannot stat 'virt-guest-shutdown.target': No such file or directory
Makefile:2792: recipe for target 'install-init-systemd' failed
make[3]: *** [install-init-systemd] Error 1
make[3]: *** Waiting for unfinished jobs....

The problem is that while other files around that location in
Makefile are firstly generated into the builddir and only after
that installed, virt-guest-shutdown.target file is not generated
at all and should be installed from the srcdir.

This was introduced in 01079727.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuProcessReconnect: Avoid relabeling images after migration
Jiri Denemark [Wed, 23 Nov 2016 13:07:53 +0000 (14:07 +0100)]
qemuProcessReconnect: Avoid relabeling images after migration

Restarting libvirtd on the source host at the end of migration when a
domain is already running on the destination would cause image labels to
be reset effectively killing the domain. Commit e8d0166e1d fixed similar
issue on the destination host, but kept the source always resetting the
labels, which was mostly correct except for the specific case handled by
this patch.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Report tunnelled post-copy migration as unsupported
Jiri Denemark [Tue, 22 Nov 2016 19:23:56 +0000 (20:23 +0100)]
qemu: Report tunnelled post-copy migration as unsupported

Post-copy migration needs bi-directional communication between the
source and the destination QEMU processes, which is not supported by
tunnelled migration.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agostorage_backend_rbd: check the return value of rados_conf_set
Chen Hanxiao [Thu, 24 Nov 2016 02:48:37 +0000 (10:48 +0800)]
storage_backend_rbd: check the return value of rados_conf_set

We had a lot of rados_conf_set and check works.
Use helper virStorageBackendRBDRADOSConfSet for them.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agoqemu: capabilities: Don't partially reprope caps on process reconnect
Peter Krempa [Fri, 25 Nov 2016 16:08:25 +0000 (17:08 +0100)]
qemu: capabilities: Don't partially reprope caps on process reconnect

Thanks to the complex capability caching code virQEMUCapsProbeQMP was
never called when we were starting a new qemu VM. On the other hand,
when we are reconnecting to the qemu process we reload the capability
list from the status XML file. This means that the flag preventing the
function being called was not set and thus we partially reprobed some of
the capabilities.

The recent addition of CPU hotplug clears the
QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS if the machine does not support it.
The partial re-probe on reconnect results into attempting to call the
unsupported command and then killing the VM.

Remove the partial reprobe and depend on the stored capabilities. If it
will be necessary to reprobe the capabilities in the future, we should
do a full reprobe rather than this partial one.

8 years agoqemu: Add support for unavailable-features
Jiri Denemark [Thu, 21 Apr 2016 11:08:12 +0000 (13:08 +0200)]
qemu: Add support for unavailable-features

QEMU 2.8.0 adds support for unavailable-features in
query-cpu-definitions reply. The unavailable-features array lists CPU
features which prevent a corresponding CPU model from being usable on
current host. It can only be used when all the unavailable features are
disabled. Empty array means the CPU model can be used without
modifications.

We can use unavailable-features for providing CPU model usability info
in domain capabilities XML:

    <domainCapabilities>
      ...
      <cpu>
        <mode name='host-passthrough' supported='yes'/>
        <mode name='host-model' supported='yes'>
          <model fallback='allow'>Skylake-Client</model>
          ...
        </mode>
        <mode name='custom' supported='yes'>
          <model usable='yes'>qemu64</model>
          <model usable='yes'>qemu32</model>
          <model usable='no'>phenom</model>
          <model usable='yes'>pentium3</model>
          <model usable='yes'>pentium2</model>
          <model usable='yes'>pentium</model>
          <model usable='yes'>n270</model>
          <model usable='yes'>kvm64</model>
          <model usable='yes'>kvm32</model>
          <model usable='yes'>coreduo</model>
          <model usable='yes'>core2duo</model>
          <model usable='no'>athlon</model>
          <model usable='yes'>Westmere</model>
          <model usable='yes'>Skylake-Client</model>
          ...
        </mode>
      </cpu>
      ...
    </domainCapabilities>

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add QEMU 2.8.0 domain capabilities tests
Jiri Denemark [Wed, 16 Nov 2016 15:31:23 +0000 (16:31 +0100)]
tests: Add QEMU 2.8.0 domain capabilities tests

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add QEMU 2.8.0 capabilities data
Jiri Denemark [Wed, 16 Nov 2016 14:40:08 +0000 (15:40 +0100)]
tests: Add QEMU 2.8.0 capabilities data

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 2.7.0
Jiri Denemark [Fri, 18 Nov 2016 09:13:51 +0000 (10:13 +0100)]
tests: Update capabilities for QEMU 2.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 2.6.0 (ppc64le)
Jiri Denemark [Sun, 20 Nov 2016 22:29:03 +0000 (23:29 +0100)]
tests: Update capabilities for QEMU 2.6.0 (ppc64le)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 2.6.0 (aarch64, GICv3)
Jiri Denemark [Sun, 20 Nov 2016 22:28:09 +0000 (23:28 +0100)]
tests: Update capabilities for QEMU 2.6.0 (aarch64, GICv3)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Avoid reporting "host" as a supported CPU model
Jiri Denemark [Sun, 20 Nov 2016 22:21:19 +0000 (23:21 +0100)]
qemu: Avoid reporting "host" as a supported CPU model

"host" CPU model is supported by a special host-passthrough CPU mode and
users is not allowed to specify this model directly with custom mode.
Thus we should not advertise "host" CPU model in domain capabilities.
This worked well on architectures for which libvirt provides a list of
supported CPU models in cpu_map.xml (since "host" is not in the list).
But we need to explicitly filter "host" model out for all other
architectures.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 2.6.0 (aarch64, GICv2)
Jiri Denemark [Sun, 20 Nov 2016 22:20:09 +0000 (23:20 +0100)]
tests: Update capabilities for QEMU 2.6.0 (aarch64, GICv2)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 2.6.0
Jiri Denemark [Fri, 18 Nov 2016 09:12:10 +0000 (10:12 +0100)]
tests: Update capabilities for QEMU 2.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 2.5.0
Jiri Denemark [Fri, 18 Nov 2016 09:13:43 +0000 (10:13 +0100)]
tests: Update capabilities for QEMU 2.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 2.4.0
Jiri Denemark [Fri, 18 Nov 2016 09:13:33 +0000 (10:13 +0100)]
tests: Update capabilities for QEMU 2.4.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 2.1.1
Jiri Denemark [Fri, 18 Nov 2016 09:13:24 +0000 (10:13 +0100)]
tests: Update capabilities for QEMU 2.1.1

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 1.7.0
Jiri Denemark [Fri, 18 Nov 2016 09:10:35 +0000 (10:10 +0100)]
tests: Update capabilities for QEMU 1.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 1.6.0
Jiri Denemark [Fri, 18 Nov 2016 09:13:13 +0000 (10:13 +0100)]
tests: Update capabilities for QEMU 1.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 1.5.3
Jiri Denemark [Fri, 18 Nov 2016 09:13:02 +0000 (10:13 +0100)]
tests: Update capabilities for QEMU 1.5.3

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 1.4.2
Jiri Denemark [Fri, 18 Nov 2016 09:12:50 +0000 (10:12 +0100)]
tests: Update capabilities for QEMU 1.4.2

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 1.3.1
Jiri Denemark [Fri, 18 Nov 2016 09:12:37 +0000 (10:12 +0100)]
tests: Update capabilities for QEMU 1.3.1

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Update capabilities for QEMU 1.2.2
Jiri Denemark [Fri, 18 Nov 2016 09:12:25 +0000 (10:12 +0100)]
tests: Update capabilities for QEMU 1.2.2

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Probe CPU models for KVM and TCG
Jiri Denemark [Mon, 14 Nov 2016 16:21:30 +0000 (17:21 +0100)]
qemu: Probe CPU models for KVM and TCG

CPU models (and especially some additional details which we will start
probing for later) differ depending on the accelerator. Thus we need to
call query-cpu-definitions in both KVM and TCG mode to get all data we
want.

Tests in tests/domaincapstest.c are temporarily switched to TCG to avoid
having to squash even more stuff into this single patch. They will all
be switched back later in separate commits.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Introduce virQEMUCapsFormatCPUModels
Jiri Denemark [Mon, 14 Nov 2016 20:51:31 +0000 (21:51 +0100)]
qemu: Introduce virQEMUCapsFormatCPUModels

This patch moves the CPU models formatting code from
virQEMUCapsFormatCache into a separate function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Introduce virQEMUCapsLoadCPUModels
Jiri Denemark [Mon, 14 Nov 2016 20:51:19 +0000 (21:51 +0100)]
qemu: Introduce virQEMUCapsLoadCPUModels

This patch moves the CPU models parsing code from virQEMUCapsLoadCache
into a separate function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Refresh caps in virQEMUCapsCacheLookupByArch
Jiri Denemark [Wed, 16 Nov 2016 13:17:12 +0000 (14:17 +0100)]
qemu: Refresh caps in virQEMUCapsCacheLookupByArch

The function just returned cached capabilities without checking whether
they are still valid. We should check that and refresh the capabilities
to make sure we don't return stale data. In other words, we should do
what all other lookup functions do.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Refactor virQEMUCapsCacheLookup
Jiri Denemark [Wed, 16 Nov 2016 12:47:09 +0000 (13:47 +0100)]
qemu: Refactor virQEMUCapsCacheLookup

The function is made a little bit more readable and the code which
refreshes cached capabilities if they are not valid any more was moved
into a separate function (virQEMUCapsCacheValidate) so that it can be
reused in other places.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Don't return unusable virttype in domain capabilities
Jiri Denemark [Fri, 25 Nov 2016 19:03:12 +0000 (20:03 +0100)]
qemu: Don't return unusable virttype in domain capabilities

If a user asked for a KVM domain capabilities when KVM is not available,
we would happily return data we got when probing through TCG and
pretended they were relevant for KVM. Let's just report KVM is not
supported to avoid confusion.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Use saner defaults for domain capabilities
Jiri Denemark [Tue, 15 Nov 2016 19:02:56 +0000 (20:02 +0100)]
qemu: Use saner defaults for domain capabilities

When domain capabilities were introduced we did not have enough data to
decide whether KVM works on the host or not and thus working legacy/VFIO
device assignment was used as a witness. Now that we know whether KVM
was enabled when probing QEMU capabilities (and thus we know it's
working), we can use this knowledge to provide better default value for
virttype.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Discard caps cache when KVM availability changes
Jiri Denemark [Wed, 15 Jun 2016 15:21:08 +0000 (17:21 +0200)]
qemu: Discard caps cache when KVM availability changes

Since some may depend on the accelerator used when probing QEMU the
cache becomes invalid when KVM becomes available or if it is not
available anymore.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Enable KVM when probing capabilities
Jiri Denemark [Fri, 10 Jun 2016 15:16:21 +0000 (17:16 +0200)]
qemu: Enable KVM when probing capabilities

CPU related capabilities may differ depending on accelerator used when
probing. Let's use KVM if available when probing QEMU and fall back to
TCG. The created capabilities already contain all we need to distinguish
whether KVM or TCG was used:

    - KVM was used when probing capabilities:
        QEMU_CAPS_KVM is set
        QEMU_CAPS_ENABLE_KVM is not set

    - TCG was used and QEMU supports KVM, but it failed (e.g., missing
      kernel module or wrong /dev/kvm permissions)
        QEMU_CAPS_KVM is not set
        QEMU_CAPS_ENABLE_KVM is set

    - KVM was not used and QEMU does not support it
        QEMU_CAPS_KVM is not set
        QEMU_CAPS_ENABLE_KVM is not set

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemucapsprobe: Ignore all greetings except the first one
Jiri Denemark [Mon, 14 Nov 2016 13:29:57 +0000 (14:29 +0100)]
qemucapsprobe: Ignore all greetings except the first one

When starting QEMU more than once during a single probing process,
qemucapsprobe utility would save QMP greeting several times, which
doesn't play well with our test monitor.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Probe KVM state earlier
Jiri Denemark [Fri, 10 Jun 2016 17:14:52 +0000 (19:14 +0200)]
qemu: Probe KVM state earlier

Let's set QEMU_CAPS_KVM and QEMU_CAPS_ENABLE_KVM early so that the rest
of the probing code can use these capabilities to handle KVM/TCG replies
differently.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Use -machine when probing capabilities via QMP
Jiri Denemark [Fri, 11 Nov 2016 21:56:52 +0000 (22:56 +0100)]
qemu: Use -machine when probing capabilities via QMP

Using -machine instead of -M for QMP probing is safe because any QEMU
binary which is capable of QMP probing supports -machine.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Make QMP probing process reusable
Jiri Denemark [Mon, 22 Jul 2013 17:38:37 +0000 (19:38 +0200)]
qemu: Make QMP probing process reusable

The code that runs a new QEMU process to be used for probing
capabilities is separated into four reusable functions so that any code
that wants to probe a QEMU process may just follow a few simple steps:

    cmd = virQEMUCapsInitQMPCommandNew(...);
    virQEMUCapsInitQMPCommandRun(cmd);

    /* talk to the running QEMU process using its QMP monitor */

    if (reprobeIsRequired) {
        virQEMUCapsInitQMPCommandAbort(cmd, ...);
        virQEMUCapsInitQMPCommandRun(cmd);

        /* talk to the running QEMU process again */
    }

    virQEMUCapsInitQMPCommandFree(cmd);

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoRevert "vz: fixed race in vzDomainAttach/DettachDevice"
Maxim Nestratov [Fri, 18 Nov 2016 16:16:46 +0000 (19:16 +0300)]
Revert "vz: fixed race in vzDomainAttach/DettachDevice"

This reverts commit 3a6cf6fc16.

Mistakenly this commit was pushed because I thought I missed the
corret one b880ff42ddb while in fact I didn't.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovirstring: Unify string list function names
Michal Privoznik [Fri, 25 Nov 2016 08:18:35 +0000 (09:18 +0100)]
virstring: Unify string list function names

We have couple of functions that operate over NULL terminated
lits of strings. However, our naming sucks:

virStringJoin
virStringFreeList
virStringFreeListCount
virStringArrayHasString
virStringGetFirstWithPrefix

We can do better:

virStringListJoin
virStringListFree
virStringListFreeCount
virStringListHasString
virStringListGetFirstWithPrefix

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodocs: NEWS: Mention changes in memory slot number allocation
Peter Krempa [Fri, 25 Nov 2016 11:13:58 +0000 (12:13 +0100)]
docs: NEWS: Mention changes in memory slot number allocation

8 years agodocs: NEWS: Mention 'gluster_debug_level' qemu.conf option in the news
Peter Krempa [Fri, 25 Nov 2016 11:06:59 +0000 (12:06 +0100)]
docs: NEWS: Mention 'gluster_debug_level' qemu.conf option in the news

8 years agoNEWS: Add some missing entries
Andrea Bolognani [Fri, 25 Nov 2016 10:13:52 +0000 (11:13 +0100)]
NEWS: Add some missing entries

Catch up with changes that have been pushed but didn't include
updates to the NEWS file themselves.

8 years agoqemu: fix internal error: NUMA isn't available on this host
Boris Fiuczynski [Thu, 24 Nov 2016 12:28:00 +0000 (13:28 +0100)]
qemu: fix internal error: NUMA isn't available on this host

If libvirt is compiled without NUMACTL support starting libvirtd
reports a libvirt internal error "NUMA isn't available on this host"
without checking if NUMA support is compiled into the libvirt binaries.
This patch adds the missing NUMA support check to prevent the internal error.
It also includes a check if the cgroup controller cpuset is available before
using it.

The error was noticed when libvirtd was restarted with running domains and
on libvirtd start the qemuConnectCgroup gets called during qemuProcessReconnect.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
8 years agoconf: Wire up the vhost-scsi connection from/to XML
Eric Farman [Tue, 22 Nov 2016 03:58:20 +0000 (22:58 -0500)]
conf: Wire up the vhost-scsi connection from/to XML

With the QEMU components in place, provide the XML parsing to
invoke that code when given the following XML snippet:

    <hostdev mode='subsystem' type='scsi_host'>
      <source protocol='vhost' wwpn='naa.501234567890abcd'/>
    </hostdev>

An optional address element can be specified within the hostdev
(pick CCW or PCI as necessary):

    <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0625'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

Add basic vhost-scsi tests which were cloned from hostdev-scsi-virtio-scsi
in both xml2argv and xml2xml. Added ones for both vhost-scsi-ccw and
vhost-scsi-pci since the syntaxes are slightly different between them.

Also adjusted the docs to describe the changes.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>