]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
3 years agoqemuMonitorJSONQueryBlockstats: query stats for helper images
Peter Krempa [Mon, 1 Nov 2021 10:35:41 +0000 (11:35 +0100)] 
qemuMonitorJSONQueryBlockstats: query stats for helper images

Use the 'query-nodes' flag to return all stats. The flag was introduced
prior to qemu-2.11 so we can always use it, but we invoke it only when
querying stats. The other invocation is used for detecting the nodenames
which is fragile code.

The images without a frontend don't have the device field so the
extraction code checks need to be relaxed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemustatusxml2xmldata: backup-pull: Add private data for scratch image
Peter Krempa [Mon, 1 Nov 2021 13:31:42 +0000 (14:31 +0100)] 
qemustatusxml2xmldata: backup-pull: Add private data for scratch image

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainBackupDefFormat: Propagate private data callbacks
Peter Krempa [Mon, 1 Nov 2021 11:42:39 +0000 (12:42 +0100)] 
virDomainBackupDefFormat: Propagate private data callbacks

The formatter for the backup job data didn't pass the virDomainXMLOption
struct to the disk formatter which meant that the private data of the
disk source were not formatted.

This didn't pose a problem for now as the blockjob list remembered the
nodenames for the jobs, but the backup source lost them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: fix documentation for nodedev-start
Jonathon Jongsma [Wed, 3 Nov 2021 19:05:39 +0000 (14:05 -0500)] 
docs: fix documentation for nodedev-start

Presumably the result of a copy/paste mistake, the the argument for the
`nodedev-start` command was described as a 'network' rather than a
'device'.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
3 years agoscripts: Properly declare g_auto() stub for cocci
Michal Privoznik [Tue, 2 Nov 2021 16:32:54 +0000 (17:32 +0100)] 
scripts: Properly declare g_auto() stub for cocci

While being great semantic patching tool, coccinelle fails to
understand some of macros we use (including those provided by
glib). What they have in common is use of __attribute__ under the
hood. We store a list of such macros in a file. But in there,
g_auto() macro is not defined properly. Indeed, g_auto(type)
declares a local variable of given type, for instance from
cocci's POV:

  g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
  virBuffer buf = VIR_BUFFER_INITIALIZER;

are both the same declaration. Fix declaration of g_auto() stub.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agolib: Use G_N_ELEMENTS instead of sizeof()/sizeof()
Michal Privoznik [Tue, 2 Nov 2021 16:32:43 +0000 (17:32 +0100)] 
lib: Use G_N_ELEMENTS instead of sizeof()/sizeof()

For statically declared arrays one can use G_N_ELEMENTS() instead
of explicit sizeof(array) / sizeof(item). I've noticed couple of
places where the latter was used.

I am not fixing every occurrence because we have some places
which do not use glib (examples and NSS module).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agovirpcivpdtest: Declare variables at multiple lines
Michal Privoznik [Tue, 2 Nov 2021 16:26:48 +0000 (17:26 +0100)] 
virpcivpdtest: Declare variables at multiple lines

In testPCIVPDResourceCustomCompareIndex() there are two variables
declared at one line. They are both g_autoptr() decorated which
makes it worse, because coccinelle fails to parse that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agovirpcivpd: Bring variables into loops
Michal Privoznik [Tue, 2 Nov 2021 16:23:41 +0000 (17:23 +0100)] 
virpcivpd: Bring variables into loops

I've noticed one function inside virpcivpd.c, namely
virPCIVPDParseVPDLargeResourceFields() that declares some
variables at the top level even though they are used only inside
a loop in which they have to be freed explicitly.

Bringing variable declarations into the loop allows us to make
the code nicer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agonode_device_conf: Bring variables into loops
Michal Privoznik [Tue, 2 Nov 2021 16:16:16 +0000 (17:16 +0100)] 
node_device_conf: Bring variables into loops

I've noticed three functions inside node_device_conf.c, namely:
 - virNodeDeviceCapVPDParseCustomFields()
 - virNodeDeviceCapVPDParseReadOnlyFields()
 - virNodeDeviceCapVPDParseXML()

that have strange attitude towards g_auto* variables. The first
problem is that variables are declared at the top level despite
being used inside a loop. The second problem is use of g_free()
in combination with g_steal_pointer() even though we have
VIR_FREE() which does exactly that.

Bringing variable declarations into their respective loops allows
us to make the code nicer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agomeson: Fix rst2html5 detection
Andrea Bolognani [Wed, 3 Nov 2021 12:43:34 +0000 (13:43 +0100)] 
meson: Fix rst2html5 detection

The first part of the version string contains the name that the
rst2html5 command was invoked as, which can differ based on the
operating system: on FreeBSD, for example, it's rst2html5.py
instead of just rst2html5.

Fix our detection logic so that it works regardless of the
specific name used for the docutils-provided rst2html5 command.

Fixes: cf0c9e186565e886a0016b2b269088b3eed3d26d
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agotests: qemuxml2argv: remove validation warning
Ján Tomko [Wed, 3 Nov 2021 08:25:20 +0000 (09:25 +0100)] 
tests: qemuxml2argv: remove validation warning

This warning is emitted for pretty much every test case,
making it hard to see what the actual error is.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agomeson: Detect and reject invalid rst2html5 command
Andrea Bolognani [Mon, 9 Aug 2021 15:04:08 +0000 (17:04 +0200)] 
meson: Detect and reject invalid rst2html5 command

The version coming from the rst2html5 package instead of the
docutils package is unable to successfully generate the libvirt
documentation.

Examples of users encountering build issues because of the wrong
version of rst2html5 being installed on their systems:

  https://gitlab.com/libvirt/libvirt/-/issues/40
  https://gitlab.com/libvirt/libvirt/-/issues/139
  https://gitlab.com/libvirt/libvirt/-/issues/169
  https://gitlab.com/libvirt/libvirt/-/issues/195

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoPCI VPD: Fix a wrong return code in a test case
Dmitrii Shcherbakov [Fri, 29 Oct 2021 18:57:18 +0000 (21:57 +0300)] 
PCI VPD: Fix a wrong return code in a test case

The test case should return -1, not 0 in case a valid resource could
not be parsed successfully but the ret value is initialized to 0.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoPCI VPD: Skip fields with invalid values
Dmitrii Shcherbakov [Fri, 29 Oct 2021 18:57:17 +0000 (21:57 +0300)] 
PCI VPD: Skip fields with invalid values

While invalid values need to be ignored when presenting VPD data to the
user, it would be good to attempt to parse a valid portion of the VPD
instead of marking it invalid as a whole.

Based on a mailing list discussion, the set of accepted characters is
extended to the set of printable ASCII characters.

https://listman.redhat.com/archives/libvir-list/2021-October/msg01043.html

The particular example encountered on real hardware was multi-faceted:

* "N/A" strings present in read-only fields. This would not be a useful
  valid value for a field (especially if a unique serial number is
  expected), however, it was decided to delegate handling of those kinds
  of values to higher-level software;
* "4W/1W PCIeG2x4" - looks like some vendors use even more printable
  characters in the ASCII range than we currently allow. Since the
  PCI/PCIe VPD specs mention alphanumeric characters without specifying
  the full character set, it looks like this is ambiguous for vendors
  and they tend to use printable ASCII characters;
* 0xFF bytes present in VPD-W field values. Those bytes do not map to
  printable ASCII code points and were probably used by the vendor as
  placeholders. Ignoring the whole VPD because of that would be too
  strict.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agoPCI VPD: handle additional edge cases
Dmitrii Shcherbakov [Fri, 29 Oct 2021 18:57:16 +0000 (21:57 +0300)] 
PCI VPD: handle additional edge cases

* RV and RW fields must be at the last position in their respective
  section (per the conditions in the spec). Therefore, the parser now
  stops iterating over fields as soon as it encounters one of those
  fields and checks whether the end of the resource has been reached;
* The lack of the RW field is not treated as a parsing error since we
  can still extract valid data even though this is a PCI/PCIe VPD spec
  violation;
* Individual fields must have a valid length - the parser needs to check
  for invalid length values that violate boundary conditions of the
  resource.
* A zero-length field may be the last one in the resource, however, the
  boundary check is currently too strict to allow that.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
3 years agolib: Introduce and use g_autoptr() for virInterfaceDef
Michal Privoznik [Thu, 23 Sep 2021 12:32:24 +0000 (14:32 +0200)] 
lib: Introduce and use g_autoptr() for virInterfaceDef

There are a lot of places where we call virInterfaceDefFree()
explicitly. We can define autoptr cleanup macro and annotate
declarations with g_autoptr() and remove plenty of those explicit
free calls.

This also fixes a memory leak in udevInterfaceGetXMLDesc() which
called virInterfaceDefFree() only in successful path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu: Move code to add encryption options for swtpm_setup into function
Stefan Berger [Mon, 1 Nov 2021 17:23:39 +0000 (13:23 -0400)] 
qemu: Move code to add encryption options for swtpm_setup into function

Move the code that adds encryption options for the swtpm_setup command
line into its own function.

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 agotests: qemu: add kvm-pv-ipi off test
zhenwei pi [Tue, 2 Nov 2021 06:27:51 +0000 (14:27 +0800)] 
tests: qemu: add kvm-pv-ipi off test

Since b2757b697e29fa86972a4638a5879dccc8add2ad
(qemu: support kvm-pv-ipi off), libvirt supports xml definition like:

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

Add test case for this feature.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: qemu: use domain type 'kvm' for kvm-features-off
zhenwei pi [Tue, 2 Nov 2021 06:27:50 +0000 (14:27 +0800)] 
tests: qemu: use domain type 'kvm' for kvm-features-off

KVM features off test cases should be tested for a KVM domain, so
keep align kvm-features-off test with kvm-features except KVM
features on/off.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotestQEMUSchemaValidateEnum: Validate deprecated members
Peter Krempa [Fri, 17 Sep 2021 14:38:11 +0000 (16:38 +0200)] 
testQEMUSchemaValidateEnum: Validate deprecated members

Starting from QEMU-6.2 enum members can be deprecated. Add support to
the validator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQEMUSchemaValidateDeprecated: Move to the top
Peter Krempa [Fri, 17 Sep 2021 14:37:10 +0000 (16:37 +0200)] 
testQEMUSchemaValidateDeprecated: Move to the top

Move the function to the top of the file so other functions placed
towards the top will be able to reuse it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQEMUSchemaValidateEnum: Use new 'members' for 'enum' meta type
Peter Krempa [Fri, 17 Sep 2021 14:26:09 +0000 (16:26 +0200)] 
testQEMUSchemaValidateEnum: Use new 'members' for 'enum' meta type

Switch to the new more featured way to report enum members which will
also allow us to detect use of deprecated members.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQEMUSchemaValidateEnum: Refactor logic to simplify switching to new QMP schema...
Peter Krempa [Fri, 17 Sep 2021 14:21:43 +0000 (16:21 +0200)] 
testQEMUSchemaValidateEnum: Refactor logic to simplify switching to new QMP schema format

QEMU-6.2 is reporting enum values in the new 'members' array which we'll
be switching to. Rewrite the logic so that adding the new checker is
more straightforward.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirQEMUQAPISchemaTraverseEnum: Allow query of enume type features
Peter Krempa [Mon, 20 Sep 2021 13:22:36 +0000 (15:22 +0200)] 
virQEMUQAPISchemaTraverseEnum: Allow query of enume type features

QEMU-6.2 added feature flags for enum types. Add support for querying
them into our QMP schema query language.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirQEMUQAPISchemaTraverseEnum: Use the modern 'members' array
Peter Krempa [Fri, 17 Sep 2021 14:13:49 +0000 (16:13 +0200)] 
virQEMUQAPISchemaTraverseEnum: Use the modern 'members' array

Starting from QEMU-6.2 enum members are reported as an array of objects
under new name "values" so that extra data can be reported for each
member.

Modify the code so that we prefer 'members' and skip 'values' completely
if we've used 'members'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirQEMUQAPISchemaTraverseEnum: Move helper variables into loop
Peter Krempa [Fri, 17 Sep 2021 14:09:59 +0000 (16:09 +0200)] 
virQEMUQAPISchemaTraverseEnum: Move helper variables into loop

Move them closer to where they are actually used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemucapabilitiestest: Update capability probe for qemu-6.2 on x86_64
Peter Krempa [Fri, 29 Oct 2021 09:26:46 +0000 (11:26 +0200)] 
qemucapabilitiestest: Update capability probe for qemu-6.2 on x86_64

Update to v6.1.0-1735-gc52d69e7db which has Markus' patches for
improvements of enum probing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: Fix ambiguous output in metadata-change event
Han Han [Wed, 27 Oct 2021 08:52:33 +0000 (16:52 +0800)] 
virsh: Fix ambiguous output in metadata-change event

When you set metadata with type element like the following:
dom.setMetadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT, "<test/>", 'abc', "HAHAH", 0)

Then for `virsh event --all`, then it will output this message:
event 'metadata-change' for domain 'rhel9': element HAHAH

The message is ambiguous since it looks like the params for
metadata-change event is the element HAHAH. Actually that means the type is
element while the url is HAHAH. Let's make it more clear.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuMonitorJSONSave[Physical|Virtual]Memory: Reformat function headers
Peter Krempa [Wed, 13 Oct 2021 14:40:31 +0000 (16:40 +0200)] 
qemuMonitorJSONSave[Physical|Virtual]Memory: Reformat function headers

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorEjectMedia: Remove stale comment
Peter Krempa [Wed, 13 Oct 2021 14:32:59 +0000 (16:32 +0200)] 
qemuMonitorEjectMedia: Remove stale comment

The QMP implementation didn't use any new approach. The command itself
is now only used with legacy qemu versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: monitor: Remove unused qemuMonitorSetCPU
Peter Krempa [Fri, 29 Oct 2021 13:08:24 +0000 (15:08 +0200)] 
qemu: monitor: Remove unused qemuMonitorSetCPU

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainHotplugAddVcpu: Remove legacy hotplug branch
Peter Krempa [Wed, 13 Oct 2021 14:28:20 +0000 (16:28 +0200)] 
qemuDomainHotplugAddVcpu: Remove legacy hotplug branch

Report an error if the new hotplug is not supported and remove the
alternate code paths.

The modern cpu-hotplug code was introduced in qemu-2.7. We keep the
capability so that proper errors are reported in case a platform doesn't
support hotplug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuhotplugtest: Remove tests for legacy cpu hotplug on x86
Peter Krempa [Wed, 13 Oct 2021 14:26:11 +0000 (16:26 +0200)] 
qemuhotplugtest: Remove tests for legacy cpu hotplug on x86

Modern cpu hotplug was introduced in qemu-2.7, thus all qemu versions
actually support it. Remove the tests for the legacy hotplug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONBlockInfoAdd: Refactor hash table addition
Peter Krempa [Wed, 13 Oct 2021 13:25:15 +0000 (15:25 +0200)] 
qemuMonitorJSONBlockInfoAdd: Refactor hash table addition

Open code virHashAddEntry so that the error code path can be avoided.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONQueryBlock: Reformat function header
Peter Krempa [Wed, 13 Oct 2021 12:57:13 +0000 (14:57 +0200)] 
qemuMonitorJSONQueryBlock: Reformat function header

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolib: Don't check for virCapabilitiesAddGuestDomain() retval
Michal Privoznik [Thu, 7 Oct 2021 08:47:28 +0000 (10:47 +0200)] 
lib: Don't check for virCapabilitiesAddGuestDomain() retval

The virCapabilitiesAddGuestDomain() function can't fail. It
aborts on OOM. Therefore, there's no need to check for its
return value.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolib: Don't check for virCapabilitiesAddGuest() retval
Michal Privoznik [Thu, 7 Oct 2021 08:47:27 +0000 (10:47 +0200)] 
lib: Don't check for virCapabilitiesAddGuest() retval

The virCapabilitiesAddGuest() function can't fail. It aborts on
OOM. Therefore, there's no need to check for its return value.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
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>