Commit Graph

46586 Commits

Author SHA1 Message Date
Jiri Denemark
2d7b22b561 qemu: Make qemuMigrationSrcCancel optionally synchronous
We have always considered "migrate_cancel" QMP command to return after
successfully cancelling the migration. But this is no longer true (to be
honest I'm not sure it ever was) as it just changes the migration state
to "cancelling". In most cases the migration is canceled pretty quickly
and we don't really notice anything, but sometimes it takes so long we
even get to clearing migration capabilities before the migration is
actually canceled, which fails as capabilities can only be changed when
no migration is running. So to avoid this issue, we can wait for the
migration to be really canceled after sending migrate_cancel. The only
place where we don't need synchronous behavior is when we're cancelling
migration on user's request while it is actively watched by another
thread.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-06 18:28:10 +02:00
Jiri Denemark
4e55fe21b5 qemu: Create wrapper for qemuMonitorMigrateCancel
We will need a little bit more code around qemuMonitorMigrateCancel to
make sure it works as expected. The new qemuMigrationSrcCancel helper
will avoid repeating the code in several places.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-06 18:28:10 +02:00
Jiri Denemark
0ff8c175f7 qemu: Rename qemuMigrationSrcCancel
Let's call this qemuMigrationSrcCancelUnattended as the function is
supposed to be used when no other thread is watching the migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-06 18:28:10 +02:00
Michal Privoznik
e4f577b25e qemu_driver: Fix order of arguments in qemuDomainGetStatsCpuProc()
Just before pushing my earlier commit I've switch order of two
arguments of virProcessGetStatInfo() (as suggested in review).
However, I forgot to swap the arguments in
qemuDomainGetStatsCpuProc() which leads to userTime and sysTime
being swapped.

Fixes: 044b8744d6
Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-09-06 17:24:38 +02:00
Peter Krempa
3aa7c75fec util: virFileIsSharedFSType: Simplify shared fs type declarations
Use approach similar to virFileIsSharedFsFUSE to declaratively handle
the filesystem magic numbers mapping to libvirt's fstypes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 17:32:14 +02:00
Peter Krempa
0c51bc31bc util: virfile: Drop QB_MAGIC constant
The filesystem type magic constant was added for the 'quobyte' shared
filesystem in commit 451094bd15 but is present neither in the kernel
sources nor in coreutils which we've historically used as source of
information.

Since the code dealing with FUSE-based filesystems doesn't need the
constant we can remove it and the now-dead check for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 17:32:14 +02:00
Peter Krempa
74c499bdb0 util: virfile: Don't use VIR_FILE_SHFS_GFS2 for glusterfs
While the code works properly as no code path is specifically wanting to
check for glusterfs, we should properly declare glusterfs as a separate
from GFS2.

Fixes: 478da65fb4
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 17:32:14 +02:00
Peter Krempa
ad0cbefb13 util: virfile: Rewrite matching of FUSE-based shared filesystems
'virFileIsSharedFixFUSE' was used to update the 'f_type' field for
certain shared filesystem types.

This patch renames it to 'virFileIsSharedFsFUSE' and makes it directly
return whether the FUSE filesystem is shared or not and simplifies
additions to the list of shared FUSE filesystems.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 17:32:14 +02:00
Peter Krempa
51741c40b8 util: virFileIsSharedFixFUSE: Refactor cleanup
Automatically free memory of 'canonPath' so that the failure of
'setmntent' doesn't have to go to 'cleanup'. This allows us to remove
the cleanup section and the 'ret' variable as the rest of the function
can't fail.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 17:32:13 +02:00
Peter Krempa
6db3cc8bc3 util: virFileIsSharedFSType: Annotate (some) shared filesystem names
Expand some of the uncommon or unobvious filesystem names in a comment.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 17:32:13 +02:00
Peter Krempa
5558082cd7 util: virFileIsSharedFSType: Pass bitmap of checked fs types as unsigned
We populate the bits individually so unsigned is the proper type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 17:32:13 +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
Michal Privoznik
044b8744d6 qemu: Implement qemuDomainGetStatsCpu fallback for qemu:///session
For domains started under session URI, we don't set up CGroups
(well, how could we since we're not running as root anyways).
Nevertheless, fetching CPU statistics exits early because of
lacking cpuacct controller. But with recent extension to
virProcessGetStatInfo() we can get the values we need from the
proc filesystem. Implement the fallback for the session URI as
some of virt tools rely on cpu.* stats to be reported (virt-top,
virt-manager).

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/353
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1693707
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 13:55:11 +02:00
Michal Privoznik
cdc22d9a21 util: Extend virProcessGetStatInfo() for sysTime and userTime
The virProcessGetStatInfo() helper parses /proc stat file for
given PID and/or TID and reports cumulative cpuTime which is just
a sum of user and sys times. But in near future, we'll need those
times separately, so make the function return them too (if caller
desires).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-05 13:55:11 +02:00
Göran Uddeborg
b59285e089 Translated using Weblate (Swedish)
Currently translated at 44.3% (4634 of 10440 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>
2022-09-04 21:19:31 +02:00
Peter Krempa
c8b796aba3 NEWS: Mention removal of the sheepdog storage driver backend
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-09-01 16:29:22 +02:00
Peter Krempa
5598ce16d5 ci: Regenerate dockerfiles after 'sheepdog' removal
After support for the sheepdog storage driver backend was removed we
don't need to install it any longer in the containers.

Regenerate the dockerfiles after:
https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/314

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-09-01 16:29:15 +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
f2f5090ef1 qemuValidateDomainDef: Clarify error message when S390 PV launch security is unsupported by the kernel
Split up the condition and report a different error message when the
host or host config results in S390 PV launch security being
unavailable.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2122534
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.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
03c908bf9c virDomainControllerDefParseXML: Reject '-1' for PCI controller target properties
All of the properties use '-1' as default and the code omits formatting
them when the property is '-1'. Additionally subsequent validation code
rejects all other negative values anyways.

Since we've never formatted '-1' into an XML formatted by libvirt we can
make the parser more strict, as we will never fail to parse existing
on-disk libvirt-owned XMLs.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2121627
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
b61854baf2 virDomainControllerDefParseXML: Return early if there's unexpectedly many elements
Move some checks earlier so that they are not tucked at the back of the
block of code doing the actual parsing.

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
2486284c8c virDomainControllerDefParseXML: Remove explicit checks for negative value
Refactor all cases which use virXMLPropInt and then subsequently check
that the parsed value is not '-1'/negative by using the VIR_XML_PROP_NONNEGATIVE
flag for virXMLPropInt.

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
318e5e3bac virDomainControllerDefParseXML: Fix broken error reporting when parsing 'index'
The code attempted to report an error if the user added the 'index'
attribute to the 'target' element, but neglected to actually return an
error code.

Fix it by using the VIR_XML_PROP_NONNEGATIVE flag for virXMLPropInt
which refuses user passed negative numbers.

Fixes: 020dd80ecb
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
c91d8fdef3 virDomainControllerDefParseXML: Fix broken code indentation when parsing PCI contoller target
Code was not indented properly for one of the nested conditions.

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
f9da823afe virDomainControllerDefFormatPCI: Refactor formatting of '<target>' subelement
Rewrite the code to use virXMLFormat element so that we can avoid a
bunch of unnecessary checks.

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
66728854d1 virDomainControllerDefFormat: Split out formatting of PCI controller
Move the PCI controller code into virDomainControllerDefFormatPCI.

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
ab075f4f0d virDomainControllerDefFormat: Use proper type for enum
Typecast the controller type variable and add all cases to the switch
statement.

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
b7efd99173 virDomainControllerDefValidate: Un-break lines in error messages
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
89c40977f2 qemu: Remove extra logic around QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
The virtio-*-(non-)-transitional device models which replace the use of
'disable-legacy'/'disable-modern' features were introduced in qemu-4.0.

This means we can remove the specific parts of the code for formatting
the old-style device options and replace all other code to solely depend
on the QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL flag.

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
d1385232a0 qemu: address: Use PCIe for virtio devices also with QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL
QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL is the evolution of
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY from qemu's point of view. Make sure
that we consider both when assesing whether a device belongs on PCIe.

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
f46088e22e schema: Add schema for '<inactiveDomain>' element used in the snapshot definition
The '<inactiveDomain>' element stores the next-start definition of a VM
on snapshot. It was not covered by the schema when it was introduced.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2121276
Fixes: 152c165d34
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
423e435e8c schemas: domaincommon: Extract contents of the 'domain' element definition
Move all definition under the <domain> element into a separate
definition so that it can be referenced from elements with other names.

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
b025718b52 schemas: Extract overrides for the domain element from 'domain.rng'
Move the overrides into a single file so that later patches can add
another top level element 'inactiveDomain' used in snapshots.

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
4328018bd0 schema: nodedev: Fix schema attribute value for the 'vport_ops' capability
The code (since 448be8f706) useds 'vport_ops' in XML.
Later commit cc17f09246 added schema for 'vports_ops' (extra 's').
Fix the schema and the corresponding docs.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2121262
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
c728698a19 virDomainBackupGetXMLDesc: Fix and use full link to XML documentation
Use the full link to the backup XML description page and use the proper
anchor after html->RST coversion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
07b24d3065 virDomainCheckpointCreateXML: Add disclaimer about creating checkpoints
Checkpoints created via virDomainCheckpointCreateXML are generally not
very useful as they need to be coupled with a backup.

Add a disclaimer to the docs explaining why users should use
virDomainBackupBegin instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
35fc11139e virDomainCheckpointCreateXML: Don't use HTML in function docs and fix link
Fix the link target after the conversion of the XML description to RST
which renamed anchors and drop the <a> tag from the C code comment.
Apart from not working properly in the .c file it didn't work in the
generated docs either as the brackets were escaped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
99d533c2aa docs: newapi: Consider also 'https://' links in the API generator XSL
We converted exclusively to https links so the generator should wrap
those in appropriate link tags too.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
3e0b7167a0 storage: Remove the sheepdog storage driver backend source code
Remove the unused source code for the sheepdog storage backend.

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