Commit Graph

8201 Commits

Author SHA1 Message Date
Michal Privoznik
1fffd1605d tests: Don't wrap virTestDifference() arguments in NULLSTR()
The virTestDifference() is perfectly capable of handling NULL
arguments. There's no need to wrap arguments in NULLSTR().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-12-01 14:22:39 +01:00
Michal Privoznik
69bb187e82 virbuftest: Cleanup code around virTestDifference()
Two things are happening here:

1) Call to virTestDifference() is guarded by '!result ||
   STRNEQ(result, _)' check. This is suboptimal since we have
   STRNEQ_NULLABLE().

2) There are couple of VIR_TEST_DEBUG() printings, which are
   useless. If debug is off they don't print anything, and if it
   is on, then much more information is printed by subsequent
   virTestDifference().

This makes the STRNEQ() + virTestDifference() combo look similar
to the rest of tests and thus can be picked up by spatch later.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-12-01 14:22:39 +01:00
Michal Privoznik
f3b049e878 commandtest: Use virTestCompareToFile() in checkoutput()
In the commandtest there is checkoutput() function which checks
the latest log of commandhelper (containing things like cmd line
arguments, env vars, FDs, CWD, etc.) and compares that against
expected output. Well, the way this function implements that is
effectively by open coding virTestCompareToFile() except for the
nice feature that the virTestCompareToFile() has:
VIR_TEST_OUTPUT_REGENERATE.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-12-01 14:22:39 +01:00
Michal Privoznik
e97b6f4bc5 commandtest: Test virCommandSetSendBuffer() with virCommandDoAsyncIO()
Introduce a test case which ensures that a daemonized process can
work with virCommandSetSendBuffer() when async IO is enabled.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-12-01 14:22:39 +01:00
Michal Privoznik
5c1b5f208a virCommandSetSendBuffer: Take double pointer of @buffer
The virCommandSetSendBuffer() function consumes passed @buffer,
but takes it only as plain pointer. Switch to a double pointer to
make this obvious. This allows us then to drop all
g_steal_pointer() in callers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-12-01 14:22:39 +01:00
Michal Privoznik
5690c9594e commandtest: Use unsigned char in test27()
In test27() the virCommandSetSendBuffer() is used, which expects
unsigned char. Use that type for variables which are passed to
the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-12-01 14:22:39 +01:00
Jiri Denemark
9e5b42b5eb qemu: Replace priv with qemuCaps in qemuMigrationCookieParse
QEMU capabilities is the only thing we use from priv so we can just pass
that directly.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-12-01 11:01:58 +01:00
Jiri Denemark
8745591457 qemu: Reorder qemuMigrationCookieParse arguments
When an internal API takes a vm pointer, it's usually just after the
driver argument.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-12-01 11:01:58 +01:00
Michal Privoznik
b09441b1c5 virmockstathelpers: Load aliases for 64-bit time
On 32-bit arches, it's possible not only to request
-D_FILE_OFFSET_BITS=64 (which is always done with meson) but also
-D_TIME_BITS=64. With glibc, both of these affect what variant of
stat() or lstat() is called. With 64 bit time it's:
__stat64_time64() or __lstat64_time64(), respectively.

Fortunately, no other variant (__xstat(), __xstat64()) has
_time64 alternative and thus does not need similar treatment.

Similarly, musl is not affected by this.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/404
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-21 15:49:36 +01:00
Michal Privoznik
6f80761c08 tests: Drop needless virrandom mock from two tests
Nothing in virnettlscontexttest nor virnettlssessiontest calls
any of random number generator functions overridden
virrandommock. GnuTLS handles RNG within itself.

Therefore, there's no need to preload the mock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-21 15:36:08 +01:00
Peter Krempa
178820663d qemucapabilitiesdata: Update caps for qemu-7.2.0 rc1 on x86_64
Update to v7.2.0-rc1

Notable changes:
 - 'virtio-blk-vfio-pci' blockdev backend added
 - 'cryptodev-backend-lkcf' object added
 - new options/parameters for virtio-*-pci, virtio-*-device, and
   vhost-user-* devices:
    - 'queue_reset'
     - use-started
     - use-disabled-flags
 - 'dma-translation' option for 'intel-iommu' device
 - 'zpcii-disable' commandline parameter removed (not applicable on x86)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-21 14:06:36 +01:00
Michal Privoznik
f1154a4825 qemu_command: Generate thread-context object for main guest memory
When generating memory for main guest memory memory-backend-*
might be used. This means, we may need to generate thread-context
objects too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-11-15 11:56:08 +01:00
Michal Privoznik
f808e7c738 qemu: Generate thread-context object for memory devices
When generating memory for memory devices memory-backend-* might
be used. This means, we may need to generate thread-context
objects too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-11-15 11:56:02 +01:00
Michal Privoznik
1200aa0669 qemu_command: Generate thread-context object for guest NUMA memory
When generating memory for guest NUMA memory-backend-* might be
used. This means, we may need to generate thread-context objects
too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-11-15 11:55:40 +01:00
Michal Privoznik
d5320907e3 qemu_capabilities: Introduce QEMU_CAPS_THREAD_CONTEXT
In its commit v7.1.0-1429-g7208429223 QEMU gained new object
thread-context, which allows running specialized tasks with
affinity set to a given subset of host CPUs/NUMA nodes. Even
though only memory allocation task accepts this new object, it's
exactly what we aim to implement in libvirt. Therefore, introduce
a new capability to track whether QEMU is capable of this object.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-11-15 11:28:45 +01:00
Jim Fehlig
f81ee7b549 tests: Fix libxlxml2domconfigtest
Downstream CI recently encountered failures of libxlxml2domconfigtest when
building libvirt packages against Xen 4.17 rc3 packages. The test fails on
vnuma_hvm config, where suddently the actual json produced by
libxl_domain_config_to_json() contains a 'pnode' entry in the 'vnuma_nodes'
list, which is absent in the expected json. It appears the test has thus far
passed by luck. E.g. I was able to make the test pass in the failing
environment by changing the meson buildtype from debugoptimized to debug.

When a VM config contains vnuma settings, libxlMakeVnumaList() checks if the
number of requested vnuma nodes exceeds the number of physical nodes. The
number of physical nodes is retrieved with libxl_get_physinfo(), which can
return wildly different results in the context of unit tests. This change
mocks libxl_get_physinfo() to return consistent results. All fields of the
libxl_physinfo struct are set to 0 except nr_nodes, which is set to 6 to
ensure the vnuma_hvm configuration is properly tested.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-11 08:10:34 -07:00
Lin Yang
ddb1bc0519 qemu: Add command-line to generate SGX EPC memory backend
According to the result parsing from xml, add the argument of
SGX EPC memory backend into QEMU command line.

$ qemu-system-x86_64 \
    ...... \
    -object '{"qom-type":"memory-backend-epc","id":"memepc0","prealloc":true,"size":67108864,"host-nodes":[0,1],"policy":"bind"}' \
    -object '{"qom-type":"memory-backend-epc","id":"memepc1","prealloc":true,"size":16777216,"host-nodes":[2,3],"policy":"bind"}' \
    -machine sgx-epc.0.memdev=memepc0,sgx-epc.0.node=0,sgx-epc.1.memdev=memepc1,sgx-epc.1.node=1

Signed-off-by: Lin Yang <lin.a.yang@intel.com>
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-11 14:06:47 +01:00
Lin Yang
facadf2491 conf: Introduce SGX EPC element into device memory xml
<devices>
  ...
  <memory model='sgx-epc'>
    <source>
      <nodemask>0-1</nodemask>
    </source>
    <target>
      <size unit='KiB'>512</size>
      <node>0</node>
    </target>
  </memory>
  ...
</devices>

Signed-off-by: Lin Yang <lin.a.yang@intel.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-11 14:06:34 +01:00
Haibin Huang
8db09767a9 conf: expose SGX feature in domain capabilities
Extend hypervisor capabilities to include sgx feature. When available,
the hypervisor supports launching an VM with SGX on Intel platfrom.
The SGX feature tag privides additional details like section size and
sgx1 or sgx2.

Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-11 14:06:31 +01:00
Haibin Huang
6b7c36c8c2 Convert QMP capabilities to domain capabilities
the QMP capabilities:
  {"return":
    {
      "sgx": true,
      "section-size": 1024,
      "flc": true
    }
  }

the domain capabilities:
  <sgx>
    <flc>yes</flc>
    <epc_size>1</epc_size>
  </sgx>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-11 14:06:27 +01:00
Peter Krempa
697e26fac6 qemu: capabilities: Detect support for JSON args for -netdev
JSON args for -netdev were added as precursor for adding the 'dgram'
network backend type. Enable the detection and update test cases using
DO_TEST_CAPS_LATEST.

Enabling the capability also ensures that the -netdev argument is
validated against the QAPI schema of 'netdev_add' which was already
implemented but not enabled.

The parser supporting JSON was added by qemu commit f3eedcddba3 and
enabled when adding stream/dgram netdevs in commit 5166fe0ae46.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-10 13:16:15 +01:00
Roman Bogorodskiy
2e16c9f202 maint: fix "mixing declarations and code" errors
clang 14.0.5 complains:

../src/bhyve/bhyve_device.c:42:29: error: mixing declarations and code
is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
    virDomainPCIAddressSet *addrs = opaque;
                            ^
1 error generated.

And a few similar errors in some other places, mainly bhyve related.
Apply a trivial fix to resolve that.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-11-09 18:22:47 +01:00
Peter Krempa
9c26c1bfd4 conf: Introduce support for 'hv-avic' Hyper-V enlightenment
qemu-6.2 introduced support for the hv-avic enlightenment which allows
to use Hyper-V SynIC with hardware APICv/AVIC enabled.

Implement the libvirt support for it.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/402
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-09 14:08:31 +01:00
Tim Wiederhake
640e1050bf cpu_map: Add missing x86 feature "vgif"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-11-08 21:45:02 +01:00
Tim Wiederhake
f110a88432 cpu_map: Add missing x86 feature "v-vmsave-vmload"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-11-08 21:45:01 +01:00
Tim Wiederhake
f2c04b2367 cpu_map: Add missing x86 feature "avic"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-11-08 21:45:00 +01:00
Tim Wiederhake
501e7c780b cpu_map: Add missing x86 feature "intel-pt-lip"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-11-08 21:44:59 +01:00
Tim Wiederhake
40d6a6d987 cpu_map: Add missing x86 feature "pks"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-11-08 21:44:53 +01:00
Tim Wiederhake
6e84509cde cpu_map: Add missing x86 feature "sgxlc"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-11-08 21:44:41 +01:00
Tim Wiederhake
24b95e07d2 cpu_map: Add missing x86 feature "sgx"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-11-08 21:44:40 +01:00
Tim Wiederhake
10a41a8cbd cpu-data.py: Allow for more than child in feature nodes
cpu-data.py assumes that all "feature" nodes have exactly one child.
This assumption will no longer be true when the cpumap includes alias-
names for features.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-11-08 21:44:16 +01:00
Michal Privoznik
d974ecbab5 qemu_capabilities: Stop detecting QEMU_CAPS_DISK_WRITE_CACHE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
f28807a1e0 qemu: Assume QEMU_CAPS_DISK_WRITE_CACHE
Introduced in QEMU's commit of v2.7.0-rc0~32^2~5 the .write-cache
attribute of virtio-blk dvice is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

The change in some .args is justified, because the qemuxml2argvdatatest
runs these test caseses with very minimalistic set of capabilities,
that's nowhere near real life scenario.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
589e9a769b qemu_capabilities: Stop detecting QEMU_CAPS_DISK_SHARE_RW
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
6c4148f693 qemu: Assume QEMU_CAPS_DISK_SHARE_RW
Introduced in QEMU's commit of v2.9.0-rc0~48^2~25 the .share-rw
attribute of virtio-blk device is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

The change in controller-order.args is justified, because the
qemuxml2argvdatatest runs the test case with very minimalistic
set of capabilities, that's nowhere near real life scenario.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
7b1d8933de qemu_capabilities: Stop detecting QEMU_CAPS_VIRTIO_BLK_QUEUE_SIZE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
0244d42b82 qemu_capabilities: Stop detecting QEMU_CAPS_BLOCKIO
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
7c20bca6ae qemu_capabilities: Stop detecting QEMU_CAPS_VIRTIO_NET_FAILOVER
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
69eeea5d92 qemu: Assume QEMU_CAPS_VIRTIO_NET_FAILOVER
Introduced in QEMU's commit of v4.2.0-rc0~23^2~4 the .failover
attribute of virtio-net device is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
2390c076ee qemu_capabilities: Stop detecting QEMU_CAPS_VIRTIO_NET_HOST_MTU
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
2eab78d5f5 qemu: Assume QEMU_CAPS_VIRTIO_NET_HOST_MTU
Introduced in QEMU's commit of v2.9.0-rc0~162^2~10 the .host_mtu
attribute of virtio-net device is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
fec918000d qemu_capabilities: Stop detecting QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
ed8696549d qemu: Assume QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE
Introduced in QEMU's commit of v2.10.0-rc0~95^2~20 the
.tx_queue_size attribute of virtio-net device is always available
for all QEMU versions we support (4.2.0, currently). Therefore,
we can assume the capability is always set and thus doesn't need
to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
5bb7fe5437 qemu_capabilities: Stop detecting QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
7fd8465187 qemu: Assume QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE
Introduced in QEMU's commit of v2.8.0-rc0~116^2~26 the
.rx_queue_size attribute of virtio-net device is always available
for all QEMU versions we support (4.2.0, currently). Therefore,
we can assume the capability is always set and thus doesn't need
to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
f02190dc54 qemu_capabilities: Stop detecting QEMU_CAPS_QUERY_DISPLAY_OPTIONS
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
7a69622cf3 qemu_capabilities: Stop detecting QEMU_CAPS_BITMAP_MERGE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
55ff57dbf2 qemu_capabilities: Stop detecting QEMU_CAPS_QUERY_CURRENT_MACHINE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
b15e602278 qemu_capabilities: Stop detecting QEMU_CAPS_QOM_LIST_PROPERTIES
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
45d0015d86 qemu_capabilities: Stop detecting QEMU_CAPS_DUMP_COMPLETED
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
bf140a6edd qemu_capabilities: Stop detecting QEMU_CAPS_VSERPORT_CHANGE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
c18e2fd746 qemu_agent: Drop @singleSync from _qemuAgent
Historically, before sending any guest agent command we would
send 'guest-sync' command to make guest agent reset its internal
state and flush any partially read command (json). This was
because there was no event emitted when the agent
(dis-)connected.

But now that we have the event we can execute the sync command
just once - the first time after we've connected. Should agent
disconnect in the middle of reading a command, and then connect
back again we would get the event and disconnect and connect back
again, resulting in the sync command being executed again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
8ffcafe211 qemu_capabilities: Stop detecting QEMU_CAPS_NUMA
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
8bf50fa018 qemu: Assume QEMU_CAPS_NUMA
Introduced in QEMU's commit of v3.0.0-rc0~124^2~1 the
set-numa-node command is always available for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
bb5bc36792 tests: Make qemuAgent single sync
The qemuAgent has option to issue guest-sync command before each
intended command or issue the sync commend just once, right after
the socket is opened and before the first intended command is
issued. The latter is referred to as single sync agent and is
enabled by VSERPORT_CHANGED event which allows us to detect
when the agent (dis-)connects in the guest.

Now, every QEMU that we support (4.2.0 or newer) has the event
and thus will use single sync agent. Therefore, adjust
qemuagenttest to make it test what's used in the real world,
rather than old approach.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
d649faddb3 tests: Drop needless .err files from qemuxml2argvdata/
As some qemxml2argvtest cases were removed, we forgot to remove
their expected output counterparts.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-07 18:25:57 +01:00
Michal Privoznik
fc141bfe88 qemu_capabilities: Stop detecting QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:43 +01:00
Michal Privoznik
881cf3c4f1 qemu_capabilities: Stop detecting QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:43 +01:00
Michal Privoznik
8c0d43803b qemu: Assume QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD
Introduced in QEMU's commit of v2.11.0-rc0~95^2~9 the .discard
attribute of memory-backend-file is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
9b279f2d3e qemu_capabilities: Stop detecting QEMU_CAPS_OBJECT_MEMORY_FILE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
8641fcfa63 qemu: Assume QEMU_CAPS_OBJECT_MEMORY_FILE
Introduced in QEMU's commit of v2.1.0-rc0~41^2~26 only for Linux,
and later in v3.1.0-rc0~71^2~10 for all POSIX, the
memory-backend-file is going to be present for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
b77f5b08a7 qemu_capabilities: Stop detecting QEMU_CAPS_OBJECT_MEMORY_RAM
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
fbbae04214 qemu: Assume QEMU_CAPS_OBJECT_MEMORY_RAM
Introduced in QEMU's commit of v2.1.0-rc0~41^2~104 the
memory-backend-ram is going to be present for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
35f3864090 qemuxml2argvtest: Drop cpu-numa-memshared-1 test case
The aim of this test case it to make sure we error out when
QEMU_CAPS_OBJECT_MEMORY_RAM is missing. Well, it's never going to
be missing. Drop the test case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
682dd480ac qemuxml2xmltest: Convert hugepages related tests to _CAPS_LATEST
Currently, we have maybe a dozen tests for hugepages related stuff in
qemuxml2xmltest. In all cases DO_TEST() is used, which means we have to
enumerate all capabilities needed (though, it's usually just
QEMU_CAPS_OBJECT_MEMORY_RAM and QEMU_CAPS_OBJECT_MEMORY_FILE,
exceptionally QEMU_CAPS_DEVICE_PC_DIMM too).

Instead of deleting the caps flags one-by-one, just switch the
tests to use DO_CAPS_LATEST().

Since some of our expected output files are just a symlink to their
respective input files, these are changed too. But from QEMU's
POV nothing changes as no .args file is changed.

Oh, and I'm also adding a 'hugepages-memaccess3' test case, which
was missing, surprisingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
ea32d397fe qemuxml2argvtest: Convert hugepages related tests to _CAPS_LATEST
Currently, we have maybe a dozen tests for hugepages related
stuff in qemuxml2argvtest. In all cases DO_TEST() is used, which
means we have to enumerate all capabilities needed (though, it's
usually just QEMU_CAPS_OBJECT_MEMORY_RAM and
QEMU_CAPS_OBJECT_MEMORY_FILE, exceptionally
QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD too).

Instead of deleting the caps flags one-by-one, just switch the
tests to use DO_CAPS_LATEST().

The qemuxml2xmltest will undergo similar treatment in next
commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Peter Krempa
9acd9fa733 qemu: validate: Validate maximum start time for <clock offset='absolute'>
Glib can internally convert only unix timestamps up to
9999-12-31T23:59:59 (253402300799). Validate that the user doesn't use
more than that as otherwise we cause an assertion failure:

 (process:1183396): GLib-CRITICAL **: 14:25:00.906: g_date_time_format: assertion 'datetime != NULL' failed

Additionally adjust the schema to allow bigger values as we use
'unsigned long long' to parse the value.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2128993
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 09:54:33 +01:00
Peter Krempa
8daa94cd8e virschematest: Add infrastructure for testing single devices
Introduce an internal schema for a single device and use it to test the
various files in tests/qemuhotplugtestdevices and
tests/qemublocktestdata directories.

This also requires us to implement schema for (some) privateData bits
for the disk source.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-03 09:19:54 +01:00
Peter Krempa
32d49d4b91 virschematest: Improve testing schemas in 'tests/cputestdata'
The 'cputestdata' directory has a collection of XML files with very
complicated naming schemes for various input and output XML files.

Rather than trying to write complex regexes for selecting specific files
which diverged already multiple times we can introduce an internal
schema file which will cover all of the 3 top level elements used in the
XML files.

Schema for <cpu> is taken from our main RNG schema, <cpuTest> is just a
collection of <cpu> elements, and finally <cpudata> is a simple enough
to describe inline.

To keep the validator happy we have to generate the schema file to
place full paths for the included documents.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-03 09:19:54 +01:00
Peter Krempa
640448cc14 qemublocktest: Mark 'network-ssh-qcow2' input XML as invalid
The XML does not conform to the RNG schema as we don't yet expose the
'ssh' protocol officially. Mark the XML as invalid by renaming it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
ab9beff6b8 tests: qemublocktestdata/imagecreate: Remove bogus 'name="vda"' attribute from <disk>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
c8fe5614c4 qemublocktestdata: Fix 'block-raw-reservations' case
The 'reservations' element doesn't have an 'enabled' attribute according
to our schema, remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
cc2cdb3324 virschematest: Construct path to the schema in the SCHEMAS_PATH
'abs_top_srcdir' can be prepended to the schema in the macro. Apart from
removing one needless string copy it will also allow pointing to schema
files in the builddir which will come handy in upcoming patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
21e67c667e qemustatusxml2xml: Remove obsolete 'json' attribute
We no longer support HMP-only qemus. Remove the leftover attribute from
the test files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
696aa32e14 virschematest: Test 'nodedevxml2xmlout' directory
Test the output files against the RNG schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
fd97c85b95 tests: qemucapabilities: Add data for the qemu-7.2 dev cycle
Add data based on the v7.1.0-1579-g5107fd3eff qemu commit.

Notable changes:

- New machine types and corresponding objects:
    - pc-i440fx-7.2, pc-i440fx-7.2-machine, pc-q35-7.2, pc-q35-7.2-machine
- new NETDEV_STREAM_CONNECTED/NETDEV_STREAM_DISCONNECTED events
- thread-context object and prealloc-property for memory devices added
- libblkio block driver backed support added:
    - new backend protocol drivers:
       - io_uring, nvme-io_uring, virtio-blk-vhost-user, virtio-blk-vhost-vdpa
- New CPU flags and some CPU features become migratable
  (corresponding 'cpu-host-model' test changed output)
- cpu features 'avx', 'avx2', 'f16c', 'fma', 'vaes' became available in
  TCG
- 'dumpdtb' command added
- New disk frontend properties:
    - account-failed, account-invalid
- New unstable commands for debugging virtio:
  x-query-virtio, x-query-virtio-status, x-query-virtio-queue-status,
  x-query-virtio-vhost-queue-status, x-query-virtio-queue-element

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-01 15:47:44 +01:00
Peter Krempa
3ae376535a virNodeDeviceCapPCIDefFormat: Use %u for unsigned values
'bus', 'slot' and 'function' are unsigned int variables parsed as
unsigned int, but were formated as signed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-01 13:07:20 +01:00
Peter Krempa
0268270b0f conf: node_device: Add 'validate' argument to virNodeDeviceDefParse
Allow callers to request XML validation against the schema. All callers
for now pass 'false'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-11-01 13:07:20 +01:00
Cole Robinson
72d4709ab9 tests: Fix libxlxml2domconfigtest with latest xen
shadow_memkb is populated from a libxl API call, and the value can
change. For example:
https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=2c992810854a15b41be920519ce83a4a328d5168

Mock libxl_get_required_shadow_memory to give consistent output

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-10-30 12:34:02 -04:00
Peter Krempa
e204f8e516 qemuxml2argvtest: Don't re-parse and re-generate commandline for QAPI schema validation
The removal of the special internal flag for '-netdev' validatition now
allows us to use the same virCommand object for validation of the
schema.

Pass it into the validator instead of re-parsing and re-generating
everything.

This improved the runtime of qemuxml2argvtest by ~25% on my box.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-10-20 09:34:42 +02:00
Pavel Hrdina
33178b9e52 vircgroup: rework virCgroupNewSelf
With the introduction of `libvirt` sub-directory to the cgroup topology
some of the cgroup configuration was moved into that sub-directory
together with the VM processes.

LXC uses virCgroupNewSelf() in the container process to detect cgroups
in order to report various data from cgroups inside the container.

We need to properly detect the new `libvirt` sub-directory here
otherwise LXC will report incorrect data.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-19 16:32:30 +02:00
Pavel Hrdina
76ff847386 vircgroupmock: fix cgroup v1 mocking
The `legacy` mode is also valid so we need to take it into account as
well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-19 16:32:14 +02:00
Amneesh Singh
415f8b2233 qemu_capabilities: add "query-stats-schemas" QMP command to the QEMU capabilities
Related: https://gitlab.com/libvirt/libvirt/-/issues/276

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-19 15:58:29 +02:00
Tim Wiederhake
ad5a9fbb97 cputestdata: Fix test data for EPYC 7502
Commit 5c17a7ba41 introduced a new feature (ibrs) but did not update
existing cputestdata.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-10-19 14:25:57 +02:00
Jim Fehlig
71d9836ca1 conf: Add channel devices to domain capabilities
As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds channel devices to domain capabilities, allowing clients such
as virt-install to avoid using spicevmc channel devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-17 11:39:00 -06:00
Jim Fehlig
4e13cc4adb conf: Add USB redirect devices to domain capabilities
As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds USB redirect devices to domain capabilities, allowing clients
such as virt-install to avoid using redirdev devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-14 16:10:01 -06:00
Daniel Henrique Barboza
06ebad7c78 tests: refactor pseries features parse failure tests
The qemuxml2argvtest pseries-feature parse failure tests uses a symlink
to the pseries-features.xml test domain and control which feature it is
supposed to fail by excluding it from the capabilities list. The
advantage of this approach is that the same XML can be used in multiple
tests.

One downside is that any new pseries capability must be declared in all
existent tests, otherwise all other tests can break if this new
capability happens to be validated early in qemu_validate.c. Any new
parse_error test must declare all other existent capabilities.

Another downside is the fact that we're testing fairly improbable
scenarios: all pseries capabilities being tested here were introduced by
the same QEMU version, 4.2.0, at least as far as libvirt is aware of.
This means that it's no possible to have a scenario where, for example,
ccf-assist is not present but cfpc is. And last, but not the least, it's
getting in the way of our effort to convert all pseries tests to not use
explicit capabilities.

Changing all these tests to use DO_TEST_PARSE_ERROR_NOCAPS() will allow
us to test exactly what we want to test, which is the parse error given
for each feature if the binary does not have support for it. The XML
being used for each test can be simplified to just declare a single
feature. In the end we'll end up with more XML lines, but less
complexity inside qemuxml2argvtest.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-10-13 16:28:01 -03:00
Daniel Henrique Barboza
8ff73d22c7 tests: change qemuxml2argv pseries tests to TEST_CAPS_LATEST
Eliminate most of the pseries tests that are using explicit qemu caps
instead of CAPS_LATEST. The remaining tests will be handled in the next
patch.

The changes made are trivial: rename the .args/.err files to
ppc64-latest.(args/err) and do the required changes to match the newest
capabilities.

A notable expection were tests pseries-console-native,
pseries-serial-compat and pseries-serial+console-native. These are
aliases of the pseries-serial-native tests.  In this case we needed to
re-create the symlink accordingly.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-10-13 16:27:16 -03:00
Daniel Henrique Barboza
41c685292b tests: qemucapabilities: bump ppc64 caps with qemu 7.1.0
No significant changes from the 7.0.0 capabilities.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-10-13 16:26:58 -03:00
Michal Privoznik
27df3522e6 meson: Replace external_program.path() with external_program.full_path()
The path() method is deprecated in 0.55.0 and we're recommended
to use full_path() instead. Interestingly, we were already doing
do in couple of places, but not all of them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 15:06:09 +02:00
Michal Privoznik
3395c35f2f meson: Replace meson.source_root() with meson.project_source_root()
The source_root() method is deprecated in 0.56.0 and we're
recommended to use project_source_root() instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 15:06:09 +02:00
Michal Privoznik
5ecdcf8541 meson: Replace meson.build_root() with meson.project_build_root()
The build_root() method is deprecated in 0.56.0 and we're
recommended to use project_build_root() instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 15:06:09 +02:00
Jiri Denemark
e8efe42409 cpu_ppc64: Implement virCPUGetVendorForModel
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:43 +02:00
Jiri Denemark
311e21ad32 cpu_x86: Implement virCPUGetVendorForModel
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:43 +02:00
Jiri Denemark
2784a83907 domain_capabilities: Add vendor attribute for CPU models
Even though several CPU models from various vendors are reported as
usable on a given host, user may still want to use only those that match
the host vendor. Currently the only place where users can check the
vendor of each CPU model is our CPU map, which is considered internal
and users should not really be using it directly. So to allow for such
filtering we now advertise the vendor of each CPU model in domain
capabilities.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:42 +02:00
Jiri Denemark
f0554d88fb conf: virDomainCapsCPUModelsAdd never fails
Since the function always returns 0, we can just return void and make
callers simpler.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:42 +02:00
Peter Krempa
30095f4f4c util: xml: Remove virXMLParseFile
Most callers prefer using the XPath context. Convert the last user to
use virXMLParseFileCtxt and remove the helper macro.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
402c31f3ac virDomainDefParseNode: Pass only the XPath context as argument
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
1eb67d24de conf: network: Provide only virNetworkDefParse
Replace virNetworkDefParseString/File by direct calls to
virNetworkDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
37de09a2f9 conf: nodedev: Provide only virNodeDeviceDefParse
Replace the thin wrappers virNodeDeviceDefParseString/File by directly
calling the main parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
5ea1d04322 conf: nwfilter: Provide only virNWFilterDefParse
Replace virNWFilterDefParseString/File with the common function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
7c32578531 conf: secret: Provide only virSecretDefParse
Replace the virSecretDefParseFile/String shims by calls to
virSecretDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
2a166e6c12 conf: storage: Provide only virStorageVolDefParse
Remove the virStorageVolDefParseFile/String shim functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
97df89d7f5 conf: storage: Provide only virStoragePoolDefParse
Replace the virStoragePoolDefParseString/File thin wrappers by
virStoragePoolDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
ed080445a6 conf: networkportdef: Provide only virNetworkPortDefParse
Replace the two helpers virNetworkPortDefParseString/File with the
common helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
1cd64b7326 tests: qemuxml2argv: Use virXMLParse properly
Don't validate the root node and don't allocate a private XPath context
when virXMLParse can do that internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
0dceac9b8e conf: nwfilterbinding: Provide only virNWFilterBindingDefParse
Remove the virNWFilterBindingDefParseString/File thin wrappers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
0c5378bc07 util: xml: Expose all arguments of virXMLParseHelper in virXMLParse macro
The generic helper also has helper code to validate the root element and
create an XPath context. Many places in the code duplicate code for
doing these operations.

Extend the helper to provide all arguments and fix all callers.

In many cases this patch refactors the passing of the 'validate'
field into a separate variable to avoid quirky looking arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Ján Tomko
d6245e36c2 qemu: retire QEMU_CAPS_CCW
Now that we no longer use the capability, stop probing for existence
of 'virtual-css-bridge' and its properties.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
bbaa22e24a qemu: retire QEMU_CAPS_CCW_CSSID_UNRESTRICTED
Now that it is no longer used, stop probing for it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
0662e6bd36 qemu: Assume QEMU_CAPS_CCW
Introduced in libvirt by:
  commit f245a9791c
    qemu: introduce capability for virtual-css-bridge

Which mentions that its support was in QEMU 2.7.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
b02568f1be qemu: Assume QEMU_CAPS_CCW_CSSID_UNRESTRICTED
This capability was introduced by libvirt commit:
  commit 263e65fd20
      qemu: introduce vfio-ccw capability

It probes for the cssid-unrestricted property of
virtual-css-bridge, which was introduced in QEMU v2.12 by:
  commit 99577c492fb2916165ed9bc215f058877f0a4106
      s390x/css: unrestrict cssids

Since we bumped the minimum QEMU version to 4.2.0, assume
this property is always present.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
3f35149d4f qemu: convert some s390x tests to use real capability data
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
e4e22bf3ed tests: qemuxml2argvdata: switch zpci address generation to real caps
Among the usual changes, this puts the virtio memballoon on the CCW bus.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Michal Privoznik
b1fc788957 virgdbusmock: Mock g_dbus_connection_call_with_unix_fd_list_sync() only on UNIX-like systems
As of GLib commit c9874f817be51d3b652457daef3b10766b59db9a,
relesed in GLib 2.73, the g_dbus_connection_call_with_unix_fd_list_sync()
function is not defined always, only when G_OS_UNIX condition is
set. This is also the reason why our virGDBusCallMethodWithFD()
function is guarded with that macro. But virgdbusmock is compiled
always, even on !UNIX systems, e.g. mingw. Therefore, we need to
use the same macro to condition compile its mock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-30 15:38:47 +02:00
Lin Ma
85aafea449 qemu: Remove host-passthrough validation check for host-phys-bits=on
Besides the -cpu host, The host-phys-bits=on applies to custom or max
cpu model, So the host-passthrough validation check is unnecessary for
maxphysaddr with mode='passthrough'.

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2022-09-29 08:45:03 -06:00
Daniel P. Berrangé
8496880866 tests: add better QEMU capabilities example
Updated example covers:

  * UUID
  * CPU model, vendor, microcode, signature, counters,
    topology, maxphysaddr, features,
  * Power management
  * NUMA page size info, multiple nodes, CPU topology IDs, distances
  * CPU cache bank info
  * Multiple secmodels

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-09-21 12:02:40 +01:00
Peter Krempa
bc753aa6f7 qemu: migration: Remove QEMU_MONITOR_MIGRATE_BACKGROUND
'qemuMonitorJSONMigrate' is called from:
 - qemuMonitorMigrateToHost
 - qemuMonitorMigrateToSocket
   Both of the above function are called only from
   qemuMigrationSrcStart.

 - qemuMonitorMigrateToFd
   - called from:
     - qemuMigrationSrcToFile
       Both instances here pass QEMU_MONITOR_MIGRATE_BACKGROUND
       directly.
     - qemuMigrationSrcStart

qemuMigrationSrcStart is then called from qemuMigrationSrcRun and
qemuMigrationSrcResume, both of which always add QEMU_MONITOR_MIGRATE_BACKGROUND
to the flags.

Thus any caller always passes the flag so that we can remove the flag
altogether.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-09 16:10:47 +02:00
Peter Krempa
d5fb23bc6e qemu: monitor: Drop support for old-style non-shared storage migration
Remove the support for enabling the 'blk' and 'inc' parameters of the
'migrate' command as there are no users any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-09 16:10:47 +02:00
Peter Krempa
2980268b22 qemu: capabilities: Retire QEMU_CAPS_NBD_SERVER
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-09 16:10:47 +02:00
Kristina Hanicova
0150f7a8c1 virdomainjob: make drivers use job object in the domain object
This patch uses the job object directly in the domain object and
removes the job object from private data of all drivers that use
it as well as other relevant code (initializing and freeing the
structure).

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-07 12:13:13 +02:00
Kristina Hanicova
84e9fd068c conf: extend xmlopt with job config & add job object into domain object
This patch adds the generalized job object into the domain object
so that it can be used by all drivers without the need to extract
it from the private data.

Because of this, the job object needs to be created and set
during the creation of the domain object. This patch also extends
xmlopt with possible job config containing virDomainJobObj
callbacks, its private data callbacks and one variable
(maxQueuedJobs).

This patch includes:
* addition of virDomainJobObj into virDomainObj (used in the
  following patches)
* extending xmlopt with job config structure
* new function for freeing the virDomainJobObj

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-09-07 12:06:18 +02:00
Ján Tomko
d2e767d237 qemu: do not probe for properties of nec-usb-xhci
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
6600c0ff18 qemu: retire QEMU_CAPS_VIRTIO_PACKED_QUEUES
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
b710fcaff7 qemu: assume QEMU_CAPS_VIRTIO_PACKED_QUEUES
Added by QEMU commit:

commit 74b3e46630446568aecb0be1c77c4875d7a52f6d
Author:     Jason Wang <jasowang@redhat.com>
CommitDate: 2019-10-25 07:46:22 -0400

    virtio: add property to enable packed virtqueue

    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
    Reviewed-by: Jens Freimann <jfreimann@redhat.com>
    Message-Id: <20191025083527.30803-9-eperezma@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

git describe: v4.1.0-1780-g74b3e46630 contains: v4.2.0-rc0~32^2~17

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
3ae85b6a69 qemu: retire QEMU_CAPS_VIRTIO_SCSI_IOTHREAD
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
d8e274253a qemu: retire QEMU_CAPS_NEC_USB_XHCI_PORTS
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
04bf98a418 qemu: assume QEMU_CAPS_NEC_USB_XHCI_PORTS
Introduced by QEMU commit 0846e6359c407e372f446723b8b7b09ac20d0f03
released in QEMU 1.3.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
935865e057 qemu: retire QEMU_CAPS_CHARDEV_LOGFILE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
72768bde3d qemu: assume QEMU_CAPS_CHARDEV_LOGFILE
Introduced in QEMU 2.6

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
be217321eb qemu: retire QEMU_CAPS_CHARDEV_FILE_APPEND
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
0a5b820f8f qemu: assume QEMU_CAPS_CHARDEV_FILE_APPEND
Introduced in QEMU 2.6

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Peter Krempa
4a95d1ede4 tests: qemuxml2argvdata: Remove two unused output files
Commit d7ae7ce363 forgot to clean up unused error output files
'boot-dev+order.err' and 'boot-menu-enable-with-timeout-invalid'
after converting tests to DO_TEST_CAPS_LATEST.

Fixes: d7ae7ce363
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-09-05 17:22:28 +02:00
Peter Krempa
35acaa9488 qemucapabilitiestest: Update qemu capabilities for qemu-7.1 release
qemu-7.1 is released now. Update the capabilities for the final time.

Notable change since last update:
 - 'exit-failure' action for 'panic' lifecycle action added

The 'min-xlevel' change is related to upgrade of the host kernel.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
d34be15c6c qemu: command: Don't use deprecated chardev backend drivers 'tty' and 'parport'
The replacement is 'serial' and 'parallel' respectively introduced at
least in qemu-2.9 and the old versions are deprecated since qemu-6.0
(qemu commit 5965243641d797b22 ).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
e55888d075 virDomainControllerDefParseXML: Parse 'index' by virXMLPropInt
'index' is parsed to fit into a signed int but not have negative values.
virXMLPropInt can do that internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
45e5648350 qemu: capabilities: Retire QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
ec91195ead qemuxml2xmltest: Convert all test cases asserting QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Turn them into DO_TEST_CAPS_LATEST tests so that we are closer to real
world.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
517ca3c46a qemuxml2*test: Remove 'q35-virtio-pci' test case
As noted by the comments the only difference was the qemu capabilities
asserted. Now that we use only real caps for this test case it makes no
sense to have two copies.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
80a0f44a7a qemuxml2argvtest: Convert all test cases asserting QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Turn them into DO_TEST_CAPS_VER bound to qemu-4.2 to show the minimum
amount of change. We already have DO_TEST_CAPS_LATEST versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
e097e1a755 qemuxml2argvtest: Add DO_TEST_CAPS_LATEST versions of tests which assert QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Further patches will try to remove QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
so add few more modern tests before doing that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
a7669aa119 qemuxml2*test: Use QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL for macos hfv tests
Switch from QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY to
QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL as it has no impact on the test
output.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
50704f6c25 qemudomainsnapshotxml2xmltest: Add test case for a snapshot with 'inactiveDomain' element
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
bbda8bea04 qemudomainsnapshotxml2xmltest: Allow regenerating into non-existing output file
Replacing the 'virTestLoadFile' + 'virTestDifferenceFull' by '
virTestCompareToFile' allows to use the VIR_TEST_REGENERATE_OUTPUT=1
option to also generate the output file if it doesn't exist.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
41460774ea nodedevschematest: Add example file for a HBA with 'vport_ops' capability
Illustrate the problem in the schema fixed by previous commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
9ac2bbcbbf tests: Remove storage pool/vol tests for sheepdog
The support for the sheepdog storage backend will be dropped in the
upcoming patches. Remove all the relevant tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
d7ae7ce363 tests: qemuxml2argv: Convert all 'boot*' cases to DO_TEST_CAPS_LATEST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
89bef9575a tests: qemuxml2argv: Use x86_64 arch and emulator in all boot* test files
Using the modern emulator and arch will allow us to convert all of the
tests to use DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
9b2902c835 qemuxml2argvtest: Use different network storage protocol for boot order tests
The support for 'sheepdog' was dropped from qemu-6.1 and later, to
convert the tests to latest caps we need to use something else. Use
'nbd'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Martin Kletzander
6457619d18 Rename iterface type='dummy' to type='null'
When commit bac6b266fb added this "functionality" this was the only
naming I could think of, but after discussion with Dan we found the name
'null' fits a bit better, so change it before we make a release with the
old name.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-08-25 13:27:04 +02:00
Laine Stump
15bd9179be tests: remove superfluous cleanup: labels and ret return variables
After converting virNetworkDef * to g_autoptr(virNetworkDef) the
cleanup codepath was empty, so it has been removed.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-24 12:22:47 -04:00
Laine Stump
d9074b8e01 tests: replace explicit virNetworkDefFree() with g_autoptr(virNetworkDef)
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-24 12:22:47 -04:00
Michal Privoznik
da255ce831 lib: Don't check for retval for virCommandNew*()
The virCommand module is specifically designed so that no caller
has to check for retval of individual virCommand*() APIs except
for virCommandRun() where the actual error is reported. Moreover,
virCommandNew*() use g_new0() to allocate memory and thus it's
not really possible for those APIs to return NULL. Which is why
they are even marked as ATTRIBUTE_NONNULL. But there are few
places where we do check the retval which is a dead code
effectively. Drop those checks.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-08-23 16:14:05 +02:00
Ján Tomko
f3ce408b67 qemu: do not probe for -pcihost properties
Now that we no longer care about any of their properties, there's no need
to call `device-list-properties` on these devices.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
f4d70f3ef3 qemu: retire QEMU_CAPS_Q35_PCI_HOLE64_SIZE
We no longer use it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
a2fc283ab6 qemu: Retire QEMU_CAPS_I440FX_PCI_HOLE64_SIZE
We no longer use it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
6b4c1e010e qemu: always assume QEMU_CAPS_*_HOLE64_SIZE
Introduced back in 2013 by QEMU commit:
  commit 398489018183d613306ab022653552247d93919f

      pc: limit 64 bit hole to 2G by default

Released in 1.6.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
ec73ad2ea5 qemu: retire QEMU_CAPS_DUMP_GUEST_MEMORY
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Andrea Bolognani
838f64515e tests: Reset macOS dyld environment
This is needed to ensure the environment variables that we need
for the test program itself, specifically to load mock libraries,
do not interfere with any command that gets invoked by it, either
directly or indirectly. We already perform the same cleanup step
for LD_* variables.

This makes the test failures

  error : virCommandWait:2752 : internal error: Child process
    (/usr/libexec/qemu/vhost-user/test-vhost-user-gpu --print-capabilities)
    unexpected fatal signal 6: dyld[8896]: symbol not found in flat
    namespace '_virQEMUCapsGet'
  error : qemuVhostUserFillDomainGPU:394 : operation failed: Unable to
    find a satisfying vhost-user-gpu

that were showing up on macOS 12 go away.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-22 10:50:56 +02:00
Jiri Denemark
f1929d4289 tests: Drop irrelevant CPU config from graphics-spice-timeout
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/243

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-08-18 16:32:21 +02:00
Amneesh Singh
ceaa74dfe0 qemu_capabilities: add "query-stats" QMP command to the QEMU capabilities
Related: https://gitlab.com/libvirt/libvirt/-/issues/276

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-08-18 15:09:49 +02:00
Martin Kletzander
580538c5dd vmx: Add support for VDS interface
Since we cannot properly plug a new VM into the distributed switch, we can at
least report the provided pieces of information, so that XML editing still works
even for VMs with such interfaces.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-18 08:34:32 +02:00
Martin Kletzander
9c9fc39ded tests: Fix vmx/xml filenames
Commit 70768cda97 added a functionality that was previously (in an unsubmitted
version of the commit) represented differently in the XML, but the filenames
kept the old name.  Fix the name so they are not misleading.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-18 08:34:30 +02:00
Jim Fehlig
231af0a08c schema: Add maxphysaddr element to hostcpu
The output of "virsh capabilities" was not conformant to the
capability.rng schema. Add the missing element to the schema.

Fixes: c647bf29af
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-08-15 09:32:59 -06:00
Jim Fehlig
65e8ac6f92 schema: Don't enforce ordering of hostcpu capabilities elements
The change to caps-test.xml demonstrates the need for the change to
cputypes.rng.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-08-15 09:32:59 -06:00
Ján Tomko
01cf26d41f qemu: retire QEMU_CAPS_VIRTIO_TX_ALG
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-11 18:34:47 +02:00
Ján Tomko
c80b10e88f qemu: always assume QEMU_CAPS_VIRTIO_TX_ALG
Introduced back in 2010 by QEMU commit:
  commit a697a334b3c4d3250e6420f5d38550ea10eb5319
      virtio-net: Introduce a new bottom half packet TX

Released in QEMU 0.14.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-11 18:34:47 +02:00
Ján Tomko
9a23c55b04 tests: qemuxml2xmltest: remove interface from disk test
There is no need to specify an interface for a disk test.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-11 18:34:47 +02:00
Peter Krempa
5eb283e294 qemu: Assume and retire QEMU_CAPS_BLOCKDEV_BACKUP
The blockdev-backup QMP command was introduced in qemu-2.3.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:26:32 +02:00
Peter Krempa
66c442f80f qemu: Assume support and retire QEMU_CAPS_BLOCK_WRITE_THRESHOLD
The event was introduced in qemu-2.3

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:26:17 +02:00
Peter Krempa
3a7955979c qemu: capabilities: Retire QEMU_CAPS_QUERY_NAMED_BLOCK_NODES
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:26:02 +02:00
Peter Krempa
a0b8b54348 qemu: Retire QEMU_CAPS_BLOCKDEV
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:25:36 +02:00
Peter Krempa
1050d80585 qemuDomainValidateStorageSource: Remove 'maskBlockdev' argument
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:25:11 +02:00
Peter Krempa
6695162c76 qemu: domain: Assume QEMU_CAPS_BLOCKDEV for the domain private code
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:24:11 +02:00
Peter Krempa
2ebb44a957 qemuhotplugtest: Switch to -blockdev mode
Enable blockdev mode and convert the expected commands to the modern
equivalents in preparation for removing the old-style hotplug code
paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:22:14 +02:00
Peter Krempa
d2831cd521 qemu: monitor: Remove unused qemuMonitor(Eject|Change)Media
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:21:59 +02:00
Peter Krempa
b573224cf7 qemu: monitor: Remove unused qemuMonitorDrivePivot
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:20:21 +02:00
Peter Krempa
d926d7b4c9 qemu: monitor: Remove unused arguments of qemuMonitorBlockStream
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:19:39 +02:00
Peter Krempa
01f8c55f22 qemu: monitor: Remove unused arguments of qemuMonitorBlockCommit
The 'persistjob' is always true and 'top' and 'base' are always NULL.
Adjust the functions to drop the arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:19:11 +02:00
Peter Krempa
8c67518256 qemu: monitor: Remove unused qemuMonitorDriveMirror
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:18:44 +02:00
Peter Krempa
071a4c8ba7 qemu: alias: Remove check for QEMU_CAPS_BLOCKDEV
The only instance in this file can be simplified to avoid checking the
capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:14:18 +02:00
Peter Krempa
75a0fbe420 qemu: block: Remove 'qemuBlockNodeNamesDetect' and related infrastructure
With blockdev we are generating the nodenames ourselves so all of this
infrastructure became obsolete. Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:13:55 +02:00
Peter Krempa
58e740aa24 qemu: Remove unused code for pre-blockdev disk snapshot monitor interaction
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:07:39 +02:00
Peter Krempa
b27549e631 qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_DEL
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:07:14 +02:00
Peter Krempa
b45f63ecd9 qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
ebfa1fb0f9 qemu: capabilities: Retire capabilities used for -blockdev detection
Retire:
    QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC
    QEMU_CAPS_SCSI_DISK_DEVICE_ID
    QEMU_CAPS_SAVEVM_MONITOR_NODES

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
b51512f915 qemu: command: Always assume support for QEMU_CAPS_SCSI_DISK_DEVICE_ID
The 'device_id' property of 'scsi_disk' was added in qemu-4.0 and it's
unconditionally present, thus we can now always assume its presence.

Update some fake-caps test which didn't yet assert the capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
5998381b08 tests: Force QEMU_CAPS_BLOCKDEV(_HOSTDEV_SCSI) in fake caps tests
Until we finish removing the capabilities we need to force them in the
tests so that it's obvious that the code changes have no impact.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
9b54efb7cf qemu: capabilities: Unconditionally set QEMU_CAPS_BLOCKDEV/QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
The cleanup of the code to always assume support for QEMU_CAPS_BLOCKDEV
will not be simple, so for now we hardcode the support and the code will
be cleaned up gradually.

We also disallow users to clear the flags via the namespace property or
qemu.conf configuration.

The change to the PPC64 test data originates from the fact that the
capability dump is not from the release version but is lacking one of
the necessary flags to enable -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
78ad796a43 qemu: capabilities: Retire QEMU_CAPS_QCOW2_LUKS
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
8eae01ba28 qemuxml2xmltest: Modernize all test cases using QEMU_CAPS_QCOW2_LUKS
Modernize 'disk-nvme', 'encrypted-disk-usage', 'encrypted-disk', and
'user-aliases' cases to use DO_TEST_CAPS_LATEST.

This will remove all uses of QEMU_CAPS_QCOW2_LUKS from the test suite.

Since the output files are done via symlinks to input files, the input
files need to be modernized with few auto-added XML bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
cd2d9808db qemuxml2argvtest: Use DO_TEST_CAPS_LATEST for all 'user-aliases' tests
Modernize the tests as they mostly care that the aliases are properly
propagated to qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
f80829dece qemu: capabilities: Retire QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
c250c5a3db qemu: capabilities: Retire QEMU_CAPS_GLUSTER_DEBUG_LEVEL
The debug level of gluster backend became configurable in qemu-2.8.

This also removes the only old-style syntax for the 'blockdev-add'
command prior to stabilization.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
fc0aa62377 qemu: capabilities: Retire QEMU_CAPS_ACTIVE_COMMIT
Active block commit is supported since qemu-2.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
3d367a2c93 qemu: capabilities: Retire QEMU_CAPS_CHANGE_BACKING_FILE
The 'change-backing-file' command is unconditionally supported since
qemu-2.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
d1e0eaabb1 qemu: capabilities: Retire QEMU_CAPS_AUDIODEV
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
95215e6b79 qemuxml2(argv|xml)test: Remove use of QEMU_CAPS_AUDIODEV in fake-caps tests
The code no longer uses the capability so the tests don't need to assert
it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
31ee59d4e1 qemu: command: Always assume QEMU_CAPS_AUDIODEV
Generate only new version of the '-audiodev' commandline. The leftover
old code and validation will be removed in subsequent patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
c7ab87b8a6 domaincapstest: Remove test data for qemu-4.1
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00