]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agointernal: introduce a family of NULLSTR macros
Ján Tomko [Tue, 12 Feb 2019 16:01:09 +0000 (17:01 +0100)]
internal: introduce a family of NULLSTR macros

NULLSTR_EMPTY, the quiet child,
NULLSTR_STAR, the famous one and
NULLSTR_MINUS, the grumpy one.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu_hotplug: Assume chardev alias always exists in qemuDomainDetachChrDevice
Michal Privoznik [Thu, 14 Feb 2019 09:44:15 +0000 (10:44 +0100)]
qemu_hotplug: Assume chardev alias always exists in qemuDomainDetachChrDevice

The @tmpChr is looked up in domain definition based on user
provided chardev XML. Therefore, the alias must have been
allocated already when domain was started up.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_hotplug: Don't build device string in qemuDomainDetachChrDevice
Michal Privoznik [Thu, 14 Feb 2019 09:38:09 +0000 (10:38 +0100)]
qemu_hotplug: Don't build device string in qemuDomainDetachChrDevice

This is basically an old artefact from 24b0821926e when the idea
was:

1) Build device string only to see if chardev has any -device
associated with it and thus if device_del is needed
2) Detach chardev using chardev_del

Now, that DEVICE and DEVICE_DELETED capabilities are assumed for
every domain 1) does not make sense anymore.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemuhotplugtest: Test guestfwd attach and detach
Michal Privoznik [Mon, 11 Feb 2019 15:17:53 +0000 (16:17 +0100)]
qemuhotplugtest: Test guestfwd attach and detach

Previous two commits demonstrate a hole in our test scenario.
Fix that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_hotplug: Detach guestfwd using netdev_del
Michal Privoznik [Mon, 11 Feb 2019 13:16:58 +0000 (14:16 +0100)]
qemu_hotplug: Detach guestfwd using netdev_del

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

The guestfwd channels are -netdevs really. Hotunplug them as
such. Also, DEVICE_DELETED event is not triggered (surprisingly,
since we're not issuing device_del rather than netdev_del) and
associated chardev is removed automagically too. This means that
we need to do qemuDomainRemoveChrDevice() minus monitor call to
remove the chardev.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu_hotplug: Attach guestfwd using netdev_add
Michal Privoznik [Mon, 11 Feb 2019 15:05:37 +0000 (16:05 +0100)]
qemu_hotplug: Attach guestfwd using netdev_add

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

The guestfwd channels are -netdevs really. Hotplug them as such.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemuL: Drop "user-" prefix for guestfwd netdev
Michal Privoznik [Mon, 11 Feb 2019 13:16:00 +0000 (14:16 +0100)]
qemuL: Drop "user-" prefix for guestfwd netdev

Introduced by d86c876a66e3.

There is no real need to have "user-" prefix for chardev.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Use @tmpChr in qemuDomainDetachChrDevice to build device string
Michal Privoznik [Mon, 11 Feb 2019 13:13:39 +0000 (14:13 +0100)]
qemu: Use @tmpChr in qemuDomainDetachChrDevice to build device string

So far we are passing @chr to qemuBuildChrDeviceStr. This is
suboptimal (in fact wrong) because @chr is just parsed XML
definition provided by user which by definition may lack some
information. On the other hand, @tmpChr is the one that was found
using @chr in domain definition so it contains the same amount of
information or more.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Escape external snapshot names containing comma
Eric Blake [Wed, 13 Feb 2019 04:18:15 +0000 (22:18 -0600)]
qemu: Escape external snapshot names containing comma

The code for creating external snapshots for an offline domain
called out to qemu-img without escaping commas in the manner
that qemu-img expects. This also fixes a typo in the comment.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoutil: fix memory leak in virFirewallDInterfaceSetZone()
Laine Stump [Wed, 13 Feb 2019 15:57:57 +0000 (10:57 -0500)]
util: fix memory leak in virFirewallDInterfaceSetZone()

commit 3bba4825 added the new function virFirewallDInterfaceSetZone()
which calledsends virDBUSCallMethod a DBusMessage** for the reply
message, but doesn't use the reply, and also doesn't free it. Since
this arg is allowed to be NULL, this patch simply sets it to NULL so
we don't have to deal with it.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agovirsh: initialize info in cmdIOThreadInfo
Ján Tomko [Tue, 12 Feb 2019 11:04:24 +0000 (12:04 +0100)]
virsh: initialize info in cmdIOThreadInfo

Although it is not needed at the moment, do not rely on a value being
set before the first jump to cleanup.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirsh: remove redundant virshNodeGetCPUCount
Ján Tomko [Tue, 12 Feb 2019 10:52:59 +0000 (11:52 +0100)]
virsh: remove redundant virshNodeGetCPUCount

Since commit 4c4b821e it is not used for anything.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirsh: do not assign negative values to niothreads
Ján Tomko [Tue, 12 Feb 2019 10:42:36 +0000 (11:42 +0100)]
virsh: do not assign negative values to niothreads

Use a temporary 'rc' variable to avoid comparing signed
and unsigned integers in the cleanup section.

Bug introduced by commit 3072ded which added the comparison against
the unsigned 'i'.

Also make niothreads size_t to mark that it should be unsigned.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirsh: reduce the optimism in cmdIOThreadInfo
Ján Tomko [Tue, 12 Feb 2019 09:35:17 +0000 (10:35 +0100)]
virsh: reduce the optimism in cmdIOThreadInfo

Instead of using niothreads which defaults to zero, use the common
pattern with a ret varaible set to true just before the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoutil: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageSource
John Ferlan [Tue, 12 Feb 2019 18:17:56 +0000 (13:17 -0500)]
util: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageSource

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Check for duplicated id in virStorageSourceParseRBDColonString
John Ferlan [Tue, 12 Feb 2019 13:36:40 +0000 (08:36 -0500)]
util: Check for duplicated id in virStorageSourceParseRBDColonString

If we find multiple "id=" strings during processing, then we need
to force an error since we cannot have multiple <auth>'s defined
for a single source volume.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Check for duplicate authdef during hostdev iSCSI processing
John Ferlan [Tue, 12 Feb 2019 13:35:38 +0000 (08:35 -0500)]
conf: Check for duplicate authdef during hostdev iSCSI processing

If virDomainHostdevSubsysSCSIiSCSIDefParseXML processing finds a
duplicated <auth> structure, we should error out rather than continue.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Fix memory leak in testCompareXMLToArgvFiles
John Ferlan [Fri, 8 Feb 2019 15:43:23 +0000 (10:43 -0500)]
tests: Fix memory leak in testCompareXMLToArgvFiles

Only one path will consume the @def; otherwise, we need to free it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Use VIR_AUTOCLOSE
John Ferlan [Thu, 31 Jan 2019 23:56:27 +0000 (18:56 -0500)]
storage: Use VIR_AUTOCLOSE

Modify code to use the VIR_AUTOCLOSE logic cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Rework ret logic in storageBackendUpdateVolTargetInfo
John Ferlan [Tue, 12 Feb 2019 12:46:38 +0000 (07:46 -0500)]
storage: Rework ret logic in storageBackendUpdateVolTargetInfo

Rather than overload @ret with trying serve multiple purposes,
let's initialize @ret to -1 and introduce an @rc function return
value that can be used for functions that may return -1 or -2
and only override @ret when rc < 0.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Use VIR_AUTOFREE for storage backends
John Ferlan [Thu, 31 Jan 2019 17:09:38 +0000 (12:09 -0500)]
storage: Use VIR_AUTOFREE for storage backends

Let's make use of the auto __cleanup capabilities. This also allows
for the cleanup of some goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Cleanup virStorageFileBackendGlusterReadlinkCallback
John Ferlan [Tue, 12 Feb 2019 11:23:01 +0000 (06:23 -0500)]
storage: Cleanup virStorageFileBackendGlusterReadlinkCallback

Rather than having two exit paths, let's use a @retval value
and VIR_STEAL_PTR in order to unite the exit path through the
error label.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Rename variable in testStorageFileGetMetadata
John Ferlan [Fri, 8 Feb 2019 13:35:56 +0000 (08:35 -0500)]
tests: Rename variable in testStorageFileGetMetadata

To prepare for subsequent change to use VIR_AUTOPTR logic rename
the @ret to @def.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Rename variable in virStorageSourceNewFromBacking
John Ferlan [Fri, 8 Feb 2019 13:33:33 +0000 (08:33 -0500)]
util: Rename variable in virStorageSourceNewFromBacking

To prepare for subsequent change to use VIR_AUTOPTR logic rename
the @ret to @def.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Rename variable in virStorageSourceNewFromBackingAbsolute
John Ferlan [Fri, 8 Feb 2019 13:31:51 +0000 (08:31 -0500)]
util: Rename variable in virStorageSourceNewFromBackingAbsolute

To prepare for subsequent change to use VIR_AUTOPTR logic rename
the @ret to @def.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Rename variable in virStorageSourceNewFromBackingRelative
John Ferlan [Fri, 8 Feb 2019 13:29:41 +0000 (08:29 -0500)]
util: Rename variable in virStorageSourceNewFromBackingRelative

To prepare for subsequent change to use VIR_AUTOPTR logic rename
the @ret to @def.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Rename variable in virStorageSourceCopy
John Ferlan [Fri, 8 Feb 2019 13:28:27 +0000 (08:28 -0500)]
util: Rename variable in virStorageSourceCopy

To prepare for subsequent change to use VIR_AUTOPTR logic rename
the @ret to @def.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Rename variable in virStorageFileMetadataNew
John Ferlan [Fri, 8 Feb 2019 13:25:50 +0000 (08:25 -0500)]
util: Rename variable in virStorageFileMetadataNew

To prepare for subsequent change to use VIR_AUTOPTR logic rename
the @ret to @def.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Use VIR_STEAL_PTR in storageBackendProbeTarget
John Ferlan [Thu, 7 Feb 2019 13:15:12 +0000 (08:15 -0500)]
storage: Use VIR_STEAL_PTR in storageBackendProbeTarget

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Use VIR_AUTOFREE for various storage tests
John Ferlan [Fri, 1 Feb 2019 17:03:16 +0000 (12:03 -0500)]
tests: Use VIR_AUTOFREE for various storage tests

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotest: Use VIR_AUTOFREE for test driver
John Ferlan [Fri, 1 Feb 2019 13:54:56 +0000 (08:54 -0500)]
test: Use VIR_AUTOFREE for test driver

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotest: Remove unused @xml from testDomainSnapshotCreateXML
John Ferlan [Fri, 8 Feb 2019 15:36:54 +0000 (10:36 -0500)]
test: Remove unused @xml from testDomainSnapshotCreateXML

Commit 390c06b67 added @xml, but it was never used.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotest: Cleanup testDomainRenameCallback
John Ferlan [Thu, 7 Feb 2019 13:11:03 +0000 (08:11 -0500)]
test: Cleanup testDomainRenameCallback

Rather than have a need for old_dom_name, let's just VIR_FREE
the old name first, then use VIR_STEAL_PTR to handle the swap
from the old name to the new name.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Use VIR_AUTOFREE for virstoragefile
John Ferlan [Fri, 1 Feb 2019 12:40:40 +0000 (07:40 -0500)]
util: Use VIR_AUTOFREE for virstoragefile

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Use VIR_STEAL_PTR in virstoragefile
John Ferlan [Thu, 7 Feb 2019 13:07:50 +0000 (08:07 -0500)]
util: Use VIR_STEAL_PTR in virstoragefile

Rather than open coding virStorageFileGetRelativeBackingPath
and virStorageFileGetMetadataRecurse, let's make use of the
VIR_STEAL_PTR macro.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Use VIR_AUTOFREE for storage_conf
John Ferlan [Thu, 31 Jan 2019 13:20:02 +0000 (08:20 -0500)]
conf: Use VIR_AUTOFREE for storage_conf

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Remove @name in virStoragePoolDefParseSource
John Ferlan [Tue, 12 Feb 2019 12:04:42 +0000 (07:04 -0500)]
conf: Remove @name in virStoragePoolDefParseSource

Remove the need for the @name variable by directly assigning
into source->hosts[i].name.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agostorage: Use VIR_AUTOFREE for storage util
John Ferlan [Thu, 31 Jan 2019 19:18:51 +0000 (14:18 -0500)]
storage: Use VIR_AUTOFREE for storage util

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Fix error retval for getDeviceType
John Ferlan [Tue, 12 Feb 2019 12:00:38 +0000 (07:00 -0500)]
storage: Fix error retval for getDeviceType

On error from virAsprintf we would erroneously return 0 with
the @*type not being set. Change to a return -1 on error like
we should have been doing.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Fix virStorageBackendSCSINewLun error handling
John Ferlan [Fri, 8 Feb 2019 15:25:27 +0000 (10:25 -0500)]
util: Fix virStorageBackendSCSINewLun error handling

Commit a523770c3 added @retval return processing for
virStorageBackendUpdateVolInfo in order to allow a -2
to be return; however, upon successful completion
@retval = 0 and if either the virStorageBackendSCSISerial
or the virStoragePoolObjAddVol failed, the method would
return 0, but not add the @vol to the pool. So let's
just reset retval = -1 and continue processing.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Use VIR_AUTOFREE for storage driver
John Ferlan [Thu, 31 Jan 2019 18:41:29 +0000 (13:41 -0500)]
storage: Use VIR_AUTOFREE for storage driver

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Invert retval logic in virStorageBackendSCSITriggerRescan
John Ferlan [Tue, 12 Feb 2019 02:48:53 +0000 (21:48 -0500)]
storage: Invert retval logic in virStorageBackendSCSITriggerRescan

Rather than initialize to 0 and change to -1 on error, let's do the
normal operation of initializing to -1 and set to 0 on success.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agosrc: Fix label logic in virStorageBackendSCSITriggerRescan
John Ferlan [Tue, 12 Feb 2019 02:46:28 +0000 (21:46 -0500)]
src: Fix label logic in virStorageBackendSCSITriggerRescan

Let's initialize @path to NULL, then rather than use two labels
free_path and out labels, let's use the cleanup: label to call
VIR_FREE(path); and VIR_FORCE_CLOSE(fd);

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Use VIR_AUTOPTR(virCommand)
John Ferlan [Thu, 31 Jan 2019 18:16:44 +0000 (13:16 -0500)]
storage: Use VIR_AUTOPTR(virCommand)

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Cleanup virStorageBackendLogicalFindPoolSourcesFunc
John Ferlan [Tue, 12 Feb 2019 11:39:50 +0000 (06:39 -0500)]
storage: Cleanup virStorageBackendLogicalFindPoolSourcesFunc

Rather than have two error paths, let's use a @retval value and
VIR_STEAL_PTR on @vgname and @pvname to unity the exit path through
the error label.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Fix error path in virStorageBackendSheepdogRefreshVol
John Ferlan [Tue, 12 Feb 2019 11:30:35 +0000 (06:30 -0500)]
storage: Fix error path in virStorageBackendSheepdogRefreshVol

If the virAsprintf of the vol->key fails, then we would erroneously
return the '0' from the @ret from virStorageBackendSheepdogParseVdiList.
So in this error path case, let's set ret = -1.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Rework logic in virStorageBackendDiskBuildPool
John Ferlan [Tue, 12 Feb 2019 02:29:29 +0000 (21:29 -0500)]
storage: Rework logic in virStorageBackendDiskBuildPool

Rework the logic to remove the need for the @ok_to_mklabel boolean.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Use VIR_AUTOPTR(virString)
John Ferlan [Thu, 31 Jan 2019 17:18:35 +0000 (12:18 -0500)]
storage: Use VIR_AUTOPTR(virString)

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStoragePoolDef
John Ferlan [Thu, 31 Jan 2019 15:21:47 +0000 (10:21 -0500)]
conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStoragePoolDef

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agophyp: Resolve memory leak in phypStorageVolCreateXML
John Ferlan [Tue, 12 Feb 2019 02:12:11 +0000 (21:12 -0500)]
phyp: Resolve memory leak in phypStorageVolCreateXML

The @spdef would be leaked in the normal path.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Rework virStoragePoolDefParseXML
John Ferlan [Thu, 7 Feb 2019 23:41:58 +0000 (18:41 -0500)]
conf: Rework virStoragePoolDefParseXML

Rather than having an error path, let's rework the code to allocate
and fill into an @def variable and then steal that into @ret when we
are successful leaving just a cleanup: path.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageVolDef
John Ferlan [Thu, 31 Jan 2019 14:44:54 +0000 (09:44 -0500)]
conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageVolDef

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Rework virStorageVolDefParseXML
John Ferlan [Thu, 7 Feb 2019 22:43:27 +0000 (17:43 -0500)]
conf: Rework virStorageVolDefParseXML

Rather than having an error path, let's rework the code to allocate
and fill into an @def variable and then steal that into @ret when we
are successful leaving just a cleanup: path.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Use VIR_STEAL_PTR for gluster volume processing
John Ferlan [Thu, 7 Feb 2019 13:04:20 +0000 (08:04 -0500)]
storage: Use VIR_STEAL_PTR for gluster volume processing

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStoragePoolSource
John Ferlan [Thu, 31 Jan 2019 13:48:11 +0000 (08:48 -0500)]
conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStoragePoolSource

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageAuthDef
John Ferlan [Thu, 31 Jan 2019 12:48:42 +0000 (07:48 -0500)]
util: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageAuthDef

Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Rework virStorageAuthDefCopy
John Ferlan [Thu, 7 Feb 2019 22:21:31 +0000 (17:21 -0500)]
util: Rework virStorageAuthDefCopy

Rather than having an error path, let's rework the code to allocate
and fill into an @authdef variable and then steal that into @ret when
we are successful leaving just a cleanup: path.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf,util,qemu: Use VIR_STEAL_PTR for authdef processing
John Ferlan [Thu, 7 Feb 2019 12:44:45 +0000 (07:44 -0500)]
conf,util,qemu: Use VIR_STEAL_PTR for authdef processing

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: do not format <usedQMP/> in qemu caps XML
Ján Tomko [Fri, 8 Feb 2019 12:22:12 +0000 (13:22 +0100)]
qemu: do not format <usedQMP/> in qemu caps XML

Since commit a7424faff QMP is always used.

Also, commit 932534e8 removed the last use of this apart from:
* parsing/formatting this in the caps cache
* using it as a temporary variable to know when to report an error

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agovirsh: allow empty targets in cmdDomFSInfo
Ján Tomko [Tue, 12 Feb 2019 08:09:01 +0000 (09:09 +0100)]
virsh: allow empty targets in cmdDomFSInfo

Ever since the introduction of the guest-get-fsinfo command
in QEMU commit 46d4c572 qga/qapi-schema.json says that
the 'disks' array can possibly be empty. For example when getting
the target list is unsupported:
https://bugzilla.redhat.com/show_bug.cgi?id=1567041

Pass an empty string instead of NULL to vshTableRowAppend to prevent
a mismatched column number.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: use virBufferTrim in cmdDomFSInfo
Ján Tomko [Tue, 12 Feb 2019 08:02:32 +0000 (09:02 +0100)]
virsh: use virBufferTrim in cmdDomFSInfo

Add comma after every string and trim the final one.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: do not report error on zero filesystems in cmdDomFSInfo
Ján Tomko [Tue, 12 Feb 2019 06:58:49 +0000 (07:58 +0100)]
virsh: do not report error on zero filesystems in cmdDomFSInfo

Use vshPrintExtra to report this message. It is a human-readable
explanation rather than an error.

Also, it is a very special system that runs with no filesystems.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: introduce 'ret' in cmdDomFSInfo
Ján Tomko [Tue, 12 Feb 2019 06:53:20 +0000 (07:53 +0100)]
virsh: introduce 'ret' in cmdDomFSInfo

Failing to print the table is also a reason to return failure
and print the reported error.

Switch to the usual pattern where we fall through the cleanup
label right after setting ret to true instead of infering the
return value from the number of filesystems returned.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: do not access uninitialized memory in cmdDomFSInfo
Ján Tomko [Tue, 12 Feb 2019 06:51:19 +0000 (07:51 +0100)]
virsh: do not access uninitialized memory in cmdDomFSInfo

Initialize 'info' to prevent accessing random access memory.

Introduced by commit 3072ded released in 4.8.0.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: rename ret to rc in cmdDomFSInfo
Ján Tomko [Tue, 12 Feb 2019 06:48:59 +0000 (07:48 +0100)]
virsh: rename ret to rc in cmdDomFSInfo

Leave the 'ret' variable for the current function's return value.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: introduce ninfos variable in cmdDomFSInfo
Ján Tomko [Tue, 12 Feb 2019 06:47:10 +0000 (07:47 +0100)]
virsh: introduce ninfos variable in cmdDomFSInfo

Do not use 'ret' throughout the whole function to avoid confusion
and comparison of unsigned 'i' against signed 'ret'.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovsh-table: allow empty columns
Ján Tomko [Tue, 12 Feb 2019 09:02:38 +0000 (10:02 +0100)]
vsh-table: allow empty columns

Trivially implement this by deleting the bogus check in
vshTableSafeEncode.

Now it returns an empty string for an empty string instead
of returning NULL without setting an error.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovshtabletest: indent strings with expected output
Ján Tomko [Tue, 12 Feb 2019 09:00:38 +0000 (10:00 +0100)]
vshtabletest: indent strings with expected output

Indent them by four spaces from the previous line, instead of starting
at columnn zero.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agotools: Drop support for pre-2.4.0 wireshark
Michal Privoznik [Fri, 8 Feb 2019 11:05:23 +0000 (12:05 +0100)]
tools: Drop support for pre-2.4.0 wireshark

The wireshark-2.4.0 is almost 2 years old now. Assuming anybody
interested in running latest libvirt doesn't run old wireshark,
it is safe to do this. It also simplifies the code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agom4: Put wireshark plugin into epan/ directory
Michal Privoznik [Fri, 8 Feb 2019 09:47:42 +0000 (10:47 +0100)]
m4: Put wireshark plugin into epan/ directory

Since wirshark-2.5.0 toplevel plugins are no longer loaded. Only
plugins from epan/, wiretap/ or codecs/ subdirs are. Update the
plugin dir we generate. This is safe to do even for older
wiresharks, since they load plugins from there too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agowireshark: Provide registration code for newer wireshark
Michal Privoznik [Fri, 8 Feb 2019 09:36:43 +0000 (10:36 +0100)]
wireshark: Provide registration code for newer wireshark

As advertised in previous commits, wireshark has changed the way
that plugins register. In fact, it has done so two times since
the last time we've touched our code (wireshark v2.5.0 and
v2.9.0). Use the wireshark script from respective releases to
generate newer registration callbacks and put them into our code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotools: Keep wireshark plugin registration code in git
Michal Privoznik [Fri, 8 Feb 2019 08:10:24 +0000 (09:10 +0100)]
tools: Keep wireshark plugin registration code in git

In order to be able to dissect libvirt protocol the wireshark
plugin needs to be registered. So far this plugin registration
code was generated on every build using a script that was copied
over from wireshark's tools/ directory.

This is suboptimal, because the way that plugins register changes
across wireshark releases. Therefore, let's keep the generated
file in the git, put the command line used to generate the file
into a comment and remove the script.

This solution allows us to put different registration mechanism
into one file (under #ifdef-s) and thus compile with wider range
of wireshark releases.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotools: Cleanup packet-libvirt.h
Michal Privoznik [Fri, 8 Feb 2019 08:54:40 +0000 (09:54 +0100)]
tools: Cleanup packet-libvirt.h

Move the majority of the packet-libvirt.h content into
packet-libvirt.c and expose only register functions which are the
only ones that are not static.

The rationale behind is that packet-libvirt.h will be included
from packet.c and therefore the header file needs to be as clean
as possible.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: domcaps: Remove dependency on libxl PVUSB support
Cole Robinson [Fri, 8 Feb 2019 17:00:22 +0000 (12:00 -0500)]
tests: domcaps: Remove dependency on libxl PVUSB support

Mock out libxlCapsHasPVUSB to always return true, so test results
aren't dependent on host libxl version

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agolibxl: Break out libxlCapsHasPVUSB
Cole Robinson [Fri, 8 Feb 2019 18:39:57 +0000 (13:39 -0500)]
libxl: Break out libxlCapsHasPVUSB

No functional change, but this will allow us to mock out the function
in the test suite

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: Create a shared library with libxl driver
Cole Robinson [Fri, 8 Feb 2019 18:28:39 +0000 (13:28 -0500)]
tests: Create a shared library with libxl driver

This allows us to mock functions in the libxl driver, like
is already possible for the qemu driver

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: Rename virmocklibxl.c -> libxlmock.c
Cole Robinson [Fri, 8 Feb 2019 16:51:25 +0000 (11:51 -0500)]
tests: Rename virmocklibxl.c -> libxlmock.c

Every other mock library is named ending in mock.c, move
virmocklibxl.c to follow that pattern

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agodocs: storage: owner/group default to libvirtd UID/GID
Cole Robinson [Wed, 6 Feb 2019 23:26:05 +0000 (18:26 -0500)]
docs: storage: owner/group default to libvirtd UID/GID

Commit fafcc818f changed the docs to say that when creating a
pool directory or file volume with no owner/group specified, they
will be inherited from the parent directory. This isn't correct
now and doesn't seem to have ever been correct

In reality default owner/group is whatever UID/GID libvirtd is
running as

Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agorpc: client: stream: fix multi thread abort/finish
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:47 +0000 (15:58 +0300)]
rpc: client: stream: fix multi thread abort/finish

If 2 threads call abort for example then one of them
will hang because client will send 2 abort messages and
server will reply only on first of them, the second will be
ignored. And on server reply client changes the state only
one of abort message to complete, the second will hang forever.
There are other similar issues.

We should complete all messages waiting reply if we got
error or expected abort/finish reply from server. Also if one
thread send finish and another abort one of them will win
the race and server will either abort or finish stream. If
stream is aborted then thread requested finishing should report
error. In order to archive this let's keep stream closing reason
in @closed field. If we receive VIR_NET_OK message for stream
then stream is finished if oldest (closest to queue end) message
in stream queue is finish message and stream is aborted if oldest
message is abort message. Otherwise it is protocol error.

By the way we need to fix case of receiving VIR_NET_CONTINUE
message. Now we take oldest message in queue and check if
this is dummy message. If one thread first sends abort and
second thread then receives data then oldest message is abort
message and second thread won't be notified when data arrives.
Let's find oldest dummy message instead.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agorpc: client stream: dispose private data on stream dispose
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:46 +0000 (15:58 +0300)]
rpc: client stream: dispose private data on stream dispose

If we call virStreamFinish and virStreamAbort from 2 distinct
threads for example we can have access to freed memory.
Because when virStreamFinish finishes for example virStreamAbort
yet to be finished and it access virNetClientStreamPtr object
in stream->privateData.

Also it does not make sense to clear @driver field. After
stream is finished/aborted it is better to have appropriate
error message instead of "unsupported error".

This commit reverts [1] or virNetClientStreamPtr and
virStreamPtr will never be unrefed due to cyclic dependency.
Before this patch we don't have leaks because all execution
paths we call virStreamFinish or virStreamAbort.

[1] 8b6ffe40 : virNetClientStreamNew: Track origin stream

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: client: don't set incomingEOF on errors
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:45 +0000 (15:58 +0300)]
rpc: client: don't set incomingEOF on errors

This mixing errors and EOF condition in one flag is odd.
Instead let's check st->err.code where appropriate.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: client: incapsulate error checks
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:44 +0000 (15:58 +0300)]
rpc: client: incapsulate error checks

Checking virNetClientStreamRaiseError without client lock
is racy which is fixed in [1] for example. Thus let's remove such checks
when we are sending message to server. And in other cases
(like virNetClientStreamRecvHole for example) let's move the check
into client stream code.

virNetClientStreamRecvPacket already have stream lock so we could
introduce another error checking function like virNetClientStreamRaiseErrorLocked
but as error is set when both client and stream lock are hold we
can remove locking from virNetClientStreamRaiseError because all
callers hold either client or stream lock.

Also let's split virNetClientStreamRaiseErrorLocked into checking
state function and checking message send status function. They are
same yet.

[1] 1b6a29c21: rpc: fix race on stream abort/finish and server side abort

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agorpc: add mising locking in virNetClientStreamRecvHole
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:43 +0000 (15:58 +0300)]
rpc: add mising locking in virNetClientStreamRecvHole

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: fix propagation of errors from server
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:42 +0000 (15:58 +0300)]
rpc: fix propagation of errors from server

Stream server error is not propagated if thread does not have the buck.
In case we have the buck we are ok due to the code added in [1].

Let's check for stream error on all paths. Now we don't need
to raise error in virNetClientCallDispatchStream.

Old code reported error only if the first message in wait
queue awaits reply. It is odd as depends on wait queue
situation. For example if we have only TX
message in queue and in one iteration loop both send the
message and receive error then thread sending TX message did
not receive the error. Next if we have RX message (first)
and TX message (second) in queue and in one iteration
loop both send the TX message and receive error then
thread sending TX message received error. In short
it was inconsistent. Let's report error whenever
we received it and for every type of message as it makes
sense to report errors as early as possible.

[1] 16c6e2b41: Fix propagation of RPC errors from streams

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: remove unused virNetClientSendNoReply
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:41 +0000 (15:58 +0300)]
rpc: remove unused virNetClientSendNoReply

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agorpc: use single function to send stream messages
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:40 +0000 (15:58 +0300)]
rpc: use single function to send stream messages

In next patches we'll add stream state checks to this
function that applicable to all call paths. This is handy
place because we hold client lock here.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: fix race on stream abort/finish and server side abort
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:39 +0000 (15:58 +0300)]
rpc: fix race on stream abort/finish and server side abort

Stream abort/finish can hang because we can receive abort message
from server and yet sent abort/finish message to server. The latter
will not be answered ever because after server sends abort message
it forgets the stream and messages for unknown stream are simply ignored.

We check for stream error at the very beginning of remoteStreamFinish/remoteStreamAbort
but stream error can be set after the check in another thread operating
on stream. Let's check for stream error under client lock similar
to what's done in [1].

[1] 833b901cb: stream: Check for stream EOF

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agoqemu: Unify style for qemuDomain*()
Andrea Bolognani [Wed, 6 Feb 2019 11:37:54 +0000 (12:37 +0100)]
qemu: Unify style for qemuDomain*()

These functions do mostly the same things, and it would be
preferrable if they did them in mostly the same ways. This
also fixes a few violations to our code style guidelines.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Move qemuDomainSupportsPCI() to qemu_domain
Andrea Bolognani [Wed, 28 Nov 2018 16:45:37 +0000 (17:45 +0100)]
qemu: Move qemuDomainSupportsPCI() to qemu_domain

The function operates on a virDomainDef and is not tied to
device address assignment in any way, so it makes more sense
for it to live along with qemuDomainIs*() and the like.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Make most qemuDomainMachine*() functions static
Andrea Bolognani [Wed, 28 Nov 2018 16:34:07 +0000 (17:34 +0100)]
qemu: Make most qemuDomainMachine*() functions static

Ideally we'd make all of them static, but there are a few
cases where we don't have a virDomainDef instance handy and
so they are the only option.

For the few ones we're forced to keep exporting, document
through comments that the alternative is preferred.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Remove useless ARCH_IS_X86() call
Andrea Bolognani [Wed, 28 Nov 2018 16:08:49 +0000 (17:08 +0100)]
qemu: Remove useless ARCH_IS_X86() call

Now that we have added architecture checks to all
qemuDomainIs*() functions, we no longer need to perform the
same checks separately.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Add arch checks to qemuDomainMachine*()
Andrea Bolognani [Wed, 28 Nov 2018 15:56:35 +0000 (16:56 +0100)]
qemu: Add arch checks to qemuDomainMachine*()

There is very little overlap in the machine types available
on different architectures, so broadly speaking checking the
machine type is usually enough; regardless, it's better to
check the architecture as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Add arch parameter to qemuDomainMachine*()
Andrea Bolognani [Wed, 28 Nov 2018 15:48:41 +0000 (16:48 +0100)]
qemu: Add arch parameter to qemuDomainMachine*()

We want the signatures to be consistent, and also we're
going to start using the additional parameter next.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Move functions around
Andrea Bolognani [Wed, 28 Nov 2018 15:15:31 +0000 (16:15 +0100)]
qemu: Move functions around

Make sure related functions, eg. all qemuDomainIs*(), are
close together instead of being sprinkled throughout both
the header and implementation file, and also that all
qemuDomainMachine*() functions are declared first since
we're going to make a bunch of them static later on.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Use more specific prefixes
Andrea Bolognani [Wed, 28 Nov 2018 14:04:51 +0000 (15:04 +0100)]
qemu: Use more specific prefixes

While the chances of the current checks resulting in false
positives are basically zero, it's still nicer to check for
the full prefix instead of the prefix's prefix.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Remove redundant condition
Andrea Bolognani [Wed, 28 Nov 2018 15:34:41 +0000 (16:34 +0100)]
qemu: Remove redundant condition

No need to check whether we're dealing with a pSeries guest
twice within just a few lines.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoutil: Use a semicolon for all VIR_DEFINE_AUTOPTR_FUNC
John Ferlan [Thu, 7 Feb 2019 17:18:52 +0000 (12:18 -0500)]
util: Use a semicolon for all VIR_DEFINE_AUTOPTR_FUNC

For consistency, let's use the semicolon for all definitions.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agodocs: Update the AMD SEV's spec URL
Erik Skultety [Fri, 8 Feb 2019 10:42:14 +0000 (11:42 +0100)]
docs: Update the AMD SEV's spec URL

Luckily, the new URL still points to the same location, the only change
is in the document name where an escaped space (%20) was replaced by an
underscore.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: caps: Don't call 'query-events' when we probe events from QMP schema
Peter Krempa [Thu, 7 Feb 2019 12:03:37 +0000 (13:03 +0100)]
qemu: caps: Don't call 'query-events' when we probe events from QMP schema

Avoid calling the command and fix test fallout.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Probe events from 'query-qmp-schema' rather than 'query-events'
Peter Krempa [Thu, 7 Feb 2019 11:50:27 +0000 (12:50 +0100)]
qemu: caps: Probe events from 'query-qmp-schema' rather than 'query-events'

QEMU plans to deprecate 'query-events' as it's non-extensible. Events
are also described by 'query-qmp-schema' so we can use that one instead.

This patch adds detection of events to
virQEMUCapsProbeQMPSchemaCapabilities using the same structure declaring
them for the old approach (virQEMUCapsEvents). This is possible as the
name is the same in the QMP schema and our detector supports that
trivially.

For any complex queries virQEMUCapsQMPSchemaQueries can be used in the
future.

For now we still call 'query-events' and discard the result so that it's
obvious that the tests pass. This will be cleaned up later.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>