]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agoRelease of libvirt-7.5.0 v7.5.0
Jiri Denemark [Thu, 1 Jul 2021 13:40:26 +0000 (15:40 +0200)] 
Release of libvirt-7.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoAdd news item for sVirt CVE fix
Daniel P. Berrangé [Thu, 1 Jul 2021 11:38:45 +0000 (12:38 +0100)] 
Add news item for sVirt CVE fix

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agosecurity: fix SELinux label generation logic
Daniel P. Berrangé [Mon, 28 Jun 2021 12:09:04 +0000 (13:09 +0100)] 
security: fix SELinux label generation logic

A process can access a file if the set of MCS categories
for the file is equal-to *or* a subset-of, the set of
MCS categories for the process.

If there are two VMs:

  a) svirt_t:s0:c117
  b) svirt_t:s0:c117,c720

Then VM (b) is able to access files labelled for VM (a).

IOW, we must discard case where the categories are equal
because that is a subset of many other valid category pairs.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/153
CVE-2021-3631
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoNEWS: Update for 7.5.0
Peter Krempa [Mon, 28 Jun 2021 09:44:35 +0000 (11:44 +0200)] 
NEWS: Update for 7.5.0

Mention fixing of disk iothread validation and the disk serial
truncation state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoTranslated using Weblate (Ukrainian) v7.5.0-rc2
Yuri Chornoivan [Mon, 28 Jun 2021 06:04:36 +0000 (08:04 +0200)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10342 of 10342 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>
4 years agoTranslated using Weblate (Korean)
simmon [Mon, 28 Jun 2021 06:04:35 +0000 (08:04 +0200)] 
Translated using Weblate (Korean)

Currently translated at 44.9% (4644 of 10342 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
4 years agoTranslated using Weblate (Italian)
Nathan [Mon, 28 Jun 2021 06:04:34 +0000 (08:04 +0200)] 
Translated using Weblate (Italian)

Currently translated at 23.3% (2411 of 10342 strings)

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

Co-authored-by: Nathan <nathan95@live.it>
Signed-off-by: Nathan <nathan95@live.it>
4 years agoUpdate translation files
Weblate [Mon, 28 Jun 2021 06:04:32 +0000 (08:04 +0200)] 
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>
4 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Mon, 28 Jun 2021 06:04:28 +0000 (08:04 +0200)] 
Translated using Weblate (Finnish)

Currently translated at 21.8% (2255 of 10314 strings)

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

Translated using Weblate (Finnish)

Currently translated at 21.8% (2249 of 10314 strings)

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

Translated using Weblate (Finnish)

Currently translated at 21.0% (2176 of 10314 strings)

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

Translated using Weblate (Finnish)

Currently translated at 21.0% (2170 of 10314 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>
4 years agoTranslated using Weblate (Korean)
simmon [Mon, 28 Jun 2021 06:04:27 +0000 (08:04 +0200)] 
Translated using Weblate (Korean)

Currently translated at 44.8% (4624 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4618 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4614 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4613 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4613 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.7% (4611 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.5% (4593 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.5% (4590 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.4% (4582 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.3% (4577 of 10314 strings)

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

Translated using Weblate (Korean)

Currently translated at 44.3% (4570 of 10314 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
4 years agovirSetUIDGIDWithCaps: Don't drop CAP_SETPCAP right away
Michal Privoznik [Thu, 24 Jun 2021 14:58:09 +0000 (16:58 +0200)] 
virSetUIDGIDWithCaps: Don't drop CAP_SETPCAP right away

There are few cases where we execute a virCommand with all caps
cleared (virCommandClearCaps()). For instance
dnsmasqCapsRefreshInternal() does just that. This means, that
after fork() and before exec() the virSetUIDGIDWithCaps() is
called. But since the caller did not want to change anything,
just drop capabilities, these are the values of arguments:

  virSetUIDGIDWithCaps (uid=-1, gid=-1, groups=0x0, ngroups=0,
                        capBits=0, clearExistingCaps=true)

This means that indeed all capabilities will be dropped,
including CAP_SETPCAP. But this capability controls whether
capabilities can be set, IOW whether capng_apply() succeeds.

There are two calls of capng_apply() in the function. The
CAP_SETPCAP is dropped after the first call and thus the other
call (capng_apply(CAPNG_SELECT_BOUNDS);) fails.

The solution is to keep the capability for as long as needed
(just like CAP_SETGID and CAP_SETUID) and drop it only at the
very end (just like CAP_SETGID and CAP_SETUID).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1949388
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agospec: avoid rpm warning about macro in comment
Zbigniew Jędrzejewski-Szmek [Wed, 23 Jun 2021 07:37:38 +0000 (09:37 +0200)] 
spec: avoid rpm warning about macro in comment

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
4 years agospec: avoid repeated calls to systemd macros and binaries
Zbigniew Jędrzejewski-Szmek [Wed, 23 Jun 2021 07:37:19 +0000 (09:37 +0200)] 
spec: avoid repeated calls to systemd macros and binaries

The macro can take multiple arguments, and the calls are more efficient
if done in one go.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
4 years agospec: drop/update dependencies on systemd-{units,sysv}
Zbigniew Jędrzejewski-Szmek [Wed, 23 Jun 2021 07:20:03 +0000 (09:20 +0200)] 
spec: drop/update dependencies on systemd-{units,sysv}

-sysv was probably a left-over, and the -units deps was outdated and not
necessary, see
https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_dependencies_on_the_systemd_package.

Only for 'systemctl mask' which is executed in %post, we want to make
sure that /usr/bin/systemctl is installed, so keep that dependency.
(A file dep is used to avoid issues if the systemd package is further
split later on.)

Ferried over from https://src.fedoraproject.org/rpms/libvirt/pull-request/7.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
4 years agopo: Refresh potfile for v7.5.0 v7.5.0-rc1
Jiri Denemark [Fri, 25 Jun 2021 09:26:54 +0000 (11:26 +0200)] 
po: Refresh potfile for v7.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoApparmor: Allow reading /etc/ssl/openssl.cnf
Jim Fehlig [Wed, 16 Jun 2021 21:25:33 +0000 (15:25 -0600)] 
Apparmor: Allow reading /etc/ssl/openssl.cnf

I noticed the following denial when running confined VMs with the QEMU
driver

type=AVC msg=audit(1623865089.263:865): apparmor="DENIED" operation="open" \
profile="virt-aa-helper" name="/etc/ssl/openssl.cnf" pid=12503 \
comm="virt-aa-helper" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Allow reading the file by including the openssl abstraction in the
virt-aa-helper profile.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agoApparmor: Allow reading libnl's classid file
Jim Fehlig [Wed, 16 Jun 2021 21:11:14 +0000 (15:11 -0600)] 
Apparmor: Allow reading libnl's classid file

I noticed the following denial messages from apparmor in audit.log when
starting confined VMs via the QEMU driver

type=AVC msg=audit(1623864006.370:837): apparmor="DENIED" operation="open" \
profile="virt-aa-helper" name="/etc/libnl/classid" pid=11265 \
comm="virt-aa-helper" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

type=AVC msg=audit(1623864006.582:849): apparmor="DENIED" operation="open" \
profile="libvirt-0ca2720d-6cff-48bb-86c2-61ab9a79b6e9" \
name="/etc/libnl/classid" pid=11270 comm="qemu-system-x86" \
requested_mask="r" denied_mask="r" fsuid=107 ouid=0

It is possible for site admins to assign names to classids in this file,
which are then used by all libnl tools, possibly those used by libvirt.
To be on the safe side, allow read access to the file in the virt-aa-helper
profile and the libvirt-qemu abstraction.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agotests: qemucapabilities: Bump test data for qemu-6.1 on x86_64
Peter Krempa [Mon, 21 Jun 2021 08:52:32 +0000 (10:52 +0200)] 
tests: qemucapabilities: Bump test data for qemu-6.1 on x86_64

Update the caps data for the upcoming qemu version.

Notable changes are:

- 'query-sev-attestation-report' command added
- 'sample-pages' members for dirty rate calculation added
- 'qtest' device added
- 'share' member added to query-memdev and 'reserve' members added to
  query-memdev/memory-backend-[file,memfd,ram]
- 'qemu-vdagent' chardev added
- 'mptcp' toggle added to inet servers
- 'zstd' compression for qcow2
- new cpu models: - "Snowridge-v3"
                  - "Skylake-Server-v5"
                  - "Skylake-Client-v4"
                  - "Icelake-Server-v5"
                  - "Icelake-Client-v3"
                  - "Dhyana-v2"
                  - "Denverton-v3"
                  - "Cooperlake-v2"
                  - "Cascadelake-Server-v5"
- 'avx-vnni' added to some existing cpu models
- 'model-id' is now being reported as the host cpu again rather than
  QEMU TCG as I've noted in previous bump

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agospec: Drop libiscsi support in RHEL-9
Jiri Denemark [Thu, 24 Jun 2021 08:18:17 +0000 (10:18 +0200)] 
spec: Drop libiscsi support in RHEL-9

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoci: Also perform package upgrades on macOS and FreeBSD
Martin Kletzander [Tue, 15 Jun 2021 08:15:39 +0000 (10:15 +0200)] 
ci: Also perform package upgrades on macOS and FreeBSD

The base OS image might include outdated contents, and we don't
want to get spurious failures caused by bugs that have already been
fixed in the respective packages.

This is particularly important on macOS, because 'brew install foo'
will fail if 'foo' is already installed but outdated: upgrading all
packages first ensures we never run into this scenario.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agobuild: fix logic for enabling libssh/libssh2 checks
Daniel P. Berrangé [Wed, 23 Jun 2021 11:31:53 +0000 (12:31 +0100)] 
build: fix logic for enabling libssh/libssh2 checks

When 'driver_remote' is 'auto', the 'enabled()' method does not
evaluate to true, causing the libssh/libssh2 checks to be skipped.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: prefer SHA256 host key fingerprint with new libssh
Daniel P. Berrangé [Wed, 23 Jun 2021 09:46:48 +0000 (10:46 +0100)] 
rpc: prefer SHA256 host key fingerprint with new libssh

The host key fingerprint for SSH servers is used in a scenario where
cryptographic strength is important. We should thus be defaulting to
use of SHA256 where available. We only need SHA1 for Ubuntu 18.04
which does not have libssh >= 0.8.1

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirDomainFeaturesDefParse: Simplify APIC parsing
Tim Wiederhake [Tue, 22 Jun 2021 12:22:57 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Simplify APIC parsing

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesCapabilitiesDefParse: Remove ctxt
Tim Wiederhake [Tue, 22 Jun 2021 12:22:56 +0000 (14:22 +0200)] 
virDomainFeaturesCapabilitiesDefParse: Remove ctxt

Iterating over all child elements of a node does not require xpath.
By doing away with xpath for this code, the code can be simplified.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesDefParse: Factor out capabilities parsing into separate function
Tim Wiederhake [Tue, 22 Jun 2021 12:22:55 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Factor out capabilities parsing into separate function

Cleanup to follow. This removes the last re-use of `nodes` in this function,
eliminating two VIR_FREEs.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesDefParse: Inline MSRS parsing
Tim Wiederhake [Tue, 22 Jun 2021 12:22:54 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Inline MSRS parsing

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesDefParse: Inline SMM parsing
Tim Wiederhake [Tue, 22 Jun 2021 12:22:53 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Inline SMM parsing

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesXENDefParse: Remove tautological "if"
Tim Wiederhake [Tue, 22 Jun 2021 12:22:52 +0000 (14:22 +0200)] 
virDomainFeaturesXENDefParse: Remove tautological "if"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesXENDefParse: Remove ctxt
Tim Wiederhake [Tue, 22 Jun 2021 12:22:51 +0000 (14:22 +0200)] 
virDomainFeaturesXENDefParse: Remove ctxt

Iterating over all child elements of a node does not require xpath.
By doing away with xpath for this code, the code can be simplified.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesDefParse: Factor out XEN parsing into separate function
Tim Wiederhake [Tue, 22 Jun 2021 12:22:50 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Factor out XEN parsing into separate function

Only moving code, cleanup to follow.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesKVMDefParse: Remove tautological "if"
Tim Wiederhake [Tue, 22 Jun 2021 12:22:49 +0000 (14:22 +0200)] 
virDomainFeaturesKVMDefParse: Remove tautological "if"

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesKVMDefParse: Remove tautological "switch"
Tim Wiederhake [Tue, 22 Jun 2021 12:22:48 +0000 (14:22 +0200)] 
virDomainFeaturesKVMDefParse: Remove tautological "switch"

`feature` is always one of the values listed in the switch,
ensured by `virDomainKVMTypeFromString` above.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesKVMDefParse: Remove ctxt
Tim Wiederhake [Tue, 22 Jun 2021 12:22:47 +0000 (14:22 +0200)] 
virDomainFeaturesKVMDefParse: Remove ctxt

Iterating over all child elements of a node does not require xpath.
By doing away with xpath for this code, the code can be simplified.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesDefParse: Factor out KVM parsing into separate function
Tim Wiederhake [Tue, 22 Jun 2021 12:22:46 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Factor out KVM parsing into separate function

Only moving code, cleanup to follow.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesHyperVDefParse: Remove tautological "if"
Tim Wiederhake [Tue, 22 Jun 2021 12:22:45 +0000 (14:22 +0200)] 
virDomainFeaturesHyperVDefParse: Remove tautological "if"

Fix some line wrapping in the process.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesHyperVDefParse: Remove ctxt
Tim Wiederhake [Tue, 22 Jun 2021 12:22:44 +0000 (14:22 +0200)] 
virDomainFeaturesHyperVDefParse: Remove ctxt

Iterating over all child elements of a node does not require xpath.
By doing away with xpath for this code, the code can be simplified.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesHyperVDefParse: Inline hyperv/stimer parsing
Tim Wiederhake [Tue, 22 Jun 2021 12:22:43 +0000 (14:22 +0200)] 
virDomainFeaturesHyperVDefParse: Inline hyperv/stimer parsing

Iterating over all child elements of a node does not require xpath.
By doing away with xpath for this code, the code can be inlined and
simplified. This also removes the re-use of `nodes`, elimininating
two VIR_FREEs.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainFeaturesDefParse: Factor out HyperV parsing into separate function
Tim Wiederhake [Tue, 22 Jun 2021 12:22:42 +0000 (14:22 +0200)] 
virDomainFeaturesDefParse: Factor out HyperV parsing into separate function

Only moving code, cleanup to follow.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Fix some typos
Tim Wiederhake [Tue, 22 Jun 2021 13:54:01 +0000 (15:54 +0200)] 
docs: Fix some typos

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agochValidateDomainDeviceDef: Remove per-device-type error messages
Peter Krempa [Mon, 21 Jun 2021 07:38:30 +0000 (09:38 +0200)] 
chValidateDomainDeviceDef: Remove per-device-type error messages

Vast majority of device types is not supported by the Cloud-Hypervisor
driver. Simplify the error reporting by using
virDomainDeviceTypeToString.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoNews: Mention bump in minimum supported Xen version
Jim Fehlig [Thu, 17 Jun 2021 20:21:35 +0000 (14:21 -0600)] 
News: Mention bump in minimum supported Xen version

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoXen: Remove unneeded LIBXL_HAVE_* ifdefs
Jim Fehlig [Thu, 17 Jun 2021 17:27:26 +0000 (11:27 -0600)] 
Xen: Remove unneeded LIBXL_HAVE_* ifdefs

Now that the minimum supported Xen version has bumped to 4.9, all
uses of LIBXL_HAVE_* that are included in Xen 4.9 can be removed
from the libxl driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirresctrl: fix starting VMs with cputune.memorytune specified
Pavel Hrdina [Mon, 21 Jun 2021 11:03:51 +0000 (13:03 +0200)] 
virresctrl: fix starting VMs with cputune.memorytune specified

When removing check for return value of VIR_EXPAND_N this place was
incorrectly modified causing failure to start a VM with cputune
memorytune configured with useless error message:

    error: Failed to start domain 'vm1'
    error: An error occurred, but the cause is unknown

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1973094
Fixes: 7d2fd6ef0163a939adb7ce0f0fad3b7654c340de
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageBackendISCSIDirectFindPoolSources: Rework cleanup
Peter Krempa [Fri, 18 Jun 2021 12:08:24 +0000 (14:08 +0200)] 
virStorageBackendISCSIDirectFindPoolSources: Rework cleanup

virISCSIDirectScanTargets now returns a GStrv, so we can use automatic
cleanup for it and get rid of the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirISCSIDirectUpdateTargets: Rework to simplify cleanup and return GStrv
Peter Krempa [Fri, 18 Jun 2021 12:06:27 +0000 (14:06 +0200)] 
virISCSIDirectUpdateTargets: Rework to simplify cleanup and return GStrv

Count the elements in advance rather than using VIR_APPEND_ELEMENT and
ensure that there's a NULL terminator for the string list so it's GStrv
compatible.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageBackendISCSIDirectFindPoolSources: Use allocated virStoragePoolSourceList
Peter Krempa [Fri, 18 Jun 2021 12:01:17 +0000 (14:01 +0200)] 
virStorageBackendISCSIDirectFindPoolSources: Use allocated virStoragePoolSourceList

Using an allocated version together with copying the
host/initiator/device portions into it allows us to switch to automatic
clearing rather than open-coding it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: storage: Introduce virStoragePoolSourceListFree
Peter Krempa [Wed, 16 Jun 2021 08:04:30 +0000 (10:04 +0200)] 
conf: storage: Introduce virStoragePoolSourceListFree

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoch_domain: Add handler for virDomainDeviceDefValidateCallback
William Douglas [Fri, 18 Jun 2021 21:25:59 +0000 (14:25 -0700)] 
ch_domain: Add handler for virDomainDeviceDefValidateCallback

Instead of trying to match devices passed in based on the monitor
detecting the number of devices that were used in the domain
definition, use the deviceValidateCallback to evaluate if
unsupported devices are used.

This allows the compiler to detect when new device types are added
that need to be checked.

Signed-off-by: William Douglas <william.douglas@intel.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu_hotplug: don't forget to add hostdev interfaces to the interface list
Laine Stump [Thu, 17 Jun 2021 05:14:27 +0000 (01:14 -0400)] 
qemu_hotplug: don't forget to add hostdev interfaces to the interface list

Originally qemuDomainAttachNetDevice() would wait until the cleanup at
the very end of the function to add newly hotplugged interfaces to the
domain's nets list. commit 7b8bec4560 modified it to add the new
interface to the nets list earlier (but not all the way at the
beginning of the function either, because there are some operations
(PCI address assignment in particular) that need the new device to not
yet be visible in the domaindef).

But hostdev interfaces short-circuit past most of the body of
qemuDomainAttachNetDevice() (since none of it applies to hostdev
interfaces). In the past that was okay, but since the line that adds
the new interface to the domaindef's nets list is in that "most of the
body", after that commit hotplugged hostdev interfaces are no longer
being properly added to the domaindef nets list, so they don't show up
in the status XML or the virsh domiflist output.

It really *is* important to add interfaces to the nets list earlier,
so we can't revert commit 7b8bec4560, and we also can't move the
insert to common code *earlier* in the function, so instead this patch
duplicates the VIR_APPEND_ELEMENT_COPY() just before the code path for
hostdev interfaces jumps to cleanup.

Resolves: https://bugzilla.redhat.com/1972468
Fixes: 7b8bec45601b6570f6a7413e94d291986d2663f1
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoremote: switch to auto-spawn modular daemons by default
Daniel P. Berrangé [Mon, 24 May 2021 10:36:28 +0000 (11:36 +0100)] 
remote: switch to auto-spawn modular daemons by default

When determining what socket path to connect to for a given URI we will

 - Connect to the driver specific daemon if its UNIX socket exists
 - Connect to libvirtd if its UNIX socket exists
 - If non-root, auto-spawn a daemon based on the default mode

Historically the last point would result in spawning libvirtd, but with
this change we now spawn a modular daemon. Remote client probing logic
will pick a specific hypervisor daemon to connect to when the URI is
NULL.

Tested-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: remove probing logic from virtproxyd dispatcher
Daniel P. Berrangé [Mon, 24 May 2021 16:35:21 +0000 (17:35 +0100)] 
remote: remove probing logic from virtproxyd dispatcher

Now that the remote driver itself can probe for listening sockets /
running daemons, virtproxyd doesn't need to probe URIs itself. Instead
it can just delegate to the remote driver.

Tested-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: add support for probing drivers with modular daemons
Daniel P. Berrangé [Tue, 25 May 2021 09:45:06 +0000 (10:45 +0100)] 
remote: add support for probing drivers with modular daemons

With the traditional libvirtd, the virConnectOpen call will probe active
drivers server side to find which one to use when the URI is NULL/empty.

With the modular daemons though, the remote client does not know which
daemon to connect in the first place, so we can't rely on virConnectOpen
probing. Currently the virtproxyd daemon has code to probe for a
possible driver by looking at which sockets are listening or which
binaries are installed. The remote client can thus connect to virtproxyd
which in turn can connect to a real hypervisor driver.

The virtproxyd probing code though isn't something that needs to live in
virtproxyd. By moving it into the remote client we can get probing
client side in all scenarios and avoid the extra trip via virtproxyd in
the common case.

Tested-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: extract logic for probing for modular daemons
Daniel P. Berrangé [Mon, 24 May 2021 16:10:05 +0000 (17:10 +0100)] 
remote: extract logic for probing for modular daemons

When virtproxyd gets a NULL URI, it needs to implement probing logic
similar to that found in virConnectOpen. The latter can't be used
directly since it relied on directly calling into the internal drivers
in libvirtd. virtproxyd approximates this behaviour by looking to see
what modular daemon sockets exist, or what daemon binaries are installed.

This same logic is also going to be needed when the regular libvirt
remote client switches to prefer modular daemons by default, as we
don't want to continue spawning libvirtd going forward.

Tested-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: fix prefix for libxl Xen driver
Daniel P. Berrangé [Fri, 18 Jun 2021 14:08:07 +0000 (15:08 +0100)] 
remote: fix prefix for libxl Xen driver

The libxl driver supports xen:///system URLs and the daemon socket
uses 'virtxend' as the socket prefix.

Reported-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemuSnapshotCreateActiveExternal: Don't unlink memory snapshot image if it was existi...
Peter Krempa [Wed, 16 Jun 2021 14:56:56 +0000 (16:56 +0200)] 
qemuSnapshotCreateActiveExternal: Don't unlink memory snapshot image if it was existing before

When writing the memory snapshot into an existing file don't remove it
if the snapshot fails later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: snapshot: rename variable holding memory snapshot file location
Peter Krempa [Wed, 16 Jun 2021 14:54:18 +0000 (16:54 +0200)] 
conf: snapshot: rename variable holding memory snapshot file location

'file' is too generic to know what's going on. Rename it to
'memorysnapshotfile'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotPrepareDiskExternal: Refactor existing file check
Peter Krempa [Wed, 16 Jun 2021 13:43:03 +0000 (15:43 +0200)] 
qemuSnapshotPrepareDiskExternal: Refactor existing file check

Use the snapshot disk type from the definition now that we validate that
it matches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotPrepareDiskExternal: Enforce match between snapshot type and existing...
Peter Krempa [Wed, 16 Jun 2021 13:42:53 +0000 (15:42 +0200)] 
qemuSnapshotPrepareDiskExternal: Enforce match between snapshot type and existing file type

The code executed later when creating a snapshot makes all decisions
based on the configured type rather than the actual type of the existing
file, while the check whether the file exists is based solely on the
on-disk type.

Since a block device is allowed to exist even when not reusing existing
files in contrast to regular files this creates a potential for a block
device to squeak past the check but then be influenced by other code
executed later. Specifically this is a problem when creating a snapshot
with the following XML:

  <domainsnapshot>
    <disks>
      <disk name='vdb' type='file'>
        <source file='/dev/sdb'/>
      </disk>
    </disks>
  </domainsnapshot>

If the snapshot creation fails, '/dev/sdb' will be removed because it's
considered to be a regular file by the cleanup code.

Add a check that will force that the configured type matches the on-disk
state.

Additional supporting reason is that qemu stopped to accept block
devices with the 'file' backend, thus the above configuration will not
work any more. This allows us to fail sooner.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1972145
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotPrepareDiskExternal: Reject creation of block devices sooner
Peter Krempa [Wed, 16 Jun 2021 12:57:06 +0000 (14:57 +0200)] 
qemuSnapshotPrepareDiskExternal: Reject creation of block devices sooner

In case when the snapshot target is of VIR_STORAGE_TYPE_BLOCK type and
doesn't exist libvirt won't be able to create it. Reject such a config
sooner.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotPrepareDiskExternal: Avoid condition squashing
Peter Krempa [Wed, 16 Jun 2021 12:57:44 +0000 (14:57 +0200)] 
qemuSnapshotPrepareDiskExternal: Avoid condition squashing

Separate the 'else if' branches into nested conditions so that it's more
obvious when we'll be adding additional checks later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotPrepareDiskExternal: Move temp variables into the block using them
Peter Krempa [Wed, 16 Jun 2021 12:49:26 +0000 (14:49 +0200)] 
qemuSnapshotPrepareDiskExternal: Move temp variables into the block using them

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: capabilities: Fill egl-headless graphics support only when it's really supported
Peter Krempa [Tue, 15 Jun 2021 09:47:01 +0000 (11:47 +0200)] 
qemu: capabilities: Fill egl-headless graphics support only when it's really supported

virQEMUCapsFillDomainDeviceGraphicsCaps fills data needed both for
validation of the graphics type and also for correct display in the
(dom)capablities XML.

Signal the support for egl-headless only when qemu has the capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
4 years agotests: qemuxml2*: Add QEMU_CAPS_EGL_HEADLESS to fake-caps tests using egl-headless...
Peter Krempa [Tue, 15 Jun 2021 09:46:54 +0000 (11:46 +0200)] 
tests: qemuxml2*: Add QEMU_CAPS_EGL_HEADLESS to fake-caps tests using egl-headless graphics

Next commit will modify the code so that it validates whether
egl-headless is present. Certain tests need to get the egl-headless
capability to keep working properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
4 years agoqemu: capabilities: Un-retire QEMU_CAPS_EGL_HEADLESS
Peter Krempa [Tue, 15 Jun 2021 09:38:26 +0000 (11:38 +0200)] 
qemu: capabilities: Un-retire QEMU_CAPS_EGL_HEADLESS

egl-headless graphics can be compiled out in qemu so we need to be able
to know whether the given qemu version support it.

Base the capability on the presence of the 'egl-headless' member in
'query-display-options' or imply it if 'query-display-options' is not
supported as we implied it before for all versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
4 years agoXen: Bump minimum supported Xen version to 4.9
Jim Fehlig [Mon, 14 Jun 2021 17:17:54 +0000 (11:17 -0600)] 
Xen: Bump minimum supported Xen version to 4.9

Platforms supported by libvirt have the following Xen versions

openSUSE Leap 15.2: 4.13
openSUSE Leap 15.3: 4.14
         Fedora 33: 4.14
      Ubuntu 18.04: 4.9
      Ubuntu 20.04: 4.11
     Debian Stable: 4.11

Bumping the minimum version doesn't allow us to drop much code, but it
does provide better alignment with libvirt's platform support statement.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: Deduplicate code in qemuSecurityChownCallback()
Michal Privoznik [Thu, 3 Jun 2021 09:54:11 +0000 (11:54 +0200)] 
qemu: Deduplicate code in qemuSecurityChownCallback()

The DAC security driver has an option to register a callback that
is called instead of chown(). So far QEMU is the only user of
this feature and it's used to set labels on non-local disks (like
gluster), where exists notion of owners but regular chown() can't
be used.

However, this callback (if set) is called always, even for local
disks. And thus the QEMU's implementation duplicated parts of the
DAC driver to deal with chown().

If the DAC driver would call the callback only for non-local
disks then the QEMU's callback can be shorter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirSecurityDACSetOwnershipInternal: Fix WIN32 code
Michal Privoznik [Fri, 4 Jun 2021 08:24:46 +0000 (10:24 +0200)] 
virSecurityDACSetOwnershipInternal: Fix WIN32 code

I must admit, I have no idea why we build such POSIX dependent
code as DAC driver for something such not POSIX as WIN32. Anyway,
the code which is supposed to set error is not doing that. The
proper way is to mimic what chown() does:

  On error, -1 is returned, and errno is set to indicate the error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirSecurityDACSetOwnershipInternal: Don't overwrite @path argument
Michal Privoznik [Fri, 4 Jun 2021 08:03:47 +0000 (10:03 +0200)] 
virSecurityDACSetOwnershipInternal: Don't overwrite @path argument

As shown in the previous commit, @path can be NULL. However, in
that case @src->path is also NULL. Therefore, trying to "fix"
@path to be not NULL is not going to succeed. The real value of
NULLSTR() is in providing a non-NULL string for error reporting.
Well, that can be done in the error reporting without overwriting
argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirSecurityDACSetOwnershipInternal: Drop dead code
Michal Privoznik [Thu, 3 Jun 2021 12:33:00 +0000 (14:33 +0200)] 
virSecurityDACSetOwnershipInternal: Drop dead code

The virSecurityDACSetOwnershipInternal() function accepts two
arguments (among others): @path and @src. The idea being that in
some cases @path is NULL and @src is not and then @path is filled
from @src->path. However, this is done in both callers already
(because of seclabel remembering/recall). Therefore, this code in
virSecurityDACSetOwnershipInternal() is dead, effectively.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agosecurity_dac: Don't check for !priv in virSecurityDACSetOwnershipInternal()
Michal Privoznik [Thu, 3 Jun 2021 12:19:22 +0000 (14:19 +0200)] 
security_dac: Don't check for !priv in virSecurityDACSetOwnershipInternal()

The virSecurityDACSetOwnershipInternal() has two callers and in
both the private data (@priv) is obtained via
virSecurityManagerGetPrivateData(). But in case of DAC driver the
private data can never be NULL. This is because the private data
is allocated in virSecurityManagerNewDriver() according to
.privateDataLen attribute of secdriver. In case of DAC driver the
attribute is set to sizeof(virSecurityDACData).

NB, no other function within DAC driver checks for !priv.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agosecurity_dac: Introduce g_autoptr for virSecurityDACChownList
Michal Privoznik [Wed, 16 Jun 2021 07:39:56 +0000 (09:39 +0200)] 
security_dac: Introduce g_autoptr for virSecurityDACChownList

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agosecurity_dac: Introduce virSecurityDACChownItemFree()
Michal Privoznik [Thu, 17 Jun 2021 09:36:47 +0000 (11:36 +0200)] 
security_dac: Introduce virSecurityDACChownItemFree()

Introduce a function that frees individual items on the chown
list and declare and use g_autoptr() for it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agosecurity_dac: Use g_autofree
Michal Privoznik [Thu, 17 Jun 2021 09:38:07 +0000 (11:38 +0200)] 
security_dac: Use g_autofree

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: require target for external virtiofsd
Ján Tomko [Wed, 16 Jun 2021 13:35:16 +0000 (15:35 +0200)] 
conf: require target for external virtiofsd

When adding support for externally launched virtiofsd,
I was too liberal and did not require a target.

But the target is required, because it's passed to the
QEMU device, not to virtiofsd.

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

Fixes: 12967c3e1333a6e106110f449ccb1e96279b9527
Fixes: 56dcdec1ac8104f94371c210585bab91eb36395d
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoconf: move filesystem target validation
Ján Tomko [Wed, 16 Jun 2021 14:59:42 +0000 (16:59 +0200)] 
conf: move filesystem target validation

Check the presence of the target in the validation phase.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: Don't set NVRAM label when creating it
Michal Privoznik [Wed, 9 Jun 2021 13:44:11 +0000 (15:44 +0200)] 
qemu: Don't set NVRAM label when creating it

The NVRAM label is set in qemuSecuritySetAllLabel(). There's no
need to set its label upfront. In fact, setting it twice creates
an imbalance because it's unset only once which mangles seclabel
remembering. However, plain removal of the
qemuSecurityDomainSetPathLabel() undoes the fix for the original
bug (when dynamic ownership is off then the NVRAM is not created
with cfg->user and cfg->group but as root:root). Therefore, we
have to switch to virFileOpenAs() and pass cfg->user and
cfg->group and VIR_FILE_OPEN_FORCE_OWNER flag. There's no need to
pass VIR_FILE_OPEN_FORCE_MODE because the file will be created
with the proper mode.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1969347
Fixes: bcdaa91a27b5b2d103535270a6a287efe6cd8bfb
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf: reject duplicate virtiofs tags
Ján Tomko [Wed, 16 Jun 2021 13:56:21 +0000 (15:56 +0200)] 
conf: reject duplicate virtiofs tags

https://gitlab.com/libvirt/libvirt/-/issues/178

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agodocs: fix filesystem schema indentation
Ján Tomko [Wed, 16 Jun 2021 13:40:38 +0000 (15:40 +0200)] 
docs: fix filesystem schema indentation

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agogitlab-ci: Don't build docs in 'sanitizer' jobs
Peter Krempa [Tue, 15 Jun 2021 15:27:18 +0000 (17:27 +0200)] 
gitlab-ci: Don't build docs in 'sanitizer' jobs

Docs are not sanitized, thus there's no point in building them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
4 years agoqemu_hotplug: Report VIR_ERR_DEVICE_MISSING when device is not found
Lee Yarwood [Mon, 14 Jun 2021 10:18:37 +0000 (11:18 +0100)] 
qemu_hotplug: Report VIR_ERR_DEVICE_MISSING when device is not found

126db34a81bc9f9f9710408f88cceaa1e34bbbd7 had previously switched various
flows over to this from VIR_ERR_OPERATION_FAILED.

This change simply does the same for qemuDomainDetachPrepDisk,
qemuDomainDetachPrepInput and qemuDomainDetachPrepVsock to allow
management apps to centralise their error handling on just
VIR_ERR_DEVICE_MISSING for missing devices during a detach.

Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirsh-volume: Apply virshStorageVolNameCompleter to vol-{key,path} commands
Lin Ma [Wed, 16 Jun 2021 08:02:54 +0000 (16:02 +0800)] 
virsh-volume: Apply virshStorageVolNameCompleter to vol-{key,path} commands

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh-volume: Apply virshStorageVolKeyCompleter to vol-{name,pool} commands
Lin Ma [Wed, 16 Jun 2021 08:02:53 +0000 (16:02 +0800)] 
virsh-volume: Apply virshStorageVolKeyCompleter to vol-{name,pool} commands

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh-volume: Add macros VIRSH_COMMON_OPT_VOL_*
Lin Ma [Wed, 16 Jun 2021 08:02:52 +0000 (16:02 +0800)] 
virsh-volume: Add macros VIRSH_COMMON_OPT_VOL_*

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh-volume: Introduce virshStorageVolKeyCompleter
Lin Ma [Wed, 16 Jun 2021 08:02:51 +0000 (16:02 +0800)] 
virsh-volume: Introduce virshStorageVolKeyCompleter

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh-pool: Remove static from virshStoragePoolList{Free,Collect}
Lin Ma [Wed, 16 Jun 2021 08:02:50 +0000 (16:02 +0800)] 
virsh-pool: Remove static from virshStoragePoolList{Free,Collect}

The functions will be used by next patch.

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirFindFileInPath: Don't pass NULL to g_canonicalize_filename()
Michal Privoznik [Tue, 15 Jun 2021 16:01:37 +0000 (18:01 +0200)] 
virFindFileInPath: Don't pass NULL to g_canonicalize_filename()

If given file is not found in $PATH then g_find_program_in_path()
returns NULL. However, g_canonicalize_filename() does not accept
NULL as input.

Fixes: 65c2901906b5e2d707f9184ff3719a5375bab427
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirStorageBackendRBDGetVolNames: Refactor cleanup in 'rbd_list' version
Peter Krempa [Mon, 14 Jun 2021 14:44:19 +0000 (16:44 +0200)] 
virStorageBackendRBDGetVolNames: Refactor cleanup in 'rbd_list' version

Use automatic memory freeing for the string list so that we can remove
the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageBackendRBDGetVolNames: Fix memory leak in 'rbd_list2' version
Peter Krempa [Mon, 14 Jun 2021 15:14:13 +0000 (17:14 +0200)] 
virStorageBackendRBDGetVolNames: Fix memory leak in 'rbd_list2' version

The 'rbd_image_spec_t' struct has two string members 'id' and
'name'. We only stole the 'name' members thus the 'id's as well as the
whole list would be leaked on success.

Restructure the code so that we copy out the image names and call
rbd_image_spec_list_cleanup on success rather than on error.

The error path is then handled by using g_autofree for 'images'.

Since we no longer have a error path after allocating the returned
string list we can completely remove its cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMonitorJSONGetStringListProperty: Don't return element count
Peter Krempa [Mon, 14 Jun 2021 14:22:30 +0000 (16:22 +0200)] 
qemuMonitorJSONGetStringListProperty: Don't return element count

The only caller doesn't care about the number of elements in the string
list so we don't have to calculate it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMonitorJSONGetStringArray: Don't return element count
Peter Krempa [Mon, 14 Jun 2021 14:41:09 +0000 (16:41 +0200)] 
qemuMonitorJSONGetStringArray: Don't return element count

There's just one caller who cares (testQemuMonitorJSONGetTPMModels). Fix
it and remove the counting of elements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirQEMUCapsProbeQMPTPM: Refactor handling of string lists
Peter Krempa [Mon, 14 Jun 2021 14:34:28 +0000 (16:34 +0200)] 
virQEMUCapsProbeQMPTPM: Refactor handling of string lists

This refactors multiple aspects of the function:

1) Use automatic memory freeing
2) Remove need to check element count in the returned arrays
3) Fixes questionable code linebreaks
4) Removes reuse of variables

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirQEMUCapsProcessStringFlags: Don't require 'nvalues'
Peter Krempa [Mon, 14 Jun 2021 13:37:46 +0000 (15:37 +0200)] 
virQEMUCapsProcessStringFlags: Don't require 'nvalues'

All callers pass in NULL-terminated string lists. Remove the 'nvalues'
argument and fix all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: capabilities: Use g_auto(GStrv) instead of virStringListFreeCount
Peter Krempa [Mon, 14 Jun 2021 08:30:55 +0000 (10:30 +0200)] 
qemu: capabilities: Use g_auto(GStrv) instead of virStringListFreeCount

All the capability getters which return a string list do in fact return
a NULL-terminated list so we can use g_auto(GStrv) to free it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotestQemuMonitorJSONGetTPMModels: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 14:38:26 +0000 (16:38 +0200)] 
testQemuMonitorJSONGetTPMModels: Refactor cleanup

Use automatic memory freeing and remove the cleanup section.t

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotestQemuMonitorJSONGetCommands: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 13:56:16 +0000 (15:56 +0200)] 
testQemuMonitorJSONGetCommands: Refactor cleanup

Use g_auto(GStrv) for clearing the string list and thus remove the
'cleanup' section and 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMonitorJSONGetObjectTypes: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 14:20:50 +0000 (16:20 +0200)] 
qemuMonitorJSONGetObjectTypes: Refactor cleanup

Use automatic memory clearing to simplify the control flow.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMonitorJSONGetStringArray: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 14:20:50 +0000 (16:20 +0200)] 
qemuMonitorJSONGetStringArray: Refactor cleanup

Use automatic memory clearing to simplify the control flow.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMonitorJSONGetCommands: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 14:19:11 +0000 (16:19 +0200)] 
qemuMonitorJSONGetCommands: Refactor cleanup

Use automatic memory freeing to simplify the control flow.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMonitorJSONGetMigrationCapabilities: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 08:29:36 +0000 (10:29 +0200)] 
qemuMonitorJSONGetMigrationCapabilities: Refactor cleanup

Use automatic memory clearing and remove the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMonitorJSONGetObjectProps: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 08:25:53 +0000 (10:25 +0200)] 
qemuMonitorJSONGetObjectProps: Refactor cleanup

Use 'g_autoptr' for the two temporary JSON objects and remove the
cleanup section.

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