]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
8 years agosecurity: Include vhost-scsi in security labels
Eric Farman [Tue, 22 Nov 2016 03:58:21 +0000 (22:58 -0500)]
security: Include vhost-scsi in security labels

Ensure that the vhost-scsi wwpn information is passed to the
different security policies.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
8 years agoqemu: Allow hotplug of vhost-scsi device
Eric Farman [Tue, 22 Nov 2016 03:58:19 +0000 (22:58 -0500)]
qemu: Allow hotplug of vhost-scsi device

Adjust the device string that is built for vhost-scsi devices so that it
can be invoked from hotplug.

From the QEMU command line, the file descriptors are expect to be numeric only.
However, for hotplug, the file descriptors are expected to begin with at least
one alphabetic character else this error occurs:

  # virsh attach-device guest_0001 ~/vhost.xml
  error: Failed to attach device from /root/vhost.xml
  error: internal error: unable to execute QEMU command 'getfd':
  Parameter 'fdname' expects a name not starting with a digit

We also close the file descriptor in this case, so that shutting down the
guest cleans up the host cgroup entries and allows future guests to use
vhost-scsi devices.  (Otherwise the guest will silently end.)

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
8 years agoqemu: Add vhost-scsi string for -device parameter
Eric Farman [Tue, 22 Nov 2016 03:58:18 +0000 (22:58 -0500)]
qemu: Add vhost-scsi string for -device parameter

Open /dev/vhost-scsi, and record the resulting file descriptor, so that
the guest has access to the host device outside of the libvirt daemon.
Pass this information, along with data parsed from the XML file, to build
a device string for the qemu command line.  That device string will be
for either a vhost-scsi-ccw device in the case of an s390 machine, or
vhost-scsi-pci for any others.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
8 years agoutil: Management routines for scsi_host devices
Eric Farman [Tue, 22 Nov 2016 03:58:17 +0000 (22:58 -0500)]
util: Management routines for scsi_host devices

For a new hostdev type='scsi_host' we have a number of
required functions for managing, adding, and removing the
host device to/from guests.  Provide the basic infrastructure
for these tasks.

The name "SCSIVHost" (and its variants) is chosen to avoid
conflicts with existing code named "SCSIHost" to refer to
a hostdev type='scsi' protcol='none'.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
8 years agoIntroduce framework for a hostdev SCSI_host subsystem type
Eric Farman [Tue, 22 Nov 2016 03:58:16 +0000 (22:58 -0500)]
Introduce framework for a hostdev SCSI_host subsystem type

We already have a "scsi" hostdev subsys type, which refers to a single
LUN that is passed through to a guest.  But what of things where
multiple LUNs are passed through via a single SCSI HBA, such as with
the vhost-scsi target?  Create a new hostdev subsys type that will
carry this.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
8 years agoqemu: Introduce vhost-scsi capability
Eric Farman [Tue, 22 Nov 2016 03:58:15 +0000 (22:58 -0500)]
qemu: Introduce vhost-scsi capability

Do all the stuff for the vhost-scsi capability in QEMU,
so it's in place for our checks later.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agotests: eventtest: fix build on macOS
Roman Bogorodskiy [Sat, 19 Nov 2016 17:42:27 +0000 (20:42 +0300)]
tests: eventtest: fix build on macOS

macOS doesn't support clock_gettime(2), at least versions prior 10.12
(I didn't actually check 10.12 though). So, use its own routines in
eventtest.

 * configure.ac: check for requires symbols and define
   HAVE_MACH_CLOCK_ROUTINES if found
 * tests/eventtest.c: add clock_get_time() based implementation

8 years agotests: eventtest: fix LDADD
Roman Bogorodskiy [Thu, 24 Nov 2016 15:03:39 +0000 (18:03 +0300)]
tests: eventtest: fix LDADD

Don't explicitly LDADD -lrt, use $(LIB_CLOCK_GETTIME) because
not all platforms have clock_gettime(2) and librt available.

8 years agogenprotocol.pl: add darwin to fixup list
Roman Bogorodskiy [Sat, 19 Nov 2016 17:40:27 +0000 (20:40 +0300)]
genprotocol.pl: add darwin to fixup list

8 years agovbox: get rid of g_pVBoxGlobalData
Dawid Zamirski [Wed, 23 Nov 2016 19:01:11 +0000 (14:01 -0500)]
vbox: get rid of g_pVBoxGlobalData

now that we have a new global vboxDriver object, remove the old
vboxGlobalData struct and all references to it.

8 years agovbox: change how vbox API is initialized.
Dawid Zamirski [Wed, 23 Nov 2016 19:01:10 +0000 (14:01 -0500)]
vbox: change how vbox API is initialized.

* add vboxDriver object to serve as a singleton global object that
  holds references to IVirtualBox and ISession to be shared among
  multiple connections. The vbox_driver is instantiated only once in
  the first call vboxGetDriverConnection function that is guarded by
  a mutex.

* call vbox API initialize only when the first connection is
  established, and likewise uninitialize when last connection
  disconnects. The prevents each subsequent connection from overwriting
  IVirtualBox/ISession instances of any other active connection that
  led to libvirtd segfaults. The virConnectOpen and virConnectClose
  implementations are guarded by mutex on the global vbox_driver_lock
  where the global vbox_driver object counts connectios and decides
  when it's safe to call vbox's init/uninit routines.

* add IVirutalBoxClient to vboxDriver and use it to in tandem with newer
  pfnClientInitialize/pfnClientUninitalize APIs for vbox versions that
  support it, to avoid usage of the old pfnComInitialize/Uninitialize.

8 years agoqemu: Removed an outdated comment in qemuDomainSaveImageStartVM()
Marc Hartmayer [Fri, 18 Nov 2016 13:18:27 +0000 (14:18 +0100)]
qemu: Removed an outdated comment in qemuDomainSaveImageStartVM()

Removed the comment 'Set the migration source' as it isn't valid anymore
and 'start it up' isn't useful as qemuProcessStart() is already a
speaking name.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agovirutil: fix trailing '/' for path prefixes
Bjoern Walk [Fri, 18 Nov 2016 13:18:26 +0000 (14:18 +0100)]
virutil: fix trailing '/' for path prefixes

The path prefixes for sysfs trees are always prepended by paths
beginning with a slash, making the trailing slash in the prefix
redundant.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agovirfile: Only generate a warning if there is something to report
Marc Hartmayer [Fri, 18 Nov 2016 13:18:25 +0000 (14:18 +0100)]
virfile: Only generate a warning if there is something to report

Only generate a warning if there is something to report.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoFix typos and grammar
Nitesh Konkar [Tue, 15 Nov 2016 14:00:08 +0000 (19:30 +0530)]
Fix typos and grammar

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoqemu: Update cgroup on chardev hotplug
Michal Privoznik [Fri, 18 Nov 2016 10:45:44 +0000 (11:45 +0100)]
qemu: Update cgroup on chardev hotplug

Just like in the previous commit, we are not updating CGroups on
chardev hot(un-)plug and thus leaving qemu unable to access any
non-default device users are trying to hotplug.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Update cgroup on RNG hotplug
Michal Privoznik [Fri, 18 Nov 2016 10:17:51 +0000 (11:17 +0100)]
qemu: Update cgroup on RNG hotplug

If users try to hotplug RNG device with a backend different to
/dev/random or /dev/urandom the whole operation fails as qemu is
unable to access the device. The problem is we don't update
device CGroups during the operation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodocs: Add apps.html link to index.html
Michal Privoznik [Wed, 23 Nov 2016 07:28:51 +0000 (08:28 +0100)]
docs: Add apps.html link to index.html

I think when trying to introduce libvirt (we have a section for
that in our index page) it might be useful to promote success
stories - other applications that are based on libvirt.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoNEWS: Close <li> tag properly
Andrea Bolognani [Wed, 23 Nov 2016 10:59:14 +0000 (11:59 +0100)]
NEWS: Close <li> tag properly

Not closing the <li> tag on a separate line causes the plain
text version of the file to have no empty line between entries.

8 years agoNEWS: document the new libssh transport
Pino Toscano [Tue, 22 Nov 2016 14:36:31 +0000 (15:36 +0100)]
NEWS: document the new libssh transport

8 years agoqemu: agent: fix unsafe agent access
Nikolay Shirokovskiy [Mon, 14 Nov 2016 14:24:23 +0000 (17:24 +0300)]
qemu: agent: fix unsafe agent access

qemuDomainObjExitAgent is unsafe.

First it accesses domain object without domain lock.
Second it uses outdated logic that goes back to commit 79533da1 of
year 2009 when code was quite different. (unref function
instead of unreferencing only unlocked and disposed object
in case of last reference and leaved unlocking to the caller otherwise).
Nowadays this logic may lead to disposing locked object
i guess.

Another problem is that the callers of qemuDomainObjEnterAgent
use domain object again (namely priv->agent) without domain lock.

This patch address these two problems.

qemuDomainGetAgent is dropped as unused.

8 years agoqemu: drop write-only agentStart
Nikolay Shirokovskiy [Mon, 14 Nov 2016 14:24:22 +0000 (17:24 +0300)]
qemu: drop write-only agentStart

8 years agoqemu: agent: cleanup agent error flag correctly
Nikolay Shirokovskiy [Wed, 16 Nov 2016 13:43:03 +0000 (16:43 +0300)]
qemu: agent: cleanup agent error flag correctly

Sometimes after domain restart agent is unavailabe even
if it is up and running in guest. Diagnostic message is
"QEMU guest agent is not available due to an error"
that is 'priv->agentError' is set. Investiagion shows that
'priv->agent' is not NULL, so error flag is set probably
during domain shutdown process and not cleaned up eventually.

The patch is quite simple - just clean up error flag unconditionally
upon domain stop.

Other hunks address other cases when error flag is not cleaned up.

1. processSerialChangedEvent. We need to clean error flag
unconditionally here too. For example if upon first 'connected' event we
fail to connect and set error flag and then connect on second
'connected' event then error flag will remain set erroneously
and make agent unavailable.

2. qemuProcessHandleAgentEOF. If error flag is set and we get
EOF we need to change state (and diagnostic) from 'error' to
'not connected'.

8 years agoqemu: agent: remove redundant check
Nikolay Shirokovskiy [Wed, 16 Nov 2016 13:43:02 +0000 (16:43 +0300)]
qemu: agent: remove redundant check

8 years agoqemu: agent: handle agent connection errors in one place
Nikolay Shirokovskiy [Wed, 16 Nov 2016 13:43:01 +0000 (16:43 +0300)]
qemu: agent: handle agent connection errors in one place

qemuConnectAgent return -1 or -2 in case of different errors.
A. -1 is a case of unsuccessuful connection to guest agent.
B. -2 is a case of destoyed domain during connection attempt.

All qemuConnectAgent callers handle the first error the same way
so let's move this logic into qemuConnectAgent itself. Patched
function returns 0 in case A and -1 in case B.

8 years agolibvirtd: systemd: add special target for system shutdown
Nikolay Shirokovskiy [Fri, 14 Oct 2016 07:13:48 +0000 (10:13 +0300)]
libvirtd: systemd: add special target for system shutdown

It is already discussed in "[RFC] daemon: remove hardcode dep on libvirt-guests" [1].

Mgmt can use means to save/restore domains on system shutdown/boot other than
libvirt-guests.service. Thus we need to specify appropriate ordering dependency between
libvirtd, domains and save/restore service. This patch takes approach suggested
in RFC and introduces a systemd target, so that ordering can be built next way:

libvirtd -> domain -> virt-guest-shutdown.target -> save-restore.service.

This way domains are decoupled from specific shutdown service via intermediate
target.

[1] https://www.redhat.com/archives/libvir-list/2016-September/msg01353.html

8 years agovirsh: Document --rdma-pin-all migrate option properly
Jiri Denemark [Tue, 22 Nov 2016 18:26:45 +0000 (19:26 +0100)]
virsh: Document --rdma-pin-all migrate option properly

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agovirsh: Add support for VIR_MIGRATE_PARAM_PERSIST_XML
Jiri Denemark [Tue, 22 Nov 2016 13:06:43 +0000 (14:06 +0100)]
virsh: Add support for VIR_MIGRATE_PARAM_PERSIST_XML

Commit v1.3.3-181-gb028e9d7c implmented support for
VIR_MIGRATE_PARAM_PERSIST_XML migration parameter, but forgot to update
virsh.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoRefactoring: Use virHostdevIsSCSIDevice()
Marc Hartmayer [Tue, 15 Nov 2016 18:25:41 +0000 (19:25 +0100)]
Refactoring: Use virHostdevIsSCSIDevice()

Use the util function virHostdevIsSCSIDevice() to simplify if
statements.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoutil: Add virHostdevIsSCSIDevice()
Marc Hartmayer [Tue, 15 Nov 2016 18:25:40 +0000 (19:25 +0100)]
util: Add virHostdevIsSCSIDevice()

Add the function virHostdevIsSCSIDevice() which detects whether a
hostdev is a SCSI device or not.

Signed-off-by: Marc Hartmayer <mhartmay@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: Fix improper union member access on hostdevs
Marc Hartmayer [Tue, 15 Nov 2016 18:25:39 +0000 (19:25 +0100)]
qemu: Fix improper union member access on hostdevs

Add missing checks if a hostdev is a subsystem/SCSI device before access
the union member 'subsys'/'scsi'.  Also fix indentation and simplify
qemuDomainObjCheckHostdevTaint().

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoForbid new-line char in name of new storagepool
Sławek Kapłoński [Fri, 11 Nov 2016 09:17:38 +0000 (10:17 +0100)]
Forbid new-line char in name of new storagepool

New line character in name of storagepool is now forbidden because it
mess virsh output and can be confusing for users.
Validation of name is done in driver, after parsing XML to avoid
problems with dissappeared pools which was already created with
new-line char in name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoForbid new-line char in name of new domain
Sławek Kapłoński [Fri, 11 Nov 2016 09:17:37 +0000 (10:17 +0100)]
Forbid new-line char in name of new domain

New line character in name of domain is now forbidden because it
mess virsh output and can be confusing for users.
Validation of name is done in drivers, after parsing XML to avoid
problems with dissappeared domains which was already created with
new-line char in name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoNEWS: Update entries
Andrea Bolognani [Mon, 21 Nov 2016 20:35:28 +0000 (21:35 +0100)]
NEWS: Update entries

All of these changes have already been merged, so document
them properly.

8 years agoNEWS: Update XSLT stylesheet
Andrea Bolognani [Mon, 21 Nov 2016 20:11:17 +0000 (21:11 +0100)]
NEWS: Update XSLT stylesheet

The new format requires some tweaks to be translated into
a nice plain text output, and the XSLT stylesheet needs to
be updated to match.

8 years agoNEWS: Archive 2016 releases
Andrea Bolognani [Mon, 21 Nov 2016 18:13:36 +0000 (19:13 +0100)]
NEWS: Archive 2016 releases

We're going to change the format of the source HTML quite
a bit, and we're going to have to update the XSLT stylesheet
accordingly.

Move 2016 releases out of the way before doing so.

8 years agoqemu: monitor: Properly propagate the 'qemu_id' field through the matcher
Peter Krempa [Tue, 22 Nov 2016 08:32:11 +0000 (09:32 +0100)]
qemu: monitor: Properly propagate the 'qemu_id' field through the matcher

Commit 3f71c797689a4a70 added 'qemu_id' field to track the id of the cpu
as reported by query-cpus. The patch did not include changes necessary
to propagate the id through the functions matching the data to the
libvirt cpu structures and thus all vcpus had id 0.

8 years agotests: qemumonitorjson: Rename 'qemu-id' to 'enable-id' in cpu info test
Peter Krempa [Tue, 22 Nov 2016 09:21:46 +0000 (10:21 +0100)]
tests: qemumonitorjson: Rename 'qemu-id' to 'enable-id' in cpu info test

The field is named 'enable_id' in other structures and a patch recently
added 'qemu_id' which has different semantics. To avoid confusion in the
tests rename the field.

8 years agobhyve: cleanup bhyveBuildNetArgStr error handling
Roman Bogorodskiy [Mon, 21 Nov 2016 15:43:20 +0000 (18:43 +0300)]
bhyve: cleanup bhyveBuildNetArgStr error handling

Use 'goto cleanup'-style error handling instead of explicitly
freeing variables in every error path.

8 years agoqemu: domain: Refresh vcpu halted state using qemuMonitorGetCpuHalted
Peter Krempa [Mon, 21 Nov 2016 14:50:19 +0000 (15:50 +0100)]
qemu: domain:  Refresh vcpu halted state using qemuMonitorGetCpuHalted

Don't use qemuMonitorGetCPUInfo which does a lot of matching to get the
full picture which is not necessary and would be mostly discarded.

Refresh only the vcpu halted state using data from query-cpus.

8 years agoqemu: monitor: Extract halted state to a bitmap indexed by cpu id
Peter Krempa [Mon, 21 Nov 2016 13:54:35 +0000 (14:54 +0100)]
qemu: monitor: Extract halted state to a bitmap indexed by cpu id

We don't need to call qemuMonitorGetCPUInfo which is very inefficient to
get data required to update the vcpu 'halted' state.

Add a monitor helper that will retrieve the halted state and return it
in a bitmap so that it can be indexed easily.

8 years agoqemu: monitor: Extract qemu cpu id along with other data
Peter Krempa [Mon, 21 Nov 2016 13:57:54 +0000 (14:57 +0100)]
qemu: monitor: Extract qemu cpu id along with other data

Storing of the ID will allow simpler extraction of data present only in
query-cpus without the need to call qemuMonitorGetCPUInfo in statistics
paths.

8 years agoqemu_monitor_json: Don't check existence of "return" object
Jiri Denemark [Sun, 20 Nov 2016 23:10:06 +0000 (00:10 +0100)]
qemu_monitor_json: Don't check existence of "return" object

Whenever qemuMonitorJSONCheckError returns 0, the "return" object is
guaranteed to exist. Thus virJSONValueObjectGetObject will never fail to
get it. On the other hand, virJSONValueObjectGetArray may fail since the
"return" object may not be an array.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoNEWS: Start using the improved format
Andrea Bolognani [Fri, 18 Nov 2016 16:16:47 +0000 (17:16 +0100)]
NEWS: Start using the improved format

This entry is meant to both get the ball rolling on the
switch and to provide a blueprint of what NEWS file entries
are supposed to look like.

8 years agoqemu: process: Set current vcpu count to maximum if it was not specified
Peter Krempa [Mon, 14 Nov 2016 13:52:40 +0000 (14:52 +0100)]
qemu: process: Set current vcpu count to maximum if it was not specified

Mimic qemu's behavior on the given command line.