]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agolibxl: fix unused functions
Roman Bogorodskiy [Sun, 14 Aug 2016 01:24:37 +0000 (04:24 +0300)]
libxl: fix unused functions

Commit eee7bd4e introduced two functions: libxlDiskPathToID and
libxlDiskSectorSize.

However, as they're used only by code under #ifdef __linux__,
on non-Linux platforms it results in errors similar to this:

 CC       libxl/libvirt_driver_libxl_impl_la-libxl_driver.lo
libxl/libxl_driver.c:5263:1: error: unused function 'libxlDiskPathToID' [-Werror,-Wunused-function]
libxlDiskPathToID(const char *virtpath)
^
libxl/libxl_driver.c:5312:1: error: unused function 'libxlDiskSectorSize' [-Werror,-Wunused-function]
libxlDiskSectorSize(int domid, int devno)
^
2 errors generated.

Fix that by moving these functions under the #ifdef __linux__ block.

8 years agoIntroduce node device update event as top level event
Jovanka Gulicoska [Thu, 11 Aug 2016 15:15:23 +0000 (17:15 +0200)]
Introduce node device update event as top level event

This event is emitted when a nodedev XML definition is updated,
like when cdrom media is changed in a cdrom block device.

Also includes node device update event implementation for udev
backend, virsh nodedev-event support, and event-test support

8 years agovirsh: Fix core for cmdSecretGetValue
John Ferlan [Mon, 15 Aug 2016 11:53:45 +0000 (07:53 -0400)]
virsh: Fix core for cmdSecretGetValue

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

When commit id 'cb2e3e50' reworked the cmdSecretGetValue call to use
VIR_DISPOSE_STRING for base64, it neglected to initialize the base64
value to NULL since the cleanup: label could be reached prior to the
base64 value being set or not.  This resulted in a core dump, adding
the initialization will avoid the issue.

8 years agoqemu_command: don't modify heads for graphics device
Pavel Hrdina [Fri, 12 Aug 2016 14:12:39 +0000 (16:12 +0200)]
qemu_command: don't modify heads for graphics device

Setting heads to 0 in case that *max_outputs* is not supported while building
command line doesn't have any real effect.  It only removes *heads* attribute
from live XML, but after restarting libvirt the default value is restored.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovirschematest: Make sure that validator is initialized
Michal Privoznik [Mon, 15 Aug 2016 07:51:10 +0000 (09:51 +0200)]
virschematest: Make sure that validator is initialized

It may happen that a developer wants to run just a specific
subset of tests:

tests $ VIR_TEST_RANGE=22 ../run ./virschematest

This now fails miserably:

    ==6840== Invalid read of size 8
    ==6840==    at 0x4F397C0: virXMLValidatorValidate (virxml.c:1216)
    ==6840==    by 0x402B72: testSchemaFile (virschematest.c:53)
    ==6840==    by 0x403737: virTestRun (testutils.c:180)
    ==6840==    by 0x402CF5: testSchemaDir (virschematest.c:98)
    ==6840==    by 0x402EB1: testSchemaDirs (virschematest.c:131)
    ==6840==    by 0x40314D: mymain (virschematest.c:194)
    ==6840==    by 0x4051AF: virTestMain (testutils.c:982)
    ==6840==    by 0x4035A9: main (virschematest.c:217)
    ==6840==  Address 0x10 is not stack'd, malloc'd or (recently) free'd

Problem is, we are trying to do two types of tests here: validate
RNG schema itself, and validate XML files against RNG schemas.
And the latter tries to re-use a resource allocated in the
former. Therefore if the former is skipped (due to
VIR_TEST_RANGE) we have to allocate the resource manually.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agocpu_x86: fix libvirtd crash when host cpu vendor is not available
Jim Fehlig [Fri, 5 Aug 2016 21:23:47 +0000 (15:23 -0600)]
cpu_x86: fix libvirtd crash when host cpu vendor is not available

When starting a guest and copying host vendor cpuid to the guest
cpu, libvirtd would crash if the host cpu contained a NULL vendor
field. Avoid the crash by checking for a valid vendor in the host
cpu before copying the cpuid to the guest cpu.

For completeness, here is a backtrace from the crash

(gdb) bt
f0  0x00007ffff739bf33 in x86DataCpuid (cpuid=0x8, cpuid=0x8,
    data=data@entry=0x7fffb800ee78) at cpu/cpu_x86.c:287
f1  virCPUx86DataAddCPUID (data=data@entry=0x7fffb800ee78, cpuid=0x8)
    at cpu/cpu_x86.c:355
f2  0x00007ffff739ef47 in x86Compute (host=<optimized out>, cpu=0x7fffb8000cc0,
    guest=0x7fffecca7348, message=<optimized out>) at cpu/cpu_x86.c:1580
f3  0x00007fffd2b38e53 in qemuBuildCpuModelArgStr (migrating=false,
    hasHwVirt=<synthetic pointer>, qemuCaps=0x7fffb8001040, buf=0x7fffecca7360,
    def=0x7fffc400ce20, driver=0x1c) at qemu/qemu_command.c:6283
f4  qemuBuildCpuCommandLine (cmd=cmd@entry=0x7fffb8002f60,
    driver=driver@entry=0x7fffc80882c0, def=def@entry=0x7fffc400ce20,
    qemuCaps=qemuCaps@entry=0x7fffb8001040, migrating=<optimized out>)
    at qemu/qemu_command.c:6445
(gdb) f2
(gdb) p *host_model
$23 = {name = 0x7fffb800ec50 "qemu64", vendor = 0x0, signature = 0, data = {
    len = 2, data = 0x7fffb800e720}}

8 years agoqemu: command: Simplify USB controller model selection
Andrea Bolognani [Thu, 28 Jul 2016 15:39:05 +0000 (17:39 +0200)]
qemu: command: Simplify USB controller model selection

Since we now pick the default USB controller model when parsing
the guest XML, we can get rid of some duplicated code so that
the default model selection happens in one place only.

Add some comments as well.

8 years agoqemu: domain: Drop piix3-ohci controller for migration
Andrea Bolognani [Fri, 12 Aug 2016 15:10:40 +0000 (17:10 +0200)]
qemu: domain: Drop piix3-ohci controller for migration

Now that the default USB controller model is explicit rather
than implicit for i440fx machines, we have to tweak the
conditions for dropping it in order to keep migration towards
libvirt <= 0.9.4 working.

8 years agoqemu: domain: Reflect USB controller model in guest XML
Andrea Bolognani [Thu, 28 Jul 2016 13:33:29 +0000 (15:33 +0200)]
qemu: domain: Reflect USB controller model in guest XML

When the user doesn't specify any model for a USB controller,
we use an architecture-dependent default, but we don't reflect
it in the guest XML.

Pick the default USB controller model when parsing the guest
XML instead of when creating the QEMU command line, so that
our choice is saved back to disk.

8 years agovirschematest: Initialize @data
Michal Privoznik [Fri, 12 Aug 2016 10:19:44 +0000 (12:19 +0200)]
virschematest: Initialize @data

==8630== Invalid read of size 8
==8630==    at 0x4EA4F0F: virFree (viralloc.c:582)
==8630==    by 0x4F398F0: virXMLValidatorFree (virxml.c:1257)
==8630==    by 0x40305C: mymain (virschematest.c:191)
==8630==    by 0x405159: virTestMain (testutils.c:982)
==8630==    by 0x403553: main (virschematest.c:215)
==8630==  Address 0xcd72243 is 131 bytes inside a block of size 177 free'd
==8630==    at 0x4C2B1F0: free (vg_replace_malloc.c:473)
==8630==    by 0x4EA4F19: virFree (viralloc.c:582)
==8630==    by 0x4ED0973: virFindFileInPath (virfile.c:1646)
==8630==    by 0x405149: virTestMain (testutils.c:980)
==8630==    by 0x403553: main (virschematest.c:215)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoschema: Don't validate paths
Michal Privoznik [Fri, 12 Aug 2016 08:52:30 +0000 (10:52 +0200)]
schema: Don't validate paths

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

On UNIX like systems there are no constraints on what characters
can be in file/dir names (except for NULL, obviously). Moreover,
some values that we think of as paths (e.g. disk source) are not
necessarily paths at all. For instance, some hypervisors take
that as an arbitrary identifier and corresponding file is then
looked up by hypervisor in its table. Instead of trying to fix
our regular expressions (and forgetting to include yet another
character there), lets drop the validation completely.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirNetDevMacVLanCreateWithVPortProfile: Drop @ret
Michal Privoznik [Tue, 9 Aug 2016 17:25:44 +0000 (19:25 +0200)]
virNetDevMacVLanCreateWithVPortProfile: Drop @ret

Usually, this variable is used to hold the return value for a
function of ours. Well, this is not the case. Its use does not
match our pattern and therefore it is very misleading. Drop it
and define an alternative @rc variable, but only in that single
block where it is needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirNetDevMacVLanCreateWithVPortProfile: Drop @rc
Michal Privoznik [Tue, 9 Aug 2016 17:23:15 +0000 (19:23 +0200)]
virNetDevMacVLanCreateWithVPortProfile: Drop @rc

This variable is very misleading. We use VIR_FORCE_CLOSE to set
it to -1 and returning it even though it does not refer to a FD
at all. It merely holds 0 or -1. Drop it completely. Also, at the
same time some corner cases are fixed too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirNetDevMacVLanCreateWithVPortProfile: Don't mask virNetDevMacVLanTapOpen error
Michal Privoznik [Tue, 9 Aug 2016 16:47:49 +0000 (18:47 +0200)]
virNetDevMacVLanCreateWithVPortProfile: Don't mask virNetDevMacVLanTapOpen error

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

In this function we create a macvtap device and open its tap
device. Possibly multiple times. Now the thing is, if opening the
tap device fails, that is virNetDevMacVLanTapOpen() returns a
negative value, we unroll all the changes BUT return 0 fooling
caller into thinking everything went okay.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: fix qemu.conf security_driver
Cole Robinson [Wed, 10 Aug 2016 14:32:03 +0000 (10:32 -0400)]
qemu: fix qemu.conf security_driver

Since a9331394 (first release v2.1.0), specifying a manual
security_driver setting in qemu.conf causes the daemon to fail to
start, erroring with 'Duplicate security driver X'.

The duplicate checking was incorrectly comparing every entry
against itself, guaranteeing a false positive.

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

8 years agoconf: restrict expander buses to connect only to a root bus
Laine Stump [Sat, 6 Aug 2016 23:03:31 +0000 (19:03 -0400)]
conf: restrict expander buses to connect only to a root bus

More misunderstanding/mistaken assumptions on my part - I had thought
that a pci-expander-bus could be plugged into any legacy PCI slot, and
that pcie-expander-bus could be plugged into any PCIe slot. This isn't
correct - they can both be plugged ontly into their respective root
buses. This patch adds that restriction.

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

8 years agoconf: restrict where dmi-to-pci-bridge can be connected
Laine Stump [Fri, 5 Aug 2016 19:01:08 +0000 (15:01 -0400)]
conf: restrict where dmi-to-pci-bridge can be connected

libvirt had allowed a dmi-to-pci-bridge to be plugged in anywhere a
normal PCIe endpoint can be connected, but this is wrong - it will
only work if it's plugged into pcie-root (the PCIe root complex) or a
pcie-expander-bus (the qemu device pxb-pcie). This patch adjusts the
connection flags accordingly.

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

8 years agoconf: don't allow connecting upstream-port directly to pce-expander-bus
Laine Stump [Thu, 4 Aug 2016 17:04:12 +0000 (13:04 -0400)]
conf: don't allow connecting upstream-port directly to pce-expander-bus

I apparently misunderstood Marcel's description of what could and
couldn't be plugged into qemu's pxb-pcie controller (known as
pcie-expander-bus in libvirt) - I specifically allowed directly
connecting a pcie-switch-upstream-port, and it turns out that causes
the guest kernel to crash.

This patch forbids such a connection, and updates the xml docs
appropriately.

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

8 years agoconf: improve error log when PCI devices don't match requested controller
Laine Stump [Sat, 6 Aug 2016 01:19:27 +0000 (21:19 -0400)]
conf: improve error log when PCI devices don't match requested controller

The virDomainPCIAddressFlagsCompatible() error logs report that a
device required a controller that accepted standard PCI endpoint
devices, or PCI Express endpoint devices, and if hotplug was required
by the configuration but not provided by the selected controller. But
the wording of the error messages was apparently confusing (according
to the bugzilla report referenced below). On top of that, if the
device was something other than an endpoint device (e.g. a
pcie-switch-downstream-port) the error message was a complete punt -
it would just say that the flags were incorrect.

This patch makes the messages for PCI/PCIe endpoint and hotplug
requirements more clear, and also specifically indicates what was the
device type when it is other than an endpoint device.

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

8 years agovirt-admin: Fix the error when an invalid URI has been provided
Erik Skultety [Tue, 9 Aug 2016 14:11:26 +0000 (16:11 +0200)]
virt-admin: Fix the error when an invalid URI has been provided

After commit 9d479dd1 fiddled with the cmdConnect's output which used to be a
bit more verbose prior to the mentioned commit, the program flow would result
in a quite confusing error if an invalid URI has been provided:

    error: Failed to connect to the admin server
    Connected to the admin server
    error: <some error>

The problem is that the commit mentioned above relied on the fact that
connect routine always succeeds which is not true.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agocpu_x86: Fix host-model CPUs on hosts with CMT
Jiri Denemark [Tue, 9 Aug 2016 13:15:20 +0000 (15:15 +0200)]
cpu_x86: Fix host-model CPUs on hosts with CMT

Since the introduction of CMT features (commit v1.3.5-461-gf294b83)
starting a domain with host-model CPU on a host which supports CMT fails
because QEMU complains about unknown 'cmt' feature:

    qemu-system-x86_64: CPU feature cmt not found

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add a test for host-model CPU with CMT feature
Jiri Denemark [Tue, 9 Aug 2016 13:03:20 +0000 (15:03 +0200)]
tests: Add a test for host-model CPU with CMT feature

The generated command line wouldn't work since QEMU doesn't know what
'cmt' is. The following patch will fix this issue.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Properly drop non-migratable features
Jiri Denemark [Tue, 28 Jun 2016 09:12:41 +0000 (11:12 +0200)]
cpu_x86: Properly drop non-migratable features

By removing a non-migratable feature in a for loop we would fail to drop
every second non-migratable feature if the features array contained
several of them in a row.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Introduce x86FeatureIsMigratable
Jiri Denemark [Tue, 28 Jun 2016 08:51:41 +0000 (10:51 +0200)]
cpu_x86: Introduce x86FeatureIsMigratable

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agovirsh: clarify snapshot --live
Chen Hanxiao [Fri, 5 Aug 2016 07:23:52 +0000 (15:23 +0800)]
virsh: clarify snapshot --live

In libvirt, snapshot means disk snapshot.
snapshot --live is more like VM checkpoint.
Make it clear in virsh.pod.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirsh: Introduce nodedev-event command
Jovanka Gulicoska [Mon, 8 Aug 2016 19:34:21 +0000 (21:34 +0200)]
virsh: Introduce nodedev-event command

Add nodedev-event support for node device lifecycle events

8 years agovirt-admin: Properly fix the default session daemon URI to admin server
Erik Skultety [Tue, 9 Aug 2016 11:57:41 +0000 (13:57 +0200)]
virt-admin: Properly fix the default session daemon URI to admin server

Commit 30ce2f0e tried to fix the issue with an incorrect session URI to admin
server but it messed up the checks:

    if (geteuid == 0 && VIR_STRDUP(*uristr, "libvirtd:///system") < 0)
        return -1;
    else if (VIR_STRDUP(*uristr, "libvirtd:///session") < 0)
        return -1;

So if a client executed with root privileges tries to connect, its euid is
checked (true) and the correct URI is successfully copied to @uristr (false),
therefore the 'else' branch is taken and @uristr is replaced by the session URI
which for root results in:
    Failed to connect socket to '/root/.cache/libvirt/libvirt-admin-sock':
    No such file or directory

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Fix the default uri for session daemon to libvirtd:///session
Erik Skultety [Fri, 29 Jul 2016 11:57:59 +0000 (13:57 +0200)]
admin: Fix the default uri for session daemon to libvirtd:///session

Just like we decide on which URI we go with based on EUID for qemu in remote
driver, do a similar thing for admin except we do not spawn a daemon in this
case.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agodocs: Distribute subsite.xsl
Michal Privoznik [Mon, 8 Aug 2016 09:36:01 +0000 (11:36 +0200)]
docs: Distribute subsite.xsl

So, I've ran into very interesting problem lately. When doing the
following, I've encountered an error:

  libvirt.git $ make dist && tar -xJf libvirt-2.2.0.tar.xz && \
                cd libvirt-2.2.0 && ./configure && \
                rm docs/formatdomain.html && make -C docs

  make: Entering directory 'docs'
  make: *** No rule to make target 'formatdomain.html', needed by 'web'.  Stop.
  make: Leaving directory 'docs'

I had no idea what was going on, so I've nailed down the commit
that "broke it" via running git-bisect. It was this one:
7659bd9221b9dd1cdf. But that shed no more light until I realized
that the commit might actually just exposed a problem we had. And
guess what - I've nailed it down. Of course we are not
distributing subsite.xsl that's why make prints error message.
Very misleading one I must say.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirsystemd: Fix error check
Marc Hartmayer [Fri, 5 Aug 2016 16:04:27 +0000 (18:04 +0200)]
virsystemd: Fix error check

Commit b3e4401dc620 introduced a check to ignore an error if the guest
is already terminated. However the check accidentally compared
error.code with VIR_ERR_ERROR, which is an error level, not an error
code. Because of this, almost every error got silently ignored.

Fixes: b3e4401dc620 ("systemd: don't report an error if the guest is
already terminated")

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agonsslinktest: also build virAtomic.h
Kai Kang [Mon, 8 Aug 2016 01:53:47 +0000 (09:53 +0800)]
nsslinktest: also build virAtomic.h

When build for architecture that don't use gcc atomic ops but pthread,
it fails to build for armel:

| ../tools/nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virobject.o): In function `virClassNew':
| /buildarea2/kkang/builds/qemuarm-Aug03/bitbake_build/tmp/work/armv5e-wrs-linux-gnueabi/libvirt/1.3.5-r0/build/src/../../libvirt-1.3.5/src/util/virobject.c:153: undefined reference to `virAtomicLock'
| ../tools/nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virobject.o): In function `virObjectNew':
| /buildarea2/kkang/builds/qemuarm-Aug03/bitbake_build/tmp/work/armv5e-wrs-linux-gnueabi/libvirt/1.3.5-r0/build/src/../../libvirt-1.3.5/src/util/virobject.c:205: undefined reference to `virAtomicLock'
| ../tools/nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virobject.o): In function `virObjectUnref':
| /buildarea2/kkang/builds/qemuarm-Aug03/bitbake_build/tmp/work/armv5e-wrs-linux-gnueabi/libvirt/1.3.5-r0/build/src/../../libvirt-1.3.5/src/util/virobject.c:277: undefined reference to `virAtomicLock'
| ../tools/nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virobject.o): In function `virObjectRef':
| /buildarea2/kkang/builds/qemuarm-Aug03/bitbake_build/tmp/work/armv5e-wrs-linux-gnueabi/libvirt/1.3.5-r0/build/src/../../libvirt-1.3.5/src/util/virobject.c:298: undefined reference to `virAtomicLock'
| collect2: error: ld returned 1 exit status

It is similar with:

http://libvirt.org/git/?p=libvirt.git;a=commit;h=12dc729

Signed-off-by: Kai Kang <kai.kang@windriver.com>
8 years agovz: add vzDomainGetJobStats
Nikolay Shirokovskiy [Mon, 20 Jun 2016 10:08:15 +0000 (13:08 +0300)]
vz: add vzDomainGetJobStats

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: add getting job info for migration
Nikolay Shirokovskiy [Mon, 20 Jun 2016 10:08:14 +0000 (13:08 +0300)]
vz: add getting job info for migration

Unfortunately vz sdk do not provide detail information on migration
progress, only progress percentage. Thus vz driver provides percents
instead of bytes in data fields of virDomainJobInfoPtr.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agobuild: centralize use of extra Cygwin LDFLAGS
Eric Blake [Sat, 6 Aug 2016 13:43:06 +0000 (07:43 -0600)]
build: centralize use of extra Cygwin LDFLAGS

The build was failing with:

  CCLD     lockd.la
libtool:   error: can't build i686-pc-cygwin shared library unless -no-undefined is specified

Rather than add yet another $(CYGWIN_EXTRA_LDFLAGS) to all the
impacted *_la_LDFLAGS, it was easier to just pull the extra
flags into ALL libraries via AM_LDFLAGS.

Then, fix lockd_la_LDFLAGS to include AM_LDFLAGS, like all other
libraries.

Signed-off-by: Eric Blake <eblake@redhat.com>
8 years agobuild: use XDR_CFLAGS for Cygwin build
Eric Blake [Sat, 6 Aug 2016 13:27:03 +0000 (07:27 -0600)]
build: use XDR_CFLAGS for Cygwin build

Without XDR_CFLAGS, compilation on Cygwin fails with:

  CC       libvirt_driver_la-libvirt-stream.lo
In file included from libvirt-stream.c:26:0:
rpc/virnetprotocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

Signed-off-by: Eric Blake <eblake@redhat.com>
8 years agolxcDomainCreateXMLWithFiles: Avoid crash
Michal Privoznik [Thu, 4 Aug 2016 14:44:01 +0000 (16:44 +0200)]
lxcDomainCreateXMLWithFiles: Avoid crash

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

Imagine that you're creating a transient domain, but for some reason,
starting it fails. That is virLXCProcessStart() returns an error. With
current code, in the error handling code the domain object is removed
from the domain object list, @vm is set to NULL and controls jump to
enjob label where virLXCDomainObjEndJob() is called which dereference vm
leading to instant crash.

The fix is to end the job in the error handling code and only after that
remove the domain from the list and jump onto cleanup label instead of
endjob.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agostorage: Don't remove the pool for buildPool failure in storagePoolCreate
John Ferlan [Thu, 4 Aug 2016 19:24:48 +0000 (15:24 -0400)]
storage: Don't remove the pool for buildPool failure in storagePoolCreate

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

When adding the ability to build the pool during the start pool processing
using the similar flags as buildPool processing would use, the code was
essentially cut-n-pasted from storagePoolCreateXML.  However, that included
a call to virStoragePoolObjRemove which shouldn't happen within the
storagePoolCreate path since that'll remove the pool from the list of
pools only to be rediscovered if libvirtd restarts.

So on failure, just fail and return as we should expect

8 years agoFix indentation
Ján Tomko [Mon, 6 Jun 2016 14:30:51 +0000 (16:30 +0200)]
Fix indentation

8 years agoqemu: Add tests for virQEMUCapsNewCopy
Jiri Denemark [Thu, 4 Aug 2016 20:43:22 +0000 (22:43 +0200)]
qemu: Add tests for virQEMUCapsNewCopy

Doing a load, copy, format cycle on all QEMU capabilities XML files
should make sure we don't forget to update virQEMUCapsNewCopy when
adding new elements to QEMU capabilities.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Copy missing QEMU caps elements
Jiri Denemark [Thu, 4 Aug 2016 14:48:40 +0000 (16:48 +0200)]
qemu: Copy missing QEMU caps elements

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Copy QEMU caps elements in order of definition
Jiri Denemark [Thu, 4 Aug 2016 14:45:53 +0000 (16:45 +0200)]
qemu: Copy QEMU caps elements in order of definition

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: qemucapabilities: Add data for qemu 2.7.0
Peter Krempa [Fri, 29 Jul 2016 07:17:11 +0000 (09:17 +0200)]
tests: qemucapabilities: Add data for qemu 2.7.0

As of (v2.7.0-rc1-52-g42e0d60)

8 years agostorage: Fix a NULL ptr dereference in virStorageBackendCreateQemuImg
Erik Skultety [Wed, 3 Aug 2016 10:08:41 +0000 (12:08 +0200)]
storage: Fix a NULL ptr dereference in virStorageBackendCreateQemuImg

There was a missing check for vol->target.encryption being NULL
at one particular place (modified by commit a48c71411) which caused a crash
when user attempted to create a raw volume using a non-raw file volume as
source.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agointernal: Introduce macro for stealing pointers
Peter Krempa [Sun, 31 Jul 2016 12:02:08 +0000 (14:02 +0200)]
internal: Introduce macro for stealing pointers

VIR_STEAL_PTR copies the pointer from the second argument into the
first argument and then sets the second to NULL.

8 years agotests: Fix broken build
John Ferlan [Thu, 4 Aug 2016 17:02:38 +0000 (13:02 -0400)]
tests: Fix broken build

Commit id 'f522b7d2' caused a build failure :

GEN      check-augeas-virtlogd
Test failure:test_libvirtd_qemu.aug:69.3-147.28:
 Expected:
{
...
  { "nvram"
    { "1" = "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd" }
    { "2" = "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd" }
  }
...
 Actual:
...
{
  { "nvram"
    { "1" = "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd" }
    { "2" = "/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.fd" }
    { "3" = "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd" }
  }
...

This patch adds the OVMF_CODE.secboot.fd to the aug.in file

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: fix capability counting
Boris Fiuczynski [Thu, 4 Aug 2016 15:13:48 +0000 (17:13 +0200)]
qemu: fix capability counting

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoqemu: Advertise OVMF_CODE.secboot.fd
Michal Privoznik [Wed, 13 Jul 2016 15:19:08 +0000 (17:19 +0200)]
qemu: Advertise OVMF_CODE.secboot.fd

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Enable secure boot
Michal Privoznik [Wed, 13 Jul 2016 09:33:52 +0000 (11:33 +0200)]
qemu: Enable secure boot

In qemu, enabling this feature boils down to adding the following
onto the command line:

  -global driver=cfi.pflash01,property=secure,value=on

However, there are some constraints resulting from the
implementation. For instance, System Management Mode (SMM) is
required to be enabled, the machine type must be q35-2.4 or
later, and the guest should be x86_64. While technically it is
possible to have 32 bit guests with secure boot, some non-trivial
CPU flags tuning is required (for instance lm and nx flags must
be prohibited). Given complexity of our CPU driver, this is not
trivial. Therefore I've chosen to forbid 32 bit guests for now.
If there's ever need, we can refine the check later.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoIntroduce @secure attribute to os loader element
Michal Privoznik [Wed, 13 Jul 2016 07:22:51 +0000 (09:22 +0200)]
Introduce @secure attribute to os loader element

This element will control secure boot implemented by some
firmwares. If the firmware used in <loader/> does support the
feature we must tell it to the underlying hypervisor. However, we
can't know whether loader does support it or not just by looking
at the file. Therefore we have to have an attribute to the
element where users can tell us whether the firmware is secure
boot enabled or not.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoIntroduce SMM feature
Michal Privoznik [Wed, 13 Jul 2016 12:09:20 +0000 (14:09 +0200)]
Introduce SMM feature

Since its release of 2.4.0 qemu is able to enable System
Management Module in the firmware, or disable it. We should
expose this capability in the XML. Unfortunately, there's no good
way to determine whether the binary we are talking to supports
it. I mean, if qemu's run with real machine type, the smm
attribute can be seen in 'qom-list /machine' output. But it's not
there when qemu's run with -M none. Therefore we're stuck with
version based check.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuBuildMachineCommandLine: Follow our pattern
Michal Privoznik [Wed, 13 Jul 2016 11:57:17 +0000 (13:57 +0200)]
qemuBuildMachineCommandLine: Follow our pattern

We use 'goto cleanup' for a reason. If a function can exit at
many places but doesn't follow the pattern, it has to copy the
free code in multiple places.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agorpm: set TLS priority to @LIBVIRT,SYSTEM on Fedora >= 25
Daniel P. Berrange [Thu, 4 Aug 2016 07:56:27 +0000 (08:56 +0100)]
rpm: set TLS priority to @LIBVIRT,SYSTEM on Fedora >= 25

With newest gnutls available in Fedora 25/rawhide, it is
possible to have TLS priority fallbacks, so we can finally
use --tls-priority=@LIBVIRT,SYSTEM

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agotests: qemuxml2xml: Add some USB test cases
Andrea Bolognani [Fri, 29 Jul 2016 14:09:53 +0000 (16:09 +0200)]
tests: qemuxml2xml: Add some USB test cases

All these configurations are already covered for qemuxml2argv,
but there were no equivalent tests for qemuxml2xml.

8 years agotests: qemuxml2xml: Use DO_TEST() for most tests
Andrea Bolognani [Fri, 29 Jul 2016 13:27:03 +0000 (15:27 +0200)]
tests: qemuxml2xml: Use DO_TEST() for most tests

Now that DO_TEST() can be passed capabilities, there is little
need to use DO_TEST_FULL() instead of DO_TEST().

8 years agotests: qemuxml2xml: Pass capabilities to DO_TEST()
Andrea Bolognani [Fri, 29 Jul 2016 13:13:56 +0000 (15:13 +0200)]
tests: qemuxml2xml: Pass capabilities to DO_TEST()

This will allow us to remove most DO_TEST_FULL() usages. For the
time being, just add the extra argument to all DO_TEST() calls.

8 years agotests: qemuxml2xml: Use WHEN_BOTH for most tests
Andrea Bolognani [Fri, 29 Jul 2016 12:47:40 +0000 (14:47 +0200)]
tests: qemuxml2xml: Use WHEN_BOTH for most tests

A bunch of cases were only being tested for WHEN_ACTIVE or
WHEN_INACTIVE. Use WHEN_BOTH for all except the very few that
actually require the existing setup.

8 years agotests: qemuxml2xml: Clean up disk-mirror
Andrea Bolognani [Fri, 29 Jul 2016 12:20:12 +0000 (14:20 +0200)]
tests: qemuxml2xml: Clean up disk-mirror

Instead of testing it twice using WHEN_ACTIVE and WHEN_INACTIVE
separately, just use WHEN_BOTH.

8 years agotests: qemuxml2argv: Fix usb-too-long-port-path-invalid
Andrea Bolognani [Fri, 29 Jul 2016 11:54:13 +0000 (13:54 +0200)]
tests: qemuxml2argv: Fix usb-too-long-port-path-invalid

The test case uses DO_TEST_PARSE_FLAGS_ERROR(), but doesn't
pass any parse flag. Use DO_TEST_PARSE_ERROR() instead.

8 years agotests: qemuxml2argv: Remove useless GIC flags
Andrea Bolognani [Fri, 29 Jul 2016 16:11:26 +0000 (18:11 +0200)]
tests: qemuxml2argv: Remove useless GIC flags

DO_TEST_FAILURE() doesn't take a GIC version, but the GIC flag
was passed anyway. Get rid of all such occurrences.

8 years agovirObjectEventNew: Use virObjectUnref() to free virObjectEvent
Michal Privoznik [Thu, 4 Aug 2016 06:33:17 +0000 (08:33 +0200)]
virObjectEventNew: Use virObjectUnref() to free virObjectEvent

While no leak was observed yet, there might be one if
virObjectEventClass is ever derived from another class. Because
in that case plain VIR_FREE() will not call dispose() from parent
classes possibly leaking some memory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolibxlDoMigrateReceive: Drop useless check for !vm
Michal Privoznik [Wed, 3 Aug 2016 12:48:01 +0000 (14:48 +0200)]
libxlDoMigrateReceive: Drop useless check for !vm

In the cleanup path, @vm cannot be possibly NULL. If it were so,
we would receive SIGSEGV much earlier. At the beginning of the
function we do libxlDomainObjBeginJob(.., vm, ..); and so on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirshConnect: Don't leak polkit agent
Michal Privoznik [Wed, 3 Aug 2016 12:41:50 +0000 (14:41 +0200)]
virshConnect: Don't leak polkit agent

In our attempts to reconnect, we may create a polkit daemon.
However, it may happen that we would rewrite the variable that
already holds pointer to the agent.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agosecurityselinuxlabeltest: Prefer virGetLastErrorMessage() over virGetLastError
Michal Privoznik [Thu, 4 Aug 2016 07:20:31 +0000 (09:20 +0200)]
securityselinuxlabeltest: Prefer virGetLastErrorMessage() over virGetLastError

At the beginning of the test, some preparation work is done. For
instance new virSecurityManager is created. If this fails for
whatever reason, we try to fetch the latest error and print the
error message contained in it. However, if there's a bug in our
code and no error is reported, this approach will lead to crash,
while with virGetLastErrorMessage() it won't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirqemu: Reflect return type of virJSONValueArraySize()
Michal Privoznik [Wed, 3 Aug 2016 06:32:44 +0000 (08:32 +0200)]
virqemu: Reflect return type of virJSONValueArraySize()

The virJSONValueArraySize() function return ssize_t (with
possibly returning -1 if the passed json is not an array).
Storing the return value into size_t is possibly dangerous then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: domain: Simplify return values of qemuDomainRefreshVcpuInfo
Peter Krempa [Mon, 1 Aug 2016 05:35:50 +0000 (07:35 +0200)]
qemu: domain: Simplify return values of qemuDomainRefreshVcpuInfo

Call the vcpu thread info validation separately to decrease complexity
of returned values by qemuDomainRefreshVcpuInfo.

This function now returns 0 on success and -1 on error. Certain
failures of qemu to report data are still considered as success. Any
error reported now is fatal.

8 years agoqemu: domain: Improve vCPU data checking in qemuDomainRefreshVcpu
Peter Krempa [Fri, 8 Jul 2016 13:39:32 +0000 (15:39 +0200)]
qemu: domain: Improve vCPU data checking in qemuDomainRefreshVcpu

Validate the presence of the thread id according to state of the vCPU
rather than just checking the vCPU count. Additionally put the new
validation code into a separate function so that the information
retrieval can be split from the validation.

8 years agoqemu: monitor: Rename qemuMonitor(JSON|Text)GetCPUInfo
Peter Krempa [Fri, 8 Jul 2016 13:36:27 +0000 (15:36 +0200)]
qemu: monitor: Rename qemuMonitor(JSON|Text)GetCPUInfo

Use a name that contains the command used to get the information.

8 years agoqemu: domain: Rename qemuDomainDetectVcpuPids to qemuDomainRefreshVcpuInfo
Peter Krempa [Tue, 19 Jul 2016 14:00:29 +0000 (16:00 +0200)]
qemu: domain: Rename qemuDomainDetectVcpuPids to qemuDomainRefreshVcpuInfo

The function will eventually do more useful stuff than just detection of
thread ids.

8 years agoqemu: Improve error message in virDomainGetVcpus
Peter Krempa [Mon, 18 Jul 2016 09:21:06 +0000 (11:21 +0200)]
qemu: Improve error message in virDomainGetVcpus

If the VM is offline we can't retrieve the runtime statistical
information. Pinning could be retrieved but there are separate APIs for
that.

8 years agoqemu: monitor: Add do-while block to QEMU_CHECK_MONITOR_FULL
Peter Krempa [Fri, 29 Jul 2016 07:04:34 +0000 (09:04 +0200)]
qemu: monitor: Add do-while block to QEMU_CHECK_MONITOR_FULL

Assure that it's just one statement to avoid problems when used with
conditions.

8 years agoqemu: monitor: Add monitor API for device_add supporting JSON objects
Peter Krempa [Sun, 31 Jul 2016 13:26:12 +0000 (15:26 +0200)]
qemu: monitor: Add monitor API for device_add supporting JSON objects

Rather than formatting a string and splitting it back to a JSON object
add API that will take a JSON object directly.

8 years agoconf: events: Fix coverity warning
Cole Robinson [Wed, 3 Aug 2016 22:45:50 +0000 (18:45 -0400)]
conf: events: Fix coverity warning

Since 2bfa75134 virObjectEventNew can be passed a NULL 'uuid' value,
so drop the ATTRIBUTE_NONNULL annotation

8 years agolibxl: allow libxl to calculate shadow mem requirements
Jim Fehlig [Tue, 2 Aug 2016 23:36:34 +0000 (17:36 -0600)]
libxl: allow libxl to calculate shadow mem requirements

Long, long ago before libxl_get_required_shadow_memory() was
made publicly available, its code was copied to the libxl driver
for calculating shadow memory requirements of HVM domains.

Long ago, libxl_get_required_shadow_memory() was exported in
libxl_utils.h and included in xen-devel packages everywhere.

Remove the copied code, which has become stale, and let libxl
provode a proper shadow memory value.

8 years agoqemu: Add support to get/set IOThread period and quota cgroup values
John Ferlan [Mon, 25 Jul 2016 11:07:43 +0000 (07:07 -0400)]
qemu: Add support to get/set IOThread period and quota cgroup values

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

Add support for IOThread quota/bandwidth and period parameters for non
session mode. If in session mode, then error out.  Uses all the same
places where {vcpu|emulator|global}_{period|quota} are adjusted and
adds the iothread values.

8 years agoconf: Add IOThread quota and period scheduler/cputune defs
John Ferlan [Mon, 25 Jul 2016 11:04:38 +0000 (07:04 -0400)]
conf: Add IOThread quota and period scheduler/cputune defs

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

Add the definitions to allow for viewing/setting cgroup period and quota
limits for IOThreads.

This is similar to the work done for emulator quota and period by
commit ids 'b65dafa' and 'e051c482'.

Being able to view/set the IOThread specific values is related to more
recent changes adding global period (commmit id '4d92d58f') and global
quota (commit id '55ecdae') definitions and qemu support (commit id
'4e17ff79' and 'fbcbd1b2'). With a global setting though, if somehow
the IOThread value in the cgroup hierarchy was set "outside of libvirt"
to a value that is incompatible with the global value.

Allowing control over IOThread specific values provides the capability
to alter the IOThread values as necessary.

8 years agoDon't error when attaching security label of model "none"
Daniel P. Berrange [Wed, 13 Jul 2016 10:16:45 +0000 (11:16 +0100)]
Don't error when attaching security label of model "none"

If you invoke virDomainLxcEnterSecurityLabel() on security
model of "none" it will report an error. Logically a "none"
security model should be treated as a no-op, so we should
just return success immediately, instead of an error.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoqemu: only report errno in trace message on failure
Daniel P. Berrange [Tue, 2 Aug 2016 10:48:01 +0000 (11:48 +0100)]
qemu: only report errno in trace message on failure

Avoid reporting a stale errno value when the syscall succeeds,
instead always pass 0.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirsh: qemu-monitor-command: Don't print extra newline with --pretty
Peter Krempa [Mon, 1 Aug 2016 04:13:39 +0000 (06:13 +0200)]
virsh: qemu-monitor-command: Don't print extra newline with --pretty

The prettified JSON string already contains a newline so don't print
another one. This allows to pipe the json output (in conjunction with
the --quiet option) to files without having to truncate them afterwards.

8 years agotests: Make schema test fail on XML schema errors
Peter Krempa [Tue, 2 Aug 2016 07:11:33 +0000 (09:11 +0200)]
tests: Make schema test fail on XML schema errors

Failure to parse the schema file would not trigger a test suite failure.

In addition to making the test fail it's necessary to split up the
parsing of the schema file into a separate test.

This is necessary as the XML validator uses libvirt errors to report
problems parsing of the actual schema RNG needs to be split out into a
separate function and called via virTestRun which has the
infrastructure to report them.

8 years agoremote: Fix indentation of the remote protocol structs check file
Peter Krempa [Tue, 2 Aug 2016 14:15:57 +0000 (16:15 +0200)]
remote: Fix indentation of the remote protocol structs check file

8 years agoqemu: Use the hostdev alias in qemuDomainAttachHostSCSIDevice error path
John Ferlan [Mon, 18 Jul 2016 17:24:27 +0000 (13:24 -0400)]
qemu: Use the hostdev alias in qemuDomainAttachHostSCSIDevice error path

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

Rather than pass the whole drive string (which contained the alias),
pass only the alias for the qemuMonitorDriveDel call in the error
path when adding a host device in the monitor fails.

8 years agoqemu: Use qemuAliasFromHostdev
John Ferlan [Mon, 18 Jul 2016 17:22:29 +0000 (13:22 -0400)]
qemu: Use qemuAliasFromHostdev

When building the command line alias and for SCSI Host Device deletion,
use the common API to build the alias

8 years agoqemu: Introduce qemuAliasFromHostdev
John Ferlan [Mon, 18 Jul 2016 17:19:02 +0000 (13:19 -0400)]
qemu: Introduce qemuAliasFromHostdev

Introduce a common API to generate the alias for a host device

8 years agoqemu: Add attempt to call qemuMonitorDriveDel for AttachSCSI failure path
John Ferlan [Mon, 18 Jul 2016 16:50:52 +0000 (12:50 -0400)]
qemu: Add attempt to call qemuMonitorDriveDel for AttachSCSI failure path

Completion of fix for:
    https://bugzilla.redhat.com/show_bug.cgi?id=1336225

Similar to the other disk types, add the qemuMonitorDriveDel in the failure
to add/hotplug a SCSI disk.

8 years agoqemu: Add attempt to call qemuMonitorDriveDel for USB failure path
John Ferlan [Wed, 29 Jun 2016 20:32:58 +0000 (16:32 -0400)]
qemu: Add attempt to call qemuMonitorDriveDel for USB failure path

Partial fix for:
    https://bugzilla.redhat.com/show_bug.cgi?id=1336225

Similar to the other disk types, add the qemuMonitorDriveDel in the failure
to add/hotplug a USB.

Added a couple of other formatting changes just to have a less cluttered look

8 years agoqemu: Make QEMU_DRIVE_HOST_PREFIX more private
John Ferlan [Wed, 29 Jun 2016 17:34:00 +0000 (13:34 -0400)]
qemu: Make QEMU_DRIVE_HOST_PREFIX more private

Move QEMU_DRIVE_HOST_PREFIX into the qemu_alias.c to dissuade future
callers from using it. Create qemuAliasDiskDriveSkipPrefix in order
to handle the current consumers that desire to check if an alias has
the drive- prefix and "get beyond it" in order to get the disk alias.

8 years agoqemu: Use qemuAliasFromDisk to generate drive alias
John Ferlan [Wed, 29 Jun 2016 17:11:58 +0000 (13:11 -0400)]
qemu: Use qemuAliasFromDisk to generate drive alias

Rather than open code build the drive alias command in multiple places,
use the helper to ensure consistency.

8 years agoqemu: Use qemuAliasFromDisk instead of qemuDeviceDriveHostAlias
John Ferlan [Wed, 29 Jun 2016 16:37:39 +0000 (12:37 -0400)]
qemu: Use qemuAliasFromDisk instead of qemuDeviceDriveHostAlias

Since we already have a function that will generate the drivestr from
the alias, let's use it and remove the qemuDeviceDriveHostAlias.

Move the QEMU_DRIVE_HOST_PREFIX definition into qemu_alias.h

Also alter qemuAliasFromDisk to use the QEMU_DRIVE_HOST_PREFIX instead
of "drive-%s".

8 years agoqemu: Use qemuAliasFromDisk to generate drive alias
John Ferlan [Mon, 1 Aug 2016 12:26:42 +0000 (08:26 -0400)]
qemu: Use qemuAliasFromDisk to generate drive alias

The qemuDomainSnapshotCreateSingleDiskActive open coded generating the
disk drive alias. Let's use the common function.

8 years agoqemu: Remove generation of drive alias from qcow passphrase backends
John Ferlan [Mon, 1 Aug 2016 12:11:44 +0000 (08:11 -0400)]
qemu: Remove generation of drive alias from qcow passphrase backends

Rather than pass the disks[i]->info.alias to qemuMonitorSetDrivePassphrase
and then generate the "drive-%s" alias from that, let's use qemuAliasFromDisk
prior to the call to generate the drive alias and then pass that along
thus removing the need to generate the alias from the monitor code.

8 years agoqemu: Reorder qemuDomainAttachUSBMassStorageDevice failure path
John Ferlan [Mon, 25 Apr 2016 16:26:48 +0000 (12:26 -0400)]
qemu: Reorder qemuDomainAttachUSBMassStorageDevice failure path

Modify the error/exit path to match what was done for Virtio and SCSI.
If nothing else it'll have a consistent look'n'feel

8 years agoevent-test: support node device lifecycle event APIs
Jovanka Gulicoska [Thu, 28 Jul 2016 12:02:56 +0000 (14:02 +0200)]
event-test: support node device lifecycle event APIs

8 years agonode_device: Implement event queue in udev
Jovanka Gulicoska [Thu, 28 Jul 2016 12:02:55 +0000 (14:02 +0200)]
node_device: Implement event queue in udev

8 years agonode_device: implement node device lifecycle event APIs
Jovanka Gulicoska [Thu, 28 Jul 2016 12:02:54 +0000 (14:02 +0200)]
node_device: implement node device lifecycle event APIs

8 years agoremote: implement node device lifecycle event APIs
Jovanka Gulicoska [Thu, 28 Jul 2016 12:02:53 +0000 (14:02 +0200)]
remote: implement node device lifecycle event APIs

8 years agotest: implement node device lifecycle event APIs
Jovanka Gulicoska [Thu, 28 Jul 2016 12:02:52 +0000 (14:02 +0200)]
test: implement node device lifecycle event APIs

Also includes unittests for node device lifecycle events API

8 years agoconf: add node_device_event handling
Jovanka Gulicoska [Thu, 28 Jul 2016 12:02:51 +0000 (14:02 +0200)]
conf: add node_device_event handling

Add node device event handling infrastructure to node_device_event.[ch]

8 years agoIntroduce node device lifecycle event APIs
Jovanka Gulicoska [Thu, 28 Jul 2016 12:02:50 +0000 (14:02 +0200)]
Introduce node device lifecycle event APIs

Node device lifecycle event API entry points for registering and
deregistering node deivce events, as well as types of events
associated with node device.
These entry points will be used for implementing asynchronous
lifecycle events.

Node device API:
virConnectNodeDeviceEventRegisterAny
virConnectNodeDeviceEventDeregisterAny
virNodeDeviceEventLifecycleType which has events CREATED and DELETED

8 years agoqemu: Set fake reboot flag to false when mode=agent
Nikolay Shirokovskiy [Tue, 2 Aug 2016 11:37:39 +0000 (07:37 -0400)]
qemu: Set fake reboot flag to false when mode=agent

As commit id 'e2b86f580' notes, when mode=agent possibly setting the
fake reboot flag to true wouldn't be necessary; however, it doesn't
"force" the issue by just ensuring the fake reboot is false, so this
patch adds the explicit setting for the reboot path.

More investigation and details can be found in commit id '8be502fd'
as well as in the archives at:

  https://www.redhat.com/archives/libvir-list/2015-April/msg00715.html

8 years agoqemu: Set fake reboot flag only in acpi mode for shutdown
Nikolay Shirokovskiy [Thu, 14 Jul 2016 11:08:22 +0000 (14:08 +0300)]
qemu: Set fake reboot flag only in acpi mode for shutdown

Conditional setting of the fake reboot flag should only happen for
the acpi mode shutdown path; however, for the agent mode shutdown,
the fake reboot should be cleared. This patch will essentially revert
commit id '8be502fd', but adds an explicit setting of the flag to false
when using mode=agent while also only conditionally setting the reboot
flag if the guest went away. This also avoids an issue where a shutdown
with reboot semantics is done from agent mode which sets the reboot
flag followed by a shutdown from within the guest which would result
in a reboot due to the fake reboot flag being set. The change will
also properly handle the cases described in the following archive post:

  https://www.redhat.com/archives/libvir-list/2015-April/msg00715.html