]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
3 years agoch_driver: Drop needless fwd declaration
Michal Privoznik [Fri, 29 Oct 2021 12:36:42 +0000 (14:36 +0200)] 
ch_driver: Drop needless fwd declaration

In ch_driver.c there are two forward declarations that are not
needed. Drop them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirnetdevopenvswitch: unify calculation of ovs and tc
zhangjl02 [Mon, 1 Nov 2021 07:39:55 +0000 (15:39 +0800)] 
virnetdevopenvswitch: unify calculation of ovs and tc

For other interface type, values in tc rules are calculated by
multiply by 8*1000 instead of 8*1024.

Signed-off-by: zhangjl02 <zhangjl02@inspur.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: tpm: Enable creation of certs for TPM 1.2 in non-privileged mode
Stefan Berger [Sat, 30 Oct 2021 04:01:37 +0000 (00:01 -0400)] 
qemu: tpm: Enable creation of certs for TPM 1.2 in non-privileged mode

When 'swtpm_setup --print-capabilities' shows the 'tpm12-not-need-root'
flag, then it is possible to create certificates for the TPM 1.2 also
in non-privileged mode since swtpm_setup doesn't need tcsd anymore.
Check for this flag and create the certificates if this flag is found.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: support kvm-pv-ipi off
zhenwei pi [Wed, 27 Oct 2021 07:04:30 +0000 (15:04 +0800)] 
qemu: support kvm-pv-ipi off

QEMU version 3.1 introduced PV_SEND_IPI CPUID feature bit under
commit 7f710c32bb8 (target-i386: adds PV_SEND_IPI CPUID feature bit).

This patch adds a new KVM feature 'pv-ipi' to disable this feature
(enabled by default). Newer CPU platform (Ex, AMD Zen2) supports
hardware accelation for IPI in guest, to use this feature to get
better performance in some scenarios. Detailed about the discussion:
  https://lkml.org/lkml/2021/10/20/423

To disable kvm-pv-ipi and have libvirt add "-cpu host,kvm-pv-ipi=off"
to the QEMU command line, the following XML code needs to be added to the
guest's domain description:

  <features>
    <kvm>
      <pv-ipi state='off'/>
    </kvm>
  </features>

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_agent: remove unused code
Kristina Hanicova [Wed, 27 Oct 2021 10:57:55 +0000 (12:57 +0200)] 
qemu_agent: remove unused code

This section of code was left unused ever since it was introduced
ten years ago. I think we can safely remove it.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoPost-release version bump to 7.10.0
Jiri Denemark [Mon, 1 Nov 2021 12:22:53 +0000 (13:22 +0100)] 
Post-release version bump to 7.10.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoRelease of libvirt-7.9.0 v7.9.0
Jiri Denemark [Mon, 1 Nov 2021 11:52:55 +0000 (12:52 +0100)] 
Release of libvirt-7.9.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoTranslated using Weblate (Korean)
simmon [Sat, 30 Oct 2021 18:05:15 +0000 (20:05 +0200)] 
Translated using Weblate (Korean)

Currently translated at 100.0% (10441 of 10441 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
3 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Sat, 30 Oct 2021 18:05:15 +0000 (20:05 +0200)] 
Translated using Weblate (Finnish)

Currently translated at 22.9% (2397 of 10441 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
3 years agoNEWS: Document my bugfixes for v7.9.0
Michal Privoznik [Fri, 29 Oct 2021 13:01:24 +0000 (15:01 +0200)] 
NEWS: Document my bugfixes for v7.9.0

There are two bugs I fixed worth mentioning in the 7.9.0 release
notes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agonews: Add support for librbd encryption
Han Han [Thu, 28 Oct 2021 07:07:51 +0000 (15:07 +0800)] 
news: Add support for librbd encryption

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Make the version requirement more clear for rbd encryption
Han Han [Thu, 28 Oct 2021 07:07:50 +0000 (15:07 +0800)] 
docs: Make the version requirement more clear for rbd encryption

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonews: News for the new virtio attribute page_per_vq
Han Han [Thu, 28 Oct 2021 07:07:49 +0000 (15:07 +0800)] 
news: News for the new virtio attribute page_per_vq

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Fix a typo of page_per_vq
Han Han [Thu, 28 Oct 2021 07:07:48 +0000 (15:07 +0800)] 
docs: Fix a typo of page_per_vq

The page_per_vq is added since v7.9.0 not v7.8.0.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoTranslated using Weblate (Ukrainian) v7.9.0-rc2
Yuri Chornoivan [Wed, 27 Oct 2021 15:13:41 +0000 (17:13 +0200)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10441 of 10441 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 agoTranslated using Weblate (Korean)
simmon [Wed, 27 Oct 2021 15:13:40 +0000 (17:13 +0200)] 
Translated using Weblate (Korean)

Currently translated at 99.3% (10371 of 10441 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
3 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Wed, 27 Oct 2021 15:13:39 +0000 (17:13 +0200)] 
Translated using Weblate (Finnish)

Currently translated at 22.8% (2385 of 10441 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
3 years agoTranslated using Weblate (Polish)
Piotr Drąg [Wed, 27 Oct 2021 15:13:39 +0000 (17:13 +0200)] 
Translated using Weblate (Polish)

Currently translated at 22.3% (2335 of 10441 strings)

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

Co-authored-by: Piotr Drąg <piotrdrag@gmail.com>
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
3 years agoFix some typos
Tim Wiederhake [Tue, 26 Oct 2021 14:14:06 +0000 (16:14 +0200)] 
Fix some typos

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Set "qemu-event" thread identity
Michal Privoznik [Tue, 26 Oct 2021 09:06:07 +0000 (11:06 +0200)] 
qemu: Set "qemu-event" thread identity

It may happen that qemuProcessStop() is called from "qemu-event"
thread. But this thread doesn't have any virIdentity set
(virIdentity being thread local) and therefore it may be unable
to open connection to secondary drivers. It is unable to do so
in split daemon scenario, because in there opening a connection
is coupled with copying current thread identity onto the
connection. Code-wise, virIdentityGetCurrent() returns NULL which
in turn makes virGetConnectGeneric() fail. This problem does not
occur in monolithic daemon scenario, because no identity copying
is done there.

Long story short, inability to open secondary driver connection
can lead to unwanted results. Therefore, do what
qemuProcessReconnectHelper() does - set the new thread identity
to be the one of the caller.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2013573
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agovirthreadpool: Allow setting identity for workers
Michal Privoznik [Tue, 26 Oct 2021 09:04:24 +0000 (11:04 +0200)] 
virthreadpool: Allow setting identity for workers

In some cases the worker func running inside the pool may rely on
virIdentity. While worker func could check for identity and set
one it is not optimal - it may not have access to the identity of
the thread creating the pool and thus would have to call
virIdentityGetSystem(). Allow passing identity when creating the
pool.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoUpdate translation files
Weblate [Tue, 26 Oct 2021 08:52:46 +0000 (10:52 +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 agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 26 Oct 2021 08:52:42 +0000 (10:52 +0200)] 
Translated using Weblate (Swedish)

Currently translated at 28.4% (2949 of 10374 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
3 years agoTranslated using Weblate (French)
Franck Ridel [Tue, 26 Oct 2021 08:52:42 +0000 (10:52 +0200)] 
Translated using Weblate (French)

Currently translated at 10.8% (1127 of 10374 strings)

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

Co-authored-by: Franck Ridel <fridel@protonmail.com>
Signed-off-by: Franck Ridel <fridel@protonmail.com>
3 years agopo: Refresh potfile for v7.9.0 v7.9.0-rc1
Jiri Denemark [Tue, 26 Oct 2021 08:47:25 +0000 (10:47 +0200)] 
po: Refresh potfile for v7.9.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoqemuProcessHandleMemoryDeviceSizeChange: Use qemuProcessEventSubmit()
Michal Privoznik [Mon, 25 Oct 2021 13:14:51 +0000 (15:14 +0200)] 
qemuProcessHandleMemoryDeviceSizeChange: Use qemuProcessEventSubmit()

This is a typical example of what can go wrong when sending out
an old patch. Back in January, when I was writing
qemuProcessHandleMemoryDeviceSizeChange() events were sent to the
worker pool thread using virThreadPoolSendJob(). Then, in July a
helper was introduced (qemuProcessEventSubmit()) but since my
code was not committed and I did not pay attention my code wasn't
updated. Later, when I merged my code it uses the old approach.

BTW: this also fixes a possible double free which I completely
missed when writing the code ~10 months ago.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu_monitor: Make domainMemoryDeviceSizeChange cb return void
Michal Privoznik [Mon, 25 Oct 2021 13:15:09 +0000 (15:15 +0200)] 
qemu_monitor: Make domainMemoryDeviceSizeChange cb return void

Nobody's interested in the return value of any of
struct _qemuMonitorCallbacks callbacks. They are all void, but
domainMemoryDeviceSizeChange. Change it to void.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agostorage_file: Compute QCOW2 cluster size as ULL
Jiri Denemark [Mon, 25 Oct 2021 14:30:41 +0000 (16:30 +0200)] 
storage_file: Compute QCOW2 cluster size as ULL

While the QCOW2 cluster size is represented in only 4 bits in the QCOW2
header and thus 1 << cluster_size cannot overflow int,
qcow2GetClusterSize is supposed to return unsigned long long so we can
just compute the result as ULL rather than computing it as int and
promoting to unsigned long long.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agonode_device: Fix memory leak in udevProcessMediatedDevice
Jiri Denemark [Mon, 25 Oct 2021 14:22:56 +0000 (16:22 +0200)] 
node_device: Fix memory leak in udevProcessMediatedDevice

One of the paths returned -1 directly without going through the cleanup
section.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
3 years agoutil: Drop pointless NUL_TERMINATE macro
Jiri Denemark [Thu, 30 Sep 2021 19:02:54 +0000 (21:02 +0200)] 
util: Drop pointless NUL_TERMINATE macro

It's only used once and open coding it is at least as clear as using the
macro.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: remove unused function return value
Ani Sinha [Sun, 24 Oct 2021 05:40:43 +0000 (11:10 +0530)] 
qemu: remove unused function return value

qemuBuildPMPCIRootHotplugCommandLine() returns 0 unconditionally. There is no
failure scenario at present. So clean up the code by removing integer return
from the function and also remove the failure check conditional from the
function call.
Also fix indentation for the above function call while at it.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
3 years agoqemu: Fix hotplug error message format to conform to spec
Ani Sinha [Thu, 21 Oct 2021 03:30:26 +0000 (09:00 +0530)] 
qemu: Fix hotplug error message format to conform to spec

Error messages must conform to spec as specified here:
https://www.libvirt.org/coding-style.html#error-message-format

This change makes some error messages conform to the spec above.

Fixes: 8eadf82fb5 ("conf: introduce option to enable/disable pci hotplug on pci-root controller")
Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
3 years agoRevert "qemu: capablities: detect acpi-pci-hotplug-with-bridge-support"
Laine Stump [Wed, 20 Oct 2021 19:18:35 +0000 (15:18 -0400)] 
Revert "qemu: capablities: detect acpi-pci-hotplug-with-bridge-support"

This reverts commit 58ba0f6a3d7342fba29edbbf2bb9cb5497c870e5.

Conflict:
  * src/qemu/qemu_capabilities.[ch]

    Because other new cap flags had been added since the original
    commit, reformatting was necessary to follow the "groups of
    five" pattern.

  * tests.qemucapabilitiesdata/caps_6.2.0.x86_64.xml

    This file was added after the original commit that we
    are reverting, so had to be manually edited to remove
    the two capabilities.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "conf: introduce support for acpi-bridge-hotplug feature"
Laine Stump [Thu, 21 Oct 2021 16:24:59 +0000 (12:24 -0400)] 
Revert "conf: introduce support for acpi-bridge-hotplug feature"

This reverts commit 7300ccc9b3eddb38306868534e7fc2d505a0a13c.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "qemu: command: add support for acpi-bridge-hotplug feature"
Laine Stump [Thu, 21 Oct 2021 16:24:58 +0000 (12:24 -0400)] 
Revert "qemu: command: add support for acpi-bridge-hotplug feature"

This reverts commit bef0f0d8be6baa1d9359be208b53d6b8a37ddc95.

Conflicts:
 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.args

  * this file had been renamed from its original, then renamed back,
    which understandably confused git. It's being completely removed
    here anyway, so the contents don't matter.

 tests/qemuxml2argvtest.c

  * change in context around removed chunk

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "NEWS: document new acpi pci hotplug config option"
Laine Stump [Wed, 20 Oct 2021 18:55:35 +0000 (14:55 -0400)] 
Revert "NEWS: document new acpi pci hotplug config option"

This reverts commit 5ee4f3e1d4f173f7e1b64b745ab9ef5dc8c8f393.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "qemuValidateDomainDefPCIFeature: un-break error messages"
Laine Stump [Wed, 20 Oct 2021 18:54:54 +0000 (14:54 -0400)] 
Revert "qemuValidateDomainDefPCIFeature: un-break error messages"

This reverts commit 7d074c56830c5d435f87667299cc102650dbbb4f.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "qemuValidateDomainDefPCIFeature: Fix validation logic"
Laine Stump [Wed, 20 Oct 2021 18:54:31 +0000 (14:54 -0400)] 
Revert "qemuValidateDomainDefPCIFeature: Fix validation logic"

This reverts commit bdc3e8f47be108fa552b72a6d913528869e61097.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "qemuxml2argvtest: Use real-caps testing for 'acpi-hotplug-bridge-disable'"
Laine Stump [Wed, 20 Oct 2021 18:46:57 +0000 (14:46 -0400)] 
Revert "qemuxml2argvtest: Use real-caps testing for 'acpi-hotplug-bridge-disable'"

This reverts commit 2d20f0bb05175d18513220bccd1dbaa207cc4c6a.

Conflicts:
 tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.args
 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.args

  the test output of these files was regenerated because the tests
  were changed upstream to use JSON on the commandline at a later
  commit than the commit being reverted here (where they were changed
  to use latest caps, but the patches to use JSON on the commandline
  hadn't been committed yet).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "qemuxml2argvtest: Add '-enable' variants for ACPI-hotplug related cases"
Laine Stump [Wed, 20 Oct 2021 18:26:25 +0000 (14:26 -0400)] 
Revert "qemuxml2argvtest: Add '-enable' variants for ACPI-hotplug related cases"

This reverts commit 64146031058906804b3c5f519570fadc9ff4df48.

Conflicts:
 tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-enable.x86_64-latest.args
 tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-latest.args
 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-enable.x86_64-latest.args

These files are unrelated to the functionality we need to remove, so
they weren't removed, and the associated test cases weren't removed
from qemuxml2argvtest.c

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "qemuxml2xmltest: Convert all acpi-hotplug control related tests to DO_TEST_CA...
Laine Stump [Tue, 19 Oct 2021 18:38:35 +0000 (14:38 -0400)] 
Revert "qemuxml2xmltest: Convert all acpi-hotplug control related tests to DO_TEST_CAPS_LATEST"

This reverts commit da896d440c7267e0b4575e4a3f2780bebf3fbfca.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoRevert "qemu: capabilities: Remove QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE"
Laine Stump [Tue, 19 Oct 2021 18:33:34 +0000 (14:33 -0400)] 
Revert "qemu: capabilities: Remove QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE"

This reverts commit 618e8665db2e4c1a8e9a227045b99b48f6110c06.

This is the first in a series of 10 commits that revert (in reverse
order) the changes to add the <acpi-hotplug-bridge state='on|off'/>
switch to libvirt domain XML, which unfortunately needs to be removed
due to QEMU developers discovering a flaw with the design of the QEMU
commandline switch used to implement the libvirt switch that will
likely result in a new and different method of selecting hotplug
modes. Because the libvirt switch has not been in any official
releases of libvirt, we are still able to remove it completely, rather
than deprecating it.

The original commits began with commit
58ba0f6a3d7342fba29edbbf2bb9cb5497c870e5. The other original commit
IDs are documented in each revert commit.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agodocs: fix docs output path with meson 0.60.0
Daniel P. Berrangé [Mon, 25 Oct 2021 17:48:59 +0000 (18:48 +0100)] 
docs: fix docs output path with meson 0.60.0

The meson 0.60.0 release introduced a bug with the '/' operator when
using an empty path component. '/foo' / ''  will now result in '/foo'
not '/foo/'

  https://github.com/mesonbuild/meson/issues/9450

This breaks libvirt because xsltproc requires the trailing '/' on the
output directory path. Fortunately the explicit 'join_paths' function
is not affected by the regression

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemublocktest: Don't leak 'disk' in testQemuImageCreateLoadDiskXML
Peter Krempa [Mon, 25 Oct 2021 14:11:49 +0000 (16:11 +0200)] 
qemublocktest: Don't leak 'disk' in testQemuImageCreateLoadDiskXML

The function returns only the source portion but forgot to free the disk
wrapper.

Fixes: 9696427ad67196
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
3 years agoconf: add luks2 encryption format
Or Ozeri [Sun, 24 Oct 2021 09:51:30 +0000 (04:51 -0500)] 
conf: add luks2 encryption format

This commit extends libvirt XML configuration to support luks2 encryption format.
This means that <encryption format="luks2" engine="librbd"> becomes valid.
Currently librbd is the only engine that supports this new format.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: add librbd encryption engine
Or Ozeri [Sun, 24 Oct 2021 09:51:29 +0000 (04:51 -0500)] 
qemu: add librbd encryption engine

rbd encryption is new in qemu 6.1.0.
This commit adds a new encryption engine property which
allows the user to use this new encryption engine.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoconf: add encryption engine property
Or Ozeri [Sun, 24 Oct 2021 09:51:28 +0000 (04:51 -0500)] 
conf: add encryption engine property

This commit extends libvirt XML configuration to support a custom encryption engine.
This means that <encryption format="luks" engine="qemu">  becomes valid.
The only engine for now is qemu. However, a new engine (librbd) will be added in an upcoming commit.
If no engine is specified, qemu will be used (assuming qemu driver is used).

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: capablities: Detect presence of 'rbd-encryption' as QEMU_CAPS_RBD_ENCRYPTION
Or Ozeri [Sun, 24 Oct 2021 09:51:27 +0000 (04:51 -0500)] 
qemu: capablities: Detect presence of 'rbd-encryption' as QEMU_CAPS_RBD_ENCRYPTION

rbd encryption is new in qemu 6.1.0.
This commit adds capability probing for it.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: add disk post parse to qemublocktest
Or Ozeri [Sun, 24 Oct 2021 09:51:26 +0000 (04:51 -0500)] 
qemu: add disk post parse to qemublocktest

The post parse callback is part of the real (non-test) processing flow.
This commit adds it (for disks) to the qemublocktest flow as well.
Specifically, this will be needed for tests that use luks encryption,
so that the default encryption engine (which is added in an upcoming commit)
will be overridden by qemu.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoci: regenerate container from manifest
Daniel P. Berrangé [Mon, 25 Oct 2021 11:45:31 +0000 (12:45 +0100)] 
ci: regenerate container from manifest

This removes the libnetcf-dev package from Debian Sid, as it is no
longer available in that distro stream.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu_monitor_json: Drop pointless error labels
Michal Privoznik [Fri, 22 Oct 2021 07:59:51 +0000 (09:59 +0200)] 
qemu_monitor_json: Drop pointless error labels

After previous cleanups, some 'error' labels were rendered
needless - they contain nothing more than a return statement.
Well, those labels can be dropped and 'goto error' can be
replaced with return statement directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu_monitor_json: Drop pointless cleanup labels
Michal Privoznik [Thu, 21 Oct 2021 08:33:51 +0000 (10:33 +0200)] 
qemu_monitor_json: Drop pointless cleanup labels

After previous cleanups, some 'cleanup' labels were rendered
needless - they contain nothing more than a return statement.
Well, those labels can be dropped and 'goto cleanup' can be
replaced with return statement directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu_monitor_json: Use g_autofree
Michal Privoznik [Thu, 21 Oct 2021 08:21:24 +0000 (10:21 +0200)] 
qemu_monitor_json: Use g_autofree

Let's replace VIR_FREE() calls with g_autofree. Not all calls can
be replaced though - the legitimate ones are kept (e.g. those
which free array, or which free a struct for which we don't have
g_autoptr() yet, and so on).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu_monitor_json: Use g_autoptr() for virJSONValue
Michal Privoznik [Thu, 21 Oct 2021 08:14:47 +0000 (10:14 +0200)] 
qemu_monitor_json: Use g_autoptr() for virJSONValue

A lot of explicit free calls can be saved when virJSONValue
variables are declared with g_autoptr(). There's one caveat:
there was a slight deviation from our usual pattern such that
@cmd variable was not initialized to NULL but as the very first
step it was assigned a value using qemuMonitorJSONMakeCommand().
While this works in theory it upset my GCC-11.2 (but only when
building with -O2). So I had to initialize the variable in such
case too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemuMonitorJSONExtractPRManagerInfo: Declare @entry inside the loop
Michal Privoznik [Fri, 22 Oct 2021 05:44:03 +0000 (07:44 +0200)] 
qemuMonitorJSONExtractPRManagerInfo: Declare @entry inside the loop

The reason why @entry variable in qemuMonitorJSONExtractPRManagerInfo()
was declared at the top most level was that the variable is used under
the cleanup label.  However, if declared using g_autofree then the
variable can be declared inside the loop it is used in.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu_monitor_json: Use g_autoptr() for qemuMonitorCPUModelInfo
Michal Privoznik [Fri, 22 Oct 2021 07:58:48 +0000 (09:58 +0200)] 
qemu_monitor_json: Use g_autoptr() for qemuMonitorCPUModelInfo

There's one place (specifically qemuMonitorJSONParseCPUModel())
where we can avoid explicit free call for qemuMonitorCPUModelInfo
struct.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu_monitor_json: Use g_autoptr() for virCPUData
Michal Privoznik [Fri, 22 Oct 2021 07:57:39 +0000 (09:57 +0200)] 
qemu_monitor_json: Use g_autoptr() for virCPUData

We have g_autoptr() for virCPUData struct defined already. Let's
use it in qemu_monitor_json.c and drop explicit free calls.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu_monitor: Declare and use g_autoptr for qemuMonitorEventPanicInfo
Michal Privoznik [Fri, 22 Oct 2021 07:31:22 +0000 (09:31 +0200)] 
qemu_monitor: Declare and use g_autoptr for qemuMonitorEventPanicInfo

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemuMonitorJSONQueryRxFilterParse: Set *filter only on success
Michal Privoznik [Fri, 22 Oct 2021 05:17:03 +0000 (07:17 +0200)] 
qemuMonitorJSONQueryRxFilterParse: Set *filter only on success

The qemuMonitorJSONQueryRxFilterParse() function is called to
parse the output of 'query-rx-filter' and store results into
passed virNetDevRxFilter structure. However, it is doing so in a
bit clumsy way - the return pointer is set in all cases (i.e.
even in case of error) and thus the cleanup label is more
complicated than it needs to be. With a help of g_autoptr() and
g_steal_pointer() the return pointer can be set only in case of
success - which is what callers expect anyway.

The same applies to qemuMonitorJSONQueryRxFilter().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemuMonitorJSONGetMigrationStats: Don't clear @stats on failure
Michal Privoznik [Fri, 22 Oct 2021 05:07:09 +0000 (07:07 +0200)] 
qemuMonitorJSONGetMigrationStats: Don't clear @stats on failure

In the qemuMonitorJSONGetMigrationStats() there's a code under
cleanup label that's clearing returned @stats if the function
returns with an error. However, transitively there's just one
caller - qemuMigrationAnyFetchStats() - and it doesn't care for
this behaviour. Drop the code to simplify the cleanup label.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemuMonitorJSONHumanCommand: Require @reply_str
Michal Privoznik [Fri, 22 Oct 2021 08:08:35 +0000 (10:08 +0200)] 
qemuMonitorJSONHumanCommand: Require @reply_str

All callers of qemuMonitorJSONHumanCommand() pass a non-NULL pointer
as @reply_str therefore there's no need to check whether it is NULL.
NB, the sister function (qemuMonitorJSONArbitraryCommand()) doesn't
check for NULL either.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu_monitor_json: Don't transfer ownership to @msg
Michal Privoznik [Thu, 21 Oct 2021 10:53:35 +0000 (12:53 +0200)] 
qemu_monitor_json: Don't transfer ownership to @msg

In qemuMonitorJSONCommandWithFd() given command (represented by
virJSONValue struct) is translated to string (represented by
virBuffer). The ownership of the string is then transferred to
the message which is then sent. The downside of this approach is
we have to have an explicit call to free the string from the
message. But if the message just "borrowed" the string (which it
can safely do because it is just reading from the string) then
automatic free of the buffer takes care of freeing the string.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu_monitor_json: Don't check for qemuMonitorNextCommandID() retval
Michal Privoznik [Thu, 21 Oct 2021 10:52:14 +0000 (12:52 +0200)] 
qemu_monitor_json: Don't check for qemuMonitorNextCommandID() retval

The qemuMonitorNextCommandID() function can never fail. There's
no need to check for its retval then. Moreover, the temporary
variable used to hold the retval can be declared in the inner
most block.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agolib: Drop intermediary return variables
Michal Privoznik [Fri, 22 Oct 2021 08:56:01 +0000 (10:56 +0200)] 
lib: Drop intermediary return variables

In a few places we declare a variable (which is optionally
followed by a code not touching it) then set the variable to a
value and return the variable immediately. It's obvious that the
variable is needless and the value can be returned directly
instead.

This patch was generated using this semantic patch:

  @@
  type T;
  identifier ret;
  expression E;
  @@
  - T ret;
  ... when != ret
      when strict
  - ret = E;
  - return ret;
  + return E;

After that I fixed couple of formatting issues because coccinelle
formatted some lines differently than our coding style.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONGetMigrationCapabilities: Don't return early on CommandNotFound
Michal Privoznik [Wed, 20 Oct 2021 07:03:04 +0000 (09:03 +0200)] 
qemuMonitorJSONGetMigrationCapabilities: Don't return early on CommandNotFound

The qemuMonitorJSONGetMigrationCapabilities() command executes
'query-migrate-capabilities' command and returns early if QEMU
doesn't know the command. Well, the command was introduced in
QEMU release 1.2 (specifically in commit v1.2.0-rc0~29^2~11) and
since the minimum required version is 2.11.0 we can be sure that
command will always exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONGetMemoryDeviceInfo: Don't return early on CommandNotFound
Michal Privoznik [Thu, 21 Oct 2021 08:50:09 +0000 (10:50 +0200)] 
qemuMonitorJSONGetMemoryDeviceInfo: Don't return early on CommandNotFound

The qemuMonitorJSONGetMemoryDeviceInfo() command executes
'query-memory-devices' command and returns early if QEMU
doesn't know the command. Well, the command was introduced in
QEMU release 2.1 (specifically in commit v2.1.0-rc0~41^2~9) and
since the minimum required version is 2.11.0 we can be sure that
command will always exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONGetKVMState: Don't return early on CommandNotFound
Michal Privoznik [Thu, 21 Oct 2021 08:46:09 +0000 (10:46 +0200)] 
qemuMonitorJSONGetKVMState: Don't return early on CommandNotFound

The qemuMonitorJSONGetKVMState() command executes 'query-kvm'
command and returns early if QEMU doesn't know the command. Well,
the command was introduced in QEMU release 0.14 and since the
minimum required version is 2.11.0 we can be sure that command
will always exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONGetDumpGuestMemoryCapability: Don't return early on CommandNotFound
Michal Privoznik [Thu, 21 Oct 2021 08:42:20 +0000 (10:42 +0200)] 
qemuMonitorJSONGetDumpGuestMemoryCapability: Don't return early on CommandNotFound

The qemuMonitorJSONGetDumpGuestMemoryCapability() command
executes 'query-dump-guest-memory-capability' command and returns
early if QEMU doesn't know the command. Well, the command was
introduced in QEMU release 2.0 (specifically in commit
v2.0.0-rc0~43^2~16) and since the minimum required version is
2.11.0 we can be sure that command will always exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONGetMigrationParams: Don't return early on CommandNotFound
Michal Privoznik [Thu, 21 Oct 2021 08:37:17 +0000 (10:37 +0200)] 
qemuMonitorJSONGetMigrationParams: Don't return early on CommandNotFound

The qemuMonitorJSONGetMigrationParams() function executes
'query-migrate-parameters' command and returns early if QEMU
doesn't know the command. Well, the command was introduced in
QEMU release 2.4 (specifically in commit v2.4.0-rc0~147^2~3) and
since the minimum required version is 2.11.0 we can be sure that
the command will always exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemumigparamstest: Drop "unsupported" test case
Michal Privoznik [Thu, 21 Oct 2021 09:01:03 +0000 (11:01 +0200)] 
qemumigparamstest: Drop "unsupported" test case

The aim of "unsupported" test case is to check whether our code
handles 'CommandNotFound' error returned for
'query-migrate-parameters' monitor command. Well, the command is
pretty old and every QEMU that we are dealing with supports it.
Thus this test case is useless. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agonews: Add PCI VPD parser & capability notes
Dmitrii Shcherbakov [Wed, 20 Oct 2021 08:30:35 +0000 (11:30 +0300)] 
news: Add PCI VPD parser & capability notes

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoAdd PCI VPD Capability Documentation
Dmitrii Shcherbakov [Wed, 20 Oct 2021 08:30:34 +0000 (11:30 +0300)] 
Add PCI VPD Capability Documentation

Describes the format of the newly added VPD capability and gives and
example for a real-world device.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoAdd PCI VPD Capability Support
Dmitrii Shcherbakov [Wed, 20 Oct 2021 08:30:33 +0000 (11:30 +0300)] 
Add PCI VPD Capability Support

* XML serialization and deserialization of PCI VPD;
* PCI VPD capability flags added and used in relevant places;
* XML to XML tests for the added capability.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoAdd PCI VPD-related helper functions to virpci
Dmitrii Shcherbakov [Wed, 20 Oct 2021 08:30:32 +0000 (11:30 +0300)] 
Add PCI VPD-related helper functions to virpci

Add helper functions to virpci to provide means of checking for a VPD
file presence and for VPD resource retrieval using the PCI VPD parser.

The added test assesses the basic functionality of VPD retrieval while
the full parser is tested by virpcivpdtest.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoAdd a PCI/PCIe device VPD Parser
Dmitrii Shcherbakov [Wed, 20 Oct 2021 08:30:31 +0000 (11:30 +0300)] 
Add a PCI/PCIe device VPD Parser

Add support for deserializing the binary PCI/PCIe VPD format and storing
results in memory.

The VPD format is specified in "I.3. VPD Definitions" in PCI specs
(2.2+) and "6.28.1 VPD Format" PCIe 4.0. As section 6.28 in PCIe 4.0
notes, the PCI Local Bus and PCIe VPD formats are binary compatible
and PCIe 4.0 merely started incorporating what was already present in
PCI specs.

Linux kernel exposes a binary blob in the VPD format via sysfs since
v2.6.26 (commit 94e6108803469a37ee1e3c92dafdd1d59298602f) which requires
a parser to interpret.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoNEWS: document virtiofs hotplug
Ján Tomko [Tue, 12 Oct 2021 12:45:01 +0000 (14:45 +0200)] 
NEWS: document virtiofs hotplug

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoconf: Add new/free functions for virDomainIOMMUDef
Andrea Bolognani [Thu, 23 Sep 2021 13:20:25 +0000 (15:20 +0200)] 
conf: Add new/free functions for virDomainIOMMUDef

This will make it possible to limit changes to a single spot
later on, and is also just an overall nicer way to create and
destroy objects.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Add IOMMU support to virDomainDeviceDefCopy()
Andrea Bolognani [Thu, 23 Sep 2021 16:59:13 +0000 (18:59 +0200)] 
conf: Add IOMMU support to virDomainDeviceDefCopy()

There doesn't seem to be a reason for IOMMUs not to be handled
by this function.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Make qemuBuildVirtioDevProps() const correct
Andrea Bolognani [Wed, 20 Oct 2021 10:01:03 +0000 (12:01 +0200)] 
qemu: Make qemuBuildVirtioDevProps() const correct

This involves a bit of a hack, but is overall preferable to
forcing callers to pass non-const devdata as argument.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Make qemuBuildDeviceAddressProps() const correct
Andrea Bolognani [Wed, 20 Oct 2021 10:16:41 +0000 (12:16 +0200)] 
qemu: Make qemuBuildDeviceAddressProps() const correct

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Make virDomainDeviceInfoFormat() const correct
Andrea Bolognani [Thu, 23 Sep 2021 13:43:26 +0000 (15:43 +0200)] 
conf: Make virDomainDeviceInfoFormat() const correct

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: Add replies for QEMU 6.2.0 on aarch64
Andrea Bolognani [Wed, 6 Oct 2021 16:22:51 +0000 (18:22 +0200)] 
tests: Add replies for QEMU 6.2.0 on aarch64

These were generated using a QEMU binary built from commit
v6.1.0-1552-g362534a643

Notably, this causes the arguments of -device to be generated
in JSON format.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agorpc: Temporarily stop accept()-ing new clients on EMFILE
Michal Privoznik [Tue, 12 Oct 2021 07:55:38 +0000 (09:55 +0200)] 
rpc: Temporarily stop accept()-ing new clients on EMFILE

This commit is related to 5de203f879 which I pushed a few days
ago. While that commit prioritized closing clients socket over
the rest of I/O process, this one goes one step further and
temporarily suspends processing new connection requests.

A brief recapitulation of the problem:

1) assume that libvirt is at the top of RLIMIT_NOFILE (that is no
   new FDs can be opened).

2) we have a client trying to connect to a UNIX/TCP socket

Because of 2) our event loop sees POLLIN on the socket and thus
calls virNetServerServiceAccept(). But since no new FDs can be
opened (because of 1)) the request is not handled and we will get
the same event on next iteration. The poll() will exit
immediately because there is an event on the socket.  Thus we end
up in an endless loop.

To break the loop and stop burning CPU cycles we can stop
listening for events on the socket and set up a timer tho enable
listening again after some time (I chose 5 seconds because of no
obvious reason).

There's another area where we play with temporarily suspending
accept() of new clients - when a client disconnects and we check
max_clients against number of current clients. Problem here is
that max_clients can be orders of magnitude larger than
RLIMIT_NOFILE but more importantly, what this code considers
client disconnect is not equal to closing client's FD.
A client disconnecting means that the corresponding client
structure is removed from the internal list of clients. Closing
of the client's FD is done from event loop - asynchronously.

To avoid this part stepping on the toes of my fix, let's make the
code NOP if socket timer (as described above) is active.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoSwitch to new GitHub repo-lockdown configuration
Daniel P. Berrangé [Mon, 18 Oct 2021 13:45:25 +0000 (14:45 +0100)] 
Switch to new GitHub repo-lockdown configuration

The repo-lockdown service used to run as a bot outside GitHub, but has
now switched to using the GitHub Actions workflow framework. This
requires use of a new configuration file.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: remove use of implicit boolean syntax for guest features
Daniel P. Berrangé [Tue, 5 Oct 2021 17:00:41 +0000 (18:00 +0100)] 
qemu: remove use of implicit boolean syntax for guest features

Some guest features that map to the -cpu arg are still added using
implicit syntax "feature" which is a deprecated shorthand for
"feature=on".

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: inline the qemuBuildCpuFeature code
Daniel P. Berrangé [Tue, 5 Oct 2021 16:46:17 +0000 (17:46 +0100)] 
qemu: inline the qemuBuildCpuFeature code

With the previous refactorings, there's no real benefit from the
qemuBuildCpuFeature helper method. Only one of the callers really
needs the CPU feature name re-writing logic, the others can just
use the right name directly.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: remove use of (+|-)name syntax for -cpu featres
Daniel P. Berrangé [Tue, 5 Oct 2021 16:46:17 +0000 (17:46 +0100)] 
qemu: remove use of (+|-)name syntax for -cpu featres

The -cpu arg gained support for feature=on|off syntax for the x86
emulator in 2.4.0

  commit 38e5c119c2925812bd441450ab9e5e00fc79e662
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Mon Mar 23 17:29:32 2015 -0300

    target-i386: Register QOM properties for feature flags

Most other targets gained this syntax even earlier in 1.4.1

  commit 1590bbcb02921dfe8e3cf66e3a3aafd31193babf
  Author: Andreas Färber <afaerber@suse.de>
  Date:   Mon Mar 3 23:33:51 2014 +0100

    cpu: Implement CPUClass::parse_features() for the rest of CPUs

    CPUs who do not provide their own implementation of feature parsing
    will treat each option as a QOM property and set it to the supplied
    value.

There appears no reason to keep supporting "+|-feature" syntax,
given the current minimum QEMU version.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: always use hyphens in hyperv feature names
Daniel P. Berrangé [Thu, 7 Oct 2021 14:33:35 +0000 (15:33 +0100)] 
qemu: always use hyphens in hyperv feature names

QEMU switched from using underscores in x86 CPU features to hyphens
in the 2.8.0 series with two commits

  commit fc7dfd205f3287893c436d932a167bffa30579c8 (HEAD, refs/bisect/bad)
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:40 2016 -0300

    target-i386: Remove underscores from feat_names arrays

  commit 54b8dc7c19cd781e96f1e9b001ca6001d804eb19
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:38 2016 -0300

    target-i386: Register aliases for feature names with underscores

Libvirt names use underscores so we conditionally tranlate the
names when talking to new QEMU. Since the min QEMU was raised to
version 2.11.0, all QEMU versions we talk to expect hypens, so
the translation can be done unconditionally.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: always translate underscores to hyphens in CPU features
Daniel P. Berrangé [Thu, 7 Oct 2021 14:25:54 +0000 (15:25 +0100)] 
qemu: always translate underscores to hyphens in CPU features

QEMU switched from using underscores in x86 CPU features to hyphens
in the 2.8.0 series with two commits

  commit fc7dfd205f3287893c436d932a167bffa30579c8 (HEAD, refs/bisect/bad)
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:40 2016 -0300

    target-i386: Remove underscores from feat_names arrays

  commit 54b8dc7c19cd781e96f1e9b001ca6001d804eb19
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:38 2016 -0300

    target-i386: Register aliases for feature names with underscores

Libvirt names use underscores so we conditionally tranlate the
names when talking to new QEMU. Since the min QEMU was raised to
version 2.11.0, all QEMU versions we talk to expect hypens, so
the translation can be done unconditionally.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoci: switch all non-released distros to be non-gating
Daniel P. Berrangé [Wed, 20 Oct 2021 10:43:37 +0000 (11:43 +0100)] 
ci: switch all non-released distros to be non-gating

The non-released distros have reasonably frequent package installation
failures that can last for days at a time. This makes them unsuitable
for use as gating CI jobs.

This ensures all of the jobs in Debian Sid, Fedora Rawhide, openSUSE
Tumbleweed and FreeBSD Current are marked "allow-failure: true".

This means the jobs still run, but any failure will not be considered
fatal to the pipeline.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoci: refresh configuration from manifest
Daniel P. Berrangé [Wed, 20 Oct 2021 10:37:16 +0000 (11:37 +0100)] 
ci: refresh configuration from manifest

The layering of the cross containers is fixed to move arch specific
ccache setup out of the common base layer.

A missing Cirrus CI variable substitution is added, though this is
irrelevant given libvirt's package list.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemuMonitorBlockStatsUpdateCapacity: Remove 'backingChain' argument
Peter Krempa [Tue, 19 Oct 2021 13:57:25 +0000 (15:57 +0200)] 
qemuMonitorBlockStatsUpdateCapacity: Remove 'backingChain' argument

Always fetch the stats for all backing chain members. Callers from
qemu_driver.c already always passed 'true' and the caller from the
migration code won't mind when we fetch all stats.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuMonitorGetAllBlockStatsInfo: Remove 'backingChain' argument
Peter Krempa [Tue, 19 Oct 2021 13:25:46 +0000 (15:25 +0200)] 
qemuMonitorGetAllBlockStatsInfo: Remove 'backingChain' argument

All (proper) callers pass true so we can remove the argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuMonitorJSONQueryBlockstats: Refactor cleanup
Peter Krempa [Tue, 19 Oct 2021 13:05:21 +0000 (15:05 +0200)] 
qemuMonitorJSONQueryBlockstats: Refactor cleanup

Use automatic memory clearing and remove the cleanup label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuDomainGetStatsBlock: Refactor cleanup
Peter Krempa [Tue, 19 Oct 2021 12:48:16 +0000 (14:48 +0200)] 
qemuDomainGetStatsBlock: Refactor cleanup

Use automatic memory clearing for the temporary variables and remove the
cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuMonitorJSONBlockStatsUpdateCapacityOne: Refactor cleanup
Peter Krempa [Tue, 19 Oct 2021 12:48:16 +0000 (14:48 +0200)] 
qemuMonitorJSONBlockStatsUpdateCapacityOne: Refactor cleanup

Use automatic memory clearing for the temporary variable and remove the
cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuMonitorJSONBlockStatsUpdateCapacity: Refactor cleanup
Peter Krempa [Tue, 19 Oct 2021 12:48:16 +0000 (14:48 +0200)] 
qemuMonitorJSONBlockStatsUpdateCapacity: Refactor cleanup

Use automatic memory clearing for the temporary variable and remove the
cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuDomainGetStatsBlock: Always fetch stats for the full backing chain
Peter Krempa [Tue, 19 Oct 2021 13:12:36 +0000 (15:12 +0200)] 
qemuDomainGetStatsBlock: Always fetch stats for the full backing chain

Similarly to the fix to 'qemuDomainBlocksStatsGather' we should be
always fetching the full backing chain so that we can avoid any
automatic filter notes which would prevent us from fetching the stats
for the correct nodename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuDomainBlocksStatsGather: Always fetch stats for the full backing chain
Peter Krempa [Tue, 19 Oct 2021 12:32:09 +0000 (14:32 +0200)] 
qemuDomainBlocksStatsGather: Always fetch stats for the full backing chain

In certain cases such as when running a backup blockjob qemu installs a
filter node between the frontend and the top node of the backend of the
disk. The stats gathering code didn't instruct the monitor code to fetch
the stats for all the layers, so since the top layer now doesn't have
stats we were reporting wrong stats such as allocation.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2015281
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: tpm: Run swtpm_setup --create-config-files in session mode
Stefan Berger [Tue, 19 Oct 2021 13:43:20 +0000 (09:43 -0400)] 
qemu: tpm: Run swtpm_setup --create-config-files in session mode

Using swtpm v0.7.0 we can run swtpm_setup to create default config files
for swtpm_setup and swtpm-localca in session mode. Now a user can start
a VM with an attached TPM without having to run this program on the
command line before. This program needs to run once.

This patch addresses the issue raised in
https://bugzilla.redhat.com/show_bug.cgi?id=2010649

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>