]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoqemu: Remove code conditional on QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Peter Krempa [Tue, 19 Jul 2022 11:04:16 +0000 (13:04 +0200)]
qemu: Remove code conditional on QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI

Now that QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI is always set we can remove the
code which handled cases when the capability was not set.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire capabilities used for -blockdev detection
Peter Krempa [Mon, 18 Jul 2022 11:24:38 +0000 (13:24 +0200)]
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>
2 years agoqemu: command: Always assume support for QEMU_CAPS_SCSI_DISK_DEVICE_ID
Peter Krempa [Mon, 18 Jul 2022 11:16:40 +0000 (13:16 +0200)]
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>
2 years agoqemu: Refactor access to 'qomName' field of the qemu disk private data
Peter Krempa [Wed, 20 Jul 2022 18:08:37 +0000 (20:08 +0200)]
qemu: Refactor access to 'qomName' field of the qemu disk private data

The code which fills 'qomName' does so only when the blockdev capability
is enabled so we don't have to check it separately as it can be only
non-NULL when blockdev is used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Force QEMU_CAPS_BLOCKDEV(_HOSTDEV_SCSI) in fake caps tests
Peter Krempa [Wed, 20 Jul 2022 13:37:19 +0000 (15:37 +0200)]
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>
2 years agoqemu: capabilities: Unconditionally set QEMU_CAPS_BLOCKDEV/QEMU_CAPS_BLOCKDEV_HOSTDEV...
Peter Krempa [Fri, 15 Jul 2022 14:58:34 +0000 (16:58 +0200)]
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>
2 years agoqemu: capabilities: Retire QEMU_CAPS_QCOW2_LUKS
Peter Krempa [Fri, 15 Jul 2022 14:51:07 +0000 (16:51 +0200)]
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>
2 years agoqemu: Always assume support for QEMU_CAPS_QCOW2_LUKS
Peter Krempa [Fri, 15 Jul 2022 14:49:59 +0000 (16:49 +0200)]
qemu: Always assume support for QEMU_CAPS_QCOW2_LUKS

luks-encrypted QCOW2 files were introduced in qemu-2.6 unconditionally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmltest: Modernize all test cases using QEMU_CAPS_QCOW2_LUKS
Peter Krempa [Fri, 15 Jul 2022 14:35:27 +0000 (16:35 +0200)]
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>
2 years agoqemuxml2argvtest: Use DO_TEST_CAPS_LATEST for all 'user-aliases' tests
Peter Krempa [Fri, 15 Jul 2022 14:48:22 +0000 (16:48 +0200)]
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>
2 years agoqemu: capabilities: Retire QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES
Peter Krempa [Fri, 15 Jul 2022 14:28:50 +0000 (16:28 +0200)]
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>
2 years agoqemu: Always assume support for QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES
Peter Krempa [Fri, 15 Jul 2022 14:24:39 +0000 (16:24 +0200)]
qemu: Always assume support for QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES

Discard and zero-detection for disk sources is supported since qemu-2.1
so we can always assume it's supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_GLUSTER_DEBUG_LEVEL
Peter Krempa [Fri, 15 Jul 2022 14:20:01 +0000 (16:20 +0200)]
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>
2 years agoqemu: Always assume support for QEMU_CAPS_GLUSTER_DEBUG_LEVEL
Peter Krempa [Fri, 15 Jul 2022 14:18:12 +0000 (16:18 +0200)]
qemu: Always assume support for QEMU_CAPS_GLUSTER_DEBUG_LEVEL

The 'debug' level for the gluster driver was added in qemu-2.8
unconditionally so libvirt can always assume it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_ACTIVE_COMMIT
Peter Krempa [Fri, 15 Jul 2022 14:13:19 +0000 (16:13 +0200)]
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>
2 years agoqemu: Always assume support for QEMU_CAPS_ACTIVE_COMMIT
Peter Krempa [Fri, 15 Jul 2022 14:09:33 +0000 (16:09 +0200)]
qemu: Always assume support for QEMU_CAPS_ACTIVE_COMMIT

Active layer block commit is unconditionally 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>
2 years agoqemu: capabilities: Retire QEMU_CAPS_CHANGE_BACKING_FILE
Peter Krempa [Fri, 15 Jul 2022 14:07:03 +0000 (16:07 +0200)]
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>
2 years agoqemu: Allways assume QEMU_CAPS_CHANGE_BACKING_FILE
Peter Krempa [Fri, 15 Jul 2022 14:04:23 +0000 (16:04 +0200)]
qemu: Allways assume QEMU_CAPS_CHANGE_BACKING_FILE

The 'change-backing-file' command was added in qemu-2.1 and doesn't have
any dependencies. We use it as witness for using blockjobs with relative
backing paths. Always assume it's supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_AUDIODEV
Peter Krempa [Wed, 22 Jun 2022 14:16:26 +0000 (16:16 +0200)]
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>
2 years agoqemuxml2(argv|xml)test: Remove use of QEMU_CAPS_AUDIODEV in fake-caps tests
Peter Krempa [Wed, 22 Jun 2022 14:14:47 +0000 (16:14 +0200)]
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>
2 years agoqemu: validate: Remove unreachable checks for QEMU_CAPS_AUDIODEV
Peter Krempa [Wed, 22 Jun 2022 13:43:52 +0000 (15:43 +0200)]
qemu: validate: Remove unreachable checks for QEMU_CAPS_AUDIODEV

We now only support qemu versions which already have the capability so
we can remove this now unused code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: command: Drop qemuBuildAudioCommandLine thin wrapper
Peter Krempa [Wed, 22 Jun 2022 13:41:33 +0000 (15:41 +0200)]
qemu: command: Drop qemuBuildAudioCommandLine thin wrapper

Rename qemuBuildAudioCommandLineArgs to qemuBuildAudioCommandLine and
fix the arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: command: Drop the code for configuring audio devices via environment variables
Peter Krempa [Wed, 22 Jun 2022 13:39:39 +0000 (15:39 +0200)]
qemu: command: Drop the code for configuring audio devices via environment variables

Remove the old now unused code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: command: Always assume QEMU_CAPS_AUDIODEV
Peter Krempa [Wed, 22 Jun 2022 13:36:23 +0000 (15:36 +0200)]
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>
2 years agoqemu: Formally deprecate support for qemu < 4.2
Peter Krempa [Wed, 22 Jun 2022 13:23:36 +0000 (15:23 +0200)]
qemu: Formally deprecate support for qemu < 4.2

Per [1] the Debian 10 reaches EOL in August of 2022. This allows us to
bump the minimum supported qemu version to qemu-4.2 which will also
allow us to do significant cleanups.

This commit bumps the minimum qemu verison and updates the corresponding
docs.

[1]: https://wiki.debian.org/DebianReleases

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomaincapstest: Remove test data for qemu-4.1
Peter Krempa [Wed, 22 Jun 2022 13:11:11 +0000 (15:11 +0200)]
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>
2 years agoqemucapabilitiestest: Remove test data for qemu-4.1
Peter Krempa [Wed, 22 Jun 2022 13:10:42 +0000 (15:10 +0200)]
qemucapabilitiestest: Remove test data for qemu-4.1

qemu-4.1 will not be supported any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomaincapstest: Remove test data for qemu-4.0
Peter Krempa [Wed, 22 Jun 2022 13:10:01 +0000 (15:10 +0200)]
domaincapstest: Remove test data for qemu-4.0

qemu-4.0 will no longer be supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemucapabilitiestest: Remove test data for qemu-4.0
Peter Krempa [Wed, 22 Jun 2022 13:08:56 +0000 (15:08 +0200)]
qemucapabilitiestest: Remove test data for qemu-4.0

qemu-4.0 will no longer be supported, remove the test data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: domaincaps: Remove test data for qemu-3.1
Peter Krempa [Tue, 21 Jun 2022 13:39:24 +0000 (15:39 +0200)]
tests: domaincaps: Remove test data for qemu-3.1

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemucapabilities: Remove qemu-3.1 test data
Peter Krempa [Tue, 21 Jun 2022 13:35:06 +0000 (15:35 +0200)]
tests: qemucapabilities: Remove qemu-3.1 test data

Upcoming patches will raise the minimum required qemu version to 4.2.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove 'qemu-4.0' versions of 'cpu-host-model-cmt' and 'cpu-tsc...
Peter Krempa [Wed, 22 Jun 2022 12:23:57 +0000 (14:23 +0200)]
qemuxml2argvtest: Remove 'qemu-4.0' versions of 'cpu-host-model-cmt' and 'cpu-tsc-frequency'

Minimum qemu version is going to be bumped to qemu-4.2. Upgrading the
version of these tests doesn't make sense as the host cpu in the real
capabilities doesn't support the features the tests are attempting to
test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove 'qemu-4.0' version of aarch64-features-sve case
Peter Krempa [Tue, 21 Jun 2022 14:46:14 +0000 (16:46 +0200)]
qemuxml2argvtest: Remove 'qemu-4.0' version of aarch64-features-sve case

Minimum qemu will be bumped to 4.2 so this test no longer makes sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove pre-qemu-4.2 versions of 'cpu-host-model' test
Peter Krempa [Tue, 21 Jun 2022 14:36:18 +0000 (16:36 +0200)]
qemuxml2argvtest: Remove pre-qemu-4.2 versions of 'cpu-host-model' test

Minimum qemu will be bumped to 4.2 so remove the older test cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove 'qemu-3.1' versions of virtio-(non-)transitional tests
Peter Krempa [Tue, 21 Jun 2022 14:31:30 +0000 (16:31 +0200)]
qemuxml2argvtest: Remove 'qemu-3.1' versions of virtio-(non-)transitional tests

Starting from qemu-4.0 a new device model name is used instead of the
'disable_*' props. Since we are going to bump to qemu-4.2 as minimum
this test can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Drop 'qemu-4.1' variants of all audio tests
Peter Krempa [Tue, 21 Jun 2022 14:16:31 +0000 (16:16 +0200)]
qemuxml2argvtest: Drop 'qemu-4.1' variants of all audio tests

Minimum qemu version will be bumped to qemu-4.2 so we no longer need to
care about configuring audiodevs via the environment variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemuxml2argv: Remove pre-blockdev versions of disk-related tests
Peter Krempa [Tue, 21 Jun 2022 13:53:01 +0000 (15:53 +0200)]
tests: qemuxml2argv: Remove pre-blockdev versions of disk-related tests

Upcoming patches will bump minimum supported qemu version to 4.2 which
will use '-blockdev' with qemu so we can drop all the old test cases for
pre-blockdev configs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Remove 'qemu-4.1' variant of 'x86-kvm-32-on-64'
Peter Krempa [Tue, 21 Jun 2022 13:45:11 +0000 (15:45 +0200)]
qemuxml2(argv|xml)test: Remove 'qemu-4.1' variant of 'x86-kvm-32-on-64'

Upcoming patches will bump minimum qemu version to 4.2. In this case we
the 'latest' case is sufficient as with qemu-4.2 we already behave as
upstream ('qemu64' cpu is used instead of 'qemu32').

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoci: Drop Debian 10
Peter Krempa [Fri, 22 Jul 2022 10:26:51 +0000 (12:26 +0200)]
ci: Drop Debian 10

Debian 10 reaches EOL in August of 2022.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoci: Move active Debian-10 jobs to Debian-11
Peter Krempa [Fri, 22 Jul 2022 10:24:32 +0000 (12:24 +0200)]
ci: Move active Debian-10 jobs to Debian-11

Debian 10 will reach EOL in august of 2022 and thus libvirt will no
longer target it. Move CI jobs over to Debian-11.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuMigrationSrcWaitForSpice: Remove return value
Peter Krempa [Thu, 11 Aug 2022 11:31:53 +0000 (13:31 +0200)]
qemuMigrationSrcWaitForSpice: Remove return value

The only caller doesn't check the return value and actually doesn't have
one either. Remove the return value and adjust return statements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainObjWait: Report error when VM is being destroyed
Peter Krempa [Wed, 10 Aug 2022 13:39:57 +0000 (15:39 +0200)]
qemuDomainObjWait: Report error when VM is being destroyed

Since we started handling the monitor EOF event inside a job any code
which uses virDomainObjWait would no longer properly abort in case when
the VM crashed during the wait.

This is because virDomainObjWait uses virDomainObjIsActive which checks
'vm->def->id' to see if the VM is still active. Unfortunately the domain
id is cleared in qemuProcessStop which is run only inside the job.

To fix this we can use the 'beingDestroyed' flag stored in the VM
private data which is set to true around the time when the condition is
signalled.

Reported-by: Pavel Hrdina <phrdina@redhat.com>
Fixes: 8c9ff9960b29d4703a99efdd1cadcf6f48799cc0
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoci: Fix paths shown in the website
Andrea Bolognani [Tue, 19 Jul 2022 13:21:30 +0000 (15:21 +0200)]
ci: Fix paths shown in the website

Right now we're setting the prefix to a custom path, which
results in paths like

  /builds/libvirt/libvirt/vroot/etc/libvirt/virtqemud.conf

ending up in the generated HTML. In order to avoid that,
set the prefix and other installation paths to reasonable
default values by passing

  -Dsystem=true

and then take advantage of $DESTDIR support to still be able
to write the HTML files without requiring root privileges.

Reported-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoscripts: Add $DESTDIR support to meson-install-web.py
Andrea Bolognani [Wed, 10 Aug 2022 16:06:24 +0000 (18:06 +0200)]
scripts: Add $DESTDIR support to meson-install-web.py

meson already supports $DESTDIR natively, but in this case
we're using a custom script and so we have to do some extra
work ourselves.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemu: Replace virDomainObjWait with qemuDomainObjWait
Peter Krempa [Wed, 10 Aug 2022 13:35:54 +0000 (15:35 +0200)]
qemu: Replace virDomainObjWait with qemuDomainObjWait

The qemu code will need to check other qemu-private conditions when
reporting success for waiting. Thus we must replace all use of it with a
qemu-specific helper. For now the helper forwards directly to
virDomainObjWait.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuProcessBeginStopJob: Add debug log when waking up all threads waiting on domain...
Peter Krempa [Wed, 10 Aug 2022 13:31:12 +0000 (15:31 +0200)]
qemuProcessBeginStopJob: Add debug log when waking up all threads waiting on domain condition

Aid in debugging of potentially stuck threads.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Japanese)
Ludek Janda [Tue, 9 Aug 2022 11:53:20 +0000 (13:53 +0200)]
Translated using Weblate (Japanese)

Currently translated at 99.0% (10379 of 10480 strings)

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

Co-authored-by: Ludek Janda <ljanda@redhat.com>
Signed-off-by: Ludek Janda <ljanda@redhat.com>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 9 Aug 2022 11:53:19 +0000 (13:53 +0200)]
Translated using Weblate (Swedish)

Currently translated at 41.5% (4353 of 10480 strings)

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

Translated using Weblate (Swedish)

Currently translated at 41.3% (4338 of 10480 strings)

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

Translated using Weblate (Swedish)

Currently translated at 41.3% (4333 of 10480 strings)

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

Translated using Weblate (Swedish)

Currently translated at 40.9% (4293 of 10480 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>
2 years agonodedev: support 'mtty' device for testing
Jonathon Jongsma [Fri, 15 Jul 2022 19:10:30 +0000 (14:10 -0500)]
nodedev: support 'mtty' device for testing

It would be nice to be able to test the mediated device capabilities
without having physical hardware which supports it. The 'mtty' kernel
module presents a virtual parent device which is capable of creating
'fake' mediated devices, and as such it would be useful for testing.

However, the 'mtty' device is not part of an existing device subsystem
(e.g. PCI, etc), so libvirt ignores it and it does not get added to the
node device list. And because it does not get added to the node device
list, it cannot be used to create child mdevs using `virsh
nodedev-create`.

There is already a node device type capability
VIR_NODE_DEV_CAP_MDEV_TYPES that indicates whether a device supports
creating child mediated devices, but libvirt assumes that this is a
nested capability (in other words, it assumes that the primary
capability of a device is something like PCI). If we allow this
MDEV_TYPES capability to be a primary device capability, then we can
support virtual devices like 'mtty' as a parent for mediated devices.

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Mock virQEMUCapsProbeHVF()
Andrea Bolognani [Wed, 10 Aug 2022 09:42:37 +0000 (11:42 +0200)]
tests: Mock virQEMUCapsProbeHVF()

Successfully returning without doing anything is what the
function already does on non-Apple platforms.

When building on macOS, however, the check for HVF availability
will be performed. When running on bare metal, that will result
in the QEMU_CAPS_HVF flag being added to the virQEMUCaps
instance, and a bunch of error messages along the lines of

  In 'tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml':
  Offset 7557
  Expect [c]
  Actual [hvf'/>
    <flag name=‘c]

showing up.

Up until now we hadn't noticed because our CI jobs run in VMs,
where HVF support is not available.

Reported-by: Christophe de Dinechin <dinechin@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Tested-by: Christophe de Dinechin <dinechin@redhat.com>
2 years agoqemu: Make virQEMUCapsProbeHVF() non-static
Andrea Bolognani [Wed, 10 Aug 2022 09:38:31 +0000 (11:38 +0200)]
qemu: Make virQEMUCapsProbeHVF() non-static

We need to do this so that we can mock it in the test suite.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Tested-by: Christophe de Dinechin <dinechin@redhat.com>
2 years agotests: Use domaincapsmock in qemucapabilitiestest
Andrea Bolognani [Tue, 9 Aug 2022 16:10:27 +0000 (18:10 +0200)]
tests: Use domaincapsmock in qemucapabilitiestest

This doesn't change anything at the moment, but is necessary
for the upcoming fix.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Tested-by: Christophe de Dinechin <dinechin@redhat.com>
2 years agohypervisor: domain_job: add JobData private callbacks into virDomainJobObj
Kristina Hanicova [Wed, 10 Aug 2022 12:57:04 +0000 (14:57 +0200)]
hypervisor: domain_job: add JobData private callbacks into virDomainJobObj

We need this callback structure for qemu driver only, but it
makes more sense to include it in the virDomainJobObj in case of
other future additions than as a parameter of a beginJob
functions.

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>
2 years agoqemu: refactor functions with removed driver if possible
Kristina Hanicova [Wed, 10 Aug 2022 12:57:03 +0000 (14:57 +0200)]
qemu: refactor functions with removed driver if possible

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>
2 years agoqemu: remove unused driver and all its propagations
Kristina Hanicova [Wed, 10 Aug 2022 12:57:02 +0000 (14:57 +0200)]
qemu: remove unused driver and all its propagations

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>
2 years agohypervisor: domain_job: add maxQueuedJobs
Kristina Hanicova [Wed, 10 Aug 2022 12:57:01 +0000 (14:57 +0200)]
hypervisor: domain_job: add maxQueuedJobs

This patch adds a new variable maxQueuedJobs into the job object
as it is the last hypervisor-based part of the begin job. Since
this patch, it will not be necessary to propagate driver
structure into the job functions.

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>
2 years agoqemu: beginJob: move saveStatus into private job callbacks
Kristina Hanicova [Wed, 10 Aug 2022 12:57:00 +0000 (14:57 +0200)]
qemu: beginJob: move saveStatus into private job callbacks

It makes sense to move this to other hypervisor-based functions
into the private job callback structure to make begin job
general.

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>
2 years agoqemu: Fix indentation
Andrea Bolognani [Tue, 9 Aug 2022 16:17:14 +0000 (18:17 +0200)]
qemu: Fix indentation

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2 years agobridge_driver: Enable virMacMap iff dnsmasq is started
Michal Privoznik [Tue, 9 Aug 2022 11:31:41 +0000 (13:31 +0200)]
bridge_driver: Enable virMacMap iff dnsmasq is started

The virMacMap module is used only for libvirt_guests NSS module
as it records list of MAC addresses used by certain guest. But
the module itself is usable if and only if the network assigns IP
addresses (i.e. has dnsmasq running). If it's some other
authority that assigns IP addresses then we do not need the
virMacMap module at all.

For instance, a network with no <forward/> type and no DHCP set
won't create /var/lib/libvirt/dnsmasq/ dir which is what the
module expects to exist. But there's no need for the module to
even care about such network.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/348
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agobridge_driver: Introduce a helper for virNetworkObjSetMacMap()
Michal Privoznik [Tue, 9 Aug 2022 11:42:32 +0000 (13:42 +0200)]
bridge_driver: Introduce a helper for virNetworkObjSetMacMap()

Currently, whenever virNetworkObjSetMacMap() is called the same
pattern is used:

1) call virMacMapFileName() to generate a filename,
2) pass this filename to virMacMapNew(), and finally
3) pass retval from previous step to virNetworkObjSetMacMap().

Move this code into a helper (networkSetMacMap()) and replace
both pattern occurrences with its call.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirNetworkObjSetMacMap: take double pointer of @macmap
Michal Privoznik [Tue, 9 Aug 2022 09:38:43 +0000 (11:38 +0200)]
virNetworkObjSetMacMap: take double pointer of @macmap

The virNetworkObjSetMacMap() API effectively steals passed
@macmap argument. However, the argument is a plain, first order
pointer. This requires every caller to set the argument to NULL
after the function was called. Let's make the function take
double pointer instead to make it obvious that the argument is
consumed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agobridge_driver: Use g_autoptr() for virMacMap
Michal Privoznik [Tue, 9 Aug 2022 11:37:32 +0000 (13:37 +0200)]
bridge_driver: Use g_autoptr() for virMacMap

Let's annotate virMacMap variables in bridge_driver.c with
g_autoptr() so that they are automatically freed upon error. This
may look like a needless commit, since there's no memory leak
currently, but it simplifies the next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agobridge_driver: Set @dnsmasqStarted only after successful dnsmasq spawn
Michal Privoznik [Tue, 9 Aug 2022 11:48:34 +0000 (13:48 +0200)]
bridge_driver: Set @dnsmasqStarted only after successful dnsmasq spawn

The networkStartNetworkVirtual() function handles starting of
networks of different forward types (none, nat, route, open).
And as a part of startup process dnsmasq might be spawned but
doesn't have to be (depending on the network configuration). The
@dnsmasqStarted variable is supposed to track whether dnsmasq was
started or not (so that it can be killed when starting network
fails after it was started). But the variable is set even when
the code decided not to start it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agorpm: merge mingw sub-packages into native spec
Daniel P. Berrangé [Mon, 8 Aug 2022 15:40:56 +0000 (11:40 -0400)]
rpm: merge mingw sub-packages into native spec

One specfile containing both native and mingw builds is the
new best practice for Fedora. This reduces the maint burden
and ensures the mingw packages don't fall behind.

Note this adds many more BuildRequires for anyone building
on Fedora, which will now need installing.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotests: Pass the flat_namespace option to the linker
Christophe de Dinechin [Mon, 8 Aug 2022 18:14:08 +0000 (20:14 +0200)]
tests: Pass the flat_namespace option to the linker

This fixes vircryptotest on macOS 12 (Monterey).

The test relies on library injection (using DYLD_INSERT_LIBRARIES)
to replace the normal random functions with functions giving predictable
results, defined in virrandommock.c. However, using DYLD_INSERT_LIBRARIES
only works when building with flat namespaces.

Adding the -Wl,-flat_namespace option to the linker fixes the problem.
The option was already defined in the top-level meson.build, but had been
forgotten in the test linker arguments.

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoconf: Simplify IOMMU device validation
Andrea Bolognani [Mon, 8 Aug 2022 15:38:42 +0000 (17:38 +0200)]
conf: Simplify IOMMU device validation

Instead of duplicating the list of attributes that are not
allowed for some of the IOMMU models, use two separate switch
statements: one for the attributes and one for the address.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: deprecate query-cpus-fast capability
Paolo Bonzini [Mon, 8 Aug 2022 15:15:08 +0000 (17:15 +0200)]
qemu: deprecate query-cpus-fast capability

All supported versions of QEMU have the command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: remove support for query-cpus
Paolo Bonzini [Mon, 8 Aug 2022 15:15:07 +0000 (17:15 +0200)]
qemu: remove support for query-cpus

The query-cpus-fast command was introduced in 2.12, therefore
query-cpus is never used on supported versions of QEMU.  Remove
the logic to parse its output, as well as the parameters to
choose between the two commands.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agotests: remove query-cpus tests
Paolo Bonzini [Mon, 8 Aug 2022 15:15:06 +0000 (17:15 +0200)]
tests: remove query-cpus tests

All tests now use query-cpus-fast.  Since the QEMU driver will lose
support for query-cpus soon, go ahead and remove support for testing
it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agotests: convert x86_64 tests to query-cpus-fast
Paolo Bonzini [Mon, 8 Aug 2022 15:15:05 +0000 (17:15 +0200)]
tests: convert x86_64 tests to query-cpus-fast

All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
convert the JSON output for x86 tests to the new format, and drop the
"halted" field from the expected output as it is not available anymore.

The CPU properties were obtained from the query-hotpluggable-cpus output
in tests/qemumonitorjsondata.  CPU, thread_id, and qom_path are renamed
respectively to cpu-index, qom-path and thread-id, while nip and halted
are removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agotests: convert ppc64 tests to query-cpus-fast
Paolo Bonzini [Mon, 8 Aug 2022 15:15:04 +0000 (17:15 +0200)]
tests: convert ppc64 tests to query-cpus-fast

All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
convert the JSON output for PPC tests to the new format, and drop the
"halted" field from the expected output as it is not available anymore.

The CPU properties were obtained from the query-hotpluggable-cpus output
in tests/qemumonitorjsondata.  CPU, thread_id, and qom_path are renamed
respectively to cpu-index, qom-path and thread-id, while nip and halted
are removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agotests: drop "-fast" from query-cpus-fast tests
Paolo Bonzini [Mon, 8 Aug 2022 15:15:03 +0000 (17:15 +0200)]
tests: drop "-fast" from query-cpus-fast tests

All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
remove the "-fast" suffix from both x86-full-fast and s390-fast.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agotests: remove duplicate cpuinfo test
Paolo Bonzini [Mon, 8 Aug 2022 15:15:02 +0000 (17:15 +0200)]
tests: remove duplicate cpuinfo test

All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
remove the query-cpus version of the x86-full test.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoconf: Check IOMMU for unsupported attributes
Michal Privoznik [Fri, 8 Jul 2022 09:33:02 +0000 (11:33 +0200)]
conf: Check IOMMU for unsupported attributes

Currently, it's possible to pass various attributes to an IOMMU's
<driver/> element hoping that we enable them in underlying
hypervisor. However, depending on the IOMMU model, some of these
attributes can't be enabled and are simply ignored. This is
suboptimal and we should reject such configuration in the
validate phase.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2101633
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agonews: qemu: Add support for zero-copy migration
Fangge Jin [Fri, 22 Jul 2022 08:49:40 +0000 (16:49 +0800)]
news: qemu: Add support for zero-copy migration

Signed-off-by: Fangge Jin <fjin@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: move virDomainObjCanSetJob() into hypervisor
Kristina Hanicova [Wed, 3 Aug 2022 12:43:22 +0000 (14:43 +0200)]
qemu: move virDomainObjCanSetJob() into hypervisor

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: move virDomainNestedJobAllowed into hypervisor
Kristina Hanicova [Wed, 3 Aug 2022 12:43:21 +0000 (14:43 +0200)]
qemu: move virDomainNestedJobAllowed into hypervisor

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu & hypervisor: move qemuDomainTrackJob() into hypervisor
Kristina Hanicova [Wed, 3 Aug 2022 12:43:20 +0000 (14:43 +0200)]
qemu & hypervisor: move qemuDomainTrackJob() into hypervisor

This patch moves qemuDomainTrackJob() as virDomainTrackJob() into
hypervisor because it is called in begin job and end job
functions that will be generalized in the following series.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoCH: use virDomainObjClearJob() instead of virCHDomainObjFreeJob()
Kristina Hanicova [Wed, 3 Aug 2022 12:43:19 +0000 (14:43 +0200)]
CH: use virDomainObjClearJob() instead of virCHDomainObjFreeJob()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoLXC: use virDomainObjClearJob() instead of virLXCDomainObjFreeJob()
Kristina Hanicova [Wed, 3 Aug 2022 12:43:18 +0000 (14:43 +0200)]
LXC: use virDomainObjClearJob() instead of virLXCDomainObjFreeJob()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: use virDomainObjClearJob() instead of libxlDomainObjFreeJob()
Kristina Hanicova [Wed, 3 Aug 2022 12:43:17 +0000 (14:43 +0200)]
libxl: use virDomainObjClearJob() instead of libxlDomainObjFreeJob()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu & hypervisor: move qemuDomainObjClearJob() into hypervisor
Kristina Hanicova [Wed, 3 Aug 2022 12:43:16 +0000 (14:43 +0200)]
qemu & hypervisor: move qemuDomainObjClearJob() into hypervisor

This patch moves qemuDomainObjClearJob() as
virDomainObjClearJob() into hypervisor in order to be used by
other hypervisors as well.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu & hypervisor: move qemuDomainObjPreserveJob() into hypervisor
Kristina Hanicova [Wed, 3 Aug 2022 12:43:15 +0000 (14:43 +0200)]
qemu & hypervisor: move qemuDomainObjPreserveJob() into hypervisor

This patch moves qemuDomainObjPreserveJob() as
virDomainObjPreserveJob() into hypervisor in order to be used by
other hypervisors as well.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: propagate virDomainJobObj into qemuDomainObjPreserveJob()
Kristina Hanicova [Wed, 3 Aug 2022 12:43:14 +0000 (14:43 +0200)]
qemu: propagate virDomainJobObj into qemuDomainObjPreserveJob()

It does not make sense to propagate virDomainObj and get
qemuDomainObjPrivate from it, when it is already accessible in
the only function qemuDomainObjPreserveJob() is called from. That
being said, we can also propagate virDomainJobObj directly and
avoid using qemu private structure.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu & hypervisor: move qemuDomainObjResetAsyncJob() into hypervisor
Kristina Hanicova [Wed, 3 Aug 2022 12:43:13 +0000 (14:43 +0200)]
qemu & hypervisor: move qemuDomainObjResetAsyncJob() into hypervisor

This patch moves qemuDomainObjResetAsyncJob() as
virDomainObjResetAsyncJob() into hypervisor.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu & hypervisor: move qemuDomainObjResetAgentJob() into hypervisor
Kristina Hanicova [Wed, 3 Aug 2022 12:43:12 +0000 (14:43 +0200)]
qemu & hypervisor: move qemuDomainObjResetAgentJob() into hypervisor

This patch moves qemuDomainObjResetAgentJob() as
virDomainObjResetAgentJob() into hypervisor.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovmx: Add support for dummy network interface
Martin Kletzander [Thu, 4 Aug 2022 08:27:40 +0000 (10:27 +0200)]
vmx: Add support for dummy network interface

Also map it to an ethernet without connectionType and networkName.

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>
2 years agoconf, docs: Add support for dummy network interface
Martin Kletzander [Thu, 4 Aug 2022 08:26:40 +0000 (10:26 +0200)]
conf, docs: Add support for dummy network interface

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovmx: Fix indentation
Martin Kletzander [Mon, 1 Aug 2022 14:02:53 +0000 (16:02 +0200)]
vmx: Fix indentation

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_process: Destroy domain's namespace after killing QEMU
Michal Privoznik [Wed, 3 Aug 2022 10:27:19 +0000 (12:27 +0200)]
qemu_process: Destroy domain's namespace after killing QEMU

After QEMU is killed in qemuProcessStop() its mount namespace
doesn't exist anymore, because it was the only process running
there. Thus we should clear our internal flag that the domain has
namespace enabled so that seclabel restore code does not try to
enter it. We do the same in qemuProcessHandleMonitorEOF() but
when it is us, who decides to kill QEMU rather than QEMU quitting
we haven't seen EOF by the time qemuProcessStop() is called.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agokbase: Document how to disable Secure Boot entirely
Andrea Bolognani [Thu, 4 Aug 2022 08:43:09 +0000 (10:43 +0200)]
kbase: Document how to disable Secure Boot entirely

In most cases, disabling the secure-boot or the enrolled-keys
firmware feature will achieve the same result: allowing an
unsigned operating system to run.

Right now we're only documenting the latter configuration. Add
the former as well, and explain the difference between the two.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agokbase: Always explicitly enable secure-boot firmware feature
Andrea Bolognani [Wed, 3 Aug 2022 16:07:12 +0000 (18:07 +0200)]
kbase: Always explicitly enable secure-boot firmware feature

It should be enough to enable or disable the enrolled-keys feature
to control whether Secure Boot is enforced, but there's a slight
complication: many distro packages for edk2 include, in addition
to general purpose firmware images, builds that are targeting the
Confidential Computing use case.

For those, the firmware descriptor will not advertise the
enrolled-keys feature, which will technically make them suitable
for satisfying a configuration such as

  <os firmware='efi'>
    <firmware>
      <feature state='off' name='enrolled-keys'/>
    </firmware>
  </os>

In practice, users will expect the general purpose build to be
used in this case. Explicitly asking for the secure-boot feature
to be enabled achieves that result at the cost of some slight
additional verbosity.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agovirhostcpu: Fix non-Linux virHostCPUGetPhysAddrSize() stub
Michal Privoznik [Thu, 4 Aug 2022 08:27:56 +0000 (10:27 +0200)]
virhostcpu: Fix non-Linux virHostCPUGetPhysAddrSize() stub

The non-Linux version of virHostCPUGetPhysAddrSize() is lacking
G_GNUC_UNUSED attribute to its @size argument which triggers an
error on all non-Linux builds. And while at it, make the function
actually signal error (ENOSYS) since it does not set the
argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Add support for max physical address size
Dario Faggioli [Fri, 29 Jul 2022 19:34:35 +0000 (13:34 -0600)]
qemu: Add support for max physical address size

This patch maps /domain/cpu/maxphysaddr into -cpu parameters:

  - <maxphysaddr mode='passthrough'/> becomes host-phys-bits=on
  - <maxphysaddr mode='emualte' bits='42'/> becomes phys-bits=42

Passthrough mode can only be used if the chosen CPU model is
'host-passthrough'. Also validate that an explicitly specified
bits value does not exceed the physical address bits on the host.

The feature is available since QEMU 2.7.0.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agocapabilities: Report number of host CPU physical address bits
Jim Fehlig [Fri, 29 Jul 2022 19:34:34 +0000 (13:34 -0600)]
capabilities: Report number of host CPU physical address bits

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Add support for specifying CPU max physical address size
Dario Faggioli [Fri, 29 Jul 2022 19:34:33 +0000 (13:34 -0600)]
conf: Add support for specifying CPU max physical address size

This patch introduces the

    <maxphysaddr mode='passthrough'/>
    <maxphysaddr mode='emulate' bits='42'/>

sub element of /domain/cpu, which allows specifying the guest virtual CPU
address size. This can be useful if the guest needs to have a large amount
of memory.

If mode='passthrough', the virtual CPU will have the same number of address
bits as the host. If mode='emulate', the mandatory bits attribute specifies
the number of address bits.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemuxml2argvtest: Add negative cases for TPM version
Michal Privoznik [Tue, 2 Aug 2022 08:23:42 +0000 (10:23 +0200)]
qemuxml2argvtest: Add negative cases for TPM version

Now that we have all the machinery needed, we can introduce two
simple test cases:

1) only TPM 1.2 is supported, but TPM 2.0 was requested in domain XML,
2) only TPM 2.0 is supported, but TPM 1.2 was requested in domain XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemu_validate: Validate TPM version
Michal Privoznik [Tue, 2 Aug 2022 08:23:23 +0000 (10:23 +0200)]
qemu_validate: Validate TPM version

Supported TPM versions are reported in domain capabilities. These
are used already to validate TPM type and model, but not TPM
version. This is suboptimal, because otherwise we leave users to
meet the error when starting a guest and libvirt spawns swtpm
binary which in turn reports an error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agotestutilsqemu: Fake TPM versions
Michal Privoznik [Wed, 20 Jul 2022 07:51:55 +0000 (09:51 +0200)]
testutilsqemu: Fake TPM versions

Because of v8.5.0-rc1~25 we are already faking TPM support for
domaincaps. Might as well fake supported TPM versions.
The swtpm binary supports both TPM versions since its first
release, but pretend it isn't the case. For QEMU-5.2 and older
pretend only TPM-1.2 is available, QEMU-6.* has both TPM-1.2 and
TPM-2.0 and QEMU-7.0 and newer has only TPM-2.0 available.
This way, domaincaps are more dispersed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agosrc: Export virDomainTPMVersion enum conversion helpers
Michal Privoznik [Tue, 2 Aug 2022 08:21:07 +0000 (10:21 +0200)]
src: Export virDomainTPMVersion enum conversion helpers

The virDomainTPMVersion enum is declared in domain_conf.h among
with its TypeFromString() and TypeToString() helpers (which are
then implemented in domain_conf.c). However, neither of these
helpers is exposed in libvirt_private.syms which makes it
impossible for other modules to use.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>