]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agoconf: Add infrastructure for disk source private data XML
Peter Krempa [Tue, 12 Dec 2017 16:55:03 +0000 (17:55 +0100)]
conf: Add infrastructure for disk source private data XML

VM drivers may need to store additional private data to the status XML
so that it can be restored after libvirtd restart. Since not everything
is needed add a callback infrastructure, where VM drivers can add only
stuff they need.

Note that the private data is formatted as a <privateData> sub-element
of the <disk> or <backingStore> <source> sub-element. This is done since
storing it out of band (in the VM private data) would require a complex
matching process to allow to put the data into correct place.

7 years agodocs: Fix news.xml syntax
John Ferlan [Thu, 14 Dec 2017 03:36:55 +0000 (22:36 -0500)]
docs: Fix news.xml syntax

Commit id '1241e487' used <code>&lt;interface&gt;</code> which
is not valid syntax for a <summary>.

7 years agonews: mention multiple IP addresses support for Xen
Jim Fehlig [Fri, 8 Dec 2017 21:29:56 +0000 (14:29 -0700)]
news: mention multiple IP addresses support for Xen

7 years agoutil: Report error if vhost-scsi device file cannot be found
John Ferlan [Tue, 12 Dec 2017 13:31:03 +0000 (08:31 -0500)]
util: Report error if vhost-scsi device file cannot be found

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

If the vhost-scsi device file cannot be found, the generic error

    "error: An error occurred, but the cause is unknown"

is returned.  Let's add a real error message to make it clear
why the failure occurred.

7 years agoutil: Fix error path in virSCSIVHostOpenVhostSCSI
John Ferlan [Tue, 12 Dec 2017 13:33:48 +0000 (08:33 -0500)]
util: Fix error path in virSCSIVHostOpenVhostSCSI

We cannot be sure someone initialized the passed *vhostfd and we
certainly don't want or need to be calling VIR_FORCE_CLOSE on what
probably is -1. So let's just return -1 immediately.

7 years agoqemu: Need to assign PCI address to vhost-scsi
John Ferlan [Tue, 12 Dec 2017 11:30:31 +0000 (06:30 -0500)]
qemu: Need to assign PCI address to vhost-scsi

Commit id '70249927b' neglected to cover this case because the test
had taken the "shortcut" to already add the <address>; however, when
the PCI address assignment code was adjusted by commit id '70249927'
the vhost-scsi (VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) wasn't
covered thus returning a 0 for pciFlags. So I altered the tests too
to make sure it doesn't happen again.

Previously the qemuxml2xmloutdata was a softlink to the source
qemuxml2argvdata, so I unlinked and recreated the output file to
force generation of the adddress. Without the test changes, an
address generation returns:

    libvirt: Domain Config error : internal error: Cannot automatically
    add a new PCI bus for a device with connect flags 00

if an address was supplied in the test, a restart of libvirtd or
edit of a guest would display the following opaque message:

    warning : qemuDomainCollectPCIAddress:1237 :
    qemuDomainDeviceCalculatePCIConnectFlags() thinks that the device
     with PCI address 0000:00:09.0 should not have a PCI address

where the address is related to the guest PCI address provided.

7 years agoxenconfig: fix issue found by coverity in multiple IP support
Marek Marczykowski-Górecki [Wed, 13 Dec 2017 19:15:49 +0000 (20:15 +0100)]
xenconfig: fix issue found by coverity in multiple IP support

virStringSplit may return NULL, so we must handle that.

Cc: John Ferlan <jferlan@redhat.com>
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
7 years agoxenconfig: Remove unnecessary variable clear in xenMakeIPList
Marek Marczykowski-Górecki [Wed, 13 Dec 2017 20:28:08 +0000 (15:28 -0500)]
xenconfig: Remove unnecessary variable clear in xenMakeIPList

Remove the unnecessary clearing of address_array as VIR_ALLOC_N
initialized the array already.

Cc: John Ferlan <jferlan@redhat.com>
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
7 years agoqemu: Tolerate storage source private data being NULL for hotplug SCSI hostdev
John Ferlan [Tue, 5 Dec 2017 21:03:34 +0000 (16:03 -0500)]
qemu: Tolerate storage source private data being NULL for hotplug SCSI hostdev

Commit id 'c5c96545' neglected to validate that the srcPriv was
non-NULL before dereferencing. Similar problem to what was fixed
by commit id '8056721c' but missed during multiple rebases and
code reworks.

7 years agostorage: Reduce need for using storageDriverLock
John Ferlan [Fri, 24 Nov 2017 14:32:38 +0000 (09:32 -0500)]
storage: Reduce need for using storageDriverLock

Now that the storage pools are self locking, we can reduce the number
of places that need to take the big hammer storage driver lock

7 years agostorage: Convert virStoragePoolObjList to use virObjectRWLockable
John Ferlan [Mon, 9 Oct 2017 17:34:45 +0000 (13:34 -0400)]
storage: Convert virStoragePoolObjList to use virObjectRWLockable

Now that we have a private storage pool list, we can take the next
step and convert to using objects. In this case, we're going to use
RWLockable objects (just like every other driver) with two hash
tables for lookup by UUID or Name.

Along the way the ForEach and Search API's will be adjusted to use
the related Hash API's and the various FindBy functions altered and
augmented to allow for HashLookup w/ and w/o the pool lock already
taken.

After virStoragePoolObjRemove we will need to virObjectUnref(obj)
after to indicate the caller is "done" with it's reference. The
Unlock occurs during the Remove.

The NumOf, GetNames, and Export functions all have their own callback
functions to return the required data and the FindDuplicate code
can use the HashSearch function callbacks.

7 years agostorage: Privatize virStoragePoolObjListPtr
John Ferlan [Sat, 7 Oct 2017 11:24:24 +0000 (07:24 -0400)]
storage: Privatize virStoragePoolObjListPtr

Move the structure into virstorageobj.c.

Use the virStoragePoolObjListNew allocator to fill in the @pools for
the storage driver and test driver.

7 years agostorage: Fix path check in storagePoolLookupByTargetPath
John Ferlan [Fri, 24 Nov 2017 13:17:02 +0000 (08:17 -0500)]
storage: Fix path check in storagePoolLookupByTargetPath

Commit id '5ab746b8' introduced the function as perhaps a copy
of storageVolLookupByPath; however, it did not use the @cleanpath
variable even though it used the virFileSanitizePath. So in essance
the only "check" being done for failure is whether it was possible
to strdup the path.

Looking at the virStoragePoolDefParseXML one will note that the
target.path is stored using the result of virFileSanitizePath.
Therefore, this function should sanitize and use the input @path
for the argument to storagePoolLookupByTargetPathCallback which
is comparing against stored target.path values.

Additionally, if there was an error we should use the proper error
of VIR_ERR_NO_STORAGE_POOL (instead of VIR_ERR_NO_STORAGE_VOL).

7 years agoaudit: Log only an info message if audit_level < 2 and audit is not supported
Marc Hartmayer [Wed, 13 Dec 2017 10:56:13 +0000 (11:56 +0100)]
audit: Log only an info message if audit_level < 2 and audit is not supported

Replace the error message during startup of libvirtd with an info
message if audit_level < 2 and audit is not supported by the
kernel. Audit is not supported by the current kernel if the kernel
does not have audit compiled in or if audit is disabled (e.g. by the
kernel cmdline).

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirsh: fix typo s/node filters/network filters/
Daniel P. Berrange [Tue, 12 Dec 2017 17:41:46 +0000 (17:41 +0000)]
virsh: fix typo  s/node filters/network filters/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoUpdate to latest keycodemapdb content
Daniel P. Berrange [Mon, 7 Aug 2017 13:38:28 +0000 (14:38 +0100)]
Update to latest keycodemapdb content

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agofillQemuCaps: Don't leak machine string
Michal Privoznik [Wed, 6 Dec 2017 13:56:54 +0000 (14:56 +0100)]
fillQemuCaps: Don't leak machine string

==25251== 5 bytes in 1 blocks are definitely lost in loss record 7 of 81
==25251==    at 0x4C2BEDF: malloc (vg_replace_malloc.c:299)
==25251==    by 0x967E379: strdup (in /lib64/libc-2.25.so)
==25251==    by 0x5366F9F: virStrdup (virstring.c:941)
==25251==    by 0x538BF1D: virDomainCapsNew (domain_capabilities.c:121)
==25251==    by 0x10EACE: test_virDomainCapsFormat (domaincapstest.c:295)
==25251==    by 0x10FBD2: virTestRun (testutils.c:180)
==25251==    by 0x10F192: mymain (domaincapstest.c:457)
==25251==    by 0x111C7F: virTestMain (testutils.c:1119)
==25251==    by 0x10FA3C: main (domaincapstest.c:528)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoxenMakeIPList: Don't leak @address_array
Michal Privoznik [Tue, 12 Dec 2017 14:00:15 +0000 (15:00 +0100)]
xenMakeIPList: Don't leak @address_array

==32171== 32 bytes in 1 blocks are definitely lost in loss record 44 of 107
==32171==    at 0x4C2DEF6: calloc (vg_replace_malloc.c:711)
==32171==    by 0x55744A9: virAllocN (viralloc.c:191)
==32171==    by 0x12CED2: xenMakeIPList (xen_common.c:1186)
==32171==    by 0x12D0BE: xenFormatNet (xen_common.c:1221)
==32171==    by 0x12F0D2: xenFormatVif (xen_common.c:1889)
==32171==    by 0x12F2B4: xenFormatConfigCommon (xen_common.c:1944)
==32171==    by 0x13BA32: xenFormatXL (xen_xl.c:1971)
==32171==    by 0x1186CA: testCompareParseXML (xlconfigtest.c:105)
==32171==    by 0x118A64: testCompareHelper (xlconfigtest.c:205)
==32171==    by 0x119E36: virTestRun (testutils.c:180)
==32171==    by 0x11970E: mymain (xlconfigtest.c:301)
==32171==    by 0x11BEE3: virTestMain (testutils.c:1119)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoxenParseXLVnuma: Don't leak @tmp and @token
Michal Privoznik [Wed, 6 Dec 2017 13:56:30 +0000 (14:56 +0100)]
xenParseXLVnuma: Don't leak @tmp and @token

==30399== 180 (144 direct, 36 indirect) bytes in 3 blocks are definitely lost in loss record 91 of 111
==30399==    at 0x4C2E0FF: realloc (vg_replace_malloc.c:785)
==30399==    by 0x5574572: virReallocN (viralloc.c:245)
==30399==    by 0x5574668: virExpandN (viralloc.c:294)
==30399==    by 0x55747AB: virResizeN (viralloc.c:352)
==30399==    by 0x560074D: virStringSplitCount (virstring.c:115)
==30399==    by 0x137A59: xenParseXLVnuma (xen_xl.c:442)
==30399==    by 0x13952B: xenParseXL (xen_xl.c:1064)
==30399==    by 0x11884D: testCompareFormatXML (xlconfigtest.c:152)
==30399==    by 0x118A87: testCompareHelper (xlconfigtest.c:207)
==30399==    by 0x119E36: virTestRun (testutils.c:180)
==30399==    by 0x119186: mymain (xlconfigtest.c:274)
==30399==    by 0x11BEE3: virTestMain (testutils.c:1119)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoFix minor typos
Yuri Chornoivan [Sat, 9 Dec 2017 18:32:41 +0000 (20:32 +0200)]
Fix minor typos

7 years agoqemu: Avoid comparing size_t with -1
Jiri Denemark [Mon, 11 Dec 2017 13:34:20 +0000 (14:34 +0100)]
qemu: Avoid comparing size_t with -1

ncpus would be -1 on error and the cleanup for loop would not be skipped
in this case.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemuDomainUndefineFlags: Fix error message
Michal Privoznik [Sun, 10 Dec 2017 14:25:42 +0000 (15:25 +0100)]
qemuDomainUndefineFlags: Fix error message

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

If domain is active, but the undefine API was called without the
VIR_DOMAIN_UNDEFINE_KEEP_NVRAM flag set, the following incorrect
error message is produced:

error: Requested operation is not valid: cannot delete inactive domain with nvram

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: Introduce qemuDomainDeviceDefValidateControllerIDE
Lin Ma [Mon, 27 Nov 2017 15:53:00 +0000 (10:53 -0500)]
qemu: Introduce qemuDomainDeviceDefValidateControllerIDE

Move the IDE controller check from command line building to
controller def validation. Also explicitly include the avoidance
check for the implicit IDE controller from qemuBuildSkipController.

Cause the IDE case for command line building to generate a
failure if called to add an IDE since that shouldn't happen
if the Validate code did the right thing.

7 years agoqemu: Move CCW S390 Address check to controller def validate
John Ferlan [Wed, 29 Nov 2017 15:49:37 +0000 (10:49 -0500)]
qemu: Move CCW S390 Address check to controller def validate

Move the call to qemuDomainCheckCCWS390AddressSupport from
qemuBuildControllerDevStr to qemuDomainDeviceDefValidateController.

This means we will get the qemuCaps from the driver opaque
variable passed to qemuDomainDeviceDefValidate.

7 years agoqemu: Introduce qemuDomainDeviceDefValidateController
John Ferlan [Mon, 27 Nov 2017 14:02:24 +0000 (09:02 -0500)]
qemu: Introduce qemuDomainDeviceDefValidateController

Introduce the bare bones helper to validate whether the controller
definition is valid.

7 years agoqemu: Introduce qemuBuildSkipController
John Ferlan [Wed, 29 Nov 2017 12:31:43 +0000 (07:31 -0500)]
qemu: Introduce qemuBuildSkipController

Move the non USB implicit controller checks into their own
helper to reduce the cruft in qemuBuildControllerDevCommandLine.

7 years agotests: add test for multiple IPs for libxl and xenconfig driver
Marek Marczykowski-Górecki [Thu, 7 Dec 2017 02:27:47 +0000 (03:27 +0100)]
tests: add test for multiple IPs for libxl and xenconfig driver

Test conversion of multiple IP addresses to/from xl format and
domXML. Also test libxl_domain_config generator handling of
multiple IP addresses.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
7 years agoxenconfig: add support for multiple IP addresses
Marek Marczykowski-Górecki [Thu, 7 Dec 2017 02:27:46 +0000 (03:27 +0100)]
xenconfig: add support for multiple IP addresses

Xen's xl config format has long supported specifying multiple IP
addresses for virtual interfaces. E.g.

vif = [ "ip=10.0.0.1 10.1.1.1 2000::1, ..." ]

Add support for converting multiple IP addresses to/from domXML.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
7 years agolibxl: add support for multiple IP addresses
Marek Marczykowski-Górecki [Thu, 7 Dec 2017 02:27:45 +0000 (03:27 +0100)]
libxl: add support for multiple IP addresses

vif-* scripts support it for a long time, and expect addresses to be
separated by spaces. Add appropriate support to libxl driver.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
7 years agomigration.html: Clarify configuration file handling docs
Jiri Denemark [Fri, 8 Dec 2017 09:31:38 +0000 (10:31 +0100)]
migration.html: Clarify configuration file handling docs

Migration never removes any configuration files on the destination host.
Thus when the domain is already defined on the destination, it will stay
persistent even after migration without --persist.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Make sure host-model uses CPU model supported by QEMU
Jiri Denemark [Thu, 7 Dec 2017 10:23:50 +0000 (11:23 +0100)]
qemu: Make sure host-model uses CPU model supported by QEMU

When reconnecting to a running domain started by old libvirt, which did
not change host-model into a custom CPU definition, we replace the CPU
definition with a specific CPU model from host capabilities. However,
that CPU model may not be supported by the running qemu process. We need
to translate the CPU model to one of the models which libvirt could have
used when starting the domain.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Separate fetching CPU definitions from filling qemuCaps
Jiri Denemark [Thu, 7 Dec 2017 10:21:48 +0000 (11:21 +0100)]
qemu: Separate fetching CPU definitions from filling qemuCaps

virQEMUCapsProbeQMPCPUDefinitions is now a small wrapper which fills in
qemuCaps with CPU models fetched by virQEMUCapsFetchCPUDefinitions.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: blockjob: Reset disk source index after pivot
Peter Krempa [Thu, 7 Dec 2017 15:11:18 +0000 (16:11 +0100)]
qemu: blockjob: Reset disk source index after pivot

Since we are re-detecting the backing chain after pivoting to the active
block commit target (or block copy target) the disk index needs to be
reset to 0. This is necessary since we move a member of the backing
chain to disk->src but clear indexes only starting from
disk->src->backingStore. The freshly detected images have indexes
starting from 1, but since we've pivoted into an image which was
previously a backing store it would have a non-0 index.
The lookup function would then return the top of the chain for queries
like 'vda[1]' instead of the first backing store.

This problem will not be present once we keep the disk indexes stable.

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

7 years agoqemuDomainNamespaceSetupDisk: initialize npaths
Ján Tomko [Thu, 7 Dec 2017 13:32:40 +0000 (14:32 +0100)]
qemuDomainNamespaceSetupDisk: initialize npaths

Introduced by commit d3db304.

Reported-by: John Ferlan <jferlan@redhat.com>
7 years agodocs: domain: Fix documentation of the 'snapshot' attribute for <disk>
Peter Krempa [Thu, 7 Dec 2017 13:16:10 +0000 (14:16 +0100)]
docs: domain: Fix documentation of the 'snapshot' attribute for <disk>

Emphasise the valid values by wrapping them in <code> and reword the
last sentence so that the invalid value example can be dropped.

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

7 years agovirerror: mark VIR_ERR_AGENT_UNSYNCED as DEPRECATED
Chen Hanxiao [Thu, 7 Dec 2017 01:59:14 +0000 (09:59 +0800)]
virerror: mark VIR_ERR_AGENT_UNSYNCED as DEPRECATED

Since commit 5e5019bf, we've no longer use
VIR_ERR_AGENT_UNSYNCED anymore.
Mark it as DEPRECATED.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agostorage: Don't dereference driver object if virStorageSource is not initialized
Peter Krempa [Wed, 6 Dec 2017 15:20:07 +0000 (16:20 +0100)]
storage: Don't dereference driver object if virStorageSource is not initialized

virStorageFileReportBrokenChain uses data from the driver private data
pointer to print the user and group. This would lead to a crash in call
paths where we did not initialize the storage backend as recently added
in commit 24e47ee2b93 to qemuDomainDetermineDiskChain.

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

7 years agodocs: remove outdated link to Fedora mingw staging repo
Daniel P. Berrange [Wed, 6 Dec 2017 18:06:30 +0000 (18:06 +0000)]
docs: remove outdated link to Fedora mingw staging repo

The Fedora mingw support is all merged in Fedora repos, so remove the
outdated link.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agodocs: update entries in the apps page
Daniel P. Berrange [Wed, 6 Dec 2017 18:04:33 +0000 (18:04 +0000)]
docs: update entries in the apps page

Change all links to https:// where the remote site supports it. Fix URLs for
a few packages that moved, and delete entries which appear to be dead.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agodocs: update instructions for TLS cert generation
Daniel P. Berrange [Wed, 6 Dec 2017 17:48:11 +0000 (17:48 +0000)]
docs: update instructions for TLS cert generation

Currently we only describe setting the CN field for server certs. This leads
to inevitable pain for users who set it to the fully qualified hostname and
then use a unqualified hostname or IP address to connect in the URI. Describe
the usage of Subject Alt Name extensions, to provide multiple hostnames and
IP addresses. This will help users avoid the classic mistake and is important
future proofing, since at least in browsers, TLS libraries no longer use the
CN field for validation, mandating use of SAN info instead.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agonwfilter: remove bogus 'protocolid' attribute on arp/rarp fields
Daniel P. Berrange [Wed, 6 Dec 2017 16:23:54 +0000 (16:23 +0000)]
nwfilter: remove bogus 'protocolid' attribute on arp/rarp fields

Various example XML documents for arp/rarp filtering have a protocolid
XML attribute defined. This is never parsed or output by the libvirt XML
handling code, so shouldn't be present in example XML files either

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agorng: fix nwfilter rule contents
Daniel P. Berrange [Wed, 6 Dec 2017 16:41:31 +0000 (16:41 +0000)]
rng: fix nwfilter rule contents

The contents of a <rule> are a choice of exactly one union member. The
RNG schema, however, was allowing an arbitrary number of instances of every
union member at once.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotests: Drop IDE controller in CCW
Lin Ma [Fri, 1 Dec 2017 11:31:30 +0000 (19:31 +0800)]
tests: Drop IDE controller in CCW

Adding an IDE controller for a machinetype that has no built-in IDE
controller, libvirt will log an error. Currently the machinetype list
which returns by qemuDomainMachineHasBuiltinIDE only includes 440fx,
malta, sun4u and g3beige.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agotests: Remove use of IDE disk for pseries floppy test
Lin Ma [Fri, 1 Dec 2017 11:31:29 +0000 (19:31 +0800)]
tests: Remove use of IDE disk for pseries floppy test

Adding an IDE controller for a machinetype that has no built-in IDE
controller, libvirt will log an error. Currently the machinetype list
which returns by qemuDomainMachineHasBuiltinIDE only includes 440fx,
malta, sun4u and g3beige.

Remove the disk and the .args file since the expectation is the test
will fail in qemuxml2argvtest because floppy is not supported on pseries
and thus no disk is necessary and no .args file would be created to
compare against.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Use virDomainControllerType in qemuBuildControllerDevStr switch
John Ferlan [Fri, 1 Dec 2017 13:51:05 +0000 (08:51 -0500)]
qemu: Use virDomainControllerType in qemuBuildControllerDevStr switch

Make sure all types of virDomainControllerType are handled in the
switch statement.

7 years agoDo not pass driver to qemuDomainNamespace{Setup,Teardown} functions
Ján Tomko [Fri, 24 Nov 2017 16:52:15 +0000 (17:52 +0100)]
Do not pass driver to qemuDomainNamespace{Setup,Teardown} functions

The underlying function which needs the driver gets it from the
passed virDomainObj object anyway.

7 years agoIntroduce qemuDomainNamespaceUnlinkPath
Ján Tomko [Wed, 22 Nov 2017 12:17:01 +0000 (13:17 +0100)]
Introduce qemuDomainNamespaceUnlinkPath

Use it in every qemuDomainNamespaceTeardown* function that only
wants to unlink one device.

7 years agoIntroduce qemuDomainNamespaceUnlinkPaths
Ján Tomko [Wed, 15 Nov 2017 16:52:27 +0000 (17:52 +0100)]
Introduce qemuDomainNamespaceUnlinkPaths

Split out the logic of unlinking devices from
qemuDomainNamespaceTeardownHostdev for reuse in other functions.

7 years agoIntroduce qemuDomainNamespaceMknodPath
Ján Tomko [Wed, 15 Nov 2017 16:43:51 +0000 (17:43 +0100)]
Introduce qemuDomainNamespaceMknodPath

Use this function in qemuDomainNamespaceSetup* functions which
only require creating one device.

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>