]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Sun, 1 Jan 2023 08:20:04 +0000 (09:20 +0100)]
Translated using Weblate (Finnish)

Currently translated at 22.8% (2369 of 10368 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
2 years agoFix null pointer dereference in virXMLPropStringRequired
Gedalya [Tue, 3 Jan 2023 11:39:36 +0000 (19:39 +0800)]
Fix null pointer dereference in virXMLPropStringRequired

Fixes: 65eaf58335f
Signed-off-by: Gedalya <gedalya@gedalya.net>
2 years agorpc: Check client limits in more places
Martin Kletzander [Mon, 2 Jan 2023 15:23:08 +0000 (16:23 +0100)]
rpc: Check client limits in more places

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2033879
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agorpc: Fix error message in virNetServerSetClientLimits
Martin Kletzander [Mon, 2 Jan 2023 15:21:24 +0000 (16:21 +0100)]
rpc: Fix error message in virNetServerSetClientLimits

That way it actually fits with what the condition checks for.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Check error message in virnetdaemontest
Martin Kletzander [Mon, 2 Jan 2023 15:26:31 +0000 (16:26 +0100)]
tests: Check error message in virnetdaemontest

This way we actually check for the proper error, not any error like invalid JSON
format.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoFix test case to actually test something
Martin Kletzander [Mon, 2 Jan 2023 14:03:25 +0000 (15:03 +0100)]
Fix test case to actually test something

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemumonitortestutils: Fix line counting in qemuMonitorTestProcessFileEntries()
Michal Privoznik [Wed, 21 Dec 2022 10:08:02 +0000 (11:08 +0100)]
qemumonitortestutils: Fix line counting in qemuMonitorTestProcessFileEntries()

It just so happens that our JSON snippets in
qemucapabilitiesdata/*.replies files are separated by an empty
line. These empty lines are then overwritten to make a single
line JSON. Nevertheless, the line counter @line is not
incremented which then leads to a misleading numbers in errors.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agosecret: Inhibit shutdown for ephemeral secrets
Michal Privoznik [Tue, 20 Dec 2022 08:04:48 +0000 (09:04 +0100)]
secret: Inhibit shutdown for ephemeral secrets

Our secret driver divides secrets into two groups: ephemeral
(stored only in memory) and persistent (stored on disk). Now, the
aim of ephemeral secrets is to define them shortly before being
used and then undefine them. But 'shortly before being used' is a
very vague time frame. And since we default to socket activation
and thus pass '--timeout 120' to every daemon it may happen that
just defined ephemeral secret is gone among with the virtsecretd.

This is no problem for persistent secrets as their definition
(and value) is restored when the virtsecretd starts again, but
ephemeral secrets can't be restored.

Therefore, we could view ephemeral secrets as active objects that
the daemon manages and thus inhibit automatic shutdown (just like
hypervisor daemons do when a guest is running).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agolibxl: adjust 'ich6' sound card name
Marek Marczykowski-Górecki [Tue, 20 Dec 2022 22:52:06 +0000 (23:52 +0100)]
libxl: adjust 'ich6' sound card name

Xen 4.17 has strict parsing of 'soundhw' option that allows only
specific values (instead of passing through any value directly to
qemu's -soundhw option, it uses -device now). For 'intel-hda' audio
device, it requires "hda" string. "hda" works with older libxl too.
Other supported models are the same as in libvirt XML.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: add validation if sound device is supported
Marek Marczykowski-Górecki [Tue, 20 Dec 2022 22:52:05 +0000 (23:52 +0100)]
libxl: add validation if sound device is supported

Xen supports only subset of libvirt's sound devices, and starting with
Xen 4.17 it is enforced by libxl. Verify it early.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirSecretGetSecretString: Refactor cleanup
Peter Krempa [Thu, 8 Dec 2022 11:28:13 +0000 (12:28 +0100)]
virSecretGetSecretString: Refactor cleanup

Automatically free 'sec' and remove the 'cleanup' section and 'ret'
variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodatatypes: Register autoptr cleanup for virSecret
Peter Krempa [Thu, 8 Dec 2022 11:27:23 +0000 (12:27 +0100)]
datatypes: Register autoptr cleanup for virSecret

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirStorageBackendRBDOpenRADOSConn: Don't log the RBD key
Peter Krempa [Fri, 9 Dec 2022 15:49:12 +0000 (16:49 +0100)]
virStorageBackendRBDOpenRADOSConn: Don't log the RBD key

'virStorageBackendRBDRADOSConfSet' logs its arguments but it's also
used to set the RBD secret/key.

All the security theatre with securely erasing the string we do to fetch
the secret would be quite pointless if we log it thus introduce
virStorageBackendRBDRADOSConfSetQuiet and use it to avoid logging the
password.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirCryptoEncryptDataAESgnutls: Properly initialize data structures
Peter Krempa [Thu, 8 Dec 2022 11:37:30 +0000 (12:37 +0100)]
virCryptoEncryptDataAESgnutls: Properly initialize data structures

The initialization vector is not optional thus we also don't need to
check whether the caller passed it in. Additionally we can use c99
initializers for the gnutls_datum_t structs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirCryptoEncryptDataAESgnutls: Don't secure erase gnutls_datum_t structs
Peter Krempa [Thu, 8 Dec 2022 09:56:28 +0000 (10:56 +0100)]
virCryptoEncryptDataAESgnutls: Don't secure erase gnutls_datum_t structs

'gnutls_datum_t' simply holds pointers to the encryption key and its
length. There's absolutely no point in securely erasing that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: add tests for external swtpm
Ján Tomko [Mon, 17 Oct 2022 14:05:08 +0000 (16:05 +0200)]
qemu: add tests for external swtpm

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: add external backend for tpm
Ján Tomko [Mon, 17 Oct 2022 13:20:24 +0000 (15:20 +0200)]
qemu: add external backend for tpm

Introduce a new backend type 'external' for connecting to a swtpm daemon
not managed by libvirtd.

Mostly in one commit, thanks to -Wswitch and the way we generate
capabilities.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: qemucapabilitiesdata: Final update of qemu-7.2 capabilities on x86
Peter Krempa [Mon, 28 Nov 2022 08:18:24 +0000 (09:18 +0100)]
tests: qemucapabilitiesdata: Final update of qemu-7.2 capabilities on x86

QEMU 7.2 was released, update the capabilities data to the final state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agokbase: Reorder deployments
Andrea Bolognani [Wed, 14 Dec 2022 18:31:47 +0000 (19:31 +0100)]
kbase: Reorder deployments

List the various options so that the most likely ones come
first.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agokbase: Reorder sections
Andrea Bolognani [Wed, 14 Dec 2022 18:30:07 +0000 (19:30 +0100)]
kbase: Reorder sections

Users are likely more interested in the main deployment
scenarios than in the detailed list of every existing RPM
package. Reorder sections accordingly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agoqemu: tpm: fix spacing
Ján Tomko [Mon, 17 Oct 2022 13:02:17 +0000 (15:02 +0200)]
qemu: tpm: fix spacing

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: replace footer link to the bird site with mastodon
Daniel P. Berrangé [Mon, 12 Dec 2022 11:44:14 +0000 (11:44 +0000)]
docs: replace footer link to the bird site with mastodon

Since the takeover of the bird site, the bulk of tech people who want
a more friendly and inclusive media site have jumped over to Mastodon.
With its decentralized nature, there's no one replacement that captures
everything, but the fosstodon.org site is a topic relevant choice.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agospec: List more directories
Andrea Bolognani [Tue, 13 Dec 2022 10:09:40 +0000 (11:09 +0100)]
spec: List more directories

The storage-backend/ and storage-file/ directories are currently
considered unowned by RPM. Have the libvirt-daemon package take
ownership of them, just as it already owns the connection-driver/
and lock-driver/ directories.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agospec: Add trailing backslash
Andrea Bolognani [Tue, 13 Dec 2022 10:09:27 +0000 (11:09 +0100)]
spec: Add trailing backslash

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agovirnuma: Allow multiple nodes for preferred policy
Michal Privoznik [Fri, 9 Dec 2022 13:41:24 +0000 (14:41 +0100)]
virnuma: Allow multiple nodes for preferred policy

In the past, the preferred policy
(VIR_DOMAIN_NUMATUNE_MEM_PREFERRED) required exactly one (host)
NUMA node. This made sense because:

  1) the libnuma API - numa_set_preferred() allowed exactly one
     node, because
  2) corresponding kernel syscall (__NR_set_mempolicy) accepted
     exactly one node (for MPOL_PREFERRED mode).

But things have changed since then. Firstly, kernel introduced
new MPOL_PREFERRED_MANY mode (v5.15-rc1~107^2~21) which was then
exposed in libnuma as numa_set_preferred_many() (v2.0.15~24).

Fortunately, libnuma also exposes numa_has_preferred_many() which
returns whether the kernel has support for the new mode (1) or
not (0).

Putting this all together, we can lift our check for sufficiently
new kernel and libnuma.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151064
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_migration: Fix p2p post-copy recovery
Jiri Denemark [Fri, 9 Dec 2022 23:04:41 +0000 (00:04 +0100)]
qemu_migration: Fix p2p post-copy recovery

Although the qemuMigrationSrcPerformResume actually got called
indirectly via qemuMigrationSrcPerformNative and the recovery process
worked, wrong job phases were used for the "perform" phase, which could
cause issues when libvirt daemon crashed (or was otherwise restarted)
during post-copy recovery.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_migration: Move qemuMigrationSrcPerformResume up
Jiri Denemark [Mon, 12 Dec 2022 12:52:07 +0000 (13:52 +0100)]
qemu_migration: Move qemuMigrationSrcPerformResume up

It will need to be called from a place above its current definition.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Don't warn when releasing a released job
Jiri Denemark [Wed, 7 Dec 2022 11:33:13 +0000 (12:33 +0100)]
qemu: Don't warn when releasing a released job

When qemuDomainObjReleaseAsyncJob is called when the current async job
is already released we emit quite useless warning which was implemented
to warn about releasing a job owned by another thread.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agocpu: Improve debug message in virCPUGetVendorForModel
Jiri Denemark [Wed, 7 Dec 2022 11:31:17 +0000 (12:31 +0100)]
cpu: Improve debug message in virCPUGetVendorForModel

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Fix warning in qemuMigrationDstPostcopyFailed
Jiri Denemark [Mon, 5 Dec 2022 11:17:56 +0000 (12:17 +0100)]
qemu: Fix warning in qemuMigrationDstPostcopyFailed

The function is called even if QEMU reports migration as
postcopy-paused, i.e., it's not migrating anymore. And while changing
the warning, we can drop the part about unattended migration to make the
warning shorter and consistent with qemuMigrationSrcPostcopyFailed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_process: add tray changed event to queue in refresh disks
Kristina Hanicova [Tue, 13 Dec 2022 12:40:26 +0000 (13:40 +0100)]
qemu_process: add tray changed event to queue in refresh disks

There are some cases when the internal state of disks can change
without qemu sending events about it (e.g. a disk can close
during reset). In case this happens, we should emit an event
about the modified disk.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1824722#c20

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoTranslated using Weblate (Korean)
김인수 [Wed, 7 Dec 2022 12:17:14 +0000 (13:17 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10368 of 10368 strings)

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

Translated using Weblate (Korean)

Currently translated at 100.0% (10368 of 10368 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 agoTranslated using Weblate (Korean)
Ján Tomko [Wed, 7 Dec 2022 12:17:13 +0000 (13:17 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10368 of 10368 strings)

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

Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 98.9% (10255 of 10368 strings)

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

Translated using Weblate (Swedish)

Currently translated at 51.8% (5400 of 10423 strings)

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

Translated using Weblate (Korean)

Currently translated at 99.9% (10366 of 10368 strings)

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

Translated using Weblate (Japanese)

Currently translated at 98.8% (10247 of 10368 strings)

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

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>
2 years agorpc: securely erase the message buffers
Daniel P. Berrangé [Mon, 12 Dec 2022 10:23:46 +0000 (05:23 -0500)]
rpc: securely erase the message buffers

While only a couple of the message types include sensitive data,
the overhead of calling secure erase is not noticable enough
to worry about making the erasure selective per type. Thus it is
simplest to unconditionally securely erase the buffer.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpc: fix buffer offset updates after decoding payload
Daniel P. Berrangé [Mon, 12 Dec 2022 10:21:49 +0000 (05:21 -0500)]
rpc: fix buffer offset updates after decoding payload

The buffer length refers to the allocated buffer memory size,
while the offset refers to have much of the buffer we have
read/written. After reading the message payload we must thus
update the latter.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoutil: implement secure erase with explicit_bzero
Daniel P. Berrangé [Mon, 12 Dec 2022 10:20:36 +0000 (05:20 -0500)]
util: implement secure erase with explicit_bzero

This is available on at least FreeBSD and GLibc >= 2.25.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: Provide default values for nonexistent xenlight pkgconfig vars
Michal Privoznik [Mon, 12 Dec 2022 11:46:41 +0000 (12:46 +0100)]
meson: Provide default values for nonexistent xenlight pkgconfig vars

It may happen that xenlight pkgconfig file does not contain
'xenfirmwaredir' and/or 'libexec_bin' variables, which is okay
and we have code that deals with this situation. But that code is
executed when the queried value is an empty string. This may not
always be the case and we should specifically set 'default_value'
so that the empty string is returned if pkgconfig variable
doesn't exist.

Fixes: 968479adcfa5c49b29b7b6680dcaffde1408f044
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoformatcaps: Update capabilities example
Michal Privoznik [Mon, 12 Dec 2022 09:54:35 +0000 (10:54 +0100)]
formatcaps: Update capabilities example

In the formatcaps.rst we give an example output of capabilities.
Well, there are couple of issues with it:

1) We show <features/> nested under /capabilities/host/cpu.
   There's no such element and never was.

2) The ordering of elements is corrupted.

3) There is plenty of elements missing.

Fix these by showing an actual output of 'virsh capabilities' as
obtained on my machine.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agorpm: switch to using %mingw_find_lang
Daniel P. Berrangé [Mon, 12 Dec 2022 10:52:49 +0000 (10:52 +0000)]
rpm: switch to using %mingw_find_lang

We currently list the locale file paths via a wildcard in %files, but the
normal pattern for mingw RPMs in Fedora is to use %mingw_find_lang.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for BPF_CGROUP_DEVICE
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for BPF_CGROUP_DEVICE

The BPF_CGROUP_DEVICE constant was introduced to Linux in

  commit ebc614f687369f9df99828572b1d85a7c2de3d92
  Author: Roman Gushchin <roman.gushchin@linux.dev>
  Date:   Sun Nov 5 08:15:32 2017 -0500

    bpf, cgroup: implement eBPF-based device controller for cgroup v2

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for BPF_PROG_QUERY
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for BPF_PROG_QUERY

The BPF_PROG_QUERY constant was introduced to Linux in

  commit defd9c476fa6b01b4eb5450452bfd202138decb7
  Author: Alexei Starovoitov <ast@kernel.org>
  Date:   Mon Oct 2 22:50:26 2017 -0700

    libbpf: sync bpf.h

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for VHOST_VSOCK_SET_GUEST_CID
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for VHOST_VSOCK_SET_GUEST_CID

The VHOST_VSOCK_SET_GUEST_CID constant was introduced to Linux in

  commit 433fc58e6bf2c8bd97e57153ed28e64fd78207b8
  Author: Asias He <asias@redhat.com>
  Date:   Thu Jul 28 15:36:34 2016 +0100

    VSOCK: Introduce vhost_vsock.ko

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for linux/magic.h
Daniel P. Berrangé [Thu, 8 Dec 2022 12:37:26 +0000 (12:37 +0000)]
meson: remove obsolete check for linux/magic.h

The linux/magic.h header has existed since

  commit e18fa700c9a31360bc8f193aa543b7ef7b39a06b
  Author: Jeff Garzik <jeff@garzik.org>
  Date:   Sun Sep 24 11:13:19 2006 -0400

    Move several *_SUPER_MAGIC symbols to include/linux/magic.h.

This is old enough that all our supported platforms can be assumed
to have this header.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for DEVLINK_CMD_ESWITCH_GET
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for DEVLINK_CMD_ESWITCH_GET

The DEVLINK_CMD_ESWITCH_GET constant was introduced to Linux in

  commit adf200f31c000d707e4afe238ed1d1199e0cce7c
  Author: Jiri Pirko <jiri@mellanox.com>
  Date:   Thu Feb 9 15:54:33 2017 +0100

    devlink: fix the name of eswitch commands

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: simplify check for virnetdevbridge.c headers
Daniel P. Berrangé [Thu, 8 Dec 2022 10:07:19 +0000 (10:07 +0000)]
meson: simplify check for virnetdevbridge.c headers

The headers required by virnetdevbridge.c have all exited since
before Linux moved to git. It is sufficient to check for just
one of them in order to give an error message about needing
kernel headers installed.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for GET_VLAN_VID_CMD
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for GET_VLAN_VID_CMD

The GET_VLAN_VID_CMD constant has existed since before Linux moved
to git.

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GCOALESCE
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GCOALESCE

The ETHTOOL_GCOALESCE constant has existed since before Linux moved
to git.

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GFEATURES
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GFEATURES

The ETHTOOL_GFEATURES constant was introduced to Linux in

  commit 5455c6998d34dc983a8693500e4dffefc3682dc5
  Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
  Date:   Tue Feb 15 16:59:17 2011 +0000

    net: Introduce new feature setting ops

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETH_FLAG_RXHASH
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETH_FLAG_RXHASH

The ETH_FLAG_RXHASH constant was introduced to Linux in

  commit b00fabb4020d17bda4bea59507e09fadf573088d
  Author: stephen hemminger <shemminger@vyatta.com>
  Date:   Mon Mar 29 14:47:27 2010 +0000

    netdev: ethtool RXHASH flag

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETH_FLAG_NTUPLE
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETH_FLAG_NTUPLE

The ETH_FLAG_NTUPLE constant was introduced to Linux in

  commit 15682bc488d4af8c9bb998844a94281025e0a333
  Author: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
  Date:   Wed Feb 10 20:03:05 2010 -0800

    ethtool: Introduce n-tuple filter programming support

This is old enough that all our supported platforms can be assumed
to have this feature.

A typo in the existing condition "NTUBLE" instead of "NTUPLE" meant the
code was never enabled in the first place, which is an illustration of
why it is worth eliminating redundant conditional checks.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETH_FLAG_TXVLAN/RXVLAN
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETH_FLAG_TXVLAN/RXVLAN

The ETH_FLAG_TXVLAN/RXVLAN constants were introduced to Linux in

  commit d5dbda23804156ae6f35025ade5307a49d1db6d7
  Author: Jesse Gross <jesse@nicira.com>
  Date:   Wed Oct 20 13:56:07 2010 +0000

    ethtool: Add support for vlan accleration.

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETH_FLAG_LRO
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETH_FLAG_LRO

The ETH_FLAG_LRO constant was introduced to Linux in

  commit 3ae7c0b2e3747b50c3a6c63ebb67469e0a6b3203
  Author: Jeff Garzik <jeff@garzik.org>
  Date:   Wed Aug 15 16:00:51 2007 -0700

    [ETHTOOL]: Add ETHTOOL_[GS]FLAGS sub-ioctls

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GFLAGS
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GFLAGS

The ETHTOOL_GFLAGS constant was introduced to Linux in

  commit 3ae7c0b2e3747b50c3a6c63ebb67469e0a6b3203
  Author: Jeff Garzik <jeff@garzik.org>
  Date:   Wed Aug 15 16:00:51 2007 -0700

    [ETHTOOL]: Add ETHTOOL_[GS]FLAGS sub-ioctls

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GGRO
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GGRO

The ETHTOOL_GGRO constant was introduced to Linux in

  commit b240a0e5644eb817c4a397098a40e1ad42a615bc
  Author: Herbert Xu <herbert@gondor.apana.org.au>
  Date:   Mon Dec 15 23:44:31 2008 -0800

    ethtool: Add GGRO and SGRO ops

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GGSO
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GGSO

The ETHTOOL_GGSO constant was introduced to Linux in

  commit 37c3185a02d4b85fbe134bf5204535405dd2c957
  Author: Herbert Xu <herbert@gondor.apana.org.au>
  Date:   Thu Jun 22 03:07:29 2006 -0700

    [NET]: Added GSO toggle

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agonetdev: simplify check for ethtool functionality
Daniel P. Berrangé [Thu, 8 Dec 2022 09:42:09 +0000 (09:42 +0000)]
netdev: simplify check for ethtool functionality

ethtool is a Linux specific feature that has existed since before Linux
moved to git. Checking against SIOCETHTOOL + WITH_STRUCT_IFREQ is
overkill for our needs.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: drop check for unshare()
Daniel P. Berrangé [Thu, 8 Dec 2022 09:17:37 +0000 (09:17 +0000)]
meson: drop check for unshare()

The unshare() syscall was introduced to Linux in

  commit 2da436e00f9a5fdd0fb6b31e4b2b2ba82e8f5ab8
  Author: JANAK DESAI <janak@us.ibm.com>
  Date:   Tue Feb 7 12:59:03 2006 -0800

    [PATCH] unshare system call -v5: system call registration for i386

This is old enough that all our supported platforms can be assumed
to have this feature. Furthermore, the virprocess.c file was already
using unshare() with nothing more than a #ifdef __linux__ check.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for LO_FLAGS_AUTOCLEAR
Daniel P. Berrangé [Thu, 8 Dec 2022 09:12:25 +0000 (09:12 +0000)]
meson: remove obsolete check for LO_FLAGS_AUTOCLEAR

The LO_FLAGS_AUTOCLEAR constant was introduced to Linux in

  commit 96c5865559cee0f9cbc5173f3c949f6ce3525581
  Author: David Woodhouse <dwmw2@infradead.org>
  Date:   Wed Feb 6 01:36:27 2008 -0800

    Allow auto-destruction of loop devices

This is old enough that all our supported platforms can be assumed
to have this feature. For added fun this whole meson check was
semantically insane because EPOLL_CLOEXEC is not a valid arg
to unshare().

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for EPOLL_CLOEXEC
Daniel P. Berrangé [Thu, 8 Dec 2022 09:12:25 +0000 (09:12 +0000)]
meson: remove obsolete check for EPOLL_CLOEXEC

The EPOLL_CLOEXEC constant was introduced to Linux in

  commit a0998b50c3f0b8fdd265c63e0032f86ebe377dbf
  Author: Ulrich Drepper <drepper@redhat.com>
  Date:   Wed Jul 23 21:29:27 2008 -0700

    flag parameters: epoll_create

This is old enough that all our supported platforms can be assumed
to have this feature. For added fun this whole meson check was
semantically insane because EPOLL_CLOEXEC is not a valid arg
to unshare().

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for LOOP_CTL_GET_FREE
Daniel P. Berrangé [Thu, 8 Dec 2022 09:03:23 +0000 (09:03 +0000)]
meson: remove obsolete check for LOOP_CTL_GET_FREE

The LOOP_CTL_GET_FREE constant was introduced to Linux in

  commit 770fe30a46a12b6fb6b63fbe1737654d28e84844
  Author: Kay Sievers <kay.sievers@vrfy.org>
  Date:   Sun Jul 31 22:08:04 2011 +0200

    loop: add management interface for on-demand device allocation

This is old enough that all our supported platforms can be assumed
to have this feature. As a plus point, this meson check is going
to start failing with future GCC. It fails to set _GNU_SOURCE, thus
'unshare' is not defined by the header, and its relying on an
implicit function decl. For added fun this whole meson check was
semantically insane because LOOP_CTL_GET_FREE is not a valid arg
to unshare().

Fixes https://fedoraproject.org/wiki/Toolchain/PortingToModernC
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Add missing elements to formatcaps.rst
Nobuhiro MIKI [Fri, 9 Dec 2022 05:36:26 +0000 (14:36 +0900)]
docs: Add missing elements to formatcaps.rst

Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirnetdevtap.c: Disallow pre-existing TAP devices
Michal Privoznik [Thu, 8 Dec 2022 14:35:36 +0000 (15:35 +0100)]
virnetdevtap.c: Disallow pre-existing TAP devices

When starting a guest with <interface/> which has the target
device name set (i.e. not generated by us), it may happen that
the TAP device already exists. This then may lead to all sorts of
problems. For instance: for <interface type='network'/> the TAP
device is plugged into the network's bridge, but since the TAP
device is persistent it remains plugged there even after the
guest is shut off. We don't have a code that unplugs TAP devices
from the bridge because TAP devices we create are transient, i.e.
are removed automatically when QEMU closes their FD.

The only exception is <interface type='ethernet'/> with <target
managed='no'/> where we specifically want to let users use
pre-created TAP device and basically not touch it at all.

There's another reason for denying to use a pre-created TAP
devices: if we ever have bug in TAP name generation, we may
re-use a TAP device from another domain.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2144738
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agovirnetdev: Make virNetDevGenerateName() return 1 if no name was generated
Michal Privoznik [Thu, 8 Dec 2022 16:48:06 +0000 (17:48 +0100)]
virnetdev: Make virNetDevGenerateName() return 1 if no name was generated

A caller might be interested in the case when @ifname was already
set and it wasn't a template. In such case the
virNetDevGenerateName() does not touch the @ifname at all and
returns 0 to indicate success. Make it return 1 to distinguish
this case from the other case, in which a new name was generated.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoFix a log content
liqiang [Mon, 28 Nov 2022 01:57:27 +0000 (09:57 +0800)]
Fix a log content

Signed-off-by: liqiang <liqiang64@huawei.com>
2 years agotools: Fix style issues in virt-qemu-sev-validate
Andrea Bolognani [Thu, 8 Dec 2022 17:00:13 +0000 (18:00 +0100)]
tools: Fix style issues in virt-qemu-sev-validate

The script had an incorrect interpreter line until commit
f6a19d7264bb, so the flake8 check would not realize it needed
to pick it up and these issues, some of which were present it
the very first version that was committed, were not being
reported.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotools: Fix interpreter for virt-qemu-sev-validate
Andrea Bolognani [Thu, 8 Dec 2022 15:57:23 +0000 (16:57 +0100)]
tools: Fix interpreter for virt-qemu-sev-validate

Go through env(1) instead of hardcoding the path to the Python
interpreter, as we already do for all other Python scripts.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: Fix typo in virt-qemu-sev-validate(1)
Andrea Bolognani [Thu, 8 Dec 2022 15:55:32 +0000 (16:55 +0100)]
docs: Fix typo in virt-qemu-sev-validate(1)

Spotted by Lintian (typo-in-manual-page tag).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotools: Fix install_mode for some scripts
Michal Privoznik [Thu, 8 Dec 2022 07:39:24 +0000 (08:39 +0100)]
tools: Fix install_mode for some scripts

Scripts from the following list were installed with group write
bit set: virt-xml-validate, virt-pki-validate,
virt-sanlock-cleanup, libvirt-guests.sh. This is very unusual and
in contrast with the way other scripts/binaries are installed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151202
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 years agovirsh: Add message to terminal when running snapshot-revert
Haruka Ohata [Wed, 30 Nov 2022 08:04:07 +0000 (17:04 +0900)]
virsh: Add message to terminal when running snapshot-revert

When running virsh snapshot-* command, such as snapshot-create-as /
snapshot-delete, it prints a result message.
On the other hand virsh snapshot-revert command doesn't print a result
message.

So, This patch fixes to add message when running virsh snapshot-revert
command.

    # virsh snapshot-create-as vm1 test1
    Domain snapshot test01 created
    # virsh snapshot-revert vm1 test1

    # virsh snapshot-delete vm1 test1
    Domain snapshot test01 deleted

Signed-off-by: Haruka Ohata <ohata.haruka@fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agoNEWS: Document change of screenshot format for QEMU
Michal Privoznik [Wed, 7 Dec 2022 11:18:49 +0000 (12:18 +0100)]
NEWS: Document change of screenshot format for QEMU

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Prefer PNG for domain screenshots
Michal Privoznik [Wed, 7 Dec 2022 11:04:41 +0000 (12:04 +0100)]
qemu: Prefer PNG for domain screenshots

Historically, QEMU took screenshots in PPM. While this might use
to be popular format, as of v7.1.0-rc0~125^2~6 it is possible to
take screenshots in PNG. This is more popular and renders almost
everywhere, which is not the case for PPM (for instance, modern
browsers do not render it).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_monitor: Extend qemuMonitorScreendump() for @format
Michal Privoznik [Wed, 7 Dec 2022 09:50:04 +0000 (10:50 +0100)]
qemu_monitor: Extend qemuMonitorScreendump() for @format

The 'screendump' command has new argument 'format'. Let's expose
this on our QMP level so that callers can specify the format, if
they wish so.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_monitor: Debug print all arguments in qemuMonitorScreendump()
Michal Privoznik [Wed, 7 Dec 2022 09:47:20 +0000 (10:47 +0100)]
qemu_monitor: Debug print all arguments in qemuMonitorScreendump()

For some reason, only @file argument is printed into debug logs.
The rest of arguments was left out. Include all arguments.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_caps: Introduce QEMU_CAPS_SCREENSHOT_FORMAT_PNG
Michal Privoznik [Wed, 7 Dec 2022 09:45:42 +0000 (10:45 +0100)]
qemu_caps: Introduce QEMU_CAPS_SCREENSHOT_FORMAT_PNG

In its v7.1.0-rc0~125^2~6 commit, QEMU gained support for taking
screenshots in PNG format. Track this capability.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agospec: Remove extra blank lines
Jim Fehlig [Fri, 2 Dec 2022 22:50:05 +0000 (15:50 -0700)]
spec: Remove extra blank lines

The spec file contains inconsistent use of blank lines. While trying to
make significant changes to the file, I found it hurts both readability
and maintainability. Remove blank lines that interrupt the overall flow
and consistency.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoexamples: Install amd-sev-es-vmsa.stp
Andrea Bolognani [Mon, 5 Dec 2022 23:12:32 +0000 (00:12 +0100)]
examples: Install amd-sev-es-vmsa.stp

Fixes: d154b49a7e813245ff2ef1061c89edff9db0e119
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoexamples: Sort list
Andrea Bolognani [Mon, 5 Dec 2022 23:11:33 +0000 (00:11 +0100)]
examples: Sort list

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: refresh state after reboot initiated from the guest
Kristina Hanicova [Tue, 6 Dec 2022 13:58:19 +0000 (14:58 +0100)]
qemu: refresh state after reboot initiated from the guest

Internal domain state needs to be refreshed after reset from the guest
side because it may be inconsistent with the internal qemu state.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: refresh internal domain state after reset
Kristina Hanicova [Tue, 6 Dec 2022 13:58:18 +0000 (14:58 +0100)]
qemu: refresh internal domain state after reset

Internal domain state may change during the reset and qemu does
not always send events about it.  In case it happens, internal
state of the domain in libvirt would be inconsistent with the
internal state in qemu which could cause additional problems
(e.g. cdrom tray state can change from open to closed).  The
solution is to refresh state after a successful reset to query
qemu about the current internal domain state.

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Init ext devices paths on reconnect
Michal Privoznik [Mon, 5 Dec 2022 12:08:39 +0000 (13:08 +0100)]
qemu: Init ext devices paths on reconnect

Paths for external devices (well, so far only vTPM) are not
stored in the status XML. Therefore, we need to regenerate them
after we've been restarted and reconnecting to a running domain.
Otherwise these will remain NULL which may later lead to a NULL
dereference.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2150760
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_extdevice: Expose qemuExtDevicesInitPaths()
Michal Privoznik [Mon, 5 Dec 2022 12:08:25 +0000 (13:08 +0100)]
qemu_extdevice: Expose qemuExtDevicesInitPaths()

This function is going to be called outside of qemu_extdevice.c.
Expose it to the rest of the driver.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_extdevice: Init paths in qemuExtDevicesPrepareDomain()
Michal Privoznik [Mon, 5 Dec 2022 11:27:24 +0000 (12:27 +0100)]
qemu_extdevice: Init paths in qemuExtDevicesPrepareDomain()

The path generation phase belongs conceptually into domain
preparation phase and not host preparation. Move
qemuExtDevicesInitPaths() call from qemuExtDevicesPrepareHost()
into qemuExtDevicesPrepareDomain().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_process: Document qemuProcessPrepare{Domain,Host}() order
Michal Privoznik [Mon, 5 Dec 2022 11:18:50 +0000 (12:18 +0100)]
qemu_process: Document qemuProcessPrepare{Domain,Host}() order

The domain startup process is split into multiple phases. One of
them is preparing the domain (at that point live) XML, private
data, various paths, etc - see qemuProcessPrepareDomain(); the
other prepares the host - see qemuProcessPrepareHost(). It's
obvious that the domain XML preparation function must be called
before the host preparation function (e.g. the host preparation
might try to create a file which path is generated in the domain
preparation phase). Nevertheless, let's document this
expectation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: domain: Remove virDomainDeviceDefCopy
Peter Krempa [Tue, 22 Nov 2022 19:54:45 +0000 (20:54 +0100)]
conf: domain: Remove virDomainDeviceDefCopy

The function is now unused. Remove it to dissuade anybody from trying to
use it in the future.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agolxcDomainDetachDeviceFlags: Parse XML twice rather than use virDomainDeviceDefCopy
Peter Krempa [Tue, 22 Nov 2022 16:01:31 +0000 (17:01 +0100)]
lxcDomainDetachDeviceFlags: Parse XML twice rather than use virDomainDeviceDefCopy

'virDomainDeviceDefCopy' formats the definition and parses it back.
Since we already are parsing the XML here, we're better off parsing it
twice and save the formatting step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agolxcDomainAttachDeviceFlags: Parse XML twice rather than use virDomainDeviceDefCopy
Peter Krempa [Tue, 22 Nov 2022 16:01:31 +0000 (17:01 +0100)]
lxcDomainAttachDeviceFlags: Parse XML twice rather than use virDomainDeviceDefCopy

'virDomainDeviceDefCopy' formats the definition and parses it back.
Since we already are parsing the XML here, we're better off parsing it
twice and save the formatting step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainDetachDeviceLiveAndConfig: Refactor cleanup
Peter Krempa [Tue, 22 Nov 2022 16:07:58 +0000 (17:07 +0100)]
qemuDomainDetachDeviceLiveAndConfig: Refactor cleanup

Remove the 'cleanup' label and 'ret' variable as we can now directly
return form all cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainDetachDeviceLiveAndConfig: Parse XML twice rather than use virDomainDeviceD...
Peter Krempa [Tue, 22 Nov 2022 16:01:31 +0000 (17:01 +0100)]
qemuDomainDetachDeviceLiveAndConfig: Parse XML twice rather than use virDomainDeviceDefCopy

'virDomainDeviceDefCopy' formats the definition and parses it back.
Since we already are parsing the XML here, we're better off parsing it
twice and save the formatting step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainUpdateDeviceFlags: Parse XML twice rather than use virDomainDeviceDefCopy
Peter Krempa [Tue, 22 Nov 2022 16:01:31 +0000 (17:01 +0100)]
qemuDomainUpdateDeviceFlags: Parse XML twice rather than use virDomainDeviceDefCopy

'virDomainDeviceDefCopy' formats the definition and parses it back.
Since we already are parsing the XML here, we're better off parsing it
twice and save the formatting step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: driver: Fix formatting of function headers around qemuDomainAttachDevice
Peter Krempa [Tue, 22 Nov 2022 15:56:38 +0000 (16:56 +0100)]
qemu: driver: Fix formatting of function headers around qemuDomainAttachDevice

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: drvqemu: Remove inaccuate limitations statement
Peter Krempa [Mon, 21 Nov 2022 12:47:52 +0000 (13:47 +0100)]
docs: drvqemu: Remove inaccuate limitations statement

We don't refuse override definitions for device which doesn't exist and
the same way don't care about 'remove' being used on a property which is
not actually formatted by libvirt. Drop the paragraph claiming the
contrary.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: drvqemu: Give example how to query device properties for overriding
Peter Krempa [Mon, 21 Nov 2022 12:46:29 +0000 (13:46 +0100)]
docs: drvqemu: Give example how to query device properties for overriding

Add an example of invoking qemu with '-device TYPE,?' to query
properties of a given type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: drvqemu: Fix and improve docs about device override types
Peter Krempa [Mon, 21 Nov 2022 12:44:54 +0000 (13:44 +0100)]
docs: drvqemu: Fix and improve docs about device override types

The 'number' override type didn't exist in the final version so change
it to the corresponding 'signed' and 'unsigned'.

Additionally clarify which override type is used for a corresponding
qemu type and also that we use base 10 numbers so users will need to
convert the numbers if needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Don't report spurious errors from vCPU tid validation on hotunplug timeout
Shaleen Bathla [Fri, 11 Nov 2022 09:24:38 +0000 (14:54 +0530)]
qemu: Don't report spurious errors from vCPU tid validation on hotunplug timeout

Use of qemuDomainValidateVcpuInfo in the helpers for hotplug and unplug
of vCPUs can lead to spurious errors reported such as:

  internal error: qemu didn't report thread id for vcpu 'XX'"

The reason for this is that qemuDomainValidateVcpuInfo validates the
state of all vCPUs against the expected state of vCPUs. If an unplug
operation completed before libvirt was unable to process it yet the
expected state could not reflect the current state.

To avoid spurious errors the qemuDomainHotplugAddVcpu and
qemuDomainRemoveVcpu functions are modified to do localized validation
only for the vCPUs they actually modify.

We also now ensure that the cgroups are modified before bailing out on
error for any vCPUs which passed validation.

Additionally in order for qemuDomainRemoveVcpuAlias to be able to find
the unplugged vCPU we must ensure that qemuDomainRefreshVcpuInfo does
not clear out the alias in case when the vCPU is no longer reported by
qemu.

Co-authored-by: Partha Satapathy <partha.satapathy@oracle.com>
Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_tpm: Set log file label on migration
Michal Privoznik [Fri, 2 Dec 2022 15:09:37 +0000 (16:09 +0100)]
qemu_tpm: Set log file label on migration

Recently, the QEMU driver gained support for migration with TPM
state on a shared volume (e.g. NFS). As a part of that, the
destination side avoids setting seclabels on it to avoid cutting
off the source while it is still using it. Makes sense, except
for a wee bit: the secdriver API does a bit more - it also sets
label on the swtpm log file. And this one definitely needs to be
labeled (it lives under /var/log/swtpm/libvirt/qemu/..., i.e. not
on a shared volume).

Previously, qemuSecurityStartTPMEmulator() took care of that. But
during rework to shared volume migration, the code was changed so
now plain qemuSecurityCommandRun() would be run (i.e. no
relabelling).

But after previous commits, we can now chose whether the TPM
state should be relabelled or just the log file.

Fixes: 2e669ec789231d39e0d5f5f6a201d2a661b8070c
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2130192#c7
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_tpm: Extend start/stop APIs
Michal Privoznik [Fri, 2 Dec 2022 15:04:41 +0000 (16:04 +0100)]
qemu_tpm: Extend start/stop APIs

This is basically just a continuation of the previous commit.
Now that the security driver APIs have a boolean flag that
controls setting/restoring seclabel of either both TPM state and
log files, or just the log file, propagate this boolean into
those APIs that start/stop swtpm emulator. For now, just pass
true. The juicy bits are soon to come.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agosecurity: Extend TPM label APIs
Michal Privoznik [Fri, 2 Dec 2022 14:59:28 +0000 (15:59 +0100)]
security: Extend TPM label APIs

The virSecurityDomainSetTPMLabels() and
virSecurityDomainRestoreTPMLabels() APIs set/restore label on two
files/directories:

  1) the TPM state (tpm->data.emulator.storagepath), and
  2) the TPM log file (tpm->data.emulator.logfile).

Soon there will be a need to set the label on the log file but
not on the state. Therefore, extend these APIs for a boolean flag
that when set does both, but when unset does only 2).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
Yang Yulin [Sat, 3 Dec 2022 13:19:57 +0000 (14:19 +0100)]
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 99.2% (10294 of 10368 strings)

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

Co-authored-by: Yang Yulin <yylteam@icloud.com>
Signed-off-by: Yang Yulin <yylteam@icloud.com>
2 years agovirshFindDisk: Sanitize use of 'tmp' variable
Peter Krempa [Wed, 19 Oct 2022 11:59:17 +0000 (13:59 +0200)]
virshFindDisk: Sanitize use of 'tmp' variable

The return value of virXMLPropString was assigned into 'tmp' multiple
times and to prevent static analyzers moaning about a potential leak a
short-circuited if logic or was used.

Replace the code by having a helper variable for each possibility and
also replace the for-loop to iterate elements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: xml: Introduce virXMLNodeGetSubelement
Peter Krempa [Fri, 2 Dec 2022 09:35:13 +0000 (10:35 +0100)]
util: xml: Introduce virXMLNodeGetSubelement

Introduce a simple helper fetching a sub-element node by name. This is
meant as a simple replacement for either open-coded versions of this or
use of XPath for this trivial lookup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>