]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
2 years agosecurity: Add support for SUSE edk2 firmware paths
Jim Fehlig [Thu, 23 Feb 2023 18:02:46 +0000 (11:02 -0700)] 
security: Add support for SUSE edk2 firmware paths

SUSE installs edk2 firmwares for both x86_64 and aarch64 in /usr/share/qemu.
Add support for this path in virt-aa-helper and allow locking files within
the path in the libvirt qemu abstraction.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: domain: Unexport qemuDomainObjTaintMsg
Peter Krempa [Wed, 1 Mar 2023 16:03:56 +0000 (17:03 +0100)] 
qemu: domain: Unexport qemuDomainObjTaintMsg

The function is used only inside qemu_domain.c, unexport it and move it
above its user.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: domain: Fix logic when tainting domain
Peter Krempa [Wed, 1 Mar 2023 16:09:42 +0000 (17:09 +0100)] 
qemu: domain: Fix logic when tainting domain

Originally the code was skipping all repeated taints with the same taint
flag but a logic bug introduced in commit 30626ed15b239c424ae inverted
the condition. This caused that actually the first occurence was NOT
logged but any subsequent was.

This was noticed when going through oVirt logs as they use custom guest
agent commands and the logs are totally spammed with this message.

Fixes: 30626ed15b239c424ae891f096057a696eadd715
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoconf: domain: Add comment for 'virDomainObjTaint'
Peter Krempa [Wed, 1 Mar 2023 16:08:42 +0000 (17:08 +0100)] 
conf: domain: Add comment for 'virDomainObjTaint'

Outline what the function does, especially the return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: agent: Make fetching of 'can-offline' member from 'guest-query-vcpus' optional
Peter Krempa [Wed, 1 Mar 2023 15:51:42 +0000 (16:51 +0100)] 
qemu: agent: Make fetching of 'can-offline' member from 'guest-query-vcpus' optional

The 'can-offline' member is optional according to agent's schema and in
fact in certain cases it's not returned. Libvirt then spams the logs
if something is polling the bulk guest stats API.

Noticed when going through oVirt logs which appears to call the bulk
stats API repeatedly.

Instead of requiring it we simply reply that the vCPU can't be offlined.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: Align arguments correctly
Andrea Bolognani [Wed, 1 Mar 2023 17:48:43 +0000 (18:48 +0100)] 
qemu: Align arguments correctly

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2 years agoci: Regenerate gitlab CI config with latest lcitool
Peter Krempa [Mon, 27 Feb 2023 11:34:47 +0000 (12:34 +0100)] 
ci: Regenerate gitlab CI config with latest lcitool

The latest 'lcitool' now generates the CI config in a way which
allows users to kick off pipelines with the upstream projects container
environment rather than building a throwaway updated environment each
time and enables a gitlab feature to time individual script lines.
Pull it into libvirt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoqemu_monitor: Decouple switch()-es in qemuMonitorJSONGetMemoryDeviceInfo()
Michal Privoznik [Mon, 27 Feb 2023 09:22:28 +0000 (10:22 +0100)] 
qemu_monitor: Decouple switch()-es in qemuMonitorJSONGetMemoryDeviceInfo()

There are two switch() statements over the same variable inside
of qemuMonitorJSONGetMemoryDeviceInfo(). Join them together into
one switch.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemu_monitor: Switch to virDomainMemoryModel enum in qemuMonitorJSONGetMemoryDeviceInfo()
Michal Privoznik [Mon, 27 Feb 2023 09:58:27 +0000 (10:58 +0100)] 
qemu_monitor: Switch to virDomainMemoryModel enum in qemuMonitorJSONGetMemoryDeviceInfo()

When processing memory devices (as a reply from QEMU), a bunch of
STREQ()-s is used. Fortunately, the set of strings we process is
the same as virDomainMemoryModel enum. Therefore, we can use
virDomainMemoryModelTypeFromString() and then use integer
comparison (well, switch()). This has an upside: introducing a
new memory model lets us see what places need adjusting
immediately at compile time.

NB, this is in contrast with cmd line generator
(qemuBuildMemoryDeviceProps()), where more specific models are
generated (e.g. "pc-dimm", "virtio-mem-pci", etc.). But QEMU
reports back the parent model, instead of specific child
instance.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agolibvirt_private.syms: Export virDomainMemoryModelTypeFromString()
Michal Privoznik [Mon, 27 Feb 2023 09:31:43 +0000 (10:31 +0100)] 
libvirt_private.syms: Export virDomainMemoryModelTypeFromString()

The virDomainMemoryModelTypeFromString() is not exported, though
the enum translation functions are declared in
src/conf/domain_conf.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agokbase: virtiofs: Add a note that virtiofs is not migratable
Peter Krempa [Mon, 27 Feb 2023 08:10:08 +0000 (09:10 +0100)] 
kbase: virtiofs: Add a note that virtiofs is not migratable

Note that certain operations will not work.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/452
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoci: Regenerate gitlab config with latest lcitool
Peter Krempa [Mon, 27 Feb 2023 10:00:34 +0000 (11:00 +0100)] 
ci: Regenerate gitlab config with latest lcitool

The 'cirrus-run' and 'check-dco' containers are now exported as
':latest' instead of ':master'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoPost-release version bump to 9.2.0
Jiri Denemark [Wed, 1 Mar 2023 10:15:06 +0000 (11:15 +0100)] 
Post-release version bump to 9.2.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoRelease of libvirt-9.1.0 v9.1.0
Jiri Denemark [Wed, 1 Mar 2023 10:10:41 +0000 (11:10 +0100)] 
Release of libvirt-9.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoNEWS: Document my contributions for upcoming release
Michal Privoznik [Wed, 1 Mar 2023 08:38:29 +0000 (09:38 +0100)] 
NEWS: Document my contributions for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoNEWS: Clarify limitations of passt support
Andrea Bolognani [Tue, 28 Feb 2023 21:32:35 +0000 (22:32 +0100)] 
NEWS: Clarify limitations of passt support

Let users know that we're working on lifting the limitations
and that they should not use the feature in production until
then.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoNEWS: Mention two user-visible bug fixes
Peter Krempa [Tue, 28 Feb 2023 16:22:32 +0000 (17:22 +0100)] 
NEWS: Mention two user-visible bug fixes

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoNEWS: note new passt feature & bugfix for 9.1.0 release
Laine Stump [Mon, 27 Feb 2023 18:01:57 +0000 (13:01 -0500)] 
NEWS: note new passt feature & bugfix for 9.1.0 release

This also adds a sentence pointing out that SELinux must be disabled
in order for passt support to work. I didn't think to put that info in
the NEWS file last month when reporting the addition of passt support.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoTranslated using Weblate (Russian)
Sergey A [Mon, 27 Feb 2023 14:20:28 +0000 (15:20 +0100)] 
Translated using Weblate (Russian)

Currently translated at 89.6% (9338 of 10416 strings)

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

Co-authored-by: Sergey A <sw@atrus.ru>
Signed-off-by: Sergey A. <sw@atrus.ru>
2 years agoTranslated using Weblate (Korean)
김인수 [Mon, 27 Feb 2023 14:20:28 +0000 (15:20 +0100)] 
Translated using Weblate (Korean)

Currently translated at 100.0% (10416 of 10416 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>
2 years agoqemu: Don't error out on 'unknown' memory model in qemuMonitorJSONGetMemoryDeviceInfo() v9.1.0-rc2
Michal Privoznik [Mon, 27 Feb 2023 09:23:12 +0000 (10:23 +0100)] 
qemu: Don't error out on 'unknown' memory model in qemuMonitorJSONGetMemoryDeviceInfo()

When starting QEMU (or when reconnecting to a running one),
qemuMonitorJSONGetMemoryDeviceInfo() is called to refresh info on
memory devices. In here, query-memory-devices is called which
returns info on all memory devices. The result is then iterated
over and for some memory models runtime information is updated.
The rest is to be ignored. Except, when introducing SGX support,
this was turned into an error leaving us unable to start any
domain with virtio-pmem memory device (as virtio-pmem is to be
ignored).

Fixes: ddb1bc051959eef4ad7ed6ac47b57056632bdb5e
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Sat, 25 Feb 2023 10:20:29 +0000 (11:20 +0100)] 
Translated using Weblate (Georgian)

Currently translated at 3.6% (376 of 10416 strings)

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

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
2 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Thu, 23 Feb 2023 17:20:29 +0000 (18:20 +0100)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10416 of 10416 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2 years agoUpdate translation files
Weblate [Wed, 22 Feb 2023 14:22:29 +0000 (15:22 +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>
2 years agopo: Refresh potfile for v9.1.0 v9.1.0-rc1
Jiri Denemark [Wed, 22 Feb 2023 14:16:26 +0000 (15:16 +0100)] 
po: Refresh potfile for v9.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agodocs/kbase: fix example for SEV validation
Daniel P. Berrangé [Thu, 16 Feb 2023 15:51:03 +0000 (15:51 +0000)] 
docs/kbase: fix example for SEV validation

The offline validation example needs to include the firmware path,
and is also missing line continuation markers.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpm: add missing deps for the virt-qemu-sev-validate
Daniel P. Berrangé [Thu, 16 Feb 2023 14:57:56 +0000 (14:57 +0000)] 
rpm: add missing deps for the virt-qemu-sev-validate

The RPM automatic deps generator for python does not pick these up

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: refer to --firmware instead of --loader
Daniel P. Berrangé [Thu, 16 Feb 2023 14:55:11 +0000 (14:55 +0000)] 
docs: refer to --firmware instead of --loader

The --loader syntax was left over from an earlier version of the code
before it was renamed to --firmware.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu: respond to NETDEV_STREAM_DISCONNECTED event
Laine Stump [Tue, 21 Feb 2023 06:16:04 +0000 (01:16 -0500)] 
qemu: respond to NETDEV_STREAM_DISCONNECTED event

When a QEMU netdev is of type "stream", if the socket it uses for
connectivity to the host network gets closed, then QEMU will send a
NETDEV_STREAM_DISCONNECTED event. We know that any stream netdev we've
created is backed by a passt process, and if the socket was closed,
that means the passt process has disappeared.

When we receive this event, we can respond by starting a new passt
process with the same options (including socket path) we originally
used. If we have previously created the stream netdev device with a
"reconnect" option, then QEMU will automatically reconnect to this new
passt process. (If we hadn't used "reconnect", then QEMU will never
try to reconnect to the new passt process, so there's no point in
starting it.)

Note that NETDEV_STREAM_DISCONNECTED is an event sent for the netdev
(ie "host side") of the network device, and so it sends the
"netdev-id" to specify which device was disconnected. But libvirt's
virDomainNetDef (the object used to keep track of network devices) is
the internal representation of both the host-side "netdev", and the
guest side device, and virDomainNetDef doesn't directly keep track of
the netdev-id, only of the device's "alias" (which is the "id"
parameter of the *guest* side of the device). Fortunately, by convention
libvirt always names the host-side of devices as "host" + alias, so in
order to search for the affected NetDef, all we need to do is trim the
1st 4 characters from the netdev-id and look for the NetDef having
that resulting trimmed string as its alias. (Contrast this to
NIC_RX_FILTER_CHANGED, which is an event received for the guest side
of the device, and so directly contains the device alias.)

Resolves: https://bugzilla.redhat.com/2172098
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: add reconnect=5 to passt qemu commandline options when available
Laine Stump [Mon, 20 Feb 2023 23:26:51 +0000 (18:26 -0500)] 
qemu: add reconnect=5 to passt qemu commandline options when available

QEMU's "reconnect" option of "-netdev stream" tells QEMU to
periodically (period is given in seconds as an argument to the option)
attempt to reconnect to the same passt socket to which it had
originally connected to. This is useful in cases where the passt
process terminates, and libvirtd starts a new passt process in its
place (which doesn't happen yet, but will happen automatically after
an upcoming patch in this series).

Since there is no real hueristic for determining the "best" value of
the reconnect interval, rather than clutter up config with a knob that
nobody knows how to properly twiddle, we just set the reconnect timer
to 5 seconds.

"-netdev stream" first appeared in QEMU 7.2.0, but the reconnect
option won't be available until QEMU 8.0.0, so we need to check QEMU
capabilities just in case someone is using QEMU 7.2.0 (and thus can
support passt backend, but not reconnect)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: capabilities: Introduce QEMU_CAPS_NETDEV_STREAM_RECONNECT
Peter Krempa [Mon, 20 Feb 2023 16:25:08 +0000 (17:25 +0100)] 
qemu: capabilities: Introduce QEMU_CAPS_NETDEV_STREAM_RECONNECT

Detect that the 'stream' netdev backend supports reconnecting.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: remove extraneous error log when qemuPasstStart() fails during hotplug
Laine Stump [Tue, 21 Feb 2023 06:09:04 +0000 (01:09 -0500)] 
qemu: remove extraneous error log when qemuPasstStart() fails during hotplug

qemuPasstStart() already logs any error that occurs, so having the
caller log a generic error message only serves to obscure the actual
problem.

Fixes: a56f0168d576fa01cec204dc3c67d4d63ab8487f
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: add check for QEMU_CAPS_NETDEV_STREAM during validation
Laine Stump [Mon, 20 Feb 2023 20:14:23 +0000 (15:14 -0500)] 
qemu: add check for QEMU_CAPS_NETDEV_STREAM during validation

In commit 5af6134e I had added a new capability that is true if QEMU
allows "-netdev stream", but somehow neglected to actually check it in
commit a56f0168d when hooking up passt support to qemu. This isn't
catastrophic, since QEMU itself will still report an error, but that
error isn't as easy to understand as a libvirt-generated error.

Fixes: a56f0168d576fa01cec204dc3c67d4d63ab8487f
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_passt: Remove passt socket file on exit
Stefano Brivio [Tue, 21 Feb 2023 19:19:07 +0000 (20:19 +0100)] 
qemu_passt: Remove passt socket file on exit

Just like it can't remove its own PID files, passt can't unlink its
own socket upon exit (unless the initialisation fails), because it
has no access to the filesystem at runtime.

Remove the socket file in qemuPasstKill().

Fixes: a56f0168d576 ("qemu: hook up passt config to qemu domains")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Tue, 21 Feb 2023 11:15:17 +0000 (12:15 +0100)] 
Translated using Weblate (Georgian)

Currently translated at 3.5% (367 of 10405 strings)

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

Translated using Weblate (Georgian)

Currently translated at 2.1% (223 of 10405 strings)

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

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
2 years agoqemu: forbid updating any attributes of an interface <backend> with update-device
Laine Stump [Wed, 15 Feb 2023 20:29:56 +0000 (15:29 -0500)] 
qemu: forbid updating any attributes of an interface <backend> with update-device

Changing any of the attributes of an <interface>'s <backend> would
require removing and re-adding the interface for the new setting to
take effect, so fail any update-device that changes anything in
<backend>

Resolves: https://bugzilla.redhat.com/2169245
Signed-off-by: Laine Stump <laine@redhat.com>
2 years agoNEWS: document external memory snapshot bug fixes
Pavel Hrdina [Tue, 21 Feb 2023 16:19:13 +0000 (17:19 +0100)] 
NEWS: document external memory snapshot bug fixes

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_snapshot: refactor qemuSnapshotDeleteExternalPrepare
Pavel Hrdina [Tue, 21 Feb 2023 15:52:28 +0000 (16:52 +0100)] 
qemu_snapshot: refactor qemuSnapshotDeleteExternalPrepare

When user creates external snapshot with making only memory snapshot
without any disks deleting that snapshot failed without reporting any
meaningful error.

The issue is that the qemuSnapshotDeleteExternalPrepare function
returns NULL because the returned list is empty. This will not change
so to make it clear if the function fails or not return int instead and
have another parameter where we can pass the list.

With the fixed memory snapshot deletion it will now correctly delete
memory only snapshot as well.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_snapshot: remove memory snapshot when deleting external snapshot
Pavel Hrdina [Tue, 21 Feb 2023 15:10:56 +0000 (16:10 +0100)] 
qemu_snapshot: remove memory snapshot when deleting external snapshot

When deleting external snapshot we should remove the memory snapshot
file as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: fix reconnect of unix socket is wrong
Zhenguo Yao [Thu, 16 Feb 2023 02:48:37 +0000 (10:48 +0800)] 
qemu: fix reconnect of unix socket is wrong

'reconnect' parameter doesn't pass to qemu properly when
hotplug vhost-user device to vm. Fix this by making
'reconnect' to get correct value.

Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agoNEWS: Document new pvpanic-pci device
Kristina Hanicova [Tue, 21 Feb 2023 16:37:52 +0000 (17:37 +0100)] 
NEWS: Document new pvpanic-pci device

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: document panic device 'pvpanic-pci'
Kristina Hanicova [Mon, 20 Feb 2023 16:12:59 +0000 (17:12 +0100)] 
docs: document panic device 'pvpanic-pci'

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agotests: add case for pvpanic-pci without address
Kristina Hanicova [Mon, 20 Feb 2023 16:12:58 +0000 (17:12 +0100)] 
tests: add case for pvpanic-pci without address

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: assign PCI address to device pvpanic-pci
Kristina Hanicova [Mon, 20 Feb 2023 16:12:57 +0000 (17:12 +0100)] 
qemu: assign PCI address to device pvpanic-pci

It makes sense to accept pvpanic-pci also without specified PCI
address and assign one if possible.

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agotests: add test cases for device pvpanic-pci
Kristina Hanicova [Mon, 20 Feb 2023 16:12:56 +0000 (17:12 +0100)] 
tests: add test cases for device pvpanic-pci

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoconf: add panic model 'pvpanic'
Kristina Hanicova [Mon, 20 Feb 2023 16:12:55 +0000 (17:12 +0100)] 
conf: add panic model 'pvpanic'

This patch introduces optional device pvpanic-pci, validates its
address and generates command line.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: introduce QEMU_CAPS_DEVICE_PANIC_PCI
Kristina Hanicova [Mon, 20 Feb 2023 16:12:54 +0000 (17:12 +0100)] 
qemu: introduce QEMU_CAPS_DEVICE_PANIC_PCI

This capability detects the availability of the pvpanic-pci
device that is required in order to use pvpanic on Arm (original
pvpanic is an emulated ISA device, for which Arm does not have
support).

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agotests: qemucapabilitiesdata: Update for the qemu-8.0 development cycle
Peter Krempa [Fri, 6 Jan 2023 08:54:32 +0000 (09:54 +0100)] 
tests: qemucapabilitiesdata: Update for the qemu-8.0 development cycle

Update to v7.2.0-1550-g79b677d658:

Notable changes:
 - the 'stream' netdev backend supports 'reconnect'
 - 'ide-cf' device added
 - 'sgx-aex-notify' and 'sgx-edeccssa' cpu properties added
 - 'pvrdma' device added
 - 'qio-channel-rdma' channel added
 - 'query-audiodevs` command added
 - block graph info changes
   - added specific information for 'file' node ('extent-size-hint')
   - format specific info for 'vmdk' nodes changed
 - 'query-migrationthreads' command added
 - deprecated 'sga' device removed
 - deprecated 'password' option of SPICE protocol removed
 - deprecated 'section-size' property of return value of 'query-sgx'
   removed
 - 'x-early-migration' property for 'virtio-mem' added
 - 'x-native-hotplug' renamed to 'x-do-not-expose-native-hotplug-cap'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Tue, 21 Feb 2023 05:20:48 +0000 (06:20 +0100)] 
Translated using Weblate (Georgian)

Currently translated at 2.1% (223 of 10405 strings)

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

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
2 years agoRemove unused member `upstream` from virDomainNetBackend
Martin Kletzander [Tue, 21 Feb 2023 09:31:45 +0000 (10:31 +0100)] 
Remove unused member `upstream` from virDomainNetBackend

It was used briefly and subsequently removed in 3592b81c4c71.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: Convert 404 page to rST
Martin Kletzander [Tue, 21 Feb 2023 06:57:31 +0000 (07:57 +0100)] 
docs: Convert 404 page to rST

There is no markup equivalent for any of the <s/> or <del/> HTML tags, so this
is the only thing I came up with and it looks like it works.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agosyntax-check: Ensure Python is called via env(1)
Andrea Bolognani [Mon, 20 Feb 2023 10:12:44 +0000 (11:12 +0100)] 
syntax-check: Ensure Python is called via env(1)

The syntax-check rule that calls flake8 on Python scripts
expects this to be the case, and it's the best practice anyway.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agodocs: Recommend better python3 shebang
Andrea Bolognani [Mon, 20 Feb 2023 10:14:27 +0000 (11:14 +0100)] 
docs: Recommend better python3 shebang

Python scripts should always invoked the interpreter through
env(1) to ensure that they work on macOS and the BSDs, and at
this point not explicitly asking for Python 3 doesn't really
make sense.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agodocs/html: Properly generate ACL permissions into API reference
Peter Krempa [Fri, 17 Feb 2023 21:47:34 +0000 (22:47 +0100)] 
docs/html: Properly generate ACL permissions into API reference

The 'newapi.xsl' stylesheet was referencing non-existing paths to the
XML files holding ACL permission flags for individual APIs. Additionally
the 'document()' XSL function doesn't even allow concatenation of the
path as it was done via '{$builddir}/src..', but requires either direct
argument or use of the 'concat()' function.

This meant that the 'acls' variable was always empty and thus none of
our API documentation was actually generated with the 'acl' section.

Fix it by passing the path to the XML via an argument to the stylesheet
as the files differ based on which document is being generated.

Since the 'admin' API does not have ACL we need to handle it separately
now in the build system.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agogendispatch: Add proper XML header to ACL permissions XML file
Peter Krempa [Mon, 20 Feb 2023 08:42:58 +0000 (09:42 +0100)] 
gendispatch: Add proper XML header to ACL permissions XML file

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: ACL: Mention the ACL object name along with the corresponding libvirt object...
Peter Krempa [Fri, 17 Feb 2023 15:48:35 +0000 (16:48 +0100)] 
docs: ACL: Mention the ACL object name along with the corresponding libvirt object name

It's not trivial to figure out the ACL object name from our
documentation. Add it above the table outlining existing permissions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Fix generated names for ACL objects
Peter Krempa [Mon, 20 Feb 2023 10:31:11 +0000 (11:31 +0100)] 
docs: Fix generated names for ACL objects

Both the object name and permission name in ACL use '-' instead of '_'
separator when referring to them in the docs or even when used inside of
polkit. Unfortunately the generators used for generating our docs don't
honour this in certain cases which would result in broken names in the
API docs (once they will be generated).

Rename both object and permission name to use dash and reflect that in
the anchor names in the documentation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Sun, 19 Feb 2023 16:20:23 +0000 (17:20 +0100)] 
Translated using Weblate (Georgian)

Currently translated at 1.7% (185 of 10405 strings)

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

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
2 years agoselinux: Don't ignore ENOENT in Permissive mode
Michal Privoznik [Mon, 20 Sep 2021 11:02:37 +0000 (13:02 +0200)] 
selinux: Don't ignore ENOENT in Permissive mode

In selinux driver there's virSecuritySELinuxSetFileconImpl()
which is responsible for actual setting of SELinux label on given
file and handling possible failures. In fhe failure handling code
we decide whether failure is fatal or not. But there is a bug:
depending on SELinux mode (Permissive vs. Enforcing) the ENOENT
is either ignored or considered fatal. This not correct - ENOENT
must always be fatal for couple of reasons:

- In virSecurityStackTransactionCommit() the seclabels are set
  for individual secdrivers (e.g. SELinux first and then DAC),
  but if one secdriver succeeds and another one fails, then no
  rollback is performed for the successful one leaking remembered
  labels.

- QEMU would fail opening the file anyways (if neither of
  secdrivers reported error and thus cancelled domain startup)

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2004850
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoselinux: Swap two blocks handling setfilecon_raw() failure
Michal Privoznik [Mon, 20 Sep 2021 10:21:04 +0000 (12:21 +0200)] 
selinux: Swap two blocks handling setfilecon_raw() failure

In virSecuritySELinuxSetFileconImpl() we have code that handles
setfilecon_raw() failure. The code consists of two blocks: one
for dealing with shared filesystem like NFS (errno is ENOTSUP or
EROFS) and the other block that's dealing with EPERM for
privileged daemon. Well, the order of these two blocks is a bit
confusing because the comment above them mentions the NFS case
but EPERM block follows. Swap these two blocks to make it less
confusing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_passt: Let passt write the PID file
Michal Privoznik [Thu, 16 Feb 2023 10:46:55 +0000 (11:46 +0100)] 
qemu_passt: Let passt write the PID file

The way we start passt currently is: we use
virCommandSetPidFile() to use our virCommand machinery to acquire
the PID file and leak opened FD into passt. Then, we use
virPidFile*() APIs to read the PID file (which is needed when
placing it into CGroups or killing it). But this does not fly
really because passt daemonizes itself. Thus the process we
started dies soon and thus the PID file is closed and unlocked.

We could work around this by passing '--foreground' argument, but
that weakens passt as it can't create new PID namespace (because
it doesn't fork()).

The solution is to let passt write the PID file, but since it
does not lock the file and closes it as soon as it is written, we
have to switch to those virPidFile APIs which don't expect PID
file to be locked.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu_passt: Deduplicate passt killing code
Michal Privoznik [Thu, 16 Feb 2023 11:07:42 +0000 (12:07 +0100)] 
qemu_passt: Deduplicate passt killing code

There are two places where we kill passt:

1) qemuPasstStop() - called transitively from qemuProcessStop(),
2) qemuPasstStart() - after failed start.

Now, the code from 2) lack error preservation (so if there's
another error during cleanup we might overwrite the original
error). Therefore, move the internals of qemuPasstStop() into a
separate function and call it from both places.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu_passt: Report passt's error on failed start
Michal Privoznik [Thu, 16 Feb 2023 11:19:26 +0000 (12:19 +0100)] 
qemu_passt: Report passt's error on failed start

When starting passt, it may write something onto its stderr
(convincing it to print even more is addressed later). Pass this
string we read to user.

Since we're not daemonizing passt anymore (see previous commit),
we can let virCommand module do all the heavy lifting and switch
to virCommandSetErrorBuffer() instead of reading error from an
FD.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu_passt: Avoid double daemonizing passt
Michal Privoznik [Thu, 16 Feb 2023 11:00:58 +0000 (12:00 +0100)] 
qemu_passt: Avoid double daemonizing passt

When passt is started, it daemonizes itself by default. There's
no point in having our virCommand module daemonize it too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agodocs: ACL: Show which permissions are allowed for unauthenticated connections
Peter Krempa [Fri, 17 Feb 2023 15:31:20 +0000 (16:31 +0100)] 
docs: ACL: Show which permissions are allowed for unauthenticated connections

Certain APIs are allowed also without authentication but the ACL page
didn't outline which. Generate a new column with the information.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agolibvirt-nodedev: Allow read-only access to virNodeDeviceGetAutostart
Peter Krempa [Fri, 17 Feb 2023 15:07:25 +0000 (16:07 +0100)] 
libvirt-nodedev: Allow read-only access to virNodeDeviceGetAutostart

Fetching whether a node-device is marked for autostart can be allowed
from read-only connections similarly to other objects.

Fixes: c6607a25b93
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoaccess: Allow 'node-device.read' permission for anonymous users
Peter Krempa [Fri, 17 Feb 2023 15:02:09 +0000 (16:02 +0100)] 
access: Allow 'node-device.read' permission for anonymous users

For all other objects we allow the 'read' permission for anonymous
users. In fact the idea is to allow all permissions users using the
readonly connection would have.

This impacts the following APIs (in terms of RPC procedure names):

  $ git grep -A 3 node_device:read | grep REMOTE
  src/remote/remote_protocol.x-    REMOTE_PROC_NODE_DEVICE_GET_XML_DESC = 114,
  src/remote/remote_protocol.x-    REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115,
  src/remote/remote_protocol.x-    REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116,
  src/remote/remote_protocol.x-    REMOTE_PROC_NODE_DEVICE_LIST_CAPS = 117,
  src/remote/remote_protocol.x-    REMOTE_PROC_NODE_DEVICE_GET_AUTOSTART = 433,
  src/remote/remote_protocol.x-    REMOTE_PROC_NODE_DEVICE_IS_PERSISTENT = 435,
  src/remote/remote_protocol.x-    REMOTE_PROC_NODE_DEVICE_IS_ACTIVE = 436,

Fixes: a93cd08f
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu_extdevice: Add a comment into qemuExtDevicesSetupCgroup()
Michal Privoznik [Wed, 15 Feb 2023 14:52:21 +0000 (15:52 +0100)] 
qemu_extdevice: Add a comment into qemuExtDevicesSetupCgroup()

The way setting up CGroups for external helpers work, is:
qemuExtDevicesHasDevice() is called first to determine whether
there is a helper process running, the CGroup controller is
created and then qemuExtDevicesSetupCgroup() is called to place
helpers into the CGroup. But when one reads just
qemuExtDevicesSetupCgroup() it's easy to miss this hidden logic.
Therefore, add a warning at the beginning of the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu_passt: Report error when getting passt PID failed
Michal Privoznik [Mon, 13 Feb 2023 15:05:04 +0000 (16:05 +0100)] 
qemu_passt: Report error when getting passt PID failed

If qemuPasstGetPid() fails, or the passt's PID is -1 then
qemuPasstSetupCgroup() returns early without any error message
set. Report an appropriate error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu_extdevice: Make qemuExtDevicesHasDevice() check def->nets
Michal Privoznik [Mon, 13 Feb 2023 15:01:32 +0000 (16:01 +0100)] 
qemu_extdevice: Make qemuExtDevicesHasDevice() check def->nets

We can have external helper processes running for domain
<interface/> too (e.g. slirp or passt). But this is not reflected
in qemuExtDevicesHasDevice() which simply ignores these.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoRevert "qemu: allow passt to self-daemonize"
Michal Privoznik [Mon, 13 Feb 2023 09:25:51 +0000 (10:25 +0100)] 
Revert "qemu: allow passt to self-daemonize"

This reverts commit 0c4e716835eaf2a575bd063fde074c0fc7c4e4d4.

This patch was pushed by my mistake. Even though it got ACKed on
the list, I've raised couple of issues with it. They will be
fixed in next commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoscripts: check-html-refernces: Add checking for image file usage
Peter Krempa [Tue, 14 Feb 2023 13:38:40 +0000 (14:38 +0100)] 
scripts: check-html-refernces: Add checking for image file usage

Check both that a file is referenced from our pages and also that pages
reference existing images.

The mode for dumping external references now also dumps images.

'--ignore-image' can be used repeatedly to suppress errors for specific
images.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: logos: Turn 'README' into rST, generate an index and link to images
Peter Krempa [Tue, 14 Feb 2023 14:03:18 +0000 (15:03 +0100)] 
docs: logos: Turn 'README' into rST, generate an index and link to images

The logo directory wasn't really referenced from anywhere. Additionally
there wasn't any reasonable index for all the image files which we have.

Turn the README file into rST and display the images it references. Link
to the new index file from the docs page.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agokbase: eventloop: Fix path to referenced images
Peter Krempa [Tue, 14 Feb 2023 13:38:46 +0000 (14:38 +0100)] 
kbase: eventloop: Fix path to referenced images

The images are referenced from '../images/' but the document is two
layers deep thus '../../images' needs to be used

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoscripts: check-html-references: Detect pages that are not linked to
Peter Krempa [Tue, 14 Feb 2023 12:14:25 +0000 (13:14 +0100)] 
scripts: check-html-references: Detect pages that are not linked to

Prevent sub-pages without a way to reach them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Add sub-page for all golang modules
Peter Krempa [Tue, 14 Feb 2023 12:51:02 +0000 (13:51 +0100)] 
docs: Add sub-page for all golang modules

Our documentation has pages for 4 go modules, 2 current and 2 obsolete
ones, but points only to one of them and directly to golang's docs page.

Add a sub-page where all 4 sub-pages for the modules are linked.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: manpages: Add missing manpages to index
Peter Krempa [Tue, 14 Feb 2023 12:19:09 +0000 (13:19 +0100)] 
docs: manpages: Add missing manpages to index

The manpages for 'virt-pki-query-dn', 'virt-qemu-qmp-proxy' and
'virt-ssh-helper.rst' were not referenced from the manpage index or any
other place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoscripts: check-html-references: Improve error messages and don't mess with relative...
Peter Krempa [Tue, 14 Feb 2023 11:35:23 +0000 (12:35 +0100)] 
scripts: check-html-references: Improve error messages and don't mess with relative paths

Now that we have the source file name as a custom attribute we can use
it to report which file actually needs to be edited to fix the error:

 ERROR: 'docs/uri.rst': broken link to: 'drvqemu.html#exaple'

rather than:

 broken link targets:
 docs/uri.html broken link: drvqemu.html#exaple

which pointed to file which does not exist in the source directory.

This also allows us to delete all the relative path handling needed to
report at least somewhat user-legible errors before.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoscripts: check-html-references: Rename --prefix to --webroot and make it mandatory
Peter Krempa [Tue, 14 Feb 2023 11:05:30 +0000 (12:05 +0100)] 
scripts: check-html-references: Rename --prefix to --webroot and make it mandatory

Force users to pass the path to the root of the webpage the script
should check. The script lives in a different subdirectory so the
default of the current directory doesn't make much sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: XSL: Add source document name as custom data attribute for <html>
Peter Krempa [Tue, 14 Feb 2023 10:59:22 +0000 (11:59 +0100)] 
docs: XSL: Add source document name as custom data attribute for <html>

The html standard allows custom data attributes on any element in the
format of 'data-*' which are not interpreted. We can use it to embed the
name of the source document used to generate the page so that our
checker tools can use the friendly name.

https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agovirLogCleanerShutdown: Don't call g_regex_unref on NULL regex
Peter Krempa [Wed, 15 Feb 2023 10:02:10 +0000 (11:02 +0100)] 
virLogCleanerShutdown: Don't call g_regex_unref on NULL regex

Shutdown of virtlogd prints:

  (process:54742): GLib-CRITICAL **: 11:00:40.873: g_regex_unref: assertion 'regex != NULL' failed

Use g_clear_pointer instead which prevents it in the NULL case.

Fixes: 69eeef5dfbf
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpc: Don't warn about "max_client_requests" in single-threaded daemons
Peter Krempa [Wed, 15 Feb 2023 09:48:31 +0000 (10:48 +0100)] 
rpc: Don't warn about "max_client_requests" in single-threaded daemons

The warning about max_client_requests is hit inside virtlogd every time
a VM starts which spams the logs.

Emit the warning only when the client request limit is not 1 and add a
warning into the daemon config to not configure it too low instead.

Fixes: 031878c2364
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2145188
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpc: client: Don't check return value of virNetMessageNew
Peter Krempa [Wed, 15 Feb 2023 09:43:53 +0000 (10:43 +0100)] 
rpc: client: Don't check return value of virNetMessageNew

virNetServerClientDispatchRead checked the return value but it's not
necessary any more as it can't return NULL nowadays.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotest: Introduce chxml2xmltest
Michal Privoznik [Fri, 10 Feb 2023 11:40:04 +0000 (12:40 +0100)] 
test: Introduce chxml2xmltest

Whilst reviewing a patch upstream (that ended up as
v9.0.0-200-g092176e5ec), I realized we don't have a single
xml2xml test for CH driver. Well, introduce the test with one
simple test case for now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: blockjob: Handle 'pending' blockjob state only when we need it
Peter Krempa [Fri, 10 Feb 2023 16:16:43 +0000 (17:16 +0100)] 
qemu: blockjob: Handle 'pending' blockjob state only when we need it

The 'pending' state needs to be handled by the blockjob code only when
the snapshot code requests a block-commit without auto-finalization.

If we always handle it we fail to properly remove the blockjob data for
the 'blockdev-create' job as that also transitions trhough 'pending' but
we'd never update it once it reaches 'concluded' as the code already
thinks that the job has finished and is no longer watching it.

Introduce a 'processPending' property into block job data and set it
only when we know that we need to process 'pending'.

Fixes: 90d9bc9d74a5157167548b26c00b1a016655e295
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2168769
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoTranslated using Weblate (Polish)
Piotr Drąg [Mon, 13 Feb 2023 12:20:21 +0000 (13:20 +0100)] 
Translated using Weblate (Polish)

Currently translated at 22.0% (2292 of 10405 strings)

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

Co-authored-by: Piotr Drąg <piotrdrag@gmail.com>
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
2 years agoconf: Allow conventional PCI devices to be marked as integrated
Andrea Bolognani [Thu, 9 Feb 2023 17:15:08 +0000 (18:15 +0100)] 
conf: Allow conventional PCI devices to be marked as integrated

Integrated PCI devices can be either PCIe (virtio-iommu) or
conventional PCI (pvpanic-pci). Right now libvirt will refuse
to assign an address on pcie.0 for the latter, but that's an
undesirable limitation that we can easily remove.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoch: Do not add stub console to ch VMs
Praveen K Paladugu [Thu, 9 Feb 2023 22:09:28 +0000 (22:09 +0000)] 
ch: Do not add stub console to ch VMs

virDomainDefAddConsoleCompat in post parsing step appends a stub console
of type VIR_DOMAIN_CHR_TYPE_NULL to ch VMs' Domain XML. Cloud-hypervisor's
deviceValidateCallback (chValidateDomainDeviceDef) checks that the type of
stub console is not of type VIR_DOMAIN_CHR_TYPE_PTY and throws an error.

This commit introduces NO_STUB_CONSOLE feature check to Domain features and
uses it to skip adding stub console to ch VMs.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_extdevice: Do cleanup host only for VIR_DOMAIN_TPM_TYPE_EMULATOR
Michal Privoznik [Fri, 10 Feb 2023 08:47:05 +0000 (09:47 +0100)] 
qemu_extdevice: Do cleanup host only for VIR_DOMAIN_TPM_TYPE_EMULATOR

We only set up host for VIR_DOMAIN_TPM_TYPE_EMULATOR and thus
similarly, we should do cleanup for the same type. This also
fixes a crasher, in which qemuTPMEmulatorCleanupHost() accesses
tpm->data.emulator.storagepath which is NULL for
VIR_DOMAIN_TPM_TYPE_EXTERNAL.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2168762
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agocpu_s390: Implement getVendorForModel for IBM Z
Thomas Huth [Fri, 25 Nov 2022 10:52:55 +0000 (11:52 +0100)] 
cpu_s390: Implement getVendorForModel for IBM Z

When running "virsh domcapabilities" on a s390x host, all the CPU
models show up with vendor='unknown' - which sounds kind of weird
since the vendor of these mainframe CPUs is well known: IBM.
All CPUs starting with either "z" or "gen" match a real mainframe
CPU by IBM, so let's return the string "IBM" for those now.
The only remaining ones are now the artifical "qemu" and "max"
models from QEMU itself, so it should be OK to get an "unknown"
vendor for those two.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Boris Fiuczynski<fiuczy@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: allow passt to self-daemonize
Laine Stump [Wed, 8 Feb 2023 23:13:10 +0000 (18:13 -0500)] 
qemu: allow passt to self-daemonize

I initially had the passt process being started in an identical
fashion to the slirp-helper - libvirt was daemonizing the new process
and recording its pid in a pidfile. The problem with this is that,
since it is daemonized immediately, any startup error in passt happens
after the daemonization, and thus isn't seen by libvirt - libvirt
believes that the process has started successfully and continues on
its merry way. The result was that sometimes a guest would be started,
but there would be no passt process for qemu to use for network
traffic.

Instead, we should be starting passt in the same manner we start
dnsmasq - we just exec it as normal (along with a request that passt
create the pidfile, which is just another option on the passt
commandline) and wait for the child process to exit; passt then has a
chance to parse its commandline and complete all the setup prior to
daemonizing itself; if it encounters an error and exits with a non-0
code, libvirt will see the code and know about the failure. We can
then grab the output from stderr, log that so the "user" has some idea
of what went wrong, and then fail the guest startup.

Signed-off-by: Laine Stump <laine@redhat.com>
2 years agoqemuProcessRefreshDisks: Don't skip filling of disk information if tray state didn...
Peter Krempa [Thu, 9 Feb 2023 08:40:32 +0000 (09:40 +0100)] 
qemuProcessRefreshDisks: Don't skip filling of disk information if tray state didn't change

Commit 5ef2582646eb98 added emitting of even when refreshign disk state,
where it wanted to avoid sending the event if disk state didn't change.
This was achieved by using 'continue' in the loop filling the
information. Unfortunately this skips extraction of whether the device
has a tray which is propagated into internal structures, which in turn
broke cdrom media change as the code thought there's no tray for the
device.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2166411
Fixes: 5ef2582646eb98af208ce37355f82bdef39931fa
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoremote_driver: Work around broken clang
Michal Privoznik [Thu, 9 Feb 2023 07:38:17 +0000 (08:38 +0100)] 
remote_driver: Work around broken clang

In recent commit of v9.0.0-191-gc71c159248 I've introduced
remoteConnectFormatURI() function and in the function @query
variable. Even though, the variable is used, clang-13 fails to
see it. Surprisingly, newer clang is not affected. Fortunately,
swapping the order in which variables are set makes clang happy
again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoRevert ".gitignore: Ignore cscope and other *tags files"
Martin Kletzander [Mon, 6 Feb 2023 14:05:38 +0000 (15:05 +0100)] 
Revert ".gitignore: Ignore cscope and other *tags files"

This reverts commit f2d379e7cb802f922409c35e4831ee52a2162486.

Any tool-related ignores should go to user's global ignore file or the user's
local exclude file which is per-project.  See git-config(1) and gitignore(5) for
more details.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Not-Ignored-by: Ján Tomko <jtomko@redhat.com>
2 years agoremote: Pass 'mode' and 'socket' URI parameters to virt-ssh-helper
Michal Privoznik [Fri, 3 Feb 2023 14:22:18 +0000 (15:22 +0100)] 
remote: Pass 'mode' and 'socket' URI parameters to virt-ssh-helper

When handling virConnectOpen(), we parse given URI, specifically
all those parameters we know, like ?mode, ?socket, ?name, etc.
ignoring those we don't recognize yet. Then, we reconstruct the
URI back, but ignoring all parameters we've parsed. In other
words:

  qemu:///system?mode=legacy&foo=bar

becomes:

  qemu:///system?foo=bar

The reconstructed URI is then passed to the corresponding driver
(QEMU in our example) with intent of it parsing parameters
further (or just ignoring them). But for some transport modes,
where virt-ssh-helper is ran on the remote host (libssh, libssh2,
ssh) we need to pass ?mode and ?socket parameters, so that it can
do the right thing, e.g. for 'mode=legacy' start the monolithic
daemon, or for 'socket=' connect to the given socket.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/433
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoviruri: Introduce virURIParamsSetIgnore()
Michal Privoznik [Fri, 3 Feb 2023 14:10:23 +0000 (15:10 +0100)] 
viruri: Introduce virURIParamsSetIgnore()

The aim of this helper is to manipulate the .ignore value for
given list of parameters. For instance:

  virURIParamsSetIgnore(uri, false, {"mode", "socket", NULL});

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoremote_driver: Move URI re-generation into a function
Michal Privoznik [Fri, 3 Feb 2023 13:57:47 +0000 (14:57 +0100)] 
remote_driver: Move URI re-generation into a function

There's a piece of code in doRemoteOpen() that is going to be
called twice. Instead of duplicating the code, move it into a
function that will be called twice, later on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirt-ssh-helper: Accept ?socket= in connection URI
Michal Privoznik [Fri, 3 Feb 2023 09:52:06 +0000 (10:52 +0100)] 
virt-ssh-helper: Accept ?socket= in connection URI

Similarly to the previous commit, let's accept "socket" parameter
in the connection URI. This change will allow us to use
virt-ssh-helper instead of 'nc' in all cases (done in one of
future commits).

Please note, when the parameter is used it effectively disables
automatic daemon spawning and an error is reported. But this is
intentional - so that the helper behaves just like regular
virConnectOpen() with different transport than ssh, e.g. unix.

But this 'change' is acceptable - there's no way for users to
make our remote code pass the argument to virt-ssh-helper, yet.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirt-ssh-helper: Accept ?mode= in connection URI
Michal Privoznik [Thu, 2 Feb 2023 15:51:58 +0000 (16:51 +0100)] 
virt-ssh-helper: Accept ?mode= in connection URI

When split daemons were introduced, we also made connection URI
accept new parameter: mode={auto,legacy,direct} so that a client
can force connecting to either old, monolithic daemon, or to
split daemon (see v5.7.0-rc1~257 for more info).

Now, the change was done to the remote driver, but not to
virt-ssh-helper. True, our remote driver code still does not pass
the 'mode' parameter, but that will be addressed in next commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodoRemoteOpen(): Rename 'failed' label to 'error'
Michal Privoznik [Fri, 3 Feb 2023 08:53:28 +0000 (09:53 +0100)] 
doRemoteOpen(): Rename 'failed' label to 'error'

Our own coding style suggest not inventing new names for labels
and stick with 'cleanup' (when the path is used in both,
successful and unsuccessful returns), or 'error' (when the code
below the label is used only upon error). Well, 'failed' label
falls into the latter category. Rename it then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>