Commit Graph

50381 Commits

Author SHA1 Message Date
Cole Robinson
66e4b56016 test: Fix virsh nodedev-list
$ virsh --connect test:///default nodedev-list
error: Failed to list node devices
error: unsupported flags (0x80000000) in function testConnectListAllNodeDevices

The test driver handles the nodedev state flags, we just need to
allow them

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-04-17 10:51:56 -04:00
Daniel P. Berrangé
e5b7f1e266 network: ensure nparams is non-NULL and non-negative
The typed parameter array length must be non-NULL and either 0, or a
positive number.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-04-17 13:13:02 +01:00
Jiri Denemark
ded74b3369 qemu: Use g_autoptr in qemuProcessInit
The only thing we need to free in the cleanup code is virCPUDef and for
that we already have g_autoptr handler.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-16 17:58:23 +02:00
Göran Uddeborg
8b9d35c82c Translated using Weblate (Swedish)
Currently translated at 69.2% (7225 of 10438 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-16 15:35:57 +02:00
Andi Chandler
273f44788a Translated using Weblate (English (United Kingdom))
Currently translated at 46.7% (4880 of 10438 strings)

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

Co-authored-by: Andi Chandler <andi@gowling.com>
Signed-off-by: Andi Chandler <andi@gowling.com>
2024-04-16 15:35:56 +02:00
Michal Privoznik
d3fedca807 tests: Allow spaces in path to virt-aa-helper
The virt-aa-helper bash script constructs a path to itself when
it runs. But it isn't prepared for the case when there is a space
in the path leading to the script (something, something, double
quotes, something).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-15 09:28:32 +02:00
Michal Privoznik
eac646ea49 tests: mock: Accept spaces in build path
If path to the build directory contains spaces (e.g. meson setup
'a b') then our mocks don't work. The problem is in glibc where
not just a colon but also a space character is a delimiter for
LD_PRELOAD [1]. Hence, a test using mock tries to preload
something like libvirt.git/a b/libsomethingmock.so which is
interpreted by glibc as two separate strings: "libvirt.git/a",
"b/libsomethingmock.so".

One trick to get around this is to set LD_PRELOAD to just the
shared object file (without path) and let glibc find the mock in
paths specified in LD_LIBRARY_PATH (where only a colon or a
semicolon are valid separators [1]). This can be seen in action
by running say:

  LD_DEBUG=libs ./virpcitest

1: https://man7.org/linux/man-pages/man8/ld.so.8.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-15 09:24:16 +02:00
Michal Privoznik
ece476ec2e domain_interface: Fix build on FreeBSD
In one of my recent commits I've chopped just too much and moved
a variable declaration into a function not realizing it's still
used on FreeBSD. Bring it back but only for the FreeBSD case.

Fixes: f8b5bd855f
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-15 08:51:23 +02:00
Göran Uddeborg
00db0619c6 Translated using Weblate (Swedish)
Currently translated at 69.1% (7223 of 10438 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-13 23:08:37 +02:00
Weblate
4625215a03 Translated using Weblate (Swedish)
Currently translated at 69.1% (7219 of 10438 strings)

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

Co-authored-by: Weblate <noreply-mt-weblate@weblate.org>
Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
2024-04-13 23:08:37 +02:00
Göran Uddeborg
a376da0884 Translated using Weblate (Swedish)
Currently translated at 69.1% (7219 of 10438 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-13 23:08:37 +02:00
Michal Privoznik
a4972778f9 vbox: Drop needless g_new0(..., 0) in vbox_snapshot_conf.c
clang on Fedora started to complain about some calls to g_new0()
we're making in vbox_snapshot_conf.c. Specifically, we're passing
zero as number of elements to allocate. And while usually SA
tools are not clever, in this specific case clang is right.
There are three cases where such call is made, but all of them
later use VIR_EXPAND_N() to allocate more memory (if needed). But
VIR_EXPAND_N() accepts a variable set to NULL happily.

Therefore, just drop those three calls to g_new0(..., 0) and let
VIR_EXPAND_N() allocate memory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-04-13 23:16:54 +02:00
Michal Privoznik
812a146dfe domain_interface: Introduce and use virDomainInterfaceClearQoS()
In QEMU and LXC drivers in a few places only
virNetDevBandwidthClear() is called. This means that if an
interface is of openvswitch vport profile, its QoS is not
removed. And to make matters worse - OVS is designed to remember
state even when corresponding interface is gone. This leads to
stale QoS settings piling up in OVS database.

To resolve this, introduce virDomainInterfaceClearQoS() which
looks at given interface and calls corresponding QoS clear
function. Then, basically replace virNetDevBandwidthClear() calls
in those hypervisor drivers with this new function.

Resolves: https://issues.redhat.com/browse/RHEL-30373
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 20:45:15 +02:00
Michal Privoznik
93ff328ea0 conf: Move virDomainClearNetBandwidth() to src/hypervisor/
The reason virDomainClearNetBandwidth() exists in src/conf/ is
that at the time its introduction we did not have a better place.
But now we do. Firstly, virDomainClearNetBandwidth() is
hypervisor agnostic code, but really has nothing to do with
domain configuration (it doesn't parse/format XML). Secondly, in
near future it'll call another function from src/hypervisor/ and
that's not really allowed from src/conf/.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 20:45:11 +02:00
Michal Privoznik
378dc6a32b virnetdevopenvswitch: Drop @brname arg from virNetDevOpenvswitchRemovePort()
The @brname argument of virNetDevOpenvswitchRemovePort() is and
was unused ever since its introduction in v0.9.11-rc1~257. Just
remove it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 20:45:00 +02:00
Michal Privoznik
f8b5bd855f hypervisor: Introduce and use virDomainInterfaceVportRemove()
Both LXC and QEMU drivers have the same code to remove vport when
removing a domain's interface. Instead of repeating the same
pattern in both drivers, move the code into hypervisor agnostic
location (src/hypervisor/) and switch to calling this new
function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 20:44:52 +02:00
Michal Privoznik
767d92f098 virnetdevopenvswitch: Fix comment to virNetDevOpenvswitchInterfaceGetMaster()
The comment to virNetDevOpenvswitchInterfaceGetMaster() contains
wrong function name. Fix this.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 20:44:40 +02:00
Michal Privoznik
2e72cfe25d vsh: Drop fwd declaration of a nonexistent function
The vshFindTypedParamByName() function no longer exists (as of
v1.0.2-rc1~82), but its header file declaration was still kept
around. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-12 14:27:58 +02:00
Michal Privoznik
01f2b614a2 qemusecuritytest: Call real virFileExists in mock
When I suggested to Jim to call real virFileExists() I forgot to
also suggest calling init_syms(). Without it, real_virFileExists
pointer might be left unset. And indeed, that's what we were
seeing on FreeBSD.

This effectively reverts commit 4b5cc57ed3.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2024-04-09 16:55:25 +02:00
Jim Fehlig
4b5cc57ed3 qemusecuritytest: Don't call real virFileExists in mock
Calling the real virFileExists in qemusecuritymock.c can cause a
segfault in qemusecuritytest. No segfaults are noticed when calling
access(2) instead of virFileExists.

Fixes: 4ed5ade753
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2024-04-08 14:40:02 -06:00
Jim Fehlig
4ed5ade753 security: Ensure file exists before attempting to restore label
When performing an install, it's common for tooling such as virt-install
to remove the install kernel/initrd once they are successfully booted and
the domain has been redefined to boot without them. After the installation
is complete and the domain is rebooted/shutdown, the DAC and selinux
security drivers attempt to restore labels on the now deleted files. It's
harmles wrt functionality, but results in error messages such as

Mar 08 12:40:37 virtqemud[5639]: internal error: child reported (status=125): unable to stat: /var/lib/libvirt/boot/vir>
Mar 08 12:40:37 virtqemud[5639]: unable to stat: /var/lib/libvirt/boot/virtinst-yvp19moo-linux: No such file or directo>
Mar 08 12:40:37 virtqemud[5639]: Unable to run security manager transaction

Add a check for file existence to the virSecurity*RestoreFileLabel functions,
and avoid relabeling if the file is no longer available. Skipping the restore
caused failures in qemusecuritytest, which mocks stat, chown, etc as part of
ensuring the security drivers properly restore labels. virFileExists is now
mocked in qemusecuritymock.c to return true when passed a file previously
seen by the mocked stat, chown, etc functions.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-08 10:38:25 -06:00
Michal Privoznik
fdd440c096 rpcgen: tests: Include stdint.h in test_demo.c
Since header file structure is a bit different on MacOS, it
doesn't get uint64_t type declaration and thus test_demo.c must
include it explicitly. This is proper solution anyway, because on
Linux we're apparently relying on the header file sneaking
through some other include.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/619
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-08 15:47:24 +02:00
Göran Uddeborg
c9dbcd2c87 Translated using Weblate (Swedish)
Currently translated at 69.0% (7208 of 10438 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-06 22:36:02 +02:00
Benjamin Taubmann
a39dd25715 Extend libvirt-guests to shutdown only persistent VMs
At the moment, there is no configuration option for the libvirt-guests
service that allows users to define that only persistent virtual machines
should be shutdown on host shutdown.

Currently, the service config allows to choose between two ON_SHUTDOWN
actions that are executed on running virtual machines when the host goes
down: shutdown, suspend.
The ON_SHUTDOWN action should be orthogonal to the type of the virtual
machine. However, the existing implementation, does not suspend
transient virtual machines.
This is the matrix of actions that is executed on virtual machines based
on the configured ON_SHUTDOWN action and the type of a virtual machine.

         | persistent | transient
shutdown | shutdown   | shutdown (what we want to change)
suspend  | suspend    | nothing

Add config option PERSISTENT_ONLY to libvirt-guests config that allows
users to define if the ON_SHUTDOWN action should be applied only on
persistent virtual machines. PERSISTENT_ONLY can be set to true, false,
default. The default option will implement the already existing logic.

Case 1: PERSISTENT_ONLY=default
         | persistent | transient
shutdown | shutdown   | shutdown
suspend  | suspend    | nothing

Case 2: PERSISTENT_ONLY=true
         | persistent | transient
shutdown | shutdown   | nothing
suspend  | suspend    | nothing

Case 3: PERSISTENT_ONLY=false
         | persistent | transient
shutdown | shutdown   | shutdown
suspend  | suspend    | suspend

Signed-off-by: Benjamin Taubmann <benjamin.taubmann@nutanix.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2024-04-04 09:10:00 +02:00
Marc Hartmayer
5138dd2478 node_device_conf: virNodeDeviceGetSCSITargetCaps: fix memory leak
Make sure the old value in `scsi_target->wwpn` is free'd before replacing it.
While at it, simplify the code.

==9104== 38 bytes in 2 blocks are definitely lost in loss record 1,943 of 3,250
==9104==    at 0x483B8C0: malloc (vg_replace_malloc.c:442)
==9104==    by 0x4DFB69B: g_malloc (gmem.c:130)
==9104==    by 0x4E1921D: g_strdup (gstrfuncs.c:363)
==9104==    by 0x495D60B: g_strdup_inline (gstrfuncs.h:321)
==9104==    by 0x495D60B: virFCReadRportValue (virfcp.c:62)
==9104==    by 0x4A5F5CB: virNodeDeviceGetSCSITargetCaps (node_device_conf.c:2914)
==9104==    by 0xBF62529: udevProcessSCSITarget (node_device_udev.c:657)
==9104==    by 0xBF62529: udevGetDeviceDetails (node_device_udev.c:1406)
==9104==    by 0xBF62529: udevAddOneDevice (node_device_udev.c:1563)
==9104==    by 0xBF639B5: udevProcessDeviceListEntry (node_device_udev.c:1637)
==9104==    by 0xBF639B5: udevEnumerateDevices (node_device_udev.c:1691)
==9104==    by 0xBF639B5: nodeStateInitializeEnumerate (node_device_udev.c:2009)
==9104==    by 0x49BDBFD: virThreadHelper (virthread.c:256)
==9104==    by 0x5242069: start_thread (in /usr/lib64/libc.so.6)

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-04 09:05:11 +02:00
Peter Krempa
e2a7dd3f7e qemucapabilitiestest: Update qemu-9.0 capabilities for RC1
Update the capabilities to v9.0.0-rc1-55-g7fcf7575f3

Notable changes:
 - Q35 machine now supports 4096 cpus

 - 'kvm-asyncpf-vmexit' cpu feature added
 - 'x2apic' cpu feature is now migratable

 - LUKS detached header support added
 - LUKS sm4 cipher alg support added

 - 'console' chardev backend type removed
 - 'memory' chardev backend type deprecated

 - 'mapped-ram' migration capability added
 - 'zero-page-detection' migration parameter added

 - 'acpi-generic-initiator' 'object' added

 - 'request-ebpf' QMP command added

 - 'legacy-reset', 'resettable-container', 'vhost-user-snd*' QOM types
   added

 - 'vdpa' property added for following device models:
    - virtio-balloon-pci
    - virtio-blk-pci
    - virtio-gpu-pci
    - virtio-iommu-pci
    - virtio-mem-pci
    - virtio-net-pci
    - virtio-scsi-pci

 - 'win2k-install-hack' property of 'ide-hd' added
 - 'aw-bits', 'granule', properties of 'virtio-iommu-pci' added
 - 'ebpf-rss-fds' property of 'virtio-net-pci' added

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2024-04-03 10:41:45 +02:00
Rayhan Faizel
6c62ee7933 tests: Add testcase for usb-net
Add small test case to demonstrate use of usb-net with user networking
backend.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-03 10:40:32 +02:00
Rayhan Faizel
e18c69bcd8 conf: Automatically assign address to usb-net device
This patch will allow usb-net devices to be automatically assigned a USB
address (and skip any attempt to assign a PCI one).

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-03 10:40:14 +02:00
Denis V. Lunev
d37a4aa69c remote: properly initialize objects in ACL helpers
Commit 2ecdf25929 was intended to
implement two things: reduce stack usage inside ACL helpers and
minimally initialize virDomainDef object to avoid passing garbage
inside validation framework. Though original commit has not
touched other ACL helpers.

This patch adds proper clauses to
    remoteRelayNetworkEventCheckACL
    remoteRelayStoragePoolEventCheckACL
    remoteRelayNodeDeviceEventCheckACL
    remoteRelaySecretEventCheckACL

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-03 09:34:35 +02:00
Brett Holman
b902cfece0 virsysinfo: Try reading DMI table
Add DMI support for risc-v and mips. Attempt to read dmidecode and
fall back to old behavior if that fails.

The SMBIOS specification[1] officially supports both RISC-V and LoongArch.
Some mips-based Loongson-3 processors also have SMBIOS.

[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.7.0.pdf

Signed-off-by: Brett Holman <brett.holman@canonical.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2024-04-02 16:58:47 -06:00
Jonathon Jongsma
21af003084 qemu: enable display/ramfb for vfio pci hostdevs
Implement display="on" and ramfb="on" for vfio PCI host devices in qemu.
This enables passthrough PCI devices for display just like we did for
mdevs.

Resolves: https://issues.redhat.com/browse/RHEL-28808

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-02 11:45:54 -05:00
Jonathon Jongsma
092f933a62 conf: allow display and ramfb for vfio pci hostdevs
We already allow the user to specify display="on" and ramfb="on" for
mdev host devices. But newer GPU models will no longer use the mdev
framework, so we should enable this same functionality for other
non-mdev passthrough PCI devices.

Resolves: https://issues.redhat.com/browse/RHEL-28808

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-02 11:45:54 -05:00
Andrea Bolognani
16d37076be virsh: Show 'connected to console' message later
Right now, we display the message before actually attempting
to connect to the VM console. That operation, however, can
fail for a number of reasons: for example, is the VM doesn't
have a serial device, the output ends up looking like

  $ virsh console cirros
  Connected to domain 'cirros'
  Escape character is ^] (Ctrl + ])
  error: internal error: cannot find character device <null>

The initial message is misleading. Change things so that it's
only printed if we actually successfully connected to the VM
console.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-02 18:26:35 +02:00
Peter Krempa
1e853a64dd tests: Drop 'test-lib.sh'
We no longer have any shell-based tests that use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
1f82833251 virshtest: Adapt virsh-uriprecedence test case
Reimplement the virsh-uriprecedence test case in virshtest. To do this
we need to add infrastructure to pass extra environment variables to the
tested virsh.

The user config files are shipped in repo rather than created in the
script.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
e57ce7fb45 tests: Reimplement 'libvirtd-fail' case directly in meson
The test simply invokes libvirtd and expects it to fail. We can do that
directly in meson without the need for a wrapper script.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
8f10dd32af tests: Re-implement '(virsh|virt-admin)-self-test' directly in meson
The self-test command for both virsh and virt-admin is self contained
and directly reports success, thus we don't actually need to run a shell
wrapper around it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
c92c63a5a3 virshtest: Adapt 'libvirtd-pool'
The test case is a fairly simple invocation of pool-create-as which can
be done easily from 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
3ace963662 virshtest: Adapt 'virsh-read-bufsiz' and 'virsh-read-non-seekable'
Test both situations (reading from non-regular file and reading a file
larger than (arbitrary) buffer size) via 'virshtest'.

To feed the pipe we need to create a thread that does it, but otherwise
it's fairly straightforward.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
60cc7bd1c0 virshtest: Adapt 'virsh-checkpoint' test
Invoke the majority of the command via DO_TEST_SCRIPT in 'virshtest'.
Some adaptation was needed to avoid printing of tables with volatile
data such as checkpoint creation time, which were converted to list
names-only.

To proprely test redefinition we store XMLs rather than taking them from
the defined checkpoints and use them separately to test redefinition of
checkpoint XMLs. This makes use of the 'cd' command in non-interactive
mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
c8d5703150 virshtest: Adapt 'virsh-snapshot' test
Invoke the majority of the command via DO_TEST_SCRIPT in 'virshtest'.
Some adaptation was needed to avoid printing of tables with volatile
data such as snapshot creation time, which were converted to list
names-only.

To proprely test redefinition we store XMLs rather than taking them from
the defined snapshots and use them separately to test redefinition of
snapshot XMLs. This makes use of the 'cd' command in non-interactive
mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
eb82c632e3 vsh: Allow non-interactive use of 'cd' command
For testing purposes it will come handy to change the directory from a
batch-mode script. Remove the check forbidding use of the 'cd' command
in batch mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
6193c4656e virsh: Fix '--name' and '--parent' used together in '(snapshot|checkpoint)-list' command
Until now when '--name' was used the parent was not printed and the
option was ignored. One option would be to declare the options mutually
exclusive, but for testing it may come handy to print both the snapshot
name and parent. Adjust the code to print them tab-separated and adjust
the docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
a068dec641 virshtest: Adapt 'virsh-start' and 'virsh-undefine' tests as 'lifecycle' case
The 'virsh-start' case simply tried to start an already running VM. This
can be easily tested together with the tests for undefining a VM.

For this test the test driver config with multiple VMs comes handy as we
need to test 3 situations when we undefine and stop the VM.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
6bc71ed27c virshtest: Adapt 'virsh-schedinfo'
It's a simple virsh invocation which can be done in 'virshtest'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
090ae2b46c virshtest: Adapt 'virsh-int-overflow'
It's a simple test case invoking one virsh command thus it can be moved
to 'virshtest'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
d8e2220c9a virshtest: Adapt 'virsh-vcpupin' test
As all cases are negative we can test them all in one virsh run.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
630b229bc9 qemuxmlconftest: Adapt XMLs from 'virsh-cpuset' and 'virsh-define-dev-segfault' cases
Rather than using 'virsh define' for the tests use the XML (or idea what
the XML is testing) and use them as 'qemuxmlconftest' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
c96ac614a8 virshtest: Reimplement 'virsh-output' test
Adapt the 'tests/virsh-output-commands' file from 'virsh-output' test as
a source. Apart from expanding the bash function to each command, I've
also had to drop the negative tests for argument population, as a
command parsing error aborts the execution of the script right away
rather than just reporting the error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
06f816cb7b virshtest: Adapt 'event' option arg handling tests from 'virsh-optparse'
Move the argument parsing tests excercising 'virsh event' options
from 'virsh-optparse' to 'virshtest'.

As the test invokes 'virsh event' with a timeout and thus waits for one
second pointlessly the patch also adds infrastructure to mark individual
cases as expensive and is skipped normally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00