]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agoIntroduce qemuDomainNamespaceMknodPaths
Ján Tomko [Wed, 15 Nov 2017 16:43:14 +0000 (17:43 +0100)]
Introduce qemuDomainNamespaceMknodPaths

Separate the logic of creating devices from their gathering.

Use this new function in qemuDomainNamespaceSetupHostdev and
qemuDomainNamespaceSetupDisk.

7 years agoqemuDomainNamespaceSetupHostdev: rename path to paths
Ján Tomko [Fri, 1 Dec 2017 16:26:01 +0000 (17:26 +0100)]
qemuDomainNamespaceSetupHostdev: rename path to paths

To match the "things/nthings" pattern used in virDomainDef.

7 years agoqemuDomainNamespaceTeardownHostdev: rename path to paths
Ján Tomko [Fri, 24 Nov 2017 17:33:34 +0000 (18:33 +0100)]
qemuDomainNamespaceTeardownHostdev: rename path to paths

To match the "things/nthings" pattern used in virDomainDef.

7 years agoqemu: report drive mirror errors on migration
Nikolay Shirokovskiy [Fri, 27 Oct 2017 12:37:23 +0000 (15:37 +0300)]
qemu: report drive mirror errors on migration

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: prepare blockjob complete event error usage
Nikolay Shirokovskiy [Fri, 27 Oct 2017 12:37:22 +0000 (15:37 +0300)]
qemu: prepare blockjob complete event error usage

This patch pass event error up to the place where we can
use it. Error is passed only for sync blockjob event mode
as we can't use the error in async mode. In async mode we
just pass the event details to the client thru event API
but current blockjob event API can not carry extra parameter.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agonwfilter: don't crash listing filters in unprivileged daemon
Daniel P. Berrange [Tue, 5 Dec 2017 16:39:05 +0000 (16:39 +0000)]
nwfilter: don't crash listing filters in unprivileged daemon

The unprivileged libvirtd does not support nwfilter config, by leaves the
driver active. It is supposed to result in all APIs being an effective
no-op, but several APIs rely on driver->nwfilters being non-NULL, or they
will reference a NULL pointer. Rather than adding checks for NULL in many
places, just make sure  driver->nwfilters is always initialized.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotest: Drop useless prefix for genericxml2xml test data
Michal Privoznik [Tue, 5 Dec 2017 07:00:41 +0000 (08:00 +0100)]
test: Drop useless prefix for genericxml2xml test data

There's no reason for the files to have generic- prefix
since they all live under genericxml2xmlindata and
genericxml2xmloutdata directories.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agotest: Drop useless prefix for qemuxml2xmldata test data
Michal Privoznik [Tue, 5 Dec 2017 07:00:41 +0000 (08:00 +0100)]
test: Drop useless prefix for qemuxml2xmldata test data

There's no reason for the files to have qemuxml2xmlout- prefix
since they all live under qemuxml2xmloutdata directory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agotest: Drop useless prefix for qemuargv2xml test data
Michal Privoznik [Tue, 5 Dec 2017 06:50:12 +0000 (07:50 +0100)]
test: Drop useless prefix for qemuargv2xml test data

There's no reason for the files to have qemuargv2xml- prefix
since they all live under qemuargv2xmldata directory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agotest: Drop useless prefix for qemuagent test data
Michal Privoznik [Tue, 5 Dec 2017 07:16:48 +0000 (08:16 +0100)]
test: Drop useless prefix for qemuagent test data

There's no reason for the files to have qemuagent- prefix
since they all live under qemuagentdata directory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: fix security labeling for attach/detach of char devices
Pavel Hrdina [Fri, 1 Dec 2017 12:10:35 +0000 (13:10 +0100)]
qemu: fix security labeling for attach/detach of char devices

Commit e93d844b90 was not enough to fix the permission denied
issue.  We need to apply security labels as well.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7 years agosecurity: introduce virSecurityManager(Set|Restore)ChardevLabel
Pavel Hrdina [Fri, 1 Dec 2017 09:39:26 +0000 (10:39 +0100)]
security: introduce virSecurityManager(Set|Restore)ChardevLabel

SELinux and DAC drivers already have both functions but they were not
exported as public API of security manager.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7 years agotravis: Don't try to install brew packages twice
Andrea Bolognani [Mon, 4 Dec 2017 14:54:59 +0000 (15:54 +0100)]
travis: Don't try to install brew packages twice

gettext, gnutls and libgcrypt are already installed on the
system, so we don't need to request their installation.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotravis: Upgrade brew packages
Andrea Bolognani [Mon, 4 Dec 2017 14:10:37 +0000 (15:10 +0100)]
travis: Upgrade brew packages

Installed packages might be outdated by the time the build
runs, so we should update them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoutil: gettid() is Linux-specific
Andrea Bolognani [Mon, 4 Dec 2017 15:22:02 +0000 (16:22 +0100)]
util: gettid() is Linux-specific

The manual page clearly states that

  gettid() is Linux-specific and should not be used in programs
  that are intended to be portable.

Unfortunately, it looks like macOS implemented the functionality
and defined SYS_gettid accordingly, only to deprecate syscall()
altogether with 10.12 (Sierra), released last late year.

To avoid compilation errors, call gettid() on Linux only.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agomaint: Bump version number to 4.0.0
Andrea Bolognani [Tue, 5 Dec 2017 10:17:19 +0000 (11:17 +0100)]
maint: Bump version number to 4.0.0

As documented in

  https://libvirt.org/downloads.html#schedule
  https://libvirt.org/downloads.html#numbering

the next release will happen in the middle of January 2018 and,
being the first release of a new year, will bring a brand new
major version number with it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agotests: Drop qemuxml2argv- prefix for qemuxml2argv test cases
Michal Privoznik [Fri, 1 Dec 2017 15:09:43 +0000 (16:09 +0100)]
tests: Drop qemuxml2argv- prefix for qemuxml2argv test cases

Similarly to the previous commit, rename .args files.

The files were renamed using the following commands. From
qemuxml2argvdata:

  for i in qemuxml2argv-*.args; do mv $i ${i#qemuxml2argv-}; done

and then (to fix broken symlinks) from qemuxml2argvdata and
qemuxml2xmloutdata:

  for i in $(find . -xtype l); do \
      ln -sf $(readlink $i | sed 's/qemuxml2argv-//') $i;
  done

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agotests: Drop qemuxml2argv- prefix for qemuxml2argv-*.xml test cases
Michal Privoznik [Fri, 1 Dec 2017 14:18:49 +0000 (15:18 +0100)]
tests: Drop qemuxml2argv- prefix for qemuxml2argv-*.xml test cases

These XMLs live in a separate directory, there's no need for them
to have a special prefix in addition. It also doesn't play nicely
with ':e' completion in Vim, finding proper file based on
qemuxml2argvtest.c is also needlessly complicated.

The files were renamed using the following commands. From
qemuxml2argvdata:

  for i in qemuxml2argv-*.xml; do mv $i ${i#qemuxml2argv-}; done

and then (to fix broken symlinks) from qemuxml2argvdata and
qemuxml2xmloutdata:

  for i in $(find . -xtype l); do \
      ln -sf $(readlink $i | sed 's/qemuxml2argv-//') $i;
  done

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoPost-release version bump to 3.11.0
Michal Privoznik [Tue, 5 Dec 2017 06:31:54 +0000 (07:31 +0100)]
Post-release version bump to 3.11.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoRelease of libvirt 3.10.0
Daniel Veillard [Mon, 4 Dec 2017 17:21:18 +0000 (18:21 +0100)]
Release of libvirt 3.10.0

7 years agoapparmor: allow qemu abstraction to read /proc/pid/cmdline
Jim Fehlig [Thu, 30 Nov 2017 17:32:30 +0000 (10:32 -0700)]
apparmor: allow qemu abstraction to read /proc/pid/cmdline

Noticed the following denial in audit.log when shutting down
an apparmor confined domain

type=AVC msg=audit(1512002299.742:131): apparmor="DENIED"
operation="open" profile="libvirt-66154842-e926-4f92-92f0-1c1bf61dd1ff"
name="/proc/1475/cmdline" pid=2958 comm="qemu-system-x86"
requested_mask="r" denied_mask="r" fsuid=469 ouid=0

Squelch the denial by allowing read access to /proc/<pid>/cmdline.

7 years agoRefresh translations from zanata
Daniel P. Berrange [Mon, 4 Dec 2017 13:19:59 +0000 (13:19 +0000)]
Refresh translations from zanata

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoconf: Fix memory leak for distances in virDomainNumaFree
John Ferlan [Tue, 21 Nov 2017 23:18:46 +0000 (18:18 -0500)]
conf: Fix memory leak for distances in virDomainNumaFree

Commit id '74119a03f' neglected to clean up @distances when
the numa definition is cleaned up.

7 years agoconf: Clean up virDomainNumaDefCPUFormatXML
John Ferlan [Tue, 21 Nov 2017 23:17:58 +0000 (18:17 -0500)]
conf: Clean up virDomainNumaDefCPUFormatXML

Don't use a unary comparison for an int value - compare against zero
directly instead.

7 years agoconf: Clean up virDomainNumaDefNodeDistanceParseXML
John Ferlan [Tue, 21 Nov 2017 23:13:43 +0000 (18:13 -0500)]
conf: Clean up virDomainNumaDefNodeDistanceParseXML

Clean up the style a bit w/r/t to not using a unary operator on an
integer value that could be zero - compare vs. zero instead.

Set the def->mem_nodes[*].distances to rdist or ldist inside the
if condition - no need to set outside since the value being set
to is what was fetched.

During cleanup, be sure to initialize the ndistances on error and
use the < 0 comparison not the unary one.

7 years agoqemuStateInitialize: Don't leak @memoryBackingPath
Michal Privoznik [Fri, 1 Dec 2017 08:57:22 +0000 (09:57 +0100)]
qemuStateInitialize: Don't leak @memoryBackingPath

==899== 39 bytes in 1 blocks are definitely lost in loss record 732 of 1,003
==899==    at 0x4C2AEDF: malloc (vg_replace_malloc.c:299)
==899==    by 0x8B68CE7: vasprintf (in /lib64/libc-2.25.so)
==899==    by 0x55498D2: virVasprintfInternal (virstring.c:708)
==899==    by 0x55499E7: virAsprintfInternal (virstring.c:729)
==899==    by 0x2BECFFF0: qemuGetMemoryBackingBasePath (qemu_conf.c:1757)
==899==    by 0x2BF23225: qemuStateInitialize (qemu_driver.c:893)
==899==    by 0x563073D: virStateInitialize (libvirt.c:770)
==899==    by 0x124CC4: daemonRunStateInit (libvirtd.c:834)
==899==    by 0x55521CD: virThreadHelper (virthread.c:206)
==899==    by 0x88D9686: start_thread (in /lib64/libpthread-2.25.so)
==899==    by 0x8BEAEFE: clone (in /lib64/libc-2.25.so)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirDomainDiskBackingStoreParse: Don't leak @idx
Michal Privoznik [Fri, 1 Dec 2017 08:57:04 +0000 (09:57 +0100)]
virDomainDiskBackingStoreParse: Don't leak @idx

==1277== 8 bytes in 4 blocks are definitely lost in loss record 39 of 131
==1277==    at 0x4C2AEDF: malloc (vg_replace_malloc.c:299)
==1277==    by 0x68BBBC8: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
==1277==    by 0x53B1DC2: virXMLPropString (virxml.c:510)
==1277==    by 0x53D696A: virDomainDiskBackingStoreParse (domain_conf.c:8639)
==1277==    by 0x53DA684: virDomainDiskDefParseXML (domain_conf.c:9590)
==1277==    by 0x53F619F: virDomainDefParseXML (domain_conf.c:19233)
==1277==    by 0x53F96EE: virDomainDefParseNode (domain_conf.c:20083)
==1277==    by 0x53F9540: virDomainDefParse (domain_conf.c:20027)
==1277==    by 0x53F95E6: virDomainDefParseFile (domain_conf.c:20053)
==1277==    by 0x44D1D4: testCompareDomXML2XMLFiles (testutils.c:1265)
==1277==    by 0x42FC7C: testXML2XMLActive (qemuxml2xmltest.c:71)
==1277==    by 0x44AD20: virTestRun (testutils.c:180)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirDomainDiskSourceNetworkParse: Don't leak @tlsCfg or @haveTLS
Michal Privoznik [Fri, 1 Dec 2017 08:56:36 +0000 (09:56 +0100)]
virDomainDiskSourceNetworkParse: Don't leak @tlsCfg or @haveTLS

==861== 3 bytes in 1 blocks are definitely lost in loss record 3 of 168
==861==    at 0x4C2AEDF: malloc (vg_replace_malloc.c:299)
==861==    by 0x8C7FBC8: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
==861==    by 0x5DCCDC2: virXMLPropString (virxml.c:510)
==861==    by 0x5DF1232: virDomainDiskSourceNetworkParse (domain_conf.c:8445)
==861==    by 0x5DF1728: virDomainDiskSourceParse (domain_conf.c:8576)
==861==    by 0x5DF41A5: virDomainDiskDefParseXML (domain_conf.c:9238)
==861==    by 0x5E1119F: virDomainDefParseXML (domain_conf.c:19233)
==861==    by 0x5E146EE: virDomainDefParseNode (domain_conf.c:20083)
==861==    by 0x5E14540: virDomainDefParse (domain_conf.c:20027)
==861==    by 0x5E145E6: virDomainDefParseFile (domain_conf.c:20053)
==861==    by 0x4053CC: testCompareXMLToArgv (qemuxml2argvtest.c:455)
==861==    by 0x41F135: virTestRun (testutils.c:180)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: domain: Fix backing store terminator for non-backing local files
Peter Krempa [Fri, 24 Nov 2017 11:59:59 +0000 (12:59 +0100)]
qemu: domain: Fix backing store terminator for non-backing local files

Raw local files do not pass through the backing store detector and thus
the code did not allocate the required backing store terminator for
them. Previously the terminating element would be formatted into the XML
since the default values used for the metadata allowed that. This is a
regression since a693fdba0111ff which was not detected in the review.

This patch also reverts all the changes in the test files.

7 years agoqemu: process: Move handling of non-backing files into qemuDomainDetermineDiskChain
Peter Krempa [Fri, 24 Nov 2017 11:04:14 +0000 (12:04 +0100)]
qemu: process: Move handling of non-backing files into qemuDomainDetermineDiskChain

Until now we would skip loading of the backing chain for files which
don't support backing chains only when starting up the VM. Move the
check from qemuProcessPrepareHostStorage with some adaptations so that's
always applied.

7 years agoqemu: domain: Refactor control flow in qemuDomainDetermineDiskChain
Peter Krempa [Fri, 24 Nov 2017 11:09:53 +0000 (12:09 +0100)]
qemu: domain: Refactor control flow in qemuDomainDetermineDiskChain

Split out clearing of the backing chain prior to other code since it
will be required later and optimize few layers of nested conditions and
loops.

7 years agoconf: fix migratable XML for graphics if socket is generated based on config
Pavel Hrdina [Thu, 30 Nov 2017 16:04:35 +0000 (17:04 +0100)]
conf: fix migratable XML for graphics if socket is generated based on config

The graphics code is complex and there are a lot of exceptions and
backward compatible combinations.  One of them is the possibility
to configure "spice_auto_unix_socket" in qemu.conf which will convert
all spice graphics with listen type "address" without any address
specified to listen type "socket" when the guest is started.

We don't format this generated socket into migratable XML to make
migration work with older libvirt.  However, spice has another
exception that if autoport='no' and there is no port configured
it is converted to listen type "none".  Because of this we need
to format autoport='yes' to make sure that the listen type will
be the same as the offline XML.

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

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7 years agovirQEMUCapsHasPCIMultiBus: assume true if we have no version information
Ján Tomko [Wed, 29 Nov 2017 14:05:23 +0000 (15:05 +0100)]
virQEMUCapsHasPCIMultiBus: assume true if we have no version information

In status XML, we do not store the QEMU version information, we only
format all the capabilities. We dropped QEMU_CAPS_PCI_MULTIBUS
in commit 5b783379 which was released in libvirt 3.2.0.

Therefore the only way of telling if the already running domain
at the time of daemon restart has been started with a QEMU that does
use 'pci.0' or not on PPC is to look at the pci-root controller's
alias. This is not an option if the domain has a user-specified alias
for the pci-root.

Instead of reintroducing the capability, assume 'pci.0' when we have
no version information. That way the only left broken use case would
be the combination of user aliases and very old QEMU.

Partially reverts commit 3a37af1e4.

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

7 years agovirQEMUCapsHasPCIMultiBus: use def->os.arch
Ján Tomko [Wed, 29 Nov 2017 13:51:22 +0000 (14:51 +0100)]
virQEMUCapsHasPCIMultiBus: use def->os.arch

We do not fill out qemuCaps->arch when parsing status XML.

Use def->os.arch like we do for PPC.

This fixes hotplug after daemon restart for domains that use
a user alias for the implicit pci-root on x86.

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

7 years agoqemu: prefer the PCI bus alias from status XML
Ján Tomko [Wed, 29 Nov 2017 13:38:52 +0000 (14:38 +0100)]
qemu: prefer the PCI bus alias from status XML

For some corner cases, virQEMUCapsHasPCIMultiBus depends on the QEMU
version, which is by design not stored in the status XML and therefore
it cannot be fixed for all existing running domains.

Prefer the controller alias read from the status XML when formatting
PCI addresses and only fall back to using virQEMUCapsHasPCIMultiBus
if the alias is a user alias.

This fixes hotplug after daemon restart for domains not using user
aliases.

Partially reverts commit 937f3195.

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

7 years agoIntroduce virDomainDeviceAliasIsUserAlias
Ján Tomko [Wed, 29 Nov 2017 13:02:51 +0000 (14:02 +0100)]
Introduce virDomainDeviceAliasIsUserAlias

Allow parts of code outside domain_conf to decide whether the alias
is user-specified or not.

7 years agoRemove non-existant 'wiremode' attribute
Daniel P. Berrange [Wed, 29 Nov 2017 18:00:04 +0000 (18:00 +0000)]
Remove non-existant 'wiremode' attribute

The 'wiremode' attribute exists in a couple of Xen XML files, but no code has
ever parsed that value. It was later added to the RNG schema too, again despite
there not being any code which parses it.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoMisc XML schema fixes for libxl
Daniel P. Berrange [Wed, 29 Nov 2017 17:43:29 +0000 (17:43 +0000)]
Misc XML schema fixes for libxl

The libxlxml2domconfigdata directory was not covered in the RNG schema
tests. This hid a few bugs in both the libxl XML files and the RNG
schema itself.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoqemu-capabilities: Adjust function header comments of virQEMUCapsInitCPUModel*
Boris Fiuczynski [Mon, 27 Nov 2017 12:12:17 +0000 (13:12 +0100)]
qemu-capabilities: Adjust function header comments of virQEMUCapsInitCPUModel*

Adjust function descriptions of virQEMUCapsInitCPUModelS390 and
virQEMUCapsInitCPUModel to the changes introduced with
commitID 74fc32a955.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agospec: Make the build reproducible
Jiri Denemark [Wed, 29 Nov 2017 10:08:40 +0000 (11:08 +0100)]
spec: Make the build reproducible

If the spec file applies a patch which touches any file in the API XMLs
dependency tree, we need to regenerate the XMLs and consequently
recreate hvsupport.html. The file will contain a time stamp in a comment
which means it will be different every time the package is built. The
commit a54c9622860 which added the time stamp also added support for
SOURCE_DATE_EPOCH environment variable. Let's set it to the time stamp
of the spec file itself to make the build reproducible.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pino Toscano <ptoscano@redhat.com>
7 years agospec: Turn on verbose build
Jiri Denemark [Wed, 29 Nov 2017 10:08:15 +0000 (11:08 +0100)]
spec: Turn on verbose build

When building a package in a build system, such as koji or cbs, logs are
the only thing which can be used to diagnose failures. Make them verbose
since human friendly output of V=0 build doesn't really help when a
build fails.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pino Toscano <ptoscano@redhat.com>
7 years agonews: Update for serial console fixes
Andrea Bolognani [Wed, 15 Nov 2017 11:47:09 +0000 (12:47 +0100)]
news: Update for serial console fixes

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Require QEMU_CAPS_DEVICE_PL011 for pl011
Andrea Bolognani [Tue, 28 Nov 2017 10:34:55 +0000 (11:34 +0100)]
qemu: Require QEMU_CAPS_DEVICE_PL011 for pl011

Even though we never format the device on the QEMU command line,
as it's a platform serial device that's not user-instantiable,
we should still make sure it's available before using it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Add QEMU_CAPS_DEVICE_PL011
Andrea Bolognani [Tue, 28 Nov 2017 10:23:26 +0000 (11:23 +0100)]
qemu: Add QEMU_CAPS_DEVICE_PL011

All serial devices shoule have an associated capability.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Require QEMU_CAPS_DEVICE_ISA_SERIAL for isa-serial
Andrea Bolognani [Sun, 26 Nov 2017 16:35:28 +0000 (17:35 +0100)]
qemu: Require QEMU_CAPS_DEVICE_ISA_SERIAL for isa-serial

We should make sure the isa-serial device is available before
formatting it on the QEMU command line.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Add QEMU_CAPS_DEVICE_ISA_SERIAL
Andrea Bolognani [Sun, 26 Nov 2017 16:19:46 +0000 (17:19 +0100)]
qemu: Add QEMU_CAPS_DEVICE_ISA_SERIAL

All serial devices shoule have an associated capability.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: switch s390/s390x default console back to serial
Pino Toscano [Tue, 14 Nov 2017 17:00:30 +0000 (18:00 +0100)]
qemu: switch s390/s390x default console back to serial

Now that <serial> and <console> on s390/s390x behave a bit more like the
other architectures, remove this extra differentation, and use sclp
console by default for new guests.  New virtio consoles can still be
added, and it is actually needed because of the limited number of
instances for sclp and sclplm.

This reverts commit b1c88c14764e0b043a269d454a83a6ac7af34eac, whose
reasons are not totally clear.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
7 years agoconf: add VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP
Pino Toscano [Tue, 14 Nov 2017 15:27:04 +0000 (16:27 +0100)]
conf: add VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP

Introduce specific a target types with two models for the console
devices (sclp and sclplm) used in s390 and s390x guests, so isa-serial
is no more used for them.

This makes <serial> usable on s390 and s390x guests, with at most only
a single sclpconsole and one sclplmconsole devices usable in a single
guest (due to limitations in QEMU, which will enforce already at
runtime).

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

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Add target type and model for pl011
Andrea Bolognani [Thu, 9 Nov 2017 16:14:57 +0000 (17:14 +0100)]
conf: Add target type and model for pl011

We can finally introduce a specific target model for the pl011 device
used by mach-virt guests, which means isa-serial will no longer show
up to confuse users.

We make sure migration works in both directions by interpreting the
isa-serial target type, or the lack of target type, appropriately
when parsing the guest XML, and skipping the newly-introduced type
when formatting if for migration. We also verify that pl011 is not
used for non-mach-virt guests and add a bunch of test cases.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Support usb-serial and pci-serial on pSeries
Andrea Bolognani [Fri, 10 Nov 2017 16:57:53 +0000 (17:57 +0100)]
qemu: Support usb-serial and pci-serial on pSeries

The existing implementation set the address type for all serial
devices to spapr-vio, which made it impossible to use other devices
such as usb-serial and pci-serial; moreover, some decisions were
made based on the address type rather than the device type.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Add target type and model for spapr-vty
Andrea Bolognani [Wed, 8 Nov 2017 14:31:21 +0000 (15:31 +0100)]
conf: Add target type and model for spapr-vty

We can finally introduce a specific target model for the spapr-vty
device used by pSeries guests, which means isa-serial will no longer
show up to confuse users.

We make sure migration works in both directions by interpreting the
isa-serial target type, or the lack of target type, appropriately
when parsing the guest XML, and skipping the newly-introduced type
when formatting if for migration. We also verify that spapr-vty is
not used for non-pSeries guests and add a bunch of test cases.

This commit is best viewed with 'git show -w'.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Remove redundancy in qemuBuildSerialChrDeviceStr()
Andrea Bolognani [Sun, 26 Nov 2017 11:30:10 +0000 (12:30 +0100)]
qemu: Remove redundancy in qemuBuildSerialChrDeviceStr()

Instead duplicating the capability check for each possible target
model, introduce a small helper that matches the target model with
the corresponding capability and collapse all existing checks into
a single one.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Format targetModel for serial devices
Andrea Bolognani [Tue, 21 Nov 2017 13:14:16 +0000 (14:14 +0100)]
qemu: Format targetModel for serial devices

Now that we've created a distinction between target type and target
model, with the latter being the concrete device name, it's time to
switch to formatting the model instead of the type.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Validate target model for serial devices
Andrea Bolognani [Mon, 20 Nov 2017 19:03:20 +0000 (20:03 +0100)]
qemu: Validate target model for serial devices

Target model and target type must agree for the configuration
to make sense, so check that's actually the case and error out
otherwise.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Set targetModel based on targetType for serial devices
Andrea Bolognani [Mon, 20 Nov 2017 12:02:30 +0000 (13:02 +0100)]
qemu: Set targetModel based on targetType for serial devices

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Parse and format virDomainChrSerialTargetModel
Andrea Bolognani [Mon, 20 Nov 2017 11:05:17 +0000 (12:05 +0100)]
conf: Parse and format virDomainChrSerialTargetModel

This information will be used to select, and store in the guest
configuration in order to guarantee ABI stability, the concrete
(hypervisor-specific) model for serial devices.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Improve qemuDomainChrTargetDefValidate()
Andrea Bolognani [Fri, 24 Nov 2017 16:52:26 +0000 (17:52 +0100)]
qemu: Improve qemuDomainChrTargetDefValidate()

Instead of validating each target type / address type combination
separately, create a small helper to perform the matching and
collapse all existing checks into a single one.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Introduce qemuDomainChrTargetDefValidate()
Andrea Bolognani [Mon, 20 Nov 2017 18:46:10 +0000 (19:46 +0100)]
qemu: Introduce qemuDomainChrTargetDefValidate()

Instead of waiting until we get to command line generation, we can
validate the target for a char device much earlier.

Move all the checks out of qemuBuildSerialChrDeviceStr() and into
the new fuction. This will later allow us to validate the target
for platform devices.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Remove ATTRIBUTE_FALLTHROUGH from virDomainChrTargetDefFormat()
Andrea Bolognani [Tue, 21 Nov 2017 12:03:19 +0000 (13:03 +0100)]
conf: Remove ATTRIBUTE_FALLTHROUGH from virDomainChrTargetDefFormat()

Formatting the <target/> element for serial devices will become a
bit more complicated later on, and leaving the fallthrough behavior
there would do nothing but complicate it further.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Improve virDomainChrTargetDefFormat()
Andrea Bolognani [Mon, 20 Nov 2017 17:38:18 +0000 (18:38 +0100)]
conf: Improve virDomainChrTargetDefFormat()

Make the switch statement type-aware, avoid calling
virDomainChrTargetTypeToString() more than once and check its
return value before using it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Check virDomainChrSourceDefFormat() return value
Andrea Bolognani [Thu, 23 Nov 2017 16:50:59 +0000 (17:50 +0100)]
conf: Check virDomainChrSourceDefFormat() return value

The function can fail, but none of the caller were accounting
for that.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Improve error handling in virDomainChrDefFormat()
Andrea Bolognani [Mon, 20 Nov 2017 17:07:20 +0000 (18:07 +0100)]
conf: Improve error handling in virDomainChrDefFormat()

We don't need to store the return value since we never modify it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Introduce virDomainChrTargetDefFormat()
Andrea Bolognani [Mon, 20 Nov 2017 17:02:56 +0000 (18:02 +0100)]
conf: Introduce virDomainChrTargetDefFormat()

Move formatting of the <target/> element for char devices out of
virDomainChrDefFormat() and into its own function.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Drop virDomainChrDeviceType.targetTypeAttr
Andrea Bolognani [Fri, 10 Nov 2017 13:54:19 +0000 (14:54 +0100)]
conf: Drop virDomainChrDeviceType.targetTypeAttr

This attribute was used to decide whether to format the type
attribute of the <target> element, but the logic didn't take into
account all possible cases and as such could lead to unexpected
results. Moreover, it's one more thing to keep track of, and can
easily fall out of sync with other attributes.

Now that we have VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE, we can
use that value to signal that no specific target type has been
configured for the serial device and as such the attribute should
not be formatted at all. All other values are now formatted.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Introduce VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE
Andrea Bolognani [Fri, 10 Nov 2017 12:41:06 +0000 (13:41 +0100)]
conf: Introduce VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE

This is the first step in getting rid of the assumption that
isa-serial is the default target type for serial devices.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoconf: Run devicePostParse() again for the first serial device
Andrea Bolognani [Wed, 8 Nov 2017 16:40:13 +0000 (17:40 +0100)]
conf: Run devicePostParse() again for the first serial device

The devicePostParse() callback is invoked for all devices so that
drivers have a chance to set their own specific values; however,
virDomainDefAddImplicitDevices() runs *after* the devicePostParse()
callbacks have been invoked and can add new devices, in which case
the driver wouldn't have a chance to customize them.

Work around the issue by invoking the devicePostParse() callback
after virDomainDefAddImplicitDevices(), only for the first serial
devices, which might have been added by it. The same was already
happening for the first video device for the very same reason.

This will become important later on, when we will change
virDomainDefAddConsoleCompat() not to set a targetType for
automatically added serial devices.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Introduce qemuDomainChrDefPostParse()
Andrea Bolognani [Wed, 8 Nov 2017 14:40:42 +0000 (15:40 +0100)]
qemu: Introduce qemuDomainChrDefPostParse()

Having a separate function for char device handling is better than
adding even more code to qemuDomainDeviceDefPostParse().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agodocs: Improve documentation for serial consoles
Andrea Bolognani [Wed, 15 Nov 2017 16:15:15 +0000 (17:15 +0100)]
docs: Improve documentation for serial consoles

Our current documentation is missing some information and doesn't
do a great job at explaining how the <serial> and <console> elements
are connected. Let's try to fix that.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agonews: Document qemu image locking
Peter Krempa [Thu, 23 Nov 2017 18:32:02 +0000 (19:32 +0100)]
news: Document qemu image locking

7 years agovirsh: Fix virsh prompt when connection changes to readonly mode.
Julio Faracco [Mon, 27 Nov 2017 00:18:11 +0000 (22:18 -0200)]
virsh: Fix virsh prompt when connection changes to readonly mode.

This commit fixes the virsh prompt when reconnection to the same URI is
called: `virsh # connect --readonly` (Reconnect). The problem is
happening because the code is considering URI (name) as a mandatory
parameter to change the prompt. This commit remove the assignment into
`priv->readonly` from `if (name)` conditional.

Before:
    virsh # uri
    qemu:///system

    virsh # connect --readonly

    virsh #

After:
    virsh # uri
    qemu:///system

    virsh # connect --readonly

    virsh >

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

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
7 years agodocs: Add news article to describe iSCSI usage of secret object
John Ferlan [Thu, 5 Oct 2017 12:57:41 +0000 (08:57 -0400)]
docs: Add news article to describe iSCSI usage of secret object

7 years agodocs: Add news article regarding auth/encryption placement
John Ferlan [Wed, 4 Oct 2017 13:16:21 +0000 (09:16 -0400)]
docs: Add news article regarding auth/encryption placement

7 years agoqemu: Use secret objects to pass iSCSI passwords
John Ferlan [Fri, 15 Sep 2017 17:17:59 +0000 (13:17 -0400)]
qemu: Use secret objects to pass iSCSI passwords

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

The blockdev-add code provides a mechanism to sanely provide user
and password-secret arguments for iscsi without placing them on the
command line to be viewable by a 'ps -ef' type command or needing
to create separate -iscsi devices for each disk/volume found.

So modify the iSCSI command line building to check for the presence
of the capability in order properly setup and use the domain master
secret object to encrypt the password in a secret object and alter
the parameters for the command line to utilize.

Modify the xml2argvtest to exhibit the syntax for both disk and
hostdev configurations.

7 years agoqemu: Get capabilities to use iscsi password-secret argument
John Ferlan [Fri, 1 Sep 2017 19:09:29 +0000 (15:09 -0400)]
qemu: Get capabilities to use iscsi password-secret argument

Detect the capability via the query-qmp-schema for blockdev-add
to find the 'password-secret' parameter that will allow the iSCSI
code to use the master secret object to encrypt the secret for an
and only need to provide the object id of the secret on the command
line thus obsfuscating the passphrase.

7 years agoqemu: Refactor qemuBuildSCSIiSCSIHostdevDrvStr slightly
John Ferlan [Sun, 24 Sep 2017 13:35:34 +0000 (09:35 -0400)]
qemu: Refactor qemuBuildSCSIiSCSIHostdevDrvStr slightly

Rather than building the "file" string in qemuBuildSCSIHostdevDrvStr
build it in the called helper.

7 years agoqemu: Remove private hostdev
John Ferlan [Sat, 23 Sep 2017 11:03:50 +0000 (07:03 -0400)]
qemu: Remove private hostdev

Since it's not longer used to shuttle the @secinfo, let's remove
the private hostdev completely.

7 years agoqemu: Use private storage source for iscsi instead of private hostdev
John Ferlan [Sat, 23 Sep 2017 11:03:10 +0000 (07:03 -0400)]
qemu: Use private storage source for iscsi instead of private hostdev

Rather than placing/using privateData about secinfo in the hostdev,
let's use the virStorageSource private data instead.

7 years agoconf,qemu: Replace iscsisrc fields with virStorageSourcePtr
John Ferlan [Fri, 22 Sep 2017 19:18:22 +0000 (15:18 -0400)]
conf,qemu: Replace iscsisrc fields with virStorageSourcePtr

Rather than picking apart the two pieces we need/want (path, hosts,
and auth)- let's allocate/use a virStorageSourcePtr for iSCSI storage.

The end result is that qemuBuildSCSIiSCSIHostdevDrvStr doesn't need
to "fake" one for the qemuBuildNetworkDriveStr call.

7 years agoqemu: Properly label and create evdev on input device hotplug
Ján Tomko [Tue, 21 Nov 2017 12:56:37 +0000 (13:56 +0100)]
qemu: Properly label and create evdev on input device hotplug

Utilize all the newly introduced function to create the evdev node
and label it on hotplug and destroy it on hotunplug.

This was forgotten in commits bc9ffaf and 67486bb.

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

7 years agoqemu: functions for dealing with input device namespaces and labels
Ján Tomko [Tue, 21 Nov 2017 12:55:12 +0000 (13:55 +0100)]
qemu: functions for dealing with input device namespaces and labels

Introudce functions that will let us create the evdevs in namespaces
and label the devices on input device hotplug/hotunplug.

7 years agoqemu: Introduce functions for input device cgroup manipulation
Ján Tomko [Tue, 21 Nov 2017 12:33:07 +0000 (13:33 +0100)]
qemu: Introduce functions for input device cgroup manipulation

Export qemuSetupInputCgroup and introduce qemuTeardownInputCgroup
for hotunplug.

7 years agosecurity: Introduce functions for input device hot(un)plug
Ján Tomko [Tue, 21 Nov 2017 12:31:53 +0000 (13:31 +0100)]
security: Introduce functions for input device hot(un)plug

Export the existing DAC and SELinux for separate use and introduce
functions for stack, nop and the security manager.

7 years agoIntroduce virDomainInputDefGetPath
Ján Tomko [Tue, 21 Nov 2017 12:28:28 +0000 (13:28 +0100)]
Introduce virDomainInputDefGetPath

Use it to denadify qemuDomainSetupInput.

7 years agos390: qemu-capabilities: Avoid error message when missing non-kvm host cpu info
Jason J. Herne [Fri, 24 Nov 2017 08:02:02 +0000 (09:02 +0100)]
s390: qemu-capabilities: Avoid error message when missing non-kvm host cpu info

Libvirt prints an error on startup when it is missing host cpu model
information for any queried qemu binary. On s390 we only have host cpu model
information for kvm enabled qemu instances. So when virt type is not kvm, this
is actually not an error on s390.

This patch adds virt type as a parameter to virQEMUCapsInitCPUModelS390, and a
new return code 2 for virQEMUCapsInitCPUModel and virQEMUCapsInitCPUModelS390.
If the virt type is not kvm then we skip printing the scary error message
and return 2 because this case is actually expected behavior. The new return
code is meant to differentiate between the failure case and the case where we
simply expect the cpu model information to be unattainable.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agostorage: Fix broken storage_driver build
John Ferlan [Fri, 24 Nov 2017 14:42:07 +0000 (09:42 -0500)]
storage: Fix broken storage_driver build

Commit id '5d5c732d7' had an incorrect assignment and was found
by travis build:

storage/storage_driver.c:1668:14: error: equality comparison with extraneous
      parentheses [-Werror,-Wparentheses-equality]
    if ((obj == virStoragePoolObjListSearch(&driver->pools,

         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7 years agostorage: Convert virStoragePoolObj into virObjectLockable
John Ferlan [Mon, 9 Oct 2017 10:19:37 +0000 (06:19 -0400)]
storage: Convert virStoragePoolObj into virObjectLockable

Now that we're moved the object into virstorageobj, let's make the
code use the lockable object.

7 years agostorage: Introduce virStoragePoolObjListSearch
John Ferlan [Sun, 8 Oct 2017 12:44:31 +0000 (08:44 -0400)]
storage: Introduce virStoragePoolObjListSearch

Create an API to search through the storage pool objects looking for
a specific truism from a callback API in order to return the specific
storage pool object that is desired.

7 years agostorage: Introduce virStoragePoolObjListForEach
John Ferlan [Sun, 8 Oct 2017 12:14:56 +0000 (08:14 -0400)]
storage: Introduce virStoragePoolObjListForEach

Create an API to walk the pools->objs[] list in order to perform a
callback function for each element of the objs array that doesn't care
about whether the action succeeds or fails as the desire is to run the
code over every element in the array rather than fail as soon as or if
one fails.

7 years agostorage: Introduce virStoragePoolObjEndAPI
John Ferlan [Sun, 8 Oct 2017 13:09:09 +0000 (09:09 -0400)]
storage: Introduce virStoragePoolObjEndAPI

For now it'll just call the virStoragePoolObjUnlock, but a future
adjustment will do something different. Since the new API will check
for a NULL object before the Unlock call, callers no longer need to
check for NULL before calling.

The virStoragePoolObjUnlock is now private/static to virstorageobj.c
with a short term forward reference.

7 years agonodedev: Restore setting of privileged
John Ferlan [Wed, 22 Nov 2017 15:34:11 +0000 (10:34 -0500)]
nodedev: Restore setting of privileged

Commit id '36555364' removed the setting of the driver->privileged,
which the udevProcessPCI would need in order to read the PCI device
configs.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: command: Properly format disk 'debug' attribute
Peter Krempa [Thu, 23 Nov 2017 16:15:17 +0000 (17:15 +0100)]
qemu: command: Properly format disk 'debug' attribute

Move the setup of the disk attribute to the disk source prepare function
which will allow proper usage with JSON props and move the fallback
(legacy) generating code into the block which is executed with legacy
options.

As a side-effect of this change we can clean up propagation of 'cfg'
into the command generator.

Also it's nice to see that the test output is the same even when the
value is generated in a different place.

7 years agoqemu: domain: Unify disk source prepare steps
Peter Krempa [Thu, 23 Nov 2017 16:01:37 +0000 (17:01 +0100)]
qemu: domain: Unify disk source prepare steps

Aggregate setup of various aspects of a disk source (secrets, TLS, ...)
into one function so that we don't need to call multiple across the code
base.

7 years agoqemu: hotplug: Rename qemuDomainPrepareDisk to qemuHotplugPrepareDiskAccess
Peter Krempa [Thu, 23 Nov 2017 15:48:50 +0000 (16:48 +0100)]
qemu: hotplug: Rename qemuDomainPrepareDisk to qemuHotplugPrepareDiskAccess

Match the prefix of the file and choose a name which better describes
what happens.

7 years agoqemu: block: Add support for formatting gluster debug level via JSON
Peter Krempa [Thu, 23 Nov 2017 15:07:47 +0000 (16:07 +0100)]
qemu: block: Add support for formatting gluster debug level via JSON

Improve the formatter so that we can use the 'debug' property straight
away when using json.

7 years agoutil: storage: Add fields for debug options for disk drivers
Peter Krempa [Thu, 23 Nov 2017 15:06:33 +0000 (16:06 +0100)]
util: storage: Add fields for debug options for disk drivers

Some drive backends allow output of debugging information which can be
configured using properties of the image. Add fields to virStorageSource
which will allow configuring them.

7 years agoqemu: command: Inject password-secret only when not using JSON props
Peter Krempa [Thu, 23 Nov 2017 14:37:37 +0000 (15:37 +0100)]
qemu: command: Inject password-secret only when not using JSON props

The 'file.password-secret' injection should be used only if we are using
the old formatter. When formatting the source string from the JSON
properties, the property should be added there.

Also drop the comment which refers to stuff that will not be used in
libvirt since -blockdev is the way to go.

7 years agotools: Work around ancient readline
Michal Privoznik [Thu, 23 Nov 2017 17:00:33 +0000 (18:00 +0100)]
tools: Work around ancient readline

My latest commit of a785186446de785d uncovered a problem we fixed
in 9eb23fe2 but then reverted in 834c5720e443. Turns out, some
systems (I'm looking at you OS X) have ancient readline with
broken header file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: command: Mark <shared/> disks as such in qemu
Peter Krempa [Wed, 15 Nov 2017 14:21:14 +0000 (15:21 +0100)]
qemu: command: Mark <shared/> disks as such in qemu

Qemu has now an internal mechanism for locking images to fix specific
cases of disk corruption. This requires libvirt to mark the image as
shared so that qemu lifts certain restrictions.

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

7 years agoqemu: caps: Add capability for 'share-rw' disk option
Peter Krempa [Wed, 15 Nov 2017 14:02:58 +0000 (15:02 +0100)]
qemu: caps: Add capability for 'share-rw' disk option

'share-rw' for the disk device configures qemu to allow concurrent
access to the backing storage.

The capability is checked in various supported disk frontend buses since
it does not make sense to partially backport it.

7 years agoqemu: Disallow pivot of shared disks to unsupported storage
Peter Krempa [Wed, 15 Nov 2017 13:33:11 +0000 (14:33 +0100)]
qemu: Disallow pivot of shared disks to unsupported storage

Pivoting to a unsupported storage type might break the assumption that
shared disks will not corrupt metadata.

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