Commit Graph

7637 Commits

Author SHA1 Message Date
Peter Krempa
84d1347dbe qemuxml2argvtest: Add device with 'ramfb=off' to 'hostdev-mdev-display-ramfb'
Add a test case where 'ramfb' is explicitly disabled for a mediated
device to prevent regressing again.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-19 12:40:41 +01:00
Peter Krempa
2cb53c61cf qemuxml2argvtest: Fix type for faked chardev backing a TPM
The test filled the chardev type to VIR_DOMAIN_CHR_TYPE_FILE and thus
set the 'data.emulator.source->data.file.path' pointer, but the
commandline formatter is unconditionally expecting VIR_DOMAIN_CHR_TYPE_UNIX
and thus reading 'data.emulator.source->data.nix.path'. Since it's an
union it happened to land in the correct place. Fix the faked data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-19 12:38:35 +01:00
Peter Krempa
42b0000699 conf: Properly instantiate virDomainChrSourceDef in virDomainTPMDef
'virDomainChrSourceDef' contains private data so 'virDomainChrSourceDefNew'
must be used to allocate it. 'virDomainTPMDef' was using it directly
which won't work with the chardev helper functions.

Convert it to a pointer to properly allocate private data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-19 12:38:35 +01:00
Daniel Henrique Barboza
bbbf774fb2 tests/qemuxml2*/graphics-spice-timeout: skip CPU model check
Commit 65b0b746b5 changed spice tests to use latest caps. Before this
change, "FLAG_REAL_CAPS" wasn't being set in testQemuInfoInitArgs(). The
absence of this flag triggered the code path inside
testCompareXMLToArgv() that executed testUpdateQEMUCaps(). This function
will update the host CPU via virQEMUCapsUpdateHostCPUModel() into
virQEMUCapsInitHostCPUModel(). In this function,
virQEMUCapsInitCPUModel() would end up updating the hostCPU inside the
qemuCaps (via virQEMUCapsProbeHostCPU()). Before the forementioned
commit, the host CPU was being defaulted to x86_64, vendor Intel, for
the 'graphics-spice-timeout' test that is using the 'pc' machine type
and 'accel=kvm'.

Today, "FLAG_REAL_CAPS" is being set because we're using the latest caps
from x86_64. This means that the whole code path mentioned above is
skipped. qemuCaps are now being loaded via virQEMUCapsLoadCache()
directly. Without the handling being done by testUpdateQEMUCaps(), the
host CPU is being retrieved later on, down below
qemuProcessCreatePretendCmdPrepare() into qemuProcessUpdateGuestCPU().
The latter will attempt to update the domain cpu and executing a
virCPUCompare with the hostCPU and def->cpu.

All this logic ended up causing a failure of the
'graphics-spice-timeout' test in ppc64 and s390x hosts. This test is
being run with KVM acceleration, and the KVM driver for ppc64 and s390x
will return a default x86_64 CPU with vendor "AMD", making
virCPUCompare() fail with the following message:

"QEMU XML-2-ARGV graphics-spice-timeout.x86_64-latest   ... libvirt: CPU
Driver error : the CPU is incompatible with host CPU: host CPU vendor does
not match required CPU vendor Intel"

Fix this test by setting cpu check='none' and avoid the virCPUCompare()
that causes the problem for ppc64 and s390x hosts.

Note that this is a build fix. A more adequate fix would be to mock the
getHost() interface of the cpuDriverX86 for non-x86 hosts, allowing
'fullCPU' to be retrieved in qemuProcessUpdateGuestCPU(), and a proper
x86 CPU to be retrieved in the scenario described above.

Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2021-11-17 22:47:21 -03:00
Peter Krempa
279c64dccb qemu: command: Use JSON for parameters of -audiodev
'-audiodev' as a modern implementation based on QAPI already takes JSON
as the argument. Convert our code to use it directly.

The declaration of the QAPI types can be found in
'qemu.git/qapi/audio.json'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-17 12:04:11 +01:00
Peter Krempa
14af0a3290 qemu: command: Use JSON for parameters of -compat
'-compat' as a modern implementation based on QAPI already takes JSON as
the argument. Convert our code to use it directly.

QEMU declares the ised QAPI types as:

{ 'enum': 'CompatPolicyInput',
  'data': [ 'accept', 'reject', 'crash' ] }

{ 'enum': 'CompatPolicyOutput',
  'data': [ 'accept', 'hide' ] }

{ 'struct': 'CompatPolicy',
  'data': { '*deprecated-input': 'CompatPolicyInput',
            '*deprecated-output': 'CompatPolicyOutput' } }

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-17 12:04:11 +01:00
Peter Krempa
829b6982cc virjsontest: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-17 12:04:11 +01:00
Peter Krempa
8049041720 qemublocktest: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-17 12:04:11 +01:00
Daniel Henrique Barboza
9b2130ec8e tests: update QEMU and domain ppc64 capabilities for qemu 6.2
This patch updates domaincapsdata and qemucapabilitiesdata for ppc64
with qemu commit v6.1.0-1714-gc5b2f55981.

Changes in all 'ppc64-latest.ags' files were needed. The changes are
mundane despite the volume. For all 'ppc64-latest.args' files the
changes are:

- removing '-sandbox' command line;
- 'secret' and 'memory-backend-ram' objects are now using qom-type format;
- '-device' is now using qom-type format.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2021-11-12 13:44:42 -03:00
Martin Kletzander
5d972ad910 Add suggestions for virt-pki-query-dn usage
To make it easier for users to figure out how the DN should be formatted.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-12 12:37:29 +01:00
Martin Kletzander
7e6295cc7d Remove needless space
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-11 18:31:30 +01:00
Martin Kletzander
555c24a55d docs: Simplify explanation of tls_allowed_dn_list wildcards
This removes a dead link, the need for users to understand a glib function and a
improper reference to fnmatch (as we only expand asterisks to any string).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-11 18:31:29 +01:00
Michal Privoznik
7c79cfe4da tests: Drop cleanup/error labels
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-11-11 16:16:30 +01:00
Michal Privoznik
74da85bcb9 test: Use g_autofree more
This commit doesn't aim to extinguish every VIR_FREE() call, but
only those which were touched by the previous commit. The aim is
to drop cleanup/error labels.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-11-11 16:16:28 +01:00
Michal Privoznik
b118215703 tests: Use g_autoptr(qemuMonitorTest)
Instead of calling qemuMonitorTestFree() explicitly, we can use
g_autoptr() and let it be called automagically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-11-11 16:16:26 +01:00
Michal Privoznik
e97be65e65 qemu: Use g_autoptr(qemuMonitorCPUModelInfo)
There are two instances of an explicit call to
qemuMonitorCPUModelInfoFree() which in fact can be turned into
g_auto().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-11-11 16:16:22 +01:00
Michal Privoznik
7c2a4e84b7 Prefer g_auto(GStrv) over g_strfreev()
There are a few cases where a string list is freed by an explicit
call of g_strfreev(), but the same result can be achieved by
g_atuo(GStrv).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-11-11 16:16:17 +01:00
Michal Privoznik
ac35a9fca2 qemuagenttest: Don't leak virTypedParameter on failure
There are two functions (testQemuAgentOSInfo() and
testQemuAgentTimezone()) which call virTypedParamsFree() only in
successful paths. If an error is met then those parameters would
be leaked. Fix this by placing the virTypedParamsFree() calls on
better place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-11-11 16:16:02 +01:00
Pavel Hrdina
d73265af6e qemu_command: do not use host-nodes for system memory
Commit 88957116c9 switched to use
memory-backend-* for regular VM memory as well. That change indirectly
started using 'host-nodes' for system memory which results in QEMU
calling mbind() to bind the system memory to specific NUMA node if the
VM XML contains the configuration similar to this:

  ...
  <numatune>
    <memory mode='strict' nodeset='0'/>
  </numatune>
  ...

Once the VM was started with that configuration it was no longer
possible to change the memory NUMA nodeset.

Fixes: 677c90cc1d
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-10 11:17:44 +01:00
Tim Wiederhake
f976f90465 testVshTableHeader: Cleanup
Remove unnecessary label and goto. This also fixes a bug where a
failure to create the table would result in the test passing.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-08 14:32:32 +01:00
Tim Wiederhake
1fc3f05293 testLXCCapsInit: Cleanup
Remove unnecessary label and goto. Cleanup line breaks.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-08 14:32:32 +01:00
Tim Wiederhake
086f44a0fe fillXenCaps: Cleanup
Rework to remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-08 14:32:32 +01:00
Tim Wiederhake
3bc6f46d30 qemu: Invalidate capabilities cache on host cpuid mismatch
See https://bugzilla.redhat.com/show_bug.cgi?id=1953389.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-05 17:12:25 +01:00
zhanglei
85e4f3db7c qemu: refactor 'qemuAgentGetInterfaces'
Add report_unsupported parameter to qemuAgentGetInterfaces

Signed-off-by: zhanglei <zhanglei@smartx.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-11-05 13:38:40 +01:00
Stefan Berger
a5bbe1a8b6 qemu: tpm: Extend TPM domain XML with PCR banks to activate
Extend the TPM backend XML with a node 'active_pcr_banks' that allows a
user to specify the PCR banks to activate before starting a VM. Valid
choices for PCR banks are sha1, sha256, sha384 and sha512. When the XML
node is provided, the set of active PCR banks is 'enforced' by running
swtpm_setup before every start of the VM. The activation requires that
swtpm_setup v0.7 or later is installed and may not have any effect
otherwise.

<tpm model='tpm-tis'>
  <backend type='emulator' version='2.0'>
    <active_pcr_banks>
      <sha256/>
      <sha384/>
    </active_pcr_banks>
  </backend>
</tpm>

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

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-05 09:22:50 +01:00
Ján Tomko
da0a5ef598 qemu: retire QEMU_CAPS_SPICE_UNIX
It is now unused.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-04 14:37:15 +01:00
Ján Tomko
d7c814f7f7 tests: convert name-escape to use real caps
For later QEMUs than 2.11 we do FD passing for character devices,
so lock the capabilites to this exact version.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-04 14:37:15 +01:00
Ján Tomko
65b0b746b5 tests: qemuxml2argv: use latest caps for spice tests
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-04 14:37:15 +01:00
Ján Tomko
966e08ebef tests: qemuxml2xml: use latest caps for spice tests
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-04 14:37:15 +01:00
Ján Tomko
ee7a03bd55 tests: qemuxml2xmltest: move graphics-spice-timeout
Move the test closer to other graphics-spice tests.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-04 14:37:15 +01:00
Ján Tomko
5a766de16a tests: remove disks from spice tests
Reduce the churn in following patches.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-04 14:37:13 +01:00
Peter Krempa
6448470eca 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>
2021-11-04 10:55:28 +01:00
Peter Krempa
1e4aff444c 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>
2021-11-04 10:55:28 +01:00
Michal Privoznik
196e6faabd 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>
2021-11-03 14:46:54 +01:00
Michal Privoznik
4f607caba0 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>
2021-11-03 14:46:54 +01:00
Ján Tomko
20ccc19a3c 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>
2021-11-03 10:14:12 +01:00
Dmitrii Shcherbakov
935fbcf9da 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>
2021-11-02 13:43:23 +00:00
Dmitrii Shcherbakov
600f580d62 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>
2021-11-02 13:43:23 +00:00
Dmitrii Shcherbakov
43820e4b80 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>
2021-11-02 13:43:23 +00:00
Michal Privoznik
b72419f387 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>
2021-11-02 10:52:18 +01:00
zhenwei pi
74447e404d tests: qemu: add kvm-pv-ipi off test
Since b2757b697e
(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>
2021-11-02 09:23:53 +01:00
zhenwei pi
4c54af1c93 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>
2021-11-02 09:23:53 +01:00
Peter Krempa
cc54647fb0 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>
2021-11-01 17:37:15 +01:00
Peter Krempa
43e2c6544e 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>
2021-11-01 17:37:15 +01:00
Peter Krempa
cf68184e74 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>
2021-11-01 17:37:15 +01:00
Peter Krempa
91453650f3 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>
2021-11-01 17:37:15 +01:00
Peter Krempa
5f5e490c93 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>
2021-11-01 17:37:15 +01:00
Peter Krempa
ac9f3a4444 qemu: monitor: Remove unused qemuMonitorSetCPU
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-01 16:14:53 +01:00
Peter Krempa
4b1199a5c4 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>
2021-11-01 16:14:53 +01:00
Michal Privoznik
2996a94dd0 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>
2021-11-01 16:08:26 +01:00
Michal Privoznik
c18d9e23fa 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>
2021-11-01 16:05:52 +01:00
zhangjl02
f3ac931d36 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>
2021-11-01 15:56:47 +01:00
Ani Sinha
d89fd6d93d 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>
2021-10-25 23:42:01 -04:00
Laine Stump
97475487f8 Revert "qemu: capablities: detect acpi-pci-hotplug-with-bridge-support"
This reverts commit 58ba0f6a3d.

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>
2021-10-25 23:18:41 -04:00
Laine Stump
dba9893831 Revert "conf: introduce support for acpi-bridge-hotplug feature"
This reverts commit 7300ccc9b3.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
2021-10-25 23:18:41 -04:00
Laine Stump
26e8eda46e Revert "qemu: command: add support for acpi-bridge-hotplug feature"
This reverts commit bef0f0d8be.

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>
2021-10-25 23:18:41 -04:00
Laine Stump
1a786fda0e Revert "qemuxml2argvtest: Use real-caps testing for 'acpi-hotplug-bridge-disable'"
This reverts commit 2d20f0bb05.

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>
2021-10-25 23:18:40 -04:00
Laine Stump
85094a4d60 Revert "qemuxml2argvtest: Add '-enable' variants for ACPI-hotplug related cases"
This reverts commit 6414603105.

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>
2021-10-25 23:18:40 -04:00
Laine Stump
ea373d6c07 Revert "qemuxml2xmltest: Convert all acpi-hotplug control related tests to DO_TEST_CAPS_LATEST"
This reverts commit da896d440c.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
2021-10-25 23:18:40 -04:00
Laine Stump
d65eb5dd8d Revert "qemu: capabilities: Remove QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE"
This reverts commit 618e8665db.

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
58ba0f6a3d. 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>
2021-10-25 23:18:40 -04:00
Peter Krempa
8e3a7c6db9 qemublocktest: Don't leak 'disk' in testQemuImageCreateLoadDiskXML
The function returns only the source portion but forgot to free the disk
wrapper.

Fixes: 9696427ad6
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2021-10-25 16:11:49 +02:00
Or Ozeri
060f344c80 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>
2021-10-25 14:06:15 +02:00
Or Ozeri
59090adf63 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>
2021-10-25 14:06:15 +02:00
Or Ozeri
ab1d46d612 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>
2021-10-25 14:06:15 +02:00
Or Ozeri
0398be5da6 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>
2021-10-25 14:06:15 +02:00
Or Ozeri
9696427ad6 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>
2021-10-25 14:06:15 +02:00
Michal Privoznik
857df2fe50 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>
2021-10-25 12:48:46 +02:00
Michal Privoznik
7ce6a2f30e 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>
2021-10-22 07:00:44 +02:00
Dmitrii Shcherbakov
3954378d06 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>
2021-10-21 17:34:04 +01:00
Dmitrii Shcherbakov
38003e7551 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>
2021-10-21 17:34:04 +01:00
Dmitrii Shcherbakov
59c1bc3a0e 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>
2021-10-21 17:34:04 +01:00
Andrea Bolognani
d2872fc47f 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>
2021-10-20 16:52:45 +02:00
Daniel P. Berrangé
f18592adb1 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>
2021-10-20 13:19:49 +01:00
Daniel P. Berrangé
ff3e93a26b 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>
2021-10-20 13:01:41 +01:00
Daniel P. Berrangé
a81784ea3a 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>
2021-10-20 13:01:33 +01:00
Daniel P. Berrangé
7bf6292fb3 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>
2021-10-20 13:01:22 +01:00
Peter Krempa
5f5631707f 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>
2021-10-20 13:43:37 +02:00
Peter Krempa
6f34a991c7 testCompareXMLToArgvValidateSchemaCommand: Add validation for '-device'
Now that we use JSON with -device we can validate it at least partially
(since the schema for 'device_add' is for now incomplete) against the
QMP schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:59 +02:00
Peter Krempa
c9b13e0557 qemu: Use JSON directly for '-device'
Starting with QEMU-6.2 started accepting a JSON object as argument for
'-device' which will also become the only syntax considered stable by
qemu in the future.

Since libvirt was recently converted to generate the properties via JSON
to begin wit we can start using it on the commandline as well, by simply
enabling the QEMU_CAPS_DEVICE_JSON capability, which we do by probing
for the 'json-cli' feature flag of 'device_add'.

Normally a change which changes a commandline output should be happening
only after the impacted real-caps test files are forked in the version
preceding the change, but in this case it's not necessary as the logic
for generating the device properties stays identical and we just change
the output format (avoid conversion). Additionally we still have a lot
of tests validating the conversion to the old commandline options.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:58 +02:00
Peter Krempa
697e796981 qemuMonitorTestProcessCommandDefaultValidate: Partially validate 'device_add'
Use the 'allowIncomplete' argument of testQEMUSchemaValidateCommand to
validate at least properties which are already described by the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:58 +02:00
Peter Krempa
b17fd211e2 testQEMUSchemaValidateCommand: Add possibility for partial QMP validation
The QMP schema for 'device_add' is not complete yet. Allow validation of
incomplete schema so that we can enable at least some validation. Once
there's more schema in the future all present members are still
validated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:58 +02:00
Peter Krempa
387c900de9 qemucapabilitiestest: Update qemu-6.2 cycle capability test data
Update to v6.1.0-1510-gc148a05721 which most notably adds the 'json-cli'
feature for 'device_add' QMP command meaning that -device accepts JSON.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:58 +02:00
Michal Privoznik
c2c67fe4fd objecteventtest: Don't overwrite @ret on failure
Our general pattern is to initialize @ret to -1 and set it to 0
only at the end of a function. Some functions in
objecteventtest.c do not follow this pattern.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-10-18 12:09:33 +02:00
Michal Privoznik
5ae12eba7f objecteventtest: Drop lifecycleEventCounter_reset()
The sole purpose of the lifecycleEventCounter_reset() function is
to zero out given lifecycleEventCounter struct. Well, we can let
the compiler zero it out when declaring a variable and just
remove the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-10-18 12:09:23 +02:00
Hiroki Narukawa
06b45f2c5e qemu_capabilities: Add QEMU_CAPS_QUERY_DIRTY_RATE capability
query-dirty-rate command is used for virsh domstats by default, but this
is available only on qemu >=5.2.0.

In this commit, add capability flag for query-dirty-rate first.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-18 10:37:14 +02:00
Michal Privoznik
44d8324f13 virnetsocket: Don't free virCommand in virNetSocketNewConnectCommand()
The aim of virNetSocketNewConnectCommand() is to execute passed
command and attach socket pair/pipe to it so that client socket
can be opened (this is used for connections with alternative
transports, e.g. ssh). The virCommand is created in a caller and
then passed to virNetSocketNewConnectCommand() where it is freed
using virCommandFree(). This approach is wrong on two levels:

1) The deallocation happens on a different level than allocation,
2) There's a WIN32 stub that just reports an error and doesn't
   free the command.

However, with g_autoptr() trickery the command can be freed in
caller.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-15 16:03:22 +02:00
Michal Privoznik
0cddf1978c qemu: capabilities: Retire QEMU_CAPS_VIRTIO_PCI_ATS
The capability reflects whether QEMU is capable of -device
virtio-*,ats=. Since the property was introduced in QEMU commit
v2.9.0-rc0~162^2~32 we can safely assume the property is always
present as the minimal version required is 2.11.0.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:49:11 +02:00
Michal Privoznik
8607dc3706 qemuxml2argvtest: Drop negative virtio-*-ats tests
There are some tests cases in qemuxml2argvtest that aim to check
whether our validator rejects <driver ats=''/> when
QEMU_CAPS_VIRTIO_PCI_ATS capability is not present.  Well, such
scenario can't happen really because the capability will always
be present.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:49:07 +02:00
Michal Privoznik
02c4c29823 qemu: capabilities: Retire QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM
The capability reflects whether QEMU is capable of -device
virtio-*,iommu_platform=. Since the property was introduced in
QEMU commit v2.9.0-rc0~162^2~37 we can safely assume the property
is always present as the minimal version required is 2.11.0.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:49:04 +02:00
Michal Privoznik
4b91b98889 qemuxml2argvtest: Drop negative virtio-*-iommu tests
There are some tests cases in qemuxml2argvtest that aim to check
whether our validator rejects <driver iommu=''/> when
QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM capability is not present.
Well, such scenario can't happen really because the capability
will always be present.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:48:59 +02:00
Michal Privoznik
01bfd5e33d test: Drop unused .args or .xml files
There are a few files containing expected output for test cases
that no longer exist. Remove them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:48:47 +02:00
Han Han
d139171d80 qemu: Add support for virtio device option page-per-vq
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1925363

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-15 09:40:58 +02:00
Peter Krempa
c30064a94c qemucapabilitiestest: Add test data for the qemu-6.2 development cycle
The data is based on commit v6.1.0-1313-gc09124dcb8

Notable changes:

- New machine types for the 6.2 cycle were added
- MEM_UNPLUG_ERROR event was deprecated and replaced by
  DEVICE_UNPLUG_GUEST_ERROR
- Intel SGX related commands and devices added
- 'copy-before-write' blockdev filter was added
- 'memory-backend-epc' was added
- new cpu flags

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-12 14:23:53 +02:00
Peter Krempa
89ba187943 qemuBuildTPMCommandLine: Generate via JSON
We control only the 'tpmdev' property of TPM devices which is a string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:13 +02:00
Peter Krempa
6e9231d6c0 qemuBuildVideoCommandLine: Generate via JSON
We control the following properties of the devices in question:

'virtio-gpu'
  virgl=<bool>           - on/off (default: true)

'qxl'
  ram_size=<uint32>      -  (default: 67108864)
  vram_size=<uint64>     -  (default: 67108864)
  vram64_size_mb=<uint32> -  (default: 4294967295)
  vgamem_mb=<uint32>     -  (default: 16)
  max_outputs=<uint16>   -  (default: 0)

'vhost-user-gpu'
  max_outputs=<uint32>   -  (default: 1)
  chardev=<string>

'VGA'
  vgamem_mb=<uint32>     -  (default: 16)

'bochs-display'
  vgamem=<size>          -  (default: 16777216)

common for all devices:
  xres=<uint32>          -  (default: 0)
  yres=<uint32>          -  (default: 0)

The only noticable change is using memory size in bytes for
'bochs-display' instead of kibibytes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:13 +02:00
Peter Krempa
cb1721767b qemu: monitor: Remove legacy 'device_add' infrastrcture
Remove the old-style 'device_add' helpers which parse the commandline
arguments to JSON since we now coverted all usage to use JSON directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:13 +02:00
Peter Krempa
9ac91fcceb qemuBuildChrDeviceCommandLine: Generate via JSON
Build commandlines for character devices via JSON.

For devices using 'VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL' address
type 'qemuBuildDeviceAddressProps' will now generate the address. The
only special property is 'nr'. QEMU declares it as:

  nr=<uint32>            -  (default: 4294967295)

The test fallout is caused by formatting addresses as decimal numbers
instead of hex as described in the commit which added
'qemuBuildDeviceAddressProps'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 11:11:13 +02:00
Peter Krempa
3e8d38237d qemuBuildUSBControllerDevStr: Split out validation of USB controller
Move the validation code into a separate function. For now the
validation is still kept in the commandline format step as simply just
moving it to the validator causes failures in the test suite, which will
need to be investigated deeper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:05 +02:00
Peter Krempa
d8f04f1575 qemuBuildControllerPCIDevStr: Format via JSON properties
Internally format the PCI controller properties into JSON, but convert
it back to a string so that we for now change just the SCSI controller.

The change in tests is expected as the 'port' field for various PCI
controllers is expected to be a number and thus can't be represented as
a hexadecimal value in JSON.

QEMU expects the following types:

'pci-bridge'
  chassis_nr=<uint8>     -  (default: 0)

'pxb-pcie':
  bus_nr=<uint8>         -  (default: 0)

'pcie-root-port'
  port=<uint8>           -  (default: 0)
  chassis=<uint8>        -  (default: 0)
  hotplug=<bool>         -  (default: true)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:05 +02:00
Peter Krempa
626df95907 qemuBuildControllerSCSIDevStr: Format via JSON properties
Internally format the SCSI controller properties into JSON, but convert
it back to a string so that we for now change just the SCSI controller.

The change in tests is expected as the 'reg' field for a spapr-vio
address is expected to be a number:

  $ qemu-system-ppc64 -device spapr-vscsi,help
  spapr-vscsi options:
    reg=<uint32>           -  (default: 4294967295)

The hand-rolled generator used hex representation but that will not be
possible on the monitor via JSON.

The properties of 'virtio-scsi' have following types according to QEMU:

  iothread=<link<iothread>>
  num_queues=<uint32>    -  (default: 4294967295)
  cmd_per_lun=<uint32>   -  (default: 128)
  max_sectors=<uint32>   -  (default: 65535)
  ioeventfd=<bool>       - on/off (default: true)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:05 +02:00
Peter Krempa
e840ed6f3d qemuBuildNicDevProps: Move formatting of bootindex
Move the bootindex before the address so that the code is simpler.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:05 +02:00
Peter Krempa
dc481f11a6 qemuBuildDiskCommandLine: Generate via JSON
The types for the special fields of the 'virtio-blk-pci' according to
QEMU are:
  iothread=<link<iothread>>
  ioeventfd=<bool>       - on/off (default: true)
  event_idx=<bool>       - on/off (default: true)
  scsi=<bool>            - on/off (default: false)
  num-queues=<uint16>    -  (default: 65535)
  queue-size=<uint16>    -  (default: 256)

For all disks we also use the following properties (based on 'scsi-hd'):
  device_id=<str>
  share-rw=<bool>        -  (default: false)
  drive=<str>            - Node name or ID of a block device to use as a backend
  chardev=<str>          - ID of a chardev to use as a backend  <-  vhost-user-blk-pci
  bootindex=<int32>
  logical_block_size=<size> - A power of two between 512 B and 2 MiB (default: 0)
  physical_block_size=<size> - A power of two between 512 B and 2 MiB (default: 0)
  wwn=<uint64>           -  (default: 0)
  rotation_rate=<uint16> -  (default: 0)
  vendor=<str>
  product=<str>
  removable=<bool>       - on/off (default: false)
  write-cache=<OnOffAuto> - on/off/auto (default: "auto")
  cyls=<uint32>          -  (default: 0)
  heads=<uint32>         -  (default: 0)
  secs=<uint32>          -  (default: 0)
  bios-chs-trans=<BiosAtaTranslation> - Logical CHS translation algorithm, auto/none/lba/large/rechs (default: "auto") <- ide-hd
  serial=<str>
  werror=<BlockdevOnError> - Error handling policy, report/ignore/enospc/stop/auto (default: "auto")
  rerror=<BlockdevOnError> - Error handling policy, report/ignore/enospc/stop/auto (default: "auto")

The 'wwn' field is changed from a hex string to a number since qemu
actually treats it as a number.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
9616976433 qemu: capabilities: Retire QEMU_CAPS_VIRTIO_(BLK|NET)_EVENT_IDX
Both are assumed as always present since last commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
bc5c57ad7e qemu: capabilities: Retire QEMU_CAPS_VIRTIO_IOEVENTFD
It's not used since last commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
6c3a85648c qemuBuildSCSIHostdevDevProps: Reorder 'drive','id' and 'bootindex' after address
Simplify the generator by shuffling around few fields.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
2e4bc16370 qemuBuildPCIHostdevDevProps: Move 'failover_pair_id' property before address
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
9ac81c58d3 qemuBuildHostdevMediatedDevProps: Move 'ramfb' and 'bootindex' before the address
Simplify the generator by moving few properties earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
c234430b73 qemuBuildMemballoonCommandLine: Reorder properties
Move the 'deflate-on-oom' and 'free-page-reporting' before the address
to simplify the genrator code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
d5ae0517dc qemuBuildVirtioDevStr: Format also virtioOptions
Merge the code from qemuBuildVirtioOptionsStr so that we don't have to
call two separate functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
fd2aed1ab5 qemuxml2xmltest: Remove 'panic-isa' case
The same test in regards to the 'panic' device is the 'panic-double'
case, thus panic-isa can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
bab8d47797 qemuxml2argvtest: Convert 'panic' test cases to DO_TEST_CAPS_LATEST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
3209048f36 tests: qemuxml2argv: Test also the i6300esb watchdog
Convert one of the tests to a different device.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
c7d26f4742 tests: qemuxml2argv: Convert watchdog tests on x86_64 to DO_TEST_CAPS_LATEST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
4b67fe3843 virCommandGetArgList: Remove 'nargs' argument
The returned argument list is a NULL-terminated string list and the only
caller doesn't use the count. Remove the argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
debc33ef84 qemuxml2argvtest: Refactor QAPI schema validation code
Prevent duplication of code when extending the validator for new
commands. Add a struct describing a command to validate and make the
validation loop a bit more robust to corner cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
424dc5d2d2 qemu: Remove 'qemuBuildCommandLineFlags' and associated code
The -netdev formatter code switched to a real virQEMUCaps flag so we can
remove the old flags which used to enable JSON for -netdev for
validation purposes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
36253a48b4 testCompareXMLToArgvValidateSchema: Base -netdev validation on JSON
Base the validation on presence of JSON as we do with other validated
commands. This will prepare the code for a refactor so that it's the
same for all validated commands.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:00 +02:00
Peter Krempa
618e8665db qemu: capabilities: Remove QEMU_CAPS_PIIX4_ACPI_HOTPLUG_BRIDGE
Commit 58ba0f6a3d added a capability which
is supported by all qemu versions we support. Remove it and the
associated dead code. Since the capability isn't present in any upstream
release we can delete it completely.

Specifically the commit itself states that it was introduced "around
(qemu) 2.1". The rest of the code handles properly that the feature is
used only on x86 with the i440fx machine so the capability is pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 09:41:22 +02:00
Peter Krempa
da896d440c qemuxml2xmltest: Convert all acpi-hotplug control related tests to DO_TEST_CAPS_LATEST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 09:41:22 +02:00
Peter Krempa
6414603105 qemuxml2argvtest: Add '-enable' variants for ACPI-hotplug related cases
We have input files for those, provide also xml2argv testing since we
have them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 09:41:22 +02:00
Peter Krempa
2d20f0bb05 qemuxml2argvtest: Use real-caps testing for 'acpi-hotplug-bridge-disable'
We can use real example configs to prove the support without the
need for using fake capabilities. Fix the recently added test cases.

The negative case for 'pc-i440fx-acpi-hotplug-bridge-disable' is removed
completely as there is no real qemu libvirt supports which wouldn't
have the capability.

The input file for the negative test on aarch64 is modified so that it's
actually a reasonably valid VM config.

Fixes: bef0f0d8be
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 09:41:22 +02:00
Peter Krempa
2017b9f0c0 qemuxml2argvtest: Use real-caps testing for 'pc-i440fx-acpi-root-hotplug-disable'
We can use two real example configs to prove the support without the
need for using fake capabilities. Fix the recently added test cases.

Fixes: 133d7983d6
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 09:41:22 +02:00
Ani Sinha
bef0f0d8be qemu: command: add support for acpi-bridge-hotplug feature
This change adds backend qemu command line support for new libvirt
global feature 'acpi-bridge-hotplug'. This option can be used as
following:

<feature>
  <pci>
    <acpi-bridge-hotplug state='off|on'/>
  </pci>
</feature>

The '<pci>' sub-element under '<feature>' is also newly introduced.

'acpi-bridge-hotplug' turns on the following command line option to
qemu for x86 guests:

(pc): -global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=<off|on>

(q35): -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=<off|on>

This change also adds the required qemuxml2argv unit tests in order to
test correct qemu arguments. Unit tests have also been added to test
qemu capability validation checks as well as checks for using this
option with the right architecture.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-10 13:21:04 -04:00
Ani Sinha
7300ccc9b3 conf: introduce support for acpi-bridge-hotplug feature
This change introduces a new libvirt sub-element <pci> under
<features> that can be used to configure all pci related features.
Currently the only sub-sub element supported by this sub-element is
'acpi-bridge-hotplug' as shown below:

<features>
  <pci>
    <acpi-bridge-hotplug state='on|off'/>
  </pci>
</features>

The above option is only available for the QEMU driver, for x86 guests
only. It is a global option, affecting all PCI bridge controllers on
the guest.

The 'acpi-bridge-hotplug' option enables or disables ACPI hotplug
support for cold-plugged pci bridges. Examples of bridges include the
PCI-PCI bridge (pci-bridge controller) for pc (i440fx) machinetypes,
or PCIe-PCI bridges and pcie-root-port controllers for q35
machinetypes.

For pc machinetypes in x86, this option has been available in QEMU
since version 2.1. Please see the following changes in qemu repo:

9e047b982452c6 ("piix4: add acpi pci hotplug support")
133a2da488062e ("pc: acpi: generate AML only for PCI0 devices if PCI
               bridge hotplug is disabled")

For q35 machinetypes, this was introduced in QEMU 6.1 with the
following changes in qemu repo:

(a) c0e427d6eb5fef ("hw/acpi/ich9: Enable ACPI PCI hot-plug")
(b) 17858a16950860 ("hw/acpi/ich9: Set ACPI PCI hot-plug as default on
                   Q35")

The reasons for enabling ACPI based hotplug for PCIe (q35) based
machines (as opposed to native hotplug) are outlined in (b). There are
use cases where users would still want to use native
hotplug. Therefore, this config option enables users to choose either
ACPI based hotplug or native hotplug for bridges (for example for pcie
root port controller in q35 machines).

Qemu capability validation checks have also been added along with
related unit tests to exercise the new conf option.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-10 13:13:45 -04:00
Ani Sinha
58ba0f6a3d qemu: capablities: detect acpi-pci-hotplug-with-bridge-support
qemu added support for i440fx specific global boolean flag

PIIX4_PM.acpi-pci-hotplug-with-bridge-support

around version 2.1. This flag is enabled by default. When disabled, it
turns off acpi pci hotplug for cold plugged pci bridges in i440fx
machine types.

Very recently, in qemu version 6.1, the same global option was also
added for q35 machine types as well.

ICH9-LPC.acpi-pci-hotplug-with-bridge-support

This option turns on or off acpi based hotplug for cold plugged pcie
bridges like pcie root ports. This flag is also enabled by
default. Please refer to the following qemu changes:

c0e427d6eb5fef ("hw/acpi/ich9: Enable ACPI PCI hot-plug")
17858a16950860 ("hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35")

This patch adds the corresponding qemu capabilities in libvirt. For
i440fx, the capability is detected as
QEMU_CAPS_PIIX_ACPI_HOTPLUG_BRIDGE. For q35, the capability is
detected as QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE.

Please note that the test specific qemu capabilities .replies files
has already been updated as a part of regular refreshing them when a
new qemu version is released. Hence, no updates to those files are
required.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-10 13:12:50 -04:00
Ján Tomko
e7801a490c qemu: do not put virtiofs socket in private data
Reconstruct the socket path from priv->libDir in every user.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-06 12:03:12 +02:00
Ján Tomko
ebdcb2a900 tests: qemuxml2argvtest: fix path to virtiofs socket
The mocked path in the test suite is not in sync with what libvirtd
generates.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-06 12:03:12 +02:00
Ján Tomko
da4efc5433 qemu: vhost-user-fs: format alias on the command line
The commit adding the vhost-user-fs device forgot to format
the device's alias on the command line.

Thankfully it was not needed yet because virtiofs migration
is not yet supported, but it will be needed in the future
to allow hot(un)plug.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-06 12:03:11 +02:00
Ani Sinha
400979fd06 qemu: capabilities: remove -en from piix4-acpi-root-hotplug-en
The capability name piix4-acpi-root-hotplug-en is not conventional and
appreared to be confusing to some. "en" suffix is also incorrect as the
capability in qemu is used to both enable and disable hotplug on the pci root
bus on the i440fx. Hence, rename it to piix4.acpi-root-pci-hotplug so that it
is clearer, less confusing and more accurate.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-05 00:07:23 -04:00
Ani Sinha
133d7983d6 qemu: command: add support to enable/disable hotplug on pci-root controller
This change adds qemu backend command line support for enabling or disabling
hotplug on the pci-root controller using the 'target' sub-element of the
pci-root controller as shown below:

<controller type='pci' model='pci-root'>
  <target hotplug='off'/>
</controller>

'<target hotplug='off/on'/>' is only valid for pc (i440fx-based x86)
machinetypes and turns on the following command line option that is passed
to qemu for x86 guests:

-global PIIX4_PM.acpi-root-pci-hotplug=<off/on>

Before introduction of this attribute, hotplug was always enabled for
pci-root of an i440fx-based machinetype, and since its introduction
the default setting has always been "on" for those machinetypes.

This change also adds the required qemuxml2argv unit tests in order to test
correct qemu arguments. Unit tests have also been added to test qemu capability
validation checks.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-01 14:42:18 -04:00
Ani Sinha
8eadf82fb5 conf: introduce option to enable/disable pci hotplug on pci-root controller
This change introduces libvirt xml support to enable/disable hotplug on the
pci-root controller. It adds a 'target' subelement for the pci-root controller
with a 'hotplug' property. This property can be used to enable or disable
hotplug for the pci-root controller. For example, in order to disable hotplug
on the pci-root controller, one has to use set '<target hotplug='off'>' as
shown below:

<controller type='pci' model='pci-root'>
  <target hotplug='off'/>
</controller>

'<target hotplug='on'>' option would enable hotplug for pci-root controller.
This is also the default value. This option is only available for pc machine
types and is applicable for qemu/kvm accelerator only.This feature was
introduced from qemu version 5.2 with the following change in qemu repository:

3d7e78aa7777f ("Introduce a new flag for i440fx to disable PCI hotplug on the root bus")

The above qemu commit describes some reasons why users might to disable hotplug
on PCI root buses.

Related unit tests to exercise the new conf option has also been added.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-01 14:19:44 -04:00
Ani Sinha
fdec09b00a qemu: capablities: detect presence of acpi-root-pci-hotplug for i440fx machines
The following change in qemu added support for a global boolean flag specific
to i440fx machines that would turn off or on acpi based hotplug for pci root
bus:

3d7e78aa7777f ("Introduce a new flag for i440fx to disable PCI hotplug on the root bus")

The option is passed as "-global PIIX4_PM.acpi-root-pci-hotplug=on" etc in qemu
commandline. It is enabled by default. This patch adds the corresponding qemu
capabilities in libvirt as QEMU_CAPS_PIIX_ACPI_ROOT_PCI_HOTPLUG.

Please note that the test specific qemu capabilities .replies files has already
been updated as a part of regular refreshing them when a new qemu version is
released. Hence, no updates to those files are required.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-10-01 14:19:41 -04:00
Michal Privoznik
363866a1e2 qemu: Build command line for virtio-mem
Nothing special is happening here. All important changes were
done when for 'virtio-pmem' (adjusting the code to put virtio
memory on PCI bus, generating alias using
qemuDomainDeviceAliasIndex(). The only bit that might look
suspicious is no prealloc for virtio-mem. But if you think about
it, the whole purpose of this device is to change amount of
memory exposed to guest on the fly. There is no point in locking
the whole backend in memory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-01 11:04:05 +02:00
Michal Privoznik
f931cb7f21 conf: Introduce virtio-mem <memory/> model
The virtio-mem is paravirtualized mechanism of adding/removing
memory to/from a VM. A virtio-mem-pci device is split into blocks
of equal size which are then exposed (all or only a requested
portion of them) to the guest kernel to use as regular memory.
Therefore, the device has two important attributes:

  1) block-size, which defines the size of a block
  2) requested-size, which defines how much memory (in bytes)
     is the device requested to expose to the guest.

The 'block-size' is configured on command line and immutable
throughout device's lifetime. The 'requested-size' can be set on
the command line too, but also is adjustable via monitor. In
fact, that is how management software places its requests to
change the memory allocation. If it wants to give more memory to
the guest it changes 'requested-size' to a bigger value, and if it
wants to shrink guest memory it changes the 'requested-size' to a
smaller value. Note, value of zero means that guest should
release all memory offered by the device. Of course, guest has to
cooperate. Therefore, there is a third attribute 'size' which is
read only and reflects how much memory the guest still has. This
can be different to 'requested-size', obviously. Because of name
clash, I've named it 'current' and it is dealt with in future
commits (it is a runtime information anyway).

In the backend, memory for virtio-mem is backed by usual objects:
memory-backend-{ram,file,memfd} and their size puts the cap on
the amount of memory that a virtio-mem device can offer to a
guest. But we are already able to express this info using <size/>
under <target/>.

Therefore, we need only two more elements to cover 'block-size'
and 'requested-size' attributes. This is the XML I've came up
with:

  <memory model='virtio-mem'>
    <source>
      <nodemask>1-3</nodemask>
      <pagesize unit='KiB'>2048</pagesize>
    </source>
    <target>
      <size unit='KiB'>2097152</size>
      <node>0</node>
      <block unit='KiB'>2048</block>
      <requested unit='KiB'>1048576</requested>
    </target>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
  </memory>

I hope by now it is obvious that:

  1) 'requested-size' must be an integer multiple of
     'block-size', and
  2) virtio-mem-pci device goes onto PCI bus and thus needs PCI
     address.

Then there is a limitation that the minimal 'block-size' is
transparent huge page size (I'll leave this without explanation).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-01 11:02:53 +02:00
Michal Privoznik
ed7c51b42e qemu_capabilities: Introduce QEMU_CAPS_MEMORY_BACKEND_RESERVE
This capability tracks whether memory-backend-* supports .reserve
attribute which is going to be important for backends associated
with virtio-mem devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-01 11:02:09 +02:00
Michal Privoznik
284d9c46d7 qemu_capabilities: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI
This commit introduces a new capability that reflects virtio-mem-pci
device support in QEMU:

  QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI, /* -device virtio-mem-pci */

The virtio-mem-pci device was introduced in QEMU 5.1.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-01 11:01:32 +02:00
Michal Privoznik
45aa4c1d2a virhostmem: Introduce virHostMemGetTHPSize()
New virHostMemGetTHPSize() is introduced which allows caller to
obtain THP PMD (Page Middle Directory) size, which is equal to
the minimal size that THP can use, taken from kernel doc
(Documentation/admin-guide/mm/transhuge.rst):

  Some userspace (such as a test program, or an optimized memory allocation
  library) may want to know the size (in bytes) of a transparent hugepage::

    cat /sys/kernel/mm/transparent_hugepage/hpage_pmd_size

Since this size depends on the host architecture and the kernel
it won't change whilst libvirtd is running. Therefore, we can use
virOnce() and cache the value. Of course, we can be running under
kernel that has THP disabled or has no notion of THP at all. In
that case a negative value is returned to signal error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-01 10:58:27 +02:00
Ján Tomko
0522f02f35 qemu: deprecate QEMU_CAPS_FSDEV_CREATEMODE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-27 10:11:22 +02:00
Ján Tomko
f501cec73d qemu: Deprecate QEMU_CAPS_MACHINE_KERNEL_IRQCHIP
Now that it's no longer used, remove probing for it
and mark it as deprecated.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-27 10:11:22 +02:00
Ján Tomko
3f3cf5899c qemu: capabilities: deprecate QEMU_CAPS_SECCOMP_BLACKLIST
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-27 10:11:21 +02:00
Peter Krempa
960ec985a2 qemu: capabilities: Retire QEMU_CAPS_SPICE_FILE_XFER_DISABLE
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:01 +02:00
Peter Krempa
686caa57e5 qemu: validate: Always assume QEMU_CAPS_SPICE_FILE_XFER_DISABLE
QEMU added the capability to disable file transfers via spice in commit
5ad24e5f3b ("spice: Add -spice disable-agent-file-transfer cmdline
option (rhbz#961850)") released in qemu-v1.6.0 and the option can't be
disabled.

Remove the unnecessary validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:01 +02:00
Peter Krempa
1ceb92d415 qemuxml2argvtest: Modernize the rest of 'graphics-vnc' tests
As with previous test replace the fake caps versions with a combination
of DO_TEST_CAPS_VER(..., "2.11.0") and DO_TEST_CAPS_LATEST().

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:00 +02:00
Peter Krempa
eaf44b2c67 qemuxml2argvtest: Add DO_TEST_CAPS_LATEST for the vnc unix socket tests
Now that the code is refactored add the DO_TEST_CAPS_LATEST versions as
promised in the commit adding the pinned versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:00 +02:00
Peter Krempa
41763b6cfa qemu: capabilities: Retire QEMU_CAPS_VNC_MULTI_SERVERS
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:00 +02:00
Peter Krempa
c94c76c4e6 qemu: command: Always QEMU_CAPS_VNC_MULTI_SERVERS
All supported qemu versions now use the new commandline parser
functions, thus we can remove the old-style commandline generator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:00 +02:00
Peter Krempa
8c5d7c44c1 qemuxml2argvtest: Replace vnc unix socket tests with pinned versions
Replace the 3 unix socket tests with real caps versions to demonstrate
that supported qemus no longer use the old syntax.

DO_TEST_CAPS_LATEST versions will be added later.

This also removes duplicate invocation of 'graphics-vnc-socket'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:00 +02:00
Peter Krempa
3fa36eeb7a qemu: capabilities: Retire QEMU_CAPS_VNC_OPTS
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:00 +02:00
Peter Krempa
087dbb16c6 qemu: command: Always assume QEMU_CAPS_VNC_OPTS
The switch to QemuOpts parser which brought the long-form options
happened in qemu commit 4db14629c3 ("vnc: switch to QemuOpts, allow
multiple servers") released in v2.3.0.

We can always assume this capability and remove the old-style
generators.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:00 +02:00
Peter Krempa
62b019c0fe qemu: capabilities: Retire QEMU_CAPS_OBJECT_TLS_CREDS_X509
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:37:00 +02:00
Peter Krempa
18de1d7621 qemu: Always assume presence of QEMU_CAPS_OBJECT_TLS_CREDS_X509
The 'tls-creds-x509' object is always registered even when qemu is built
without gnutls for all supported qemu versions. This means we cannot
probe for its support and thus simplify the code using TLS.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:36:59 +02:00
Peter Krempa
54d43e3619 qemuxml2argvtest: Use real caps in "graphics-vnc-tls" case
Replace the fake caps invocation with invocation binding it to the
oldest supported qemu version.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-24 10:36:59 +02:00
Peter Krempa
ef8f06c882 qemuxml2argvtest: remove 'fs9p' cases with fake capabilities.
The filesystem commandline doesn't differ in the '-latest' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
4dc709a983 qemuxml2argvtest: Pin old-style '-no-reboot' usage to qemu-5.2
After qemu-5.2 we always use -no-shutdown.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
c8b6dde975 qemuxml2argvtest: Use versioned ("4.1.0") capabilities for pre '-audiodev' cases
Use real caps instead of fake caps for the legacy cases. This will also
show us when we can remove the old-style code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
102b84451a tests: qemu: Remove 's390-ccw' machine type from fake capabilities
Modern QEMUs don't support the machine type at all. Remove it from our
fake caps generator too and adjust test cases which depend on it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
266628906f qemuxml2argvtest: Modernize s390x disk tests
An update to the machine type was necessary as 's390-ccw' is no longer
supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
bf4595d8d5 qemuxml2argvtest: Modernize 'disk-floppy-pseries' case
Use real caps. The flooppy device still is forbidden for ppc64.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
62b0be5fda qemuxml2argvtest: Modernize outstanding disk-backend related tests
For backend related tests we need to cover the pre-blockdev and
post-blockdev era, so the fake-capability test is converted to a
combination of DO_TEST_CAPS_VER(..., "4.1.0") and DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
01766f74eb qemuxml2argvtest: Modernize 'disk-network-rbd-no-colon' case
The test case fails in pre-blockdev scenarios as it would pass RBD
parameters behind our back but succeeds after as we pass it in JSON form
which doesn't have that defect.

Cover both cases instead of the fake-caps version.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
9ce94fae04 qemuxml2argvtest: Merge 'disk-iscsi' case into 'disk-cache'
Use the iSCSI disk path in one of the disks of the 'disk-cache' test as
it's the only specialty of 'disk-iscsi' case and remove the now
pointless files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
d8023425f1 qemuxml2argvtest: Replace 'disk-network-iscsi' by the more comprehensive 'disk-network-iscsi-modern'
Move the contents of 'disk-network-iscsi-modern' into 'disk-network-iscsi'
to reuse the name and also invocation with real capablities and remove
the leftovers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
b54aaafe4d qemuxml2argvtest: Use real caps for all disk frontend property tests
Cases for covering disk frontend properties can be converted to
DO_TEST_CAPS_LATEST without any need for intermediate capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
fe6816eb93 qemuxml2argvtest: Use DO_TEST_CAPS_LATEST_PARSE_ERROR for disk cases
Convert all the disk-related negative cases to use 'latest'
capabilities. The checks are mostly related to validation so using
real capabilities doesn't influence the outcome.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
70906cec03 qemuxml2argvtest: Convert encrypted disk test cases to DO_TEST_CAPS_LATEST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
1323408151 qemuxml2argvtest: Remove 'disk-usb-nosupport' case
In effor to convert all test cases to real capability testing, this
test doesn't make sense any more as even the oldest QEMU supported
supports USB storage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
b5ce2a652c qemuxml2argvtest: Remove negative case for 'luks-disks-source-qcow2'
Currently we no longer support qemus which would miss the necessary
capability, thus the test can't be converted to DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
646c06bb48 qemuxml2argvtest: Remove fake caps versions of disk tests we have a versioned test for
Many disk-related test case have both a fake capability version and one
tied to qemu-2.12. Remove all of those fake caps tests as we have
coverage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
ba491ddab7 qemuxml2argvtest: Agregate all 'disk'-related test cases
There were a few disk-related test cases spread around in the test
invocation calls. Move them together with disk tests and move one
irrelevant case away from the disk test block.

Note that there are still a few tests having 'disk' in the name but they
belong to different groups mostly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
b59b2319a6 qemuxml2argvtest: Remove 'boot-strict' case
It's identical to 'boot-order'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
4560736c9c testQemuInfoInitArgs: Report error if path to 'latest' caps for an arch is NULL
When looking up the 'latest' caps they might not be present. Report an
error instead of crashing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
1bb7b3aa9c testCompareXMLToArgv: Avoid use of uninitialized 'monitor_chr'
Failure of 'testQemuInfoInitArgs' jumps over the initialization of
'monitor_chr' via memset, which leads to a crash.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Luke Yue
6cd6225778 tests: Test IOThread related functions for test driver
testIOThreadAdd tests iothreadinfo and iothreadadd
testIOThreadDel tests iothreadinfo and iothreaddel
testIOThreadSet tests domstats and iothreadset
testIOThreadPin tests iothreadadd, iothreadinfo and iothreadpin

Above tests should cover the IOThreads related APIs for test driver

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:39 +02:00
Peter Krempa
db66d0247a qemu: Simplify qemuDomainSecretInfo
Now that we've removed support for plaintext secrets qemuDomainSecretInfo
can be simplified by removing the 'type' field and merging in all the
fields from 'qemuDomainSecretAES'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-22 14:53:56 +02:00
Peter Krempa
09466e1f62 qemu: capabilities: Retire QEMU_CAPS_ISCSI_PASSWORD_SECRET
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-22 14:53:56 +02:00
Peter Krempa
900270a24f qemu: domain: Always assume QEMU_CAPS_ISCSI_PASSWORD_SECRET
QEMU supports the 'password-secret' parameter to pass a QCryptoSecret
since 2.9. Remove the alternate plaintext logic.

Unfortunately this had a ripple effect of removing qemuCaps from a lot
of functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-22 14:53:55 +02:00
Peter Krempa
b5411ce535 qemu: capabilities: Retire QEMU_CAPS_OBJECT_SECRET
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-22 14:53:55 +02:00
Peter Krempa
0ae3e1313f qemu: Always assume presence of QEMU_CAPS_OBJECT_SECRET
The secret object is supported since qemu-2.6 and can't be compiled out.
Assume the presence to simplify the code.

This enables the use of the secret key for most tests not using real
caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-22 14:53:55 +02:00
Peter Krempa
acfce77201 util: Remove use of virCryptoHaveCipher(VIR_CRYPTO_CIPHER_AES256CBC)
It always returns true. Make the logic a bit simpler to see through.

This completely removes 'virCryptoHaveCipher' as it's pointless in the
current form.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-22 14:53:55 +02:00
Michal Privoznik
2731717a73 lib: Use $PROG instead of $PROG_PATH
Due to the way we detect programs at runtime there's no
difference between $PROG and $PROG_PATH macros that come from
meson-config.h. Either both are set to the path found during
configure or both are set to just "$prog", e.g.:

  #define EBTABLES "/sbin/ebtables"
  #define EBTABLES_PATH "/sbin/ebtables"
  #define FLAKE8 "flake8"
  #define FLAKE8_PATH "flake8"

Change those few places which use _PATH.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 14:09:44 +02:00
Peter Krempa
4bf603a52c qemu: capabilities: Retire QEMU_CAPS_FW_CFG
The code assumes that all supported qemu versions have this capability
so we can retire it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:08 +02:00
Peter Krempa
22c681256b qemu: Assume QEMU_CAPS_FW_CFG
qemu supports this since 81b2b81062 ("fw_cfg: insert fw_cfg file blobs
via qemu cmdline") released in qemu-v2.4.0 and it can't be compiled out.

Assume that the option always works and remove the corresponding check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:08 +02:00
Peter Krempa
04e5b3134f qemu: capabilities: Assume QEMU_CAPS_LOADPARM for s390 only
Added to 'query-command-line-options' in qemu commit 5559716c98
("util/qemu-config: Add loadparm to qemu machine_opts") released in
qemu-v2.10.0 but makes sense for s390 only. Treat it the same as the
keywrap capabilities in previous commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:08 +02:00
Peter Krempa
da20199762 qemu: capabilities: Assume QEMU_CAPS_AES_KEY_WRAP and QEMU_CAPS_DEA_KEY_WRAP for s390 only
qemu introduced these options in 2eb1cd0768 ("s390x: CPACF: Handle key
wrap machine options") released in qemu-v2.3.0 but was exposed in
query-command-line-options only in 5bcfa0c543 ("util/qemu-config: fix
missing machine command line options").

The problem is that they are exposed even for architectures which don't
actually in fact support those.

Make the two capabilities a bit more useful by assuming them only on
s390 and thus removing them from other arches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:08 +02:00
Peter Krempa
e9badd8ac2 qemu: capabilities: QEMU_CAPS_MEM_MERGE
The code assumes that the feature tracked by this capability always
exists.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:08 +02:00
Peter Krempa
db817385e8 qemu: Always assume QEMU_CAPS_MEM_MERGE
Supported since qemu commit 8490fc78e7 ("add -machine mem-merge=on|off
option") released in qemu-v1.3.0 and can't be compiled out.

Assume that it's present and remove the validation code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:08 +02:00
Peter Krempa
0d41080701 qemu: capabilities: Retire QEMU_CAPS_SPLASH_TIMEOUT
The code assumes that the feature tracked by this capability always
exists.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:08 +02:00
Peter Krempa
9216090cf1 qemu: Always assume QEMU_CAPS_SPLASH_TIMEOUT
Supported since qemu commit 3d3b8303c6 ("showing a splash picture when
start") released in qemu-v1.0 and can't be compiled out.

Assume that it's present and remove the validation code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:07 +02:00
Peter Krempa
c561268806 qemuxml2argvtest: Remove negative case for 'boot-menu-enable-with-timeout'
The feature is now always present. Remove the negative test case as the
upcomming commit will remove the checks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:07 +02:00
Peter Krempa
81469b3d51 qemu: capabilities: Retire QEMU_CAPS_REBOOT_TIMEOUT
The code assumes that the feature tracked by this capability always
exists.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:07 +02:00
Peter Krempa
2b928f1c2d qemu: Always assume QEMU_CAPS_REBOOT_TIMEOUT
Supported since ac05f34924 ("add a boot parameter to set reboot
timeout") released in qemu-v1.3.0 and can't be compiled out.

Assume that it's present and remove the validation code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:07 +02:00
Peter Krempa
2b0b0800bf tests: qemuxml2argv: Remove negative case for 'reboot-timeout-enabled'
All supported qemu versions now support this feature so this test is
pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:07 +02:00
Peter Krempa
0a9052e03e qemu: capabilities: Retire QEMU_CAPS_BOOT_STRICT
It's not used since last commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:07 +02:00
Peter Krempa
e2aa0c3b5a qemu: command: Always assume 'QEMU_CAPS_BOOT_STRICT'
Added by c8a6ae8bb9 in qemu-v1.5.0 and can't be compiled out. Assume
that it's present and fix all fake-caps tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:06 +02:00
Peter Krempa
6c49c2ee9f virDevMapperGetTargets: Use a linked list as return type
Of the two callers one simply iterates over the returned paths and the
second one appends the returned paths to another linked list. Simplify
all of this by directly returning a linked list.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:25:42 +02:00
Hiroki Narukawa
2d6d67e154 qemu: Implement virtio-blk queue-size option
The option "queue-size" in virtio-blk was added in qemu-2.12.0, and
default value increased from qemu-5.0.0.

However, increasing this value may lead to drop of random access
performance.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-09-21 12:22:49 +02:00
Hiroki Narukawa
ad209e7dbc qemu: add QEMU_CAPS_VIRTIO_BLK_QUEUE_SIZE capability
To support virtio-blk queue-size option, this commit adds capability
detection to the option.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-09-21 12:22:49 +02:00
Hiroki Narukawa
32967b891e qemuxml2*test: Make disk-virtio-queues tests use DO_TEST_CAPS_LATEST
Currently disk-virtio-queues test is now using specifying a fake
capability.

By this commit this test will make use of DO_TEST_CAPS_LATEST.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-09-21 12:22:48 +02:00
Tim Wiederhake
785a11cec8 Fix typos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-09-17 14:28:00 +02:00
Peter Krempa
cd09fd71d9 qemuxml2argvdata: Remove unused '.err' files
These are no longer referenced by any existing test as of:

os-firmware-invalid-type -> a9b1375d7d
tseg-explicit-size -> 604990a175

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-09-15 11:07:08 +02:00
Jonathon Jongsma
592031a580 nodedev: Add tests for mdevctl autostart command
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-09-14 14:24:07 -05:00
Ján Tomko
05e71df9f3 tests: remove pointless labels
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
2ef57217f8 tests: vir: remove pointless labels
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
cfef887893 tests: vshtabletest: remove pointless labels
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
99318ad945 tests: nwfilter: remove pointless labels
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
4739de290d tests: libxl: remove pointless labels
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
583a561a4f tests: vmx: remove pointless labels
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
8e8603d24b tests: qemu: remove pointless labels
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
6150910cf7 tests: use g_auto instead of virDomainFree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
9e1893ebd0 tests: use g_auto instead of vshTableFree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
e4756024ee tests: use VIR_AUTOCLOSE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
ca24cb1e9b tests: use g_auto instead of VIR_FORCE_FCLOSE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
0047bb18bc tests: use g_auto for virCPUDataFree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
24b5739682 tests: use g_autoptr instead of virJSONValueFree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
296f7173ed tests: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
526551ac0a tests: vir: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
5679b6283b tests: vmx: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
f657b02ce3 tests: nwfilter: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
df7116d1b0 tests: libxl: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
e062566885 tests: network: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
2e3b056cdd tests: qemu: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
d66fb7ac15 tests: use g_autoptr instead of virObjectUnref
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:13 +02:00
Ján Tomko
b078312a69 tests: virnetdaemontest: split variable declarations
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-09 18:06:12 +02:00
Daniel P. Berrangé
69254cafa0 qemu: stop probing for '-device sga' support
Since we no longer use '-device sga' we can stop probing for this device
in our capabilities code.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-09-09 16:17:30 +01:00
Daniel P. Berrangé
40dfef297a qemu: switch to use -M graphics=off instead of -device sga
SeaBIOS >= 1.11 has built-in support for outputting to the serial
console when QEMU sets -M graphics=off. Our minimum QEMU version
is 2.11.0, which bundled SeaBIOS 1.11. Thus we have no need to
use '-device sga' anymore.

This change results in a slight layout difference for option ROMs
in memory, however, it does not affect the migration data stream
format on the wire and once migration is complete the target QEMU
memory layout for ROMs matches the source QEMU once again.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-09-09 16:17:30 +01:00
Peter Krempa
4f7aaa1b7b virstoragetest: Reinstate testing of images without 'backing_fmt'
There are important security implications when we'd misprobe those
images. This commit reinstates the tests removed by commit 979d1ba3ae
since 'qemu-img' refused to format them.

With the new testing approach with stored images we won't run into that
problem.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
12906d1985 virstoragetest: Remove pointless goto from mymain
Improve the error message and abort the test. Continuing here is not
desired as without chdiring into the appropriate directory the test
would fail anyways and worse could attempt stat-ing random files on the
host.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
6aaa4d3cfe virstoragetest: Don't skip the whole test when qemu-img fails to format images
We have plenty of other work to do in this test. Skip only the real
image testing case when we can't find qemu-img or it failed to format
the image.

This allows us to also remove the last global variable in the test and
move the creation and cleanup of the images closer to the actual test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
dad6d609cc virstoragetest: testStorageChain: Skip test if filename is NULL
Prepare the test runner for skipping individual tests if images can't be
formatted rather than the whole virstoragetest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
aa3b29f8fc virstoragetest: testPrepImages: Use 'qemu-img' to format 'raw' image
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
570455d6be virstoragetest: testPrepImages: Don't reuse 'cmd' pointer
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
3ec180f58d virstoragetest: Assume that 'qemu-img' supports '-o compat='
All supported qemu versions have the parameter, so we don't need to
check. This allows us to simplify the code used for formating real
images for virstoragetest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
b8732224a7 virstoragetest: Don't rewrite the 'qcow2' image
Create it with the appropriate backing file path rather than using
another instance of 'qemu-img rebase'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
2d6bd113e2 virstoragetest: Stop rewriting images in 'mymain'
For testing of real images formatted by 'qemu-img' it's now sufficient
to format them once without the need to rewrtie them since we use the
real images only for testing of one scenario.

This allows us to also remove most of the global variables holding the
path to the images which was necessary when they were being rewritten.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
dc80ca18e0 virstoragetest: Unify testing of QCOW2 images with absolute backing
We have 3 test cases for this currently:

1) "qcow2->raw"
 1.1) VIR_STORAGE_FILE_QCOW2 as top level format
 1.2) VIR_STORAGE_FILE_AUTO as top level format
2) "wrap->qcow2->raw" whith just VIR_STORAGE_FILE_QCOW2

This patch adds also testing of VIR_STORAGE_FILE_AUTO for case 2) and
removes both 1) subcases as they are being actually tested as part of
2).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
8f36cf91ac virstoragetest: Use preformatted qcow2 image for testing relative paths
More preparation for eliminating image rewriting.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
229a6d6992 virstoragetest: Convert symlink and relative image testing use preformatted images
Use prepared test images instead to simplify and clarify the code
instead of rewriting existing images multiple times.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
0ee87da294 virstoragetest: Use existing file for testing 'raw' image lookup
We've already added a 'raw' file to the example image directory so we
can use that instead of formatting one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
df020845d5 virstoragetest: Use preformatted file for testing missing backing store
Similarly to previous ones, this one doesn't need to be created by
qemu-img in order for the test to make sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
80412bfbeb virstoragetest: Use pre-formatted file for non-path extraction test
This one doesn't require using qemu-img either.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
325fce82d1 virstoragetest: Use a pre-formatted QED file for testing backing store extraction
The QED format isn't really being developed any more. Use a
pre-formatted image to test the existing code. In this instance we
switch to using a relative backing path for simplicity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
55688197ee virstoragetest: Use existing directory in the source tree for 'directory' probing tests
We don't need a special directory for the tests. Reuse the directory
holding the data for the virstoragetest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
df94a4e907 virstoragetest: Test backing chain loops with hardcoded images
Provide the images for the self and mutual backing image loop cases in
the repository rather than formatting them with qemu-img.

This makes the code more readable and also decouples the backing chain
tests from each other.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
0a67ae731a virstoragetest: Rework TEST_LOOKUP* cases to work on fake backing chain
Rather than using 'qemu-img' and rewriting the chain we can use fake
data and few empty files to ensure the same level of coverage. This is
possible since we've already tested that the metadata parsing from files
works properly and the only thing we are testing here is that the
symlink resolution works properly.

Additionally after the refactor of 'virstoragetest' is complete
additional tests on real data will be added.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
d361234549 virstoragetest: Remove redundant arguments for chain lookup tests
Passing in both "chain*" and "chain*->path" is pointless. Use only the
full struct which we can use to infer the rest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
80c1fea639 virstoragetest: Store output of TEST_CHAIN in output files
The TEST_CHAIN cases were storing the expected output (or rather data
to generate the expected output) in code. This made the code really hard
to follow and even harder to modify to add new cases.

This patch modifies the code to store the expected output in text files
(using the same generator as we've used to) and uses
'virTestCompareToFile' to check the outputs.

The result is that the code is way simpler and doesn't require fiddling
with 'testFileData' structs when adding new cases. Additionally this
removes mixing of code and declaration so we can stop disabling the
warning for this file.

Another advantage is that the tests are now named so it's easier to
figure out if one of them breaks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
de59c4bba2 testutils: Introduce helper for stripping bulilddir/srcdir from test outputs
In certain cases we want to be able to compare test output containing
real paths against a static output file and thus we need a helper which
strips srcdir/builddir from given path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
aea559fa74 virstoragetest: Drop testing of NBD backends via parsing real images
We now have specific tests for the backing store parser and previous
tests cover the extraction of the backing store string so there's no
need for these particular tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
97d7177a11 virstoragetest: Drop testing of RBD backends via parsing real images
We now have specific tests for the backing store parser and previous
tests cover the extraction of the backing store string so there's no
need for these particular tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
5a3c35dc83 qemuxml2argvtest: Add test case for missing disk '<target>'
Cover the case of missing disk target to cover the case fixed by
previous commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-09 10:17:28 +02:00