]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
17 months agorpcgen: Don't skip all tests when pytest is missing
Andrea Bolognani [Wed, 29 Nov 2023 14:50:30 +0000 (15:50 +0100)]
rpcgen: Don't skip all tests when pytest is missing

Some of the files used by test_demo.c can only be regenerated
when pytest is present, but we have pre-generated copies in the
repository, so overall we just need the C compiler to build and
run that specific test program.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
17 months agoTranslated using Weblate (Korean)
김인수 [Thu, 30 Nov 2023 13:44:51 +0000 (14:44 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10414 of 10414 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
17 months agoUpdate translation files
Weblate [Thu, 30 Nov 2023 13:44:49 +0000 (14:44 +0100)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
17 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 30 Nov 2023 13:44:46 +0000 (14:44 +0100)]
Translated using Weblate (Swedish)

Currently translated at 54.9% (5725 of 10414 strings)

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

Translated using Weblate (Swedish)

Currently translated at 54.3% (5664 of 10414 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>
17 months agoNEWS: Mention image probing, snaphsot and hotplug fixes
Peter Krempa [Fri, 1 Dec 2023 10:15:59 +0000 (11:15 +0100)]
NEWS: Mention image probing, snaphsot and hotplug fixes

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agoqemuProcessStartWithMemoryState: Don't start qemu with '-loadvm SNAP' and '-incoming...
Peter Krempa [Fri, 1 Dec 2023 09:28:48 +0000 (10:28 +0100)]
qemuProcessStartWithMemoryState: Don't start qemu with '-loadvm SNAP' and '-incoming defer' together

A bug in qemuProcessStartWithMemoryState caused that we would start qemu
with '-loadvm SNAP' and '-incoming defer' together.  qemu doesn't expect
that and crashes on an assertion failure [1].

[1]: https://issues.redhat.com/browse/RHEL-16782

Fixes: 8a88d3e5860881f430e528d3e5e8d6455ded4d1d
Resolves: https://issues.redhat.com/browse/RHEL-17841
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
17 months agorpcgen: tests: Run cleanly on platforms where char is unsigned
Michal Privoznik [Wed, 29 Nov 2023 11:30:16 +0000 (12:30 +0100)]
rpcgen: tests: Run cleanly on platforms where char is unsigned

There are some platforms where 'char' is unsigned, by default
(RPi, s390x to name a few). And because of how test_demo is
written we are experiencing some test cases failing there. For
instance: /xdr/struct-scalar is failing. This is because in the
test (test_struct_scalar()), we have a struct with two chars. One
is initialized to 0xca, the other 0xfe (note that both have the
MSB set). The XDR encoder (xdr_TestStructScalar()) then calls
xdr_char() on both of them. But XDR itself has no notion of
char type, so under the hood, it expands it to int [1] and calls
xdr_int(). And this is where the problem lies. On platforms where
char is signed, the integer expansion results in 0xffffffca, but
on platforms where char is unsigned it results in 0x000000ca. Two
distinct results.

The test then goes and compares the encoded buffer with an
expected one (memcmp(), read from the disk earlier).

This poses no problem for real life use, because when decoding
those chars back, the padding is thrown away.

To avoid tickling this issue, use values that don't have the MSB
set.

1: https://git.linux-nfs.org/?p=steved/libtirpc.git;a=blob;f=src/xdr.c;h=28d1382cc4853ecf1238d792af5016160435d1e0;hb=HEAD#l487

Fixes: 40cbaa8fbe rpcgen: add test case for XDR serialization
Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
17 months agorpcgen: tests: Allow running test_demo from anywhere
Michal Privoznik [Wed, 29 Nov 2023 11:22:21 +0000 (12:22 +0100)]
rpcgen: tests: Allow running test_demo from anywhere

The test_demo program compares whether XDR encoded data match the
expected output as read from a file. But the file path is not
absolute and thus relative to CWD which means the program can run
only from one specific directory.

Do what we do in the rest of our test suite: define 'abs_srcdir'
macro and prefix the path with it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agoch: Don't leak ch_driver->chCaps
Michal Privoznik [Tue, 28 Nov 2023 15:35:22 +0000 (16:35 +0100)]
ch: Don't leak ch_driver->chCaps

During CH driver initialization (chStateInitialize()) the
driver's capabilities bitmap is allocated
(virCHCapsInitCHVersionCaps()), but corresponding free call is
missing in chStateCleanup().

And while at it, reorder calls to virObjectUnref() inside of
chStateCleanup() to be the reverse order of that in
chStateInitialize() so that it's easier to spot missing
free/unref call.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agorpm: Drop rpcgen Build-Requires once again
Andrea Bolognani [Tue, 28 Nov 2023 17:51:04 +0000 (18:51 +0100)]
rpm: Drop rpcgen Build-Requires once again

We no longer use it, so commit a62486b95fee correctly dropped
the Build-Requires; shortly afterwards, however, I accidentally
reintroduced it by mistake.

Fixes: 3df8cc658ed0ac2f84089ad0db61ba20eb8b8aa7
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
17 months agopo: Refresh potfile for v9.10.0
Jiri Denemark [Mon, 27 Nov 2023 12:13:31 +0000 (13:13 +0100)]
po: Refresh potfile for v9.10.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
17 months agoqemuMigrationSrcNBDStorageCopyBlockdevPrepareSource: Don't setup 'raw' layer for...
Peter Krempa [Tue, 14 Nov 2023 16:19:10 +0000 (17:19 +0100)]
qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource: Don't setup 'raw' layer for migration NBD connection

The raw driver layer is not needed in this case and can be dropped.
Removing the nodename will cause other pieces of the code to pick up and
stop adding the layer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: block: Remove unused qemuBlockStorageSourceDetachOneBlockdev
Peter Krempa [Tue, 14 Nov 2023 16:09:03 +0000 (17:09 +0100)]
qemu: block: Remove unused qemuBlockStorageSourceDetachOneBlockdev

The only caller was converted to use the common blockdev infrastructure
thus this function is no longer needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuMigrationSrcNBDCopyCancel: Use qemuBlockStorageSourceAttachRollback to detach...
Peter Krempa [Tue, 14 Nov 2023 16:07:44 +0000 (17:07 +0100)]
qemuMigrationSrcNBDCopyCancel: Use qemuBlockStorageSourceAttachRollback to detach migration NBD blockdevs

Rewrite the code to use the common tooling for removing blockdevs
instead of the ad-hoc qemuBlockStorageSourceDetachOneBlockdev helper.

Use of the common infrastructure will properly handle cases when the raw
driver is ommited from the block graph.

Since the TLS data object is shared for all migration QMP commands and
objects we need to strip its alias from the definition of the storage
source before attempting to detach it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuBlockReopenAccess: prepare for removal of 'raw' format layer
Peter Krempa [Wed, 22 Nov 2023 15:58:12 +0000 (16:58 +0100)]
qemuBlockReopenAccess: prepare for removal of 'raw' format layer

Make the helper reopening a blockdev for access pick the correct layer
to reopen based on what is currently in use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: block: Absorb qemuBlockReopenFormatMon into qemuBlockReopenAccess
Peter Krempa [Wed, 22 Nov 2023 15:51:31 +0000 (16:51 +0100)]
qemu: block: Absorb qemuBlockReopenFormatMon into qemuBlockReopenAccess

Move all the code into the now only caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agotestQemuMonitorJSONBlockdevReopen: Don't use qemuBlockReopenFormatMon
Peter Krempa [Wed, 22 Nov 2023 15:47:00 +0000 (16:47 +0100)]
testQemuMonitorJSONBlockdevReopen: Don't use qemuBlockReopenFormatMon

Use the low level monitor API directly to test the QMP wrapper itself.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: monitor: Sanitize arguments of qemuMonitorBlockdevReopen
Peter Krempa [Wed, 22 Nov 2023 13:42:26 +0000 (14:42 +0100)]
qemu: monitor: Sanitize arguments of qemuMonitorBlockdevReopen

Take the virJSONValue array object which is passed to the
'blockdev-reopen' command as the 'options' argument rather than making
the caller wrap all the properties.

The code was a leftover from the time when the blockdev-reopen command
had a different syntax, and thus can be cleaned up.

Also note that the logging of the node name never worked as the top
level object didn't ever contain a 'node-name' property.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: block: Absorb logic from qemuBlockReopenFormat to qemuBlockReopenAccess
Peter Krempa [Wed, 22 Nov 2023 13:32:48 +0000 (14:32 +0100)]
qemu: block: Absorb logic from qemuBlockReopenFormat to qemuBlockReopenAccess

Move all the logic into the new function and remove the old one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: block: Extract logic from qemuBlockReopenReadWrite/ReadOnly
Peter Krempa [Wed, 22 Nov 2023 13:27:19 +0000 (14:27 +0100)]
qemu: block: Extract logic from qemuBlockReopenReadWrite/ReadOnly

We want to preserve the wrappers for clarity but the inner logic can be
extracted to a common function qemuBlockReopenAccess. In further patches
the code from qemuBlockReopenFormat will be merged into the new wrapper
as well as logic for handling scenarios with missing 'format' layers
will be added.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuBlockStorageSourceGetEffectiveNodename: Prepare for missing 'format' driver
Peter Krempa [Thu, 19 Oct 2023 15:52:37 +0000 (17:52 +0200)]
qemuBlockStorageSourceGetEffectiveNodename: Prepare for missing 'format' driver

Return the effective storage nodename if the format layer is not
present.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuDomainPrepareStorageSourceBlockdevNodename: Restructure code to allow missing...
Peter Krempa [Fri, 3 Nov 2023 13:30:35 +0000 (14:30 +0100)]
qemuDomainPrepareStorageSourceBlockdevNodename: Restructure code to allow missing 'format' layer

Similarly to other bits of code, we don't need to setup the format layer
if it will not be formatted. Add logic which uses
qemuBlockStorageSourceNeedsFormatLayer to see whether the setup of the
format node is needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuBlockStorageSourceDetachPrepare: Prepare for possibly missing 'format' layer
Peter Krempa [Fri, 3 Nov 2023 13:29:00 +0000 (14:29 +0100)]
qemuBlockStorageSourceDetachPrepare: Prepare for possibly missing 'format' layer

Setup the data for detaching of the 'format' layer only when it's
present.

Restructure the logic to follow the same order as
qemuBlockStorageSourceAttachPrepareBlockdev in terms of
format/slice/storage -blockdev objects, and drop the now-misleading
comment for 'slice' of raw disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuBlockStorageSourceAttachPrepareBlockdev: Prepare for optionally missing format...
Peter Krempa [Fri, 3 Nov 2023 13:26:35 +0000 (14:26 +0100)]
qemuBlockStorageSourceAttachPrepareBlockdev: Prepare for optionally missing format layer

Restructure the code logic so that the function is prepared for the
possibility that the 'format' blockdev layer may be missing if not
needed.

To achieve this we need to introduce logic that selects which node
(format/slice/storage) becomes the effective node and thus formats the
correct set of arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuBlockStorageSourceGetBlockdevStorageSliceProps: Allow turning the slice layer...
Peter Krempa [Fri, 3 Nov 2023 13:21:11 +0000 (14:21 +0100)]
qemuBlockStorageSourceGetBlockdevStorageSliceProps: Allow turning the slice layer into effective blockdev layer

Allow using the slice layer as effective layer once we stop formatting
the unnecessary 'raw' driver.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: block: Introduce helper for deciding when a 'format' layer is needed
Peter Krempa [Thu, 19 Oct 2023 20:07:49 +0000 (22:07 +0200)]
qemu: block: Introduce helper for deciding when a 'format' layer is needed

The 'format' layer is not required in certain cases. As the logic for
this will be a bit more involved create a helper function to do the
decision.

For now we'll keep to always format the 'format' -blockdev layer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: block: Use qemuBlockStorageSourceNeedsStorageSliceLayer only for setup
Peter Krempa [Fri, 24 Nov 2023 09:18:56 +0000 (10:18 +0100)]
qemu: block: Use qemuBlockStorageSourceNeedsStorageSliceLayer only for setup

Add a note stating that qemuBlockStorageSourceNeedsStorageSliceLayer
must be used only when setting up a new blockdev, any other case when
the device might been already set up must use the existence of the
nodename to do so.

Adjust qemuBlockStorageSourceAttachPrepareBlockdev to do so and refactor
qemuBlockStorageSourceDetachPrepare to use the same logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: block: Introduce qemuBlockStorageSourceGetSliceNodename
Peter Krempa [Fri, 24 Nov 2023 09:14:52 +0000 (10:14 +0100)]
qemu: block: Introduce qemuBlockStorageSourceGetSliceNodename

The helper retrieves the nodename of the slice layer if it's present.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agostorage_file_probe: Treat qcow2 images with protocol drivers in backing store field...
Peter Krempa [Thu, 23 Nov 2023 21:37:46 +0000 (22:37 +0100)]
storage_file_probe: Treat qcow2 images with protocol drivers in backing store field as raw

qemu allows and in some cases uses protocol driver names ('file',
'host_device', 'nbd', ...) in the 'backing file format' field of a qcow
to denote a image where the dummy 'raw' driver was not used on top.

Adapt our backing store parser for such cases. The examples added in
previous patch show the difference in behaviour.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovirstoragetest: Add test cases for QCOW2 files with a protocol name as backing file...
Peter Krempa [Thu, 23 Nov 2023 19:42:54 +0000 (20:42 +0100)]
virstoragetest: Add test cases for QCOW2 files with a protocol name as backing file format

QEMU allows and in cases where you omit the not-strictly-needed 'raw'
driver on top of raw images automatically uses the protocol name inside
of the 'backing file format' field of the qcow2 image.

Libvirt expects only format names in that field.

Add example images showing this scenario, which will be fixed later.

The qcow2 image files in this commit were formatted as:

  qemu-img create -f qcow2 -F nbd -b  nbd+tcp://example.org:6000/blah -u qcow2-protocol-backing-nbd.qcow2 10M

and

  qemu-img create -f qcow2 -F file -b raw  qcow2-protocol-backing-file.qcow2

thus using 'nbd' and 'file' as backing format respectively.

(note that '-b raw' refers to the file in the example image folder)

To satisfy the test, note that the NBD image is also rejected as we
can't probe it, thus such configuration would not work.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovirstoragetest: Format detected/unprocessed backing store format into output files
Peter Krempa [Fri, 24 Nov 2023 10:22:57 +0000 (11:22 +0100)]
virstoragetest: Format detected/unprocessed backing store format into output files

Compare also the detected format of the backing file
('backingStoreRawFormat' field) into the output data for comparison with
others. Since the ToString function can't convert VIR_STORAGE_FILE_AUTO
use also the numeric value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovirstoragetest: Use strings for storage type and format in output data
Peter Krempa [Fri, 24 Nov 2023 10:14:21 +0000 (11:14 +0100)]
virstoragetest: Use strings for storage type and format in output data

Make it easier for the humans to read/compare the outputs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agostorage_file_probe: Remove BACKING_STORE_OK,BACKING_STORE_INVALID states
Peter Krempa [Fri, 24 Nov 2023 08:26:39 +0000 (09:26 +0100)]
storage_file_probe: Remove BACKING_STORE_OK,BACKING_STORE_INVALID states

Replace the return values by 0 because none of the callers care and some
of the backing store parser functions return this state also in cases
the rest of the code would consider as success.

Subsequently the parsers will be refactored and proper error reporting
returned.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovirStorageFileProbeGetMetadata: Do not partially skip probing of the image
Peter Krempa [Thu, 23 Nov 2023 16:03:32 +0000 (17:03 +0100)]
virStorageFileProbeGetMetadata: Do not partially skip probing of the image

Since we consider the failure of parsing the backing store to be
actually success based on the value we return to the caller, we should
continue parsing also features and the 'compat' field so that we don't
have a partial definition if e.g. the backing store format is not known.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agostorage_file_probe: Remove unused state 'BACKING_STORE_ERROR'
Peter Krempa [Thu, 23 Nov 2023 15:59:50 +0000 (16:59 +0100)]
storage_file_probe: Remove unused state 'BACKING_STORE_ERROR'

None of the backing store parser functions actually use it. Remove it to
avoid confusion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agobhyve: Add missing enum member to switch() in bhyveBuildSoundArgStr()
Michal Privoznik [Sat, 25 Nov 2023 07:35:00 +0000 (08:35 +0100)]
bhyve: Add missing enum member to switch() in bhyveBuildSoundArgStr()

In v9.9.0-104-gc472ce024b I've introduced another value to
virDomainAudioType enum. But I forgot to add corresponding case
into switch() in bhyveBuildSoundArgStr().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
17 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 24 Nov 2023 08:52:45 +0000 (09:52 +0100)]
Translated using Weblate (Swedish)

Currently translated at 53.8% (5603 of 10414 strings)

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

Translated using Weblate (Swedish)

Currently translated at 53.4% (5564 of 10414 strings)

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

Translated using Weblate (Swedish)

Currently translated at 53.2% (5544 of 10414 strings)

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

Translated using Weblate (Swedish)

Currently translated at 53.0% (5524 of 10414 strings)

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

Translated using Weblate (Swedish)

Currently translated at 52.6% (5484 of 10414 strings)

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

Translated using Weblate (Swedish)

Currently translated at 52.4% (5464 of 10414 strings)

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

Translated using Weblate (Swedish)

Currently translated at 52.2% (5444 of 10414 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>
17 months agoTranslated using Weblate (Russian)
Ján Tomko [Fri, 24 Nov 2023 08:52:44 +0000 (09:52 +0100)]
Translated using Weblate (Russian)

Currently translated at 88.4% (9215 of 10415 strings)

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

Co-authored-by: Jan Tomko <jtomko@redhat.com>
Co-authored-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Jan Tomko <jtomko@redhat.com>
17 months agoNEWS: Document pipewire audio backend
Michal Privoznik [Thu, 11 May 2023 11:31:27 +0000 (13:31 +0200)]
NEWS: Document pipewire audio backend

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: Generate cmd line for pipewire audio backend
Michal Privoznik [Wed, 10 May 2023 10:58:44 +0000 (12:58 +0200)]
qemu: Generate cmd line for pipewire audio backend

This is mostly straightforward, except for a teensy-weensy
detail: usually, there's no system wide daemon running, no system
wide available socket that anybody could connect to. PipeWire
uses a per user daemon approach instead. But this in turn means,
that the socket location floats between various locations and is
derived from various environment variables (just like the actual
socket name) and thus we must pass the variables to QEMU.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/560
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoconf: Introduce pipewire audio backend
Michal Privoznik [Wed, 10 May 2023 10:29:54 +0000 (12:29 +0200)]
conf: Introduce pipewire audio backend

QEMU gained support for PipeWire audio backend (see QEMU commit
of v8.0.0-403-gc2d3d1c294). Its configuration knobs are basically
the same as pulseaudio's, except for PA's server name. Therefore,
a lot of code is copied over from pulseadio and fixed by
s/Pulse/Pipewire/ or s/pulseaudio/pipewire/.

There's one ley difference to PA though: pipewire daemon is
usually on per user basis (just like our qemu:///session).
Therefore, introduce this 'runtimeDir' attribute, which allows
specifying path to pipewire daemon socket (useful for
qemu:///system for instance).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovirnuma: Avoid integer overflow in virNumaGetPages()
Michal Privoznik [Fri, 24 Nov 2023 10:59:32 +0000 (11:59 +0100)]
virnuma: Avoid integer overflow in virNumaGetPages()

On systems with humongous pages (16GiB) and 32bit int it's easy
to hit integer overflow in virNumaGetPages(). What happens is,
inside of virNumaGetPages() as we process hugepages for given
NUMA node (e.g. in order to produce capabilities XML), we keep a
sum of sizes of pools in an ULL variable (huge_page_sum). In each
iteration, the variable is incremented by 1024 * page_size *
page_avail. Now, page_size is just an uint, so we have:

  ULL += U * U * ULL;

and because of associativity, U * U is computed first and since
we have two operands of the same type, no type expansion happens.
But this means, for humongous pages (like 16GiB) the
multiplication overflows.

Therefore, move the multiplication out of the loop. This helps in
two ways:

1) now we have ULL += U * ULL; which expands the uint in
   multiplication,

2) it saves couple of CPU cycles.

Resolves: https://issues.redhat.com/browse/RHEL-16749
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: block: Don't try to merge bitmaps into 'raw' images
Peter Krempa [Thu, 23 Nov 2023 12:43:36 +0000 (13:43 +0100)]
qemu: block: Don't try to merge bitmaps into 'raw' images

If any of the images in a chain above a raw image have bitmaps, libvirt
would attempt to merge them when doing a block commit or block copy
operation, which would result into a error in the logs as creating
persistent bitmaps in a raw image is not supported.

Since libvirt cares only about persistent bitmaps we can simply skip the
operation if the target of a block copy or block commit is a raw image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: hotplug: Detect disk backing images before setting up security access
Peter Krempa [Thu, 23 Nov 2023 13:07:48 +0000 (14:07 +0100)]
qemu: hotplug: Detect disk backing images before setting up security access

The VM will require access also to the detected images. Unfortunately a
recent reordering of the code introduced a bug where the backing chain
was probed after setting up cgroups/selinux/namespaces, which caused
that any detected images were not allowed/added and qemu was then not
able to use them.

Fixes: 9b8bb536ff999fa61e41869bd98a026b8e23378f
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu_domain: Drop qemuCheckMemoryDimmConflict()
Michal Privoznik [Fri, 3 Nov 2023 09:15:58 +0000 (10:15 +0100)]
qemu_domain: Drop qemuCheckMemoryDimmConflict()

The virDomainMemoryDefCheckConflict() already does the same set
of checks. There's no need to duplicate them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
17 months agovirDomainMemoryDefCheckConflict: Validate dimm slot too
Michal Privoznik [Thu, 2 Nov 2023 15:35:00 +0000 (16:35 +0100)]
virDomainMemoryDefCheckConflict: Validate dimm slot too

Since we're iterating over def->mems array, might as well check
for dimm slot duplicates.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
17 months agovirDomainMemoryDefCheckConflict: Check dimm & nvdimm models too
Michal Privoznik [Thu, 2 Nov 2023 15:06:00 +0000 (16:06 +0100)]
virDomainMemoryDefCheckConflict: Check dimm & nvdimm models too

So far we check whether virtio-mem and/or virtio-pmem memory
devices do not overlap with each other. But we allow specifying
address where dimm and nvdimm memory devices are mapped too. And
there are left out from this collision check. Not anymore.

This leaves just sgx model out, but that's expected since it
can't have any address (see virDomainMemoryDefValidate()).

Resolves: https://issues.redhat.com/browse/RHEL-4452
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
17 months agodomain_validate: Move memdevice address conflict check into a separate function
Michal Privoznik [Thu, 2 Nov 2023 15:05:46 +0000 (16:05 +0100)]
domain_validate: Move memdevice address conflict check into a separate function

At the end of virDomainMemoryDefValidate() there's a code that
checks whether two virtio-mem/virtio-pmem devices don't overlap.
Separate this code into its own function
(virDomainMemoryDefCheckConflict()).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
17 months agoFix cpu-host-model test data
Tim Wiederhake [Fri, 24 Nov 2023 10:05:13 +0000 (11:05 +0100)]
Fix cpu-host-model test data

This was broken by the recent addition of vmx-* features.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x491
Tim Wiederhake [Thu, 9 Nov 2023 13:42:10 +0000 (14:42 +0100)]
cpu_map: Add missing vmx features from MSR 0x491

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x490
Tim Wiederhake [Thu, 9 Nov 2023 13:41:35 +0000 (14:41 +0100)]
cpu_map: Add missing vmx features from MSR 0x490

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x48F
Tim Wiederhake [Thu, 9 Nov 2023 13:39:59 +0000 (14:39 +0100)]
cpu_map: Add missing vmx features from MSR 0x48F

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x48E
Tim Wiederhake [Thu, 9 Nov 2023 13:39:17 +0000 (14:39 +0100)]
cpu_map: Add missing vmx features from MSR 0x48E

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x48D
Tim Wiederhake [Thu, 9 Nov 2023 13:38:10 +0000 (14:38 +0100)]
cpu_map: Add missing vmx features from MSR 0x48D

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x48C
Tim Wiederhake [Thu, 9 Nov 2023 13:37:19 +0000 (14:37 +0100)]
cpu_map: Add missing vmx features from MSR 0x48C

Differences from qemu:

* "vmx-ept-uc" (bit 8) and "vmx-ept-wb" (bit 14) are not added to
qemu's list of named features yet, but used in several qemu cpu
models never the less. Add to libvirt regardless.

* "vmx-invvpid-single-context" (bit 41) is erroneously called
"vmx-invept-single-context" in qemu. This is the name of the
feature associated with bit 25 in both libvirt and qemu.

* "vmx-invvpid-single-context-noglobals" (bit 43) is erroneously
called "vmx-invept-single-context-noglobals". Use the correct name.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x48B
Tim Wiederhake [Thu, 9 Nov 2023 13:36:30 +0000 (14:36 +0100)]
cpu_map: Add missing vmx features from MSR 0x48B

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x485
Tim Wiederhake [Thu, 9 Nov 2023 13:35:39 +0000 (14:35 +0100)]
cpu_map: Add missing vmx features from MSR 0x485

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing vmx features from MSR 0x480
Tim Wiederhake [Thu, 9 Nov 2023 13:33:38 +0000 (14:33 +0100)]
cpu_map: Add missing vmx features from MSR 0x480

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: No longer ignore vmx- features in sync_qemu_features_i386.py
Tim Wiederhake [Thu, 9 Nov 2023 12:19:41 +0000 (13:19 +0100)]
cpu_map: No longer ignore vmx- features in sync_qemu_features_i386.py

Some guest OSes require cpu features from the vmx-* family,
e.g. vmx-xsaves. Up to now, libvirt ignored these features as they
were not required yet. qemu does not automatically enable e.g.
"vmx-xsaves" when requesting "xsaves":

    qmp="qemu-kvm -machine accel=kvm -nodefaults -nographic -qmp stdio"
    $(qmp) <<-EOF | jq | grep "xsaves"
    { "execute": "qmp_capabilities" }
    {
      "execute": "query-cpu-model-expansion",
      "arguments": {
        "type": "full",
        "model": {
          "name": "Skylake-Client-v1",
          "props": { "xsaves": true }   `# set to "true" or "false"`
        }
      }
    }
    { "execute": "quit" }
    EOF

with xsaves "false":
    "xsaves": false,
    "vmx-xsaves": false,

with xsaves "true":
    "xsaves": true,
    "vmx-xsaves": false,

Stop ignoring vmx-* features and begin adding them to libvirt's
database.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing feature "amx-complex"
Tim Wiederhake [Thu, 9 Nov 2023 12:18:50 +0000 (13:18 +0100)]
cpu_map: Add missing feature "amx-complex"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agocpu_map: Add missing feature "gds-no"
Tim Wiederhake [Thu, 9 Nov 2023 12:17:11 +0000 (13:17 +0100)]
cpu_map: Add missing feature "gds-no"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
17 months agosyntax-check: Forbid use of qsort()
Michal Privoznik [Thu, 23 Nov 2023 09:54:57 +0000 (10:54 +0100)]
syntax-check: Forbid use of qsort()

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
17 months agolib: Replace qsort() with g_qsort_with_data()
Michal Privoznik [Wed, 22 Nov 2023 13:58:49 +0000 (14:58 +0100)]
lib: Replace qsort() with g_qsort_with_data()

While glibc provides qsort(), which usually is just a mergesort,
until sorting arrays so huge that temporary array used by
mergesort would not fit into physical memory (which in our case
is never), we are not guaranteed it'll use mergesort. The
advantage of mergesort is clear - it's stable. IOW, if we have an
array of values parsed from XML, qsort() it and produce some
output based on those values, we can then compare the output with
some expected output, line by line.

But with newer glibc this is all history. After [1], qsort() is
no longer mergesort but introsort instead, which is not stable.
This is suboptimal, because in some cases we want to preserve
order of equal items. For instance, in ebiptablesApplyNewRules(),
nwfilter rules are sorted by their priority. But if two rules
have the same priority, we want to keep them in the order they
appear in the XML. Since it's hard/needless work to identify
places where stable or unstable sorting is needed, let's just
play it safe and use stable sorting everywhere.

Fortunately, glib provides g_qsort_with_data() which indeed
implement mergesort and it's a drop in replacement for qsort(),
almost. It accepts fifth argument (pointer to opaque data), that
is passed to comparator function, which then accepts three
arguments.

We have to keep one occurance of qsort() though - in NSS module
which deliberately does not link with glib.

1: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=03bf8357e8291857a435afcc3048e0b697b6cc04
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
17 months agobuild-aux: Refresh list of nonreentrant functions
Michal Privoznik [Thu, 23 Nov 2023 09:11:19 +0000 (10:11 +0100)]
build-aux: Refresh list of nonreentrant functions

There's a new twalk() function that has a reentrant variant. Add
the former onto list of nonreentrant functions.

Also, refresh the comment on how to get the list, because it's
outdated a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
17 months agoci: Build RPMs on MinGW
Andrea Bolognani [Thu, 2 Nov 2023 10:16:20 +0000 (11:16 +0100)]
ci: Build RPMs on MinGW

Now that the spec file supports selectively disabling the native,
mingw32 and mingw64 parts, we can add coverage for the MinGW RPM
builds.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
17 months agorpm: Introduce with_native
Andrea Bolognani [Thu, 2 Nov 2023 15:56:54 +0000 (16:56 +0100)]
rpm: Introduce with_native

The new _without_native knob makes it possible to skip the native
build completely and build for MinGW only.

Best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
17 months agorpm: Introduce with_mingw32/with_mingw64
Andrea Bolognani [Thu, 2 Nov 2023 11:24:21 +0000 (12:24 +0100)]
rpm: Introduce with_mingw32/with_mingw64

These replace the existing with_mingw but offer additional
granularity.

The existing _without_mingw knob retains its behavior of
disabling all MinGW builds at once for convenience, while the
newly introduced _without_mingw32/_without_mingw64 knobs make
it possible to disable only one of them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
17 months agorpm: Split call to mingw_debug_package
Andrea Bolognani [Thu, 2 Nov 2023 15:10:35 +0000 (16:10 +0100)]
rpm: Split call to mingw_debug_package

This is functionally equivalent and will make future patches
nicer.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
17 months agorpm: Shuffle BuildRequires around
Andrea Bolognani [Thu, 2 Nov 2023 15:45:11 +0000 (16:45 +0100)]
rpm: Shuffle BuildRequires around

Move all dependencies that are needed both for native builds and
for MinGW ones near the top of the list. This will make future
patches nicer.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
17 months agoqemu: hotplug: Don't try to setup disk image when hotplugging empty cdrom drive
Peter Krempa [Tue, 21 Nov 2023 13:59:37 +0000 (14:59 +0100)]
qemu: hotplug: Don't try to setup disk image when hotplugging empty cdrom drive

Originally the disk hotplug code didn't know how to attach a CD-ROM
drive, thus didn't have the necessary logic to handle empty cdroms.

Other disks can't be empty which is enforced by the parser validation
logic.

When support for hotplugging cdroms was added the code was not adjusted
to deal with empty drives thus attempted to setup the blockdev backend
for it.

Fixes: 3078799fef82d45ac10624e3bacded7a285d8a4f
Resolves: https://issues.redhat.com/browse/RHEL-16870
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuDomainAttachDeviceDiskLiveInternal: Add missing jump to 'cleanup' on error
Peter Krempa [Tue, 21 Nov 2023 15:51:12 +0000 (16:51 +0100)]
qemuDomainAttachDeviceDiskLiveInternal: Add missing jump to 'cleanup' on error

Commit allowing hotplug of CDROMs moved the logic forbidding the hotplug
to the appropriate blocks based on the disk frontend but forgot to
actually bail out on such error.

Fixes: 3078799fef82d45ac10624e3bacded7a285d8a4f
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuDomainAttachDeviceDiskLiveInternal: Fix jumps on error
Peter Krempa [Tue, 21 Nov 2023 16:17:38 +0000 (17:17 +0100)]
qemuDomainAttachDeviceDiskLiveInternal: Fix jumps on error

When I've originally refactored the function in commit 0d981bcefcb5defa2
the logic was still correct, but then later in commit 52f865543920b0
I've moved most of the image setup logic into the function neglecting to
add the 'goto cleanup;' needed to skip over the setup of the disk
images.

Fixes: 52f865543920b0cc5ba93f4407c1b2efdffb8ddc
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemu: validate: Reword error message when CCW addresses are not supported for a machine
Peter Krempa [Tue, 21 Nov 2023 08:42:16 +0000 (09:42 +0100)]
qemu: validate: Reword error message when CCW addresses are not supported for a machine

Reword the error message to clearly state that the machine type doesn't
support the address type. It doesn't matter which device it's for.

Additionally the alias may be still NULL at the point when the error is
being reported misleading users that they have something wrong with a
specific device.

Resolves: https://issues.redhat.com/browse/RHEL-16878
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
17 months agogitlab: adjust url to Coverity tools
Daniel P. Berrangé [Tue, 21 Nov 2023 17:31:40 +0000 (17:31 +0000)]
gitlab: adjust url to Coverity tools

The URL to the Coverity tools download has changed; the old one points
to an obsolete version that is not supported anymore.  Adjust to point
to the correct and supported tools.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
17 months agosrc: reject empty string for 'dname' in migrate APIs
Daniel P. Berrangé [Wed, 8 Nov 2023 16:20:35 +0000 (16:20 +0000)]
src: reject empty string for 'dname' in migrate APIs

A domain name is expected to be non-empty, and we validate this when
parsing XML, or accepting a new name during renames. We fail to
enforce this property, however, when performing a migration. This
was discovered when a user complained about inaccessible VMs after
migrating with the Rust APIs which mistakenly hardcoded 'dname' to
the empty string.

Fixes: https://gitlab.com/libvirt/libvirt-rust/-/issues/11
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
17 months agoconf: virDomainDiskSourceFormat: check for srcpool presence correctly
Ján Tomko [Wed, 1 Nov 2023 14:18:24 +0000 (15:18 +0100)]
conf: virDomainDiskSourceFormat: check for srcpool presence correctly

As a guard against programming errors, one part of the condition
only dereferences srcpool if it exists, other one does not.

Move the check up one level so that it actually has a chance to do
something useful.

Fixes: 19b1c0d31988a3a10c4694c10c27eb15c018f450
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
17 months agolib: Replace xmlKeepBlanksDefault() with virXMLParseWithIndent()
Michal Privoznik [Mon, 20 Nov 2023 15:20:51 +0000 (16:20 +0100)]
lib: Replace xmlKeepBlanksDefault() with virXMLParseWithIndent()

Now that we have virXMLParseWithIndent() and
virXMLParseStringCtxtWithIndent(), we can use them directly and
drop calls to xmlKeepBlanksDefault().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovirxml: Introduce parsing APIs that keep indentation
Michal Privoznik [Tue, 21 Nov 2023 09:39:58 +0000 (10:39 +0100)]
virxml: Introduce parsing APIs that keep indentation

When parsing an XML it may be important to keep indentation to
produce a better looking result when formatting the XML back.
Just look at all those xmlKeepBlanksDefault() calls just before
virXMLParse() is called.

Anyway, as of libxml2 commit v2.12.0~108 xmlKeepBlanksDefault()
is deprecated. Therefore, introduce virXMLParse...WithIndent()
variants which would do exactly xmlKeepBlanksDefault() did but
with non-deprecated APIs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovirXMLParseHelper: Store XML parsing flags in a variable
Michal Privoznik [Sat, 18 Nov 2023 03:17:47 +0000 (04:17 +0100)]
virXMLParseHelper: Store XML parsing flags in a variable

The virXMLParseHelper() can work in two modes: either it parses a
file or a string. Either way, the same set of flags is specified
in call of corresponding function. Save flags in a local variable
instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovirxml: include <libxml/xmlsave.h> for xmlIndentTreeOutput declaration
Michal Privoznik [Mon, 20 Nov 2023 02:18:12 +0000 (03:18 +0100)]
virxml: include <libxml/xmlsave.h> for xmlIndentTreeOutput declaration

After libxml2's commit of v2.12.0~101 we no longer get
xmlIndentTreeOutput declaration by us including just
libxml/xpathInternals.h and libxml2's header files leakage.

Resolves: https://bugs.gentoo.org/917516
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovbox_snapshot_conf: Keep indent in snapshot XML
Michal Privoznik [Tue, 21 Nov 2023 09:40:36 +0000 (10:40 +0100)]
vbox_snapshot_conf: Keep indent in snapshot XML

As mentioned in previous commit, VirtualBox has its own snapshot
XML which we parse, change and then format back. During this, we
ought to keep the indentation to produce better looking result
(especially when we want to compare the output in tests later on,
like we do in vboxsnapshotxmltest).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agovbox_snapshot_conf: Parse XMLs without net access
Michal Privoznik [Mon, 20 Nov 2023 03:49:53 +0000 (04:49 +0100)]
vbox_snapshot_conf: Parse XMLs without net access

When working with VirtualBox's snapshots, the snapshot XML is
firstly parsed, stored in memory (with some parts being stored as
verbatim XML snippets, strings), requested changes are made and
then this modified XML is formatted via
virVBoxSnapshotConfSaveVboxFile() which calls
xmlParseInNodeContext() to format those previously stored XML
snippets.

The first parse of whole VirtualBox snapshot file is done using
virXMLParse() (in virVBoxSnapshotConfLoadVboxFile()) and thus
with XML_PARSE_NONET specified.

But those ad-hoc parsings when formatting the XML back pass zero
flags mask: xmlParseInNodeContext(..., options = 0, ...);

This is potentially dangerous.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agokbase: More info on firmware change for existing VMs
Andrea Bolognani [Thu, 16 Nov 2023 16:01:44 +0000 (17:01 +0100)]
kbase: More info on firmware change for existing VMs

The need to remove the <loader> and <nvram> elements in order
to make the firmware autoselection process kick in again is
not exactly intuitive, so document it explicitly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agorpc: Pass GPG_TTY and TERM environment variables
Andrea Bolognani [Thu, 16 Nov 2023 18:12:34 +0000 (19:12 +0100)]
rpc: Pass GPG_TTY and TERM environment variables

gpg-agent can be used instead of ssh-agent to authenticate
against an SSH server, but in order to do so the GPG_TTY and
TERM environment variables need to be passed through.

For obvious reasons, we avoid doing that when no_tty=1 is found
in the connection URI.

https://bugs.debian.org/843863
https://gitlab.com/libvirt/libvirt/-/merge_requests/290

Thanks: Guilhem Moulin <guilhem@guilhem.org>
Thanks: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
17 months agoqemu_snapshot: fix reverting to inactive snapshot
Pavel Hrdina [Wed, 1 Nov 2023 13:01:32 +0000 (14:01 +0100)]
qemu_snapshot: fix reverting to inactive snapshot

When reverting to inactive snapshot updating the domain definition needs
to happen after the new overlays are created otherwise qemu-img will
correctly fail with error:

    Trying to create an image with the same filename as the backing file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
17 months agoqemu_snapshot: fix snapshot deletion that had multiple children
Pavel Hrdina [Wed, 1 Nov 2023 09:12:22 +0000 (10:12 +0100)]
qemu_snapshot: fix snapshot deletion that had multiple children

When we revert to non-leaf snapshot and create new branch or branches
the overlay in snapshot metadata is no longer usable as a disk source
for deletion of that snapshot. We need to use other places to figure out
the correct storage source.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/534
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
17 months agovirDomainDeviceInfoCheckABIStability: Implement proper check for CCW addresses
Peter Krempa [Thu, 2 Nov 2023 15:08:57 +0000 (16:08 +0100)]
virDomainDeviceInfoCheckABIStability: Implement proper check for CCW addresses

CCW addresses need to be also checked for ABI stability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
17 months agoqemucapabilitiestest: Update capabilities data for 8.2 dev cycle on x86_64
Peter Krempa [Wed, 8 Nov 2023 13:29:36 +0000 (14:29 +0100)]
qemucapabilitiestest: Update capabilities data for 8.2 dev cycle on x86_64

Update to v8.1.0-3111-gad6ef0a42e

Notable changes:
 - migration:
    - multichannel migration added
        - 'channels' array argument of migrate/migrate-incomming added
    - legacy block migration deprecated
        - 'blk', 'inc' arguments of 'migrate' command
        - 'block' migration capability
        - 'block-incremental' migration parameter
    - legacy migration compression deprecated
        - 'compress' migration capability
        - 'compress-level', 'compress-threads', 'compress-wait-thread',
          'decompress-threads' migration paramters
    - migration parameter 'mode' with 'normal' and 'cpr-reboot' options
      added

 - new formats for 'dump-guest-memory'
    - 'dump-raw-lzo', 'kdump-raw-snappy', 'kdump-raw-zlib' added

 - 'block-job-change' command added

 - 'HV_BALLOON_STATUS_REPORT' event and
   'query-hv-balloon-status-report' command added

 - deprecated old i440fx machine types:
    - 'pc-i440fx-2.0', 'pc-i440fx-2.1', 'pc-i440fx-2.2', 'pc-i440fx-2.3'

 - 'sha-ni' and few other ring 0 instruction are now exposed to tcg
   guests

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuxml2argvtest: Add '8.1.0' variants of 'cpu-host-model*' tests
Peter Krempa [Thu, 9 Nov 2023 14:28:22 +0000 (15:28 +0100)]
qemuxml2argvtest: Add '8.1.0' variants of 'cpu-host-model*' tests

Upcoming test bump will cause some changes thus preserve the existing
state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuxml2argvtest: Add complementary 'kvm/tcg' test cases for cpu-host-model*
Peter Krempa [Thu, 9 Nov 2023 14:20:38 +0000 (15:20 +0100)]
qemuxml2argvtest: Add complementary 'kvm/tcg' test cases for cpu-host-model*

CPU host model expansion depends on the CPU data from the capabilities
and can change based on emulation type. Add complementary tests to the
ones we already have to ensure full coverage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemuxml2argvtest: Rename 'cpu-host-model' tests according to emulation type
Peter Krempa [Thu, 9 Nov 2023 14:15:39 +0000 (15:15 +0100)]
qemuxml2argvtest: Rename 'cpu-host-model' tests according to emulation type

The cpu-host-model.xml test case uses 'kvm' whereas the
fallback/nofallback cases use tcg in the definition. Rename them
accordingly so that the complement cases can be added later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agotests: qemumigparamsdata: Drop deprecated fields
Peter Krempa [Wed, 8 Nov 2023 13:50:10 +0000 (14:50 +0100)]
tests: qemumigparamsdata: Drop deprecated fields

Migration compression parameters 'compress-level', 'compress-threads',
'decompress-threads' were deprecated by qemu. Drop them from the tests.

Note that the migration code automatically checks whether given
capability is supported by qemu and thus we don't need to add any
further code to prepare for the legacy compression to be dropped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
17 months agoqemumigrationcookiexmltest: Don't crash when parsing of status XML fails
Peter Krempa [Thu, 9 Nov 2023 13:31:43 +0000 (14:31 +0100)]
qemumigrationcookiexmltest: Don't crash when parsing of status XML fails

Some sub-tests dereference 'data->vm' even when it is NULL.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agosystemd: More tweaks to Description and Documentation lines
Andrea Bolognani [Mon, 6 Nov 2023 18:39:51 +0000 (19:39 +0100)]
systemd: More tweaks to Description and Documentation lines

We recently unified all services and sockets, except a couple
were missed. Finish the job.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agorpcgen: use proper operators when comparing types
Laine Stump [Fri, 3 Nov 2023 23:40:32 +0000 (19:40 -0400)]
rpcgen: use proper operators when comparing types

flake8 (run on all python scripts as a part of the syntax checks)
version 6.1.0 (on macOS 14) issued many complaints like this on the
new rpcgen python scripts:

[...]libvirt/scripts/rpcgen/rpcgen/lexer.py:57:17: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

This patch changes all [type] == [type] to use "is" instead of "==",
and similarly to use "is not" instead of "!=".

(flake8 5.03, e.g. on Fedora 38, is just fine with using "==" and "!=",
but python on both likes "is" and "is not")

Fixes: commit v9.9.0-24-g8ec79e5e14
Fixes: commit v9.9.0-22-gca3f025011
Fixes: commit v9.9.0-21-g031efb691f
Fixes: commit v9.9.0-20-g8c8b97685b
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agorpm: Add libxml2 BuildRequires for xmllint
Andrea Bolognani [Thu, 2 Nov 2023 15:48:03 +0000 (16:48 +0100)]
rpm: Add libxml2 BuildRequires for xmllint

It's already been dragged in by the -devel package, but since
we use the command line tool directly as part of our build
process it's more correct to explicitly depend on the runtime
package.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agorpm: Explain a couple of BuildRequires
Andrea Bolognani [Thu, 2 Nov 2023 15:33:15 +0000 (16:33 +0100)]
rpm: Explain a couple of BuildRequires

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agorpm: Rename module-init-tools -> kmod
Andrea Bolognani [Thu, 2 Nov 2023 15:35:59 +0000 (16:35 +0100)]
rpm: Rename module-init-tools -> kmod

The old package name is only kept around for compatibility
reasons.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agorpm: Explicitly enable NLS support
Andrea Bolognani [Thu, 2 Nov 2023 16:30:06 +0000 (17:30 +0100)]
rpm: Explicitly enable NLS support

We want it both for native builds and MinGW ones.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agorpm: Disable expensive tests for MinGW builds
Andrea Bolognani [Thu, 2 Nov 2023 15:15:50 +0000 (16:15 +0100)]
rpm: Disable expensive tests for MinGW builds

Tests are disabled so this combination never made any sense,
but with recent changes it has turned into a build failure.

Fixes: 8ce0decc372051d616018f57ae268e2f03082eec
Reported-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>