]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agovirPCIGetVirtualFunctions: Fetch also network interface name if needed
Peter Krempa [Wed, 4 Aug 2021 15:37:44 +0000 (17:37 +0200)]
virPCIGetVirtualFunctions: Fetch also network interface name if needed

'virNetDevGetVirtualFunctions' calls 'virPCIGetVirtualFunctions' and
then re-iterates the returned list to fetch the interface names for the
returned virtual functions.

If we move the fetching of the interface name into
virPCIGetVirtualFunctions we can simplify the code and remove a bunch of
impossible error states.

To accomplish this the function is renamed to
'virPCIGetVirtualFunctionsFull' while keeping a wrapper with original
name and if the physical port ID is passed the interface name is fetched
too without the need to re-convert the address into a sysfs link.

For now 'virNetDevGetVirtualFunctions' still converts the returned data
into two lists.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirPCIGetNetName: Make 'physPortID' argument const
Peter Krempa [Wed, 4 Aug 2021 15:54:42 +0000 (17:54 +0200)]
virPCIGetNetName: Make 'physPortID' argument const

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirPCIGetVirtualFunctionIndex: Refactor cleanup
Peter Krempa [Wed, 4 Aug 2021 14:35:31 +0000 (16:35 +0200)]
virPCIGetVirtualFunctionIndex: Refactor cleanup

The 'ret' variable and 'out' label can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirPCIGetVirtualFunctions: Simplify cleanup of returned data
Peter Krempa [Tue, 3 Aug 2021 14:45:36 +0000 (16:45 +0200)]
virPCIGetVirtualFunctions: Simplify cleanup of returned data

Introduce a struct for holding the list of VFs returned by
virPCIGetVirtualFunctions so that we can employ automatic memory
clearing and also allow querying more information at once.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirNetDevGetVirtualFunctions: Remove 'max_vfs' argument
Peter Krempa [Wed, 4 Aug 2021 15:27:56 +0000 (17:27 +0200)]
virNetDevGetVirtualFunctions: Remove 'max_vfs' argument

The only caller doesn't use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agonodedev: look up mdevs by UUID and parent
Jonathon Jongsma [Fri, 16 Jul 2021 19:33:50 +0000 (14:33 -0500)]
nodedev: look up mdevs by UUID and parent

Since UUID is not guaranteed to be unique by mdevctl, we may have more
than one nodedev with the same UUID. Therefore, we need to disambiguate
when looking up mdevs by specifying the UUID and parent address, which
mdevctl guarantees to be a unique combination.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonodedev: Handle inactive mdevs with the same UUID
Jonathon Jongsma [Tue, 6 Jul 2021 18:41:28 +0000 (13:41 -0500)]
nodedev: Handle inactive mdevs with the same UUID

Unfortunately, mdevctl supports defining more than one mdev with the
same UUID as long as they have different parent devices. (Only one of
these devices can be active at any given time).

This means that we can't use the UUID alone as a way to uniquely
identify mdev node devices. Append the parent address to ensure
uniqueness. For example:

    Before: mdev_88a6b868_46bd_4015_8e5b_26107f82da38
    After:  mdev_88a6b868_46bd_4015_8e5b_26107f82da38_0000_00_02_0

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonodedev: add PostParse callback for nodedev parsing
Jonathon Jongsma [Fri, 16 Jul 2021 21:33:43 +0000 (16:33 -0500)]
nodedev: add PostParse callback for nodedev parsing

This can be used similarly to other postparse callbacks in libvirt --
filling in additional information that can be determined by using the
information provided in the XML. In this case, we determine the address
of the parent device and cache it in the mdev caps so that we can use it
for generating a unique name and interacting with mdevctl.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonodedev: Add parser validation for node devices
Jonathon Jongsma [Fri, 16 Jul 2021 18:46:52 +0000 (13:46 -0500)]
nodedev: Add parser validation for node devices

At the moment, this is only for mediated devices. When a new mediated
device is created or defined, the xml is expected specify the nodedev
name of an existing device as its parent. We were not previously
validating this and were simply accepting any string here.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonodedev: cache parent address in mdev caps
Jonathon Jongsma [Fri, 16 Jul 2021 18:15:54 +0000 (13:15 -0500)]
nodedev: cache parent address in mdev caps

mdevctl can report multiple defined devices with the same UUID
but different parents, including parents that don't actually exist on
the host machine. Libvirt sets the parent to the 'computer' device for
all of the mdevs that have nonexistent parents. Because of this, it's
possible that there are multiple devices with the same UUID and the same
'computer' device as their parent, so the combination of uuid and parent
nodedev name is not guaranteed to be a unique name.

We need to ensure that each nodedev has a unique name. If we can't use
the UUID as a unique nodedev name, and we can't use the combination of
UUID and nodedev parent name, we need to find another solution. By
caching and using the parent name reported by mdevctl in combination
with the UUID, we can achieve a unique name. mdevctl guarantees that its
uuid/parent combination is unique.

This value will be used to set the mdev nodedev name in a following commit.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonodedev: fix xml output for mdev parents in test suite
Jonathon Jongsma [Wed, 7 Jul 2021 20:01:20 +0000 (15:01 -0500)]
nodedev: fix xml output for mdev parents in test suite

Commit 51fbbfdce8 attempted to get the proper nodedev name for the
parent of an defined mdev by traversing the filesystem and looking for a
device that had the appropriate sysfs path.  This works, but it would be
cleaner to to avoid mucking around in the filesystem and instead just
just examine the list of devices we have in memory.

We already had a function nodeDeviceFindAddressByName() which constructs
an address for parent device in a format that can be used with mdevctl.
So if we refactor this function into a a function that simply formats an
address for an arbitrary virNodeDeviceObj*, then we can use this
function as a predicate for our new virNodeDeviceObjListFind() function
from the previous commit. This will search our list of devices for one
whose address matches the address we get from mdevctl.

One nice benefit of this approach is that our test cases will now
display xml output with the proper parent name for mdevs (assuming that
we've added the appropriate mock parent devices to the test driver).
Previously they just displayed 'computer' for the parent because the
alternative would have required specially constructing a mock filesystem
environment with a sysfs that mapped to the appropriate parent.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonodedev: add internal virNodeDeviceObjListFind()
Jonathon Jongsma [Thu, 15 Jul 2021 22:07:32 +0000 (17:07 -0500)]
nodedev: add internal virNodeDeviceObjListFind()

This is a generic function that you can provide your own predicate
function to search for a particular device. It will be used in an
upcoming commit.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosrc: stop checking virIdentityNew return value
Daniel P. Berrangé [Thu, 5 Aug 2021 18:03:19 +0000 (19:03 +0100)]
src: stop checking virIdentityNew return value

This method will always succeed.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agorpm: add conditionals around post scripts
Daniel P. Berrangé [Thu, 5 Aug 2021 09:58:29 +0000 (10:58 +0100)]
rpm: add conditionals around post scripts

The hypervisor drivers can be disabled in certain build scenarios, so
their corresponding post scripts need to match.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: directly query KVM for TSC scaling support
Daniel P. Berrangé [Wed, 4 Aug 2021 17:05:59 +0000 (18:05 +0100)]
util: directly query KVM for TSC scaling support

We currently query the host MSRs to determine if TSC scaling is
supported. This works OK when running privileged and can open
the /dev/cpu/0/msr. When unprivileged we fallback to querying
MSRs from /dev/kvm. This is incorrect because /dev/kvm only
reports accurate info for MSRs that are valid to use from inside
a guest.  The TSC scaling support MSR is not, thus we always end
up reporting lack of TSC scaling when unprivileged.

The solution to this is easy, because KVM can directly report
whether TSC scaling is available, which matches what QEMU will
do at startup.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/188
Reported-by: Roman Mohr <rmohr@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoRevert "remote: remove probing logic from virtproxyd dispatcher"
Daniel P. Berrangé [Wed, 4 Aug 2021 17:03:32 +0000 (18:03 +0100)]
Revert "remote: remove probing logic from virtproxyd dispatcher"

This reverts commit 05bd8db60b35b7706100d9cbbaeb13992965e0f2.

It is true that the remote driver client now contains logic for probing
the driver to connect to when using modular daemons. This logic, however,
only runs when the remote driver is NOT running inside a daemon since we
don't want it activated inside libvirtd. Since the same remote driver
build is used in all daemons, we can't rely on it in virtproxyd either.
Thus we need to keep the virtproxyd probing logic

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agovirStorageBackendLogicalParseVolExtents: Remove 'cleanup' and 'ret'
Peter Krempa [Wed, 4 Aug 2021 10:21:22 +0000 (12:21 +0200)]
virStorageBackendLogicalParseVolExtents: Remove 'cleanup' and 'ret'

The function was inconsistently using 'return -1' and 'goto cleanup;'
unify it by removing the cleanup label and 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirStorageBackendLogicalParseVolExtents: Move 'extents' inside the loop
Peter Krempa [Wed, 4 Aug 2021 10:18:38 +0000 (12:18 +0200)]
virStorageBackendLogicalParseVolExtents: Move 'extents' inside the loop

It's used only inside the loop filling the extents, move it there and
restructure the code so that 'extent.path' doesn't have to be freed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirStorageBackendLogicalParseVolExtents: Declare one variable per line
Peter Krempa [Wed, 4 Aug 2021 10:06:52 +0000 (12:06 +0200)]
virStorageBackendLogicalParseVolExtents: Declare one variable per line

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolxcNetworkParseDataIPs: Automatically free string list
Peter Krempa [Wed, 4 Aug 2021 10:00:17 +0000 (12:00 +0200)]
lxcNetworkParseDataIPs: Automatically free string list

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNetServerGetClients: Remove pointless cleanup
Peter Krempa [Wed, 4 Aug 2021 09:36:31 +0000 (11:36 +0200)]
virNetServerGetClients: Remove pointless cleanup

'list' will always be NULL when reaching 'virObjectListFreeCount' thus
we can remove the call as well as the 'ret' variable which was only ever
equal to 'nclients' at the point when we returned the value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuProcessSetupHotpluggableVcpus: Use automatic memory freeing
Peter Krempa [Wed, 4 Aug 2021 09:33:35 +0000 (11:33 +0200)]
qemuProcessSetupHotpluggableVcpus: Use automatic memory freeing

'bootHotplug' can be auto-freed when terminating the function and moving
the declaration of 'vcpuprops' to the loop which uses it along with
automatic freeing allows us to simplify cleanup in certain cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNWFilterIncludeDefToRuleInst: Refactor cleanup
Peter Krempa [Wed, 4 Aug 2021 09:28:35 +0000 (11:28 +0200)]
virNWFilterIncludeDefToRuleInst: Refactor cleanup

Use automatic memory freeing for 'tmpvars' and move the allocation of
tmpvars earlier so that we are guaranteed that 'obj' will always be
appended to 'inst->filters' and thus don't need cleanup for it.

By moving the reset of 'inst' to the block when virNWFilterDefToInst
fails we can get rid of the rest of the cleanup section and remove the
'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNWFilterRuleDefToRuleInst: Restructure code to avoid cleanup
Peter Krempa [Wed, 4 Aug 2021 09:21:18 +0000 (11:21 +0200)]
virNWFilterRuleDefToRuleInst: Restructure code to avoid cleanup

Construct the 'ruleinst->vars' hash table separately in a temporary
variable so that 'ruleinst' can be allocated on success. This allows us
to get rid of the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirObjectEventCallbackListAddID: Remove pointless cleanup of 'cb'
Peter Krempa [Wed, 4 Aug 2021 09:17:36 +0000 (11:17 +0200)]
virObjectEventCallbackListAddID: Remove pointless cleanup of 'cb'

'cb' is always NULL when 'virObjectEventCallbackListAddID' is called.
Remove the call.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNWFilterRuleDefToRuleInst: Remove pointless assignment
Peter Krempa [Wed, 4 Aug 2021 09:14:18 +0000 (11:14 +0200)]
virNWFilterRuleDefToRuleInst: Remove pointless assignment

'ruleinst' is NULLed by VIR_APPEND_ELEMENT

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuDomainAttachDeviceConfig: Remove pointless assignment
Peter Krempa [Wed, 4 Aug 2021 09:14:18 +0000 (11:14 +0200)]
qemuDomainAttachDeviceConfig: Remove pointless assignment

'dev->data.rng' is NULLed by VIR_APPEND_ELEMENT

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirSecuritySELinuxContextListAppend: Remove unreachable cleanup
Peter Krempa [Wed, 4 Aug 2021 09:13:10 +0000 (11:13 +0200)]
virSecuritySELinuxContextListAppend: Remove unreachable cleanup

'item' is always NULLed-out by VIR_APPEND_ELEMENT and 'ret' variable is
always 0 when used so both can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuDomainUSBAddressAddHubs: Refactor cleanup
Peter Krempa [Wed, 4 Aug 2021 09:08:49 +0000 (11:08 +0200)]
qemuDomainUSBAddressAddHubs: Refactor cleanup

'hub' doesn't need to be freed any more because it's always consumed and
NULLed-out by VIR_APPEND element. This also makes the 'ret' variable
obsolete.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoxenParseXMDisk: Use automatic memory clearing and remove 'ret' variable
Peter Krempa [Tue, 3 Aug 2021 13:08:54 +0000 (15:08 +0200)]
xenParseXMDisk: Use automatic memory clearing and remove 'ret' variable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoprlsdkAddDomainVideoInfoCt: Remove pointless cleanup section
Peter Krempa [Tue, 3 Aug 2021 13:05:59 +0000 (15:05 +0200)]
prlsdkAddDomainVideoInfoCt: Remove pointless cleanup section

'video' will only ever be NULL after the 'cleanup' label thus there's no
need to use 'virDomainVideoDefFree'. In fact we can fully remove the
cleanup section and 'ret' variable by returning directly from failure
points.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: alloc: Completely replace VIR_APPEND_ELEMENT_QUIET by VIR_APPEND_ELEMENT
Peter Krempa [Tue, 3 Aug 2021 13:04:55 +0000 (15:04 +0200)]
util: alloc: Completely replace VIR_APPEND_ELEMENT_QUIET by VIR_APPEND_ELEMENT

VIR_APPEND_ELEMENT doesn't report any errors now so we can remove
VIR_APPEND_ELEMENT_QUIET and replace all uses by VIR_APPEND_ELEMENT

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: alloc: Reimplement VIR_APPEND_ELEMENT using virAppendElement
Peter Krempa [Tue, 3 Aug 2021 12:14:20 +0000 (14:14 +0200)]
util: alloc: Reimplement VIR_APPEND_ELEMENT using virAppendElement

Use virAppendElement instead of virInsertElementsN to implement
VIR_APPEND_ELEMENT which allows us to remove error handling as the
only relevant errors were removed when switching to aborting memory
allocation functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: alloc: Reimplement VIR_APPEND_ELEMENT_QUIET using virAppendElement
Peter Krempa [Wed, 4 Aug 2021 07:25:23 +0000 (09:25 +0200)]
util: alloc: Reimplement VIR_APPEND_ELEMENT_QUIET using virAppendElement

For now it was an alias to VIR_APPEND_ELEMENT. Use virAppendElement
directly until VIR_APPEND_ELEMENT is refactored too and we'll be able to
get rid of VIR_APPEND_ELEMENT_QUIET completely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: alloc: Reimplement VIR_APPEND_ELEMENT_COPY using virAppendElement
Peter Krempa [Tue, 3 Aug 2021 12:14:20 +0000 (14:14 +0200)]
util: alloc: Reimplement VIR_APPEND_ELEMENT_COPY using virAppendElement

Use virAppendElement instead of virInsertElementsN to implement
VIR_APPEND_ELEMENT_COPY which allows us to remove error handling as the
only relevant errors were removed when switching to aborting memory
allocation functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: alloc: Reimplement VIR_APPEND_ELEMENT_(COPY_)INPLACE using virAppendElement
Peter Krempa [Tue, 3 Aug 2021 12:14:20 +0000 (14:14 +0200)]
util: alloc: Reimplement VIR_APPEND_ELEMENT_(COPY_)INPLACE using virAppendElement

VIR_APPEND_ELEMENT_INPLACE and VIR_APPEND_ELEMENT_COPY_INPLACE already
ignore the return value from 'virInsertElementsN' which allows a trivial
conversion to virAppendElement without the need for 'ignore_value'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: alloc: Introduce virAppendElement helper
Peter Krempa [Tue, 3 Aug 2021 12:11:23 +0000 (14:11 +0200)]
util: alloc: Introduce virAppendElement helper

The new wrapper calls virInsertElementInternal with the appropriate
arguments without any checks which are unnecessary for appension. This
allows to have no return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInsertElementsN: Split out actual insertion code
Peter Krempa [Tue, 3 Aug 2021 11:36:56 +0000 (13:36 +0200)]
virInsertElementsN: Split out actual insertion code

Split out the code doing the movement of the elements and insertion from
the range checks. This will help in adding an error-free version for
appension.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInsertElementsN: Rename 'add' argument
Peter Krempa [Tue, 3 Aug 2021 11:28:17 +0000 (13:28 +0200)]
virInsertElementsN: Rename 'add' argument

The idea of @add was that the insersion/appension macros would allow
adding more than one element but this feature was never implemented.

'add' is nowadays used as a dummy variable consuming the result of the
VIR_TYPEMATCH compile time check.

Make it obvious that we don't use 'add' by renaming it to
'typematchDummy', marking it as unused and replacing all occurences
where the value was used by literal '1'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: Don't leak cpu defs
Michal Privoznik [Fri, 30 Jul 2021 08:34:50 +0000 (10:34 +0200)]
tests: Don't leak cpu defs

There are cpu definitions that are allocated in
qemuTestDriverInit() but are missing corresponding
virCPUDefFree() call in qemuTestDriverFree(). It's safe to call
the free function because the definitions contain a refcounter
and thus even if they were still in use the refcounter would be
just decreased.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoutil: fix typo
Ján Tomko [Fri, 18 Jun 2021 11:37:31 +0000 (13:37 +0200)]
util: fix typo

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: virtiofs: kill the whole process group
Ján Tomko [Tue, 3 Aug 2021 14:56:41 +0000 (16:56 +0200)]
qemu: virtiofs: kill the whole process group

Send TERM/KILL to virtiofsd and its child processes too
and do not exit until they are all dead.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
3 years agoutil: virPidFileForceCleanupPath: add group argument
Ján Tomko [Wed, 23 Jun 2021 09:34:57 +0000 (11:34 +0200)]
util: virPidFileForceCleanupPath: add group argument

Add a version of virPidFileForceCleanupPath that takes
a 'group' bool argument and propagate it all the way
down to virProcessKillPainfullyDelay.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: introduce virProcessGroupGet
Ján Tomko [Tue, 3 Aug 2021 12:31:34 +0000 (14:31 +0200)]
util: introduce virProcessGroupGet

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: Introduce virProcessGroupKill
Ján Tomko [Tue, 3 Aug 2021 12:23:38 +0000 (14:23 +0200)]
util: Introduce virProcessGroupKill

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agorpm: use direct remote connection for Fedora >= 35 / RHEL >= 9
Daniel P. Berrangé [Mon, 2 Aug 2021 15:52:20 +0000 (16:52 +0100)]
rpm: use direct remote connection for Fedora >= 35 / RHEL >= 9

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agorpm: handle enabling/disabling modular daemons post/postun-install
Daniel P. Berrangé [Wed, 28 Jul 2021 16:12:43 +0000 (17:12 +0100)]
rpm: handle enabling/disabling modular daemons post/postun-install

We need to enable or disable the modular daemons with systemd after the
RPM install/uninstall.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agorpm: macroize logic for enabling/disabling daemons post/postun-install
Daniel P. Berrangé [Wed, 28 Jul 2021 14:59:31 +0000 (15:59 +0100)]
rpm: macroize logic for enabling/disabling daemons post/postun-install

The patterns for enabling/disabling daemons post/postun-install has a
bit of duplication across the different part of the spec, due to the
number of socket units involved. This is going to get much worse with
the need to enable/disalbe modular daemons, so benefits from macroization.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agorpm: restart modular daemons on upgrade
Daniel P. Berrangé [Wed, 28 Jul 2021 15:53:16 +0000 (16:53 +0100)]
rpm: restart modular daemons on upgrade

The daemons all need restarting to ensure they pick up the newly
installed code.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agorpm: restart virtnwfilter/virnetworkd if configs change
Daniel P. Berrangé [Wed, 28 Jul 2021 15:29:49 +0000 (16:29 +0100)]
rpm: restart virtnwfilter/virnetworkd if configs change

Currently we restart libvirtd if the nwfilter/network configs have
changed. We need to take account of possibility that the modular
daemons are in use instead though.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agorpm: macroize logic for restarting daemons post-transaction
Daniel P. Berrangé [Wed, 28 Jul 2021 14:59:31 +0000 (15:59 +0100)]
rpm: macroize logic for restarting daemons post-transaction

The patterns for restarting daemons post-transaction has a bit of
duplication across the different part of the spec. This is going to
get much worse with the need to restart modular daemons, so benefits
from macroization.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agovirNWFilterParseParamAttributes: Simplify loop
Tim Wiederhake [Fri, 23 Jul 2021 09:42:47 +0000 (11:42 +0200)]
virNWFilterParseParamAttributes: Simplify loop

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: Test pcie-expander-bus for aarch64/virt guests
Andrea Bolognani [Thu, 22 Jul 2021 13:06:03 +0000 (15:06 +0200)]
tests: Test pcie-expander-bus for aarch64/virt guests

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: Allow pcie-expander-bus for aarch64/virt guests
Andrea Bolognani [Thu, 22 Jul 2021 13:37:25 +0000 (15:37 +0200)]
qemu: Allow pcie-expander-bus for aarch64/virt guests

Starting with QEMU 6.0, this controller is enabled by default
on aarch64.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: Add capabilities for QEMU 6.0 on aarch64
Andrea Bolognani [Thu, 22 Jul 2021 17:10:17 +0000 (19:10 +0200)]
tests: Add capabilities for QEMU 6.0 on aarch64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoci: Adapt to lcitool command line changes
Andrea Bolognani [Thu, 22 Jul 2021 13:58:28 +0000 (15:58 +0200)]
ci: Adapt to lcitool command line changes

lcitool now uses the term "target" instead of "host" to refer to
the various operating systems it supports, and we need to adapt
our helper script so that it works with the new command line
interface.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agoqemu_migration: check for interface type 'hostdev'
Kristina Hanicova [Wed, 28 Jul 2021 16:17:25 +0000 (18:17 +0200)]
qemu_migration: check for interface type 'hostdev'

When we try to migrate vm, we check if it contains only devices
that are able to migrate. If a hostdev device is not able to
migrate we raise an error with <hostdev/>, but it can actually be
<interface/>, so we need to check if hostdev device was created
by us from interface and show the right error message.

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoexamples: test: Add a new test xml with more tainted configs for testing
Luke Yue [Mon, 12 Jul 2021 11:32:17 +0000 (19:32 +0800)]
examples: test: Add a new test xml with more tainted configs for testing

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotest_driver: Introduce testDomainObjCheckTaint
Luke Yue [Mon, 12 Jul 2021 11:32:16 +0000 (19:32 +0800)]
test_driver: Introduce testDomainObjCheckTaint

In order to test the virDomainGetMessages for test driver, we need to
check some taints or deprecations, so introduce testDomainObjCheckTaint
for checking taints.

As we introduced testDomainObjCheckTaint for test driver, the `dominfo`
command in virshtest will now print tainting messages, so add them for
test.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotest_driver: Implement virDomainGetMessages
Luke Yue [Mon, 12 Jul 2021 11:32:15 +0000 (19:32 +0800)]
test_driver: Implement virDomainGetMessages

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoconf: domain: Introduce and use virDomainObjGetMessages()
Luke Yue [Mon, 12 Jul 2021 11:32:14 +0000 (19:32 +0800)]
conf: domain: Introduce and use virDomainObjGetMessages()

The test driver and qemu driver could share the same code in
virDomainGetMessages(), so extract it to a function.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agogitlab: use custom docker:dind image
Daniel P. Berrangé [Tue, 27 Jul 2021 12:21:17 +0000 (13:21 +0100)]
gitlab: use custom docker:dind image

The current docker:dind container has broken default seccomp filter that
results in clone3 being blocked, which in turn breaks Fedora 35 rawhide.

This custom image has a workaround that causes the seccomp filter to
return ENOSYS for clone3 instad of EPERM, thus triggering glibc to
fallback to clone correctly.

Reviewed-by: Erik Skultety <eskultet@redhat>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: monitor: remove destroy callback
Ján Tomko [Wed, 21 Jul 2021 12:32:31 +0000 (14:32 +0200)]
qemu: monitor: remove destroy callback

It was added by commit c2121602 and later removed by 5a4c2374a

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agorpm: fix mingw obsoletes lines
Daniel P. Berrangé [Mon, 2 Aug 2021 10:52:51 +0000 (11:52 +0100)]
rpm: fix mingw obsoletes lines

The package is mistakenly obsoleting itself, when it should be
obsoleting the -static packages we dropped.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotestutils: Don't leak @testBitmap and @failedTests
Michal Privoznik [Thu, 29 Jul 2021 13:53:16 +0000 (15:53 +0200)]
testutils: Don't leak @testBitmap and @failedTests

In virTestMain() the @failedTests bitmap is allocated and
optionally @testBitmap too. But neither of them is freed.

Fixes: 0cd5a726e365e67690a81e3ce33ecd0cb0b5178d
Fixes: cebb468ef5e82b8d4253e27ef70c67812cf93c5a
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovmx: Parse vm.genid
Michal Privoznik [Wed, 28 Jul 2021 11:32:10 +0000 (13:32 +0200)]
vmx: Parse vm.genid

The VMware metadata file contains genid but we are not parsing
and thus reporting it in domain XML. However, it's not as
straightforward as one might think. The UUID reported by VMware
is not in its usual string form, but split into two signed long
longs. That means, we have to do a bit of trickery when parsing.
But looking around it's the same magic that libguestfs does:

https://github.com/libguestfs/virt-v2v/blob/master/v2v/input_vmx.ml#L421

It's also explained by Rich on qemu-devel:

https://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg02019.html

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1598348
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
3 years agoPost-release version bump to 7.7.0
Jiri Denemark [Mon, 2 Aug 2021 10:27:55 +0000 (12:27 +0200)]
Post-release version bump to 7.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoRelease of libvirt-7.6.0
Jiri Denemark [Mon, 2 Aug 2021 10:19:19 +0000 (12:19 +0200)]
Release of libvirt-7.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Tue, 27 Jul 2021 18:43:14 +0000 (20:43 +0200)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10349 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/uk/

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
3 years agoUpdate translation files
Weblate [Tue, 27 Jul 2021 18:43:12 +0000 (20:43 +0200)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
3 years agogitlab: Add disclaimer to the 'feature' issue template
Peter Krempa [Mon, 26 Jul 2021 09:19:35 +0000 (11:19 +0200)]
gitlab: Add disclaimer to the 'feature' issue template

Add a disclaimer that filing a feature request issue has no guarantees
that anybody will actually implement the feature.

Based on the disclaimer in the QEMU project.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirnvme: Duplicate index in nested loop in virNVMeDeviceListCreateReAttachList
Jia Zhou [Thu, 29 Jul 2021 15:39:18 +0000 (17:39 +0200)]
virnvme: Duplicate index in nested loop in virNVMeDeviceListCreateReAttachList

When loop in function virNVMeDeviceListCreateReAttachList() there may be
reused index @i, this patch fix this by using a new @j.

Signed-off-by: Jia Zhou <zhou.jia2@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoNEWS: Add haltpolling time statistic interface
Yang Fei [Thu, 29 Jul 2021 10:55:36 +0000 (18:55 +0800)]
NEWS: Add haltpolling time statistic interface

Signed-off-by: Yang Fei <yangfei85@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agorpm: properly disable -Werror
Daniel P. Berrangé [Wed, 28 Jul 2021 14:13:48 +0000 (15:13 +0100)]
rpm: properly disable -Werror

Since we use git to manage RPM applied patches, we need to disable both
meson's -Werror config knob and libvirt's equivalent.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoNEWS: Fix false positive of sc_prohibit_doubled_word
Michal Privoznik [Wed, 28 Jul 2021 15:43:05 +0000 (17:43 +0200)]
NEWS: Fix false positive of sc_prohibit_doubled_word

In the previous commit we've added a sentence into NEWS.rst that
supposedly contains doubled word. Well, it doesn't really.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoNEWS: Add new launch security type s390-pv
Boris Fiuczynski [Wed, 28 Jul 2021 12:36:00 +0000 (14:36 +0200)]
NEWS: Add new launch security type s390-pv

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoNEWS: Mention fix for 'copy_on_read' disks with trimming enabled
Peter Krempa [Wed, 28 Jul 2021 07:38:44 +0000 (09:38 +0200)]
NEWS: Mention fix for 'copy_on_read' disks with trimming enabled

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
3 years agoqemu: block: Pass discard requests through the copy-on-read block filter
Peter Krempa [Tue, 27 Jul 2021 17:12:09 +0000 (19:12 +0200)]
qemu: block: Pass discard requests through the copy-on-read block filter

We need to pass the 'trim' requests through the copy-on-read filter so
if a user configures a discard policy on the disk the requests get
through to the appropriate format layer in the blockdev tree.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1986509
Reported-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
3 years agoNEWS: Mention change to VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD
Peter Krempa [Tue, 27 Jul 2021 12:39:06 +0000 (14:39 +0200)]
NEWS: Mention change to VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agoNEWS: Mention security bug in storage pool object lookup (CVE-2021-3667)
Peter Krempa [Tue, 27 Jul 2021 12:36:30 +0000 (14:36 +0200)]
NEWS: Mention security bug in storage pool object lookup (CVE-2021-3667)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agoNEWS: Use 'code' style for constant names in entry for recent migration fix
Peter Krempa [Tue, 27 Jul 2021 12:39:51 +0000 (14:39 +0200)]
NEWS: Use 'code' style for constant names in entry for recent migration fix

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agopo: Refresh potfile for v7.6.0
Pavel Hrdina [Tue, 27 Jul 2021 17:30:55 +0000 (19:30 +0200)]
po: Refresh potfile for v7.6.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoschema: make target mandatory for filesystems
Ján Tomko [Tue, 27 Jul 2021 10:39:50 +0000 (12:39 +0200)]
schema: make target mandatory for filesystems

Commit 12967c3e13 incorrectly made the target optional.
The validation was re-introduced by commit e8863b91f (which
put it into FSDefValidate instead of the parser), but
it did not amend the schema to make it mandatory again.

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

Fixes: e8863b91fb98f077d4c44a11bd7ea84c5e6b29ef
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agogitlab: let rawhide container builds fail
Daniel P. Berrangé [Mon, 26 Jul 2021 09:35:41 +0000 (10:35 +0100)]
gitlab: let rawhide container builds fail

The nature of Fedora rawhide means that it will inevitably have failures
periodically. Currently it is failing to even update packages due to
glibc switching to use of clone3 syscall, which is mistakenly blocked by
seccomp in container runtimes using EPERM instead of ENOSYS.

When we fail to build the rawhide containers, it is quite likely that we
still have the previous build available in the gitlab registry, so it is
reasonable to allow the container job to fail and try the build job
anyway.

Ideally we would ignore the container build failure if-and-only-if the
previous container was build with the same list of packages. We don't
record the original dependency package list though, so that's not
currently possible.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Introduce qemuDomainGetStatsCpuHaltPollTime
Yang Fei [Thu, 22 Jul 2021 08:05:02 +0000 (16:05 +0800)]
qemu: Introduce qemuDomainGetStatsCpuHaltPollTime

This function add halt polling time interface in domstats. So that
we can use command 'virsh domstats VM' to get the data if system
support.

Signed-off-by: Yang Fei <yangfei85@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: Add virHostCPUGetHaltPollTime
Yang Fei [Thu, 22 Jul 2021 08:05:01 +0000 (16:05 +0800)]
util: Add virHostCPUGetHaltPollTime

Add helper function virHostCPUGetHaltPollTime to obtain halt polling
time. If the kernel support halt polling time statistic, and mount
debugfs. This function will take effect on KVM VMs.

Signed-off-by: Yang Fei <yangfei85@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: Add virFileReadValueUllongQuiet
Yang Fei [Thu, 22 Jul 2021 08:05:00 +0000 (16:05 +0800)]
util: Add virFileReadValueUllongQuiet

Use function virFileReadValueUllongQuiet to read unsigned long
long value without error report.

Signed-off-by: Yang Fei <yangfei85@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosecurityselinuxlabeltest: Add debug statements for testUserXattrEnabled return value
Peter Krempa [Fri, 23 Jul 2021 13:25:44 +0000 (15:25 +0200)]
securityselinuxlabeltest: Add debug statements for testUserXattrEnabled return value

I've noticed the test being skipped in my build scenario (tmpfs) and
the output doesn't make it clear why it's happening.

Add debug statements for the various return values of
testUserXattrEnabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoNEWS: Mention enablement of incremental backups
Peter Krempa [Fri, 23 Jul 2021 09:36:24 +0000 (11:36 +0200)]
NEWS: Mention enablement of incremental backups

Now that 'blockdev-reopen' will be stable in the upcoming qemu versions
we can finally enable incremental backups.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoqemu: capabilities: Enable detection of QEMU_CAPS_BLOCKDEV_REOPEN
Peter Krempa [Tue, 3 Nov 2020 08:16:30 +0000 (09:16 +0100)]
qemu: capabilities: Enable detection of QEMU_CAPS_BLOCKDEV_REOPEN

Base it on the presence of the "blockdev-reopen" QMP command.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoqemumonitorjsontest: Add test case for 'blockdev-reopen'
Peter Krempa [Mon, 22 Feb 2021 16:59:28 +0000 (17:59 +0100)]
qemumonitorjsontest: Add test case for 'blockdev-reopen'

Export 'qemuBlockReopenFormatMon' and use it in a new test case wich
will validate the arguments against the QMP schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoqemuBlockReopenFormatMon: Adapt to new argument format of 'blockdev-reopen'
Peter Krempa [Mon, 22 Feb 2021 16:55:12 +0000 (17:55 +0100)]
qemuBlockReopenFormatMon: Adapt to new argument format of 'blockdev-reopen'

This function was added prior 'blockdev-reopen' being stable and qemu
changed the arguments to actually contain an array of block node
definitions to reopen.

In our case we are just changing between read-only and read-write modes
and thus we can keep operating on the nodes one-by-one.

Modify the code to add the wrapper array.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoqemuBlockReopenFormat: Extract @src handling and monitor invocation
Peter Krempa [Mon, 22 Feb 2021 16:55:01 +0000 (17:55 +0100)]
qemuBlockReopenFormat: Extract @src handling and monitor invocation

This will simplify testing of the blockdev-reopen code once it's
enabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agotests: qemucapabilities: Update capabilities for qemu-6.1.0-rc0 on x86_64
Peter Krempa [Thu, 22 Jul 2021 07:09:07 +0000 (09:09 +0200)]
tests: qemucapabilities: Update capabilities for qemu-6.1.0-rc0 on x86_64

Update to v6.1.0-rc0-48-g7b7ca8ebde

Notable changes are:
 - stabilization of 'blockdev-reopen'
 - addition of the 'vmx-tsc-scaling' cpu flag
 - Supported display types are now in the schema only if they are compiled in.
 - rbd image encryption
 - 'aio-max-batch' iothread property

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoqemu_vhost_user: don't raise error for unknown features
Cole Robinson [Fri, 23 Jul 2021 19:42:16 +0000 (15:42 -0400)]
qemu_vhost_user: don't raise error for unknown features

Similar to what was done for qemu_firmware.c in 61d95a1073, don't
report an error for unknown vhost-user features, just log it and
correctly continue on

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
3 years agoqemuDomainObjPrivateAlloc: Fix unlikely memory leak
Peter Krempa [Fri, 23 Jul 2021 08:55:20 +0000 (10:55 +0200)]
qemuDomainObjPrivateAlloc: Fix unlikely memory leak

Additional cleanup paths add the possibility of not freeing earlier
stuff. Add an AUTOPTR handler for qemuDomainObjPrivate and use it in
qemuDomainObjPrivateAlloc

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu: domain: Move qemuDomainObjPrivateAlloc after qemuDomainObjPrivateFree
Peter Krempa [Fri, 23 Jul 2021 08:51:08 +0000 (10:51 +0200)]
qemu: domain: Move qemuDomainObjPrivateAlloc after qemuDomainObjPrivateFree

The freeing function will be needed to undo failures in allocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agovirNetworkObjNew: Remove impossible error handling
Peter Krempa [Fri, 23 Jul 2021 08:46:40 +0000 (10:46 +0200)]
virNetworkObjNew: Remove impossible error handling

'obj->classIdMap' is a bitmap with size of '16', thus the first 3 bits
are guaranteed to be available. Use 'virBitmapSetBit' instead of
'virBitmapSetBitExpand' since we don't need any expansion and ignore
errors as they are impossible.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agovirDomainDefValidateAliases: Refactor to avoid cleanup section
Peter Krempa [Fri, 23 Jul 2021 08:43:12 +0000 (10:43 +0200)]
virDomainDefValidateAliases: Refactor to avoid cleanup section

Use a temporary auto-freed local variable to hold the hash table so that
the cleanup section can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemuBlockNodeNameGetBackingChain: Shuffle around variable initialization
Peter Krempa [Fri, 23 Jul 2021 08:39:54 +0000 (10:39 +0200)]
qemuBlockNodeNameGetBackingChain: Shuffle around variable initialization

Allocate the hash tables first so tat the 'data' struct can be directly
initialized removing the need for a memset and two additional
assignments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>