]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
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>
4 years agoqemuMonitorJSONParsePropsList: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 08:24:25 +0000 (10:24 +0200)] 
qemuMonitorJSONParsePropsList: Refactor cleanup

Use 'g_auto' for @proplist and remove @ret.

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

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

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

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

SDL 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 'sdl' 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: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
4 years agoqemu: capabilities: Introduce QEMU_CAPS_QUERY_DISPLAY_OPTIONS
Peter Krempa [Tue, 15 Jun 2021 09:31:35 +0000 (11:31 +0200)] 
qemu: capabilities: Introduce QEMU_CAPS_QUERY_DISPLAY_OPTIONS

The command allows to query various display-related options. The absence
of the command will be used to imply certain video-related capabilities
before we would be able to detect them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
4 years agoqemu: validate: Don't check bus type in qemuValidateDomainDeviceDefDiskIOThreads
Peter Krempa [Thu, 10 Jun 2021 14:43:36 +0000 (16:43 +0200)] 
qemu: validate: Don't check bus type in qemuValidateDomainDeviceDefDiskIOThreads

IOThreads are supported with all 3 currently supported buses which can
have virtio devices (PCI, CCW, MMIO) , so there's no need for this check.

Additionally this check was buggy in the current location as on e.g.
hotplug cases the address may not yet be assigned for the disk and thus
a bogus error would be printed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1970277
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomainCheckCCWS390AddressSupport: Remove duplicated checker
Peter Krempa [Fri, 11 Jun 2021 14:25:48 +0000 (16:25 +0200)] 
qemuDomainCheckCCWS390AddressSupport: Remove duplicated checker

For validation of explicitly configured addresses we already ported the
same style of checks to qemuValidateDomainDeviceDefAddress and implicit
address assignment should do the right thing in the first place, thus
the function is redundant and can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuValidateDomainDeviceDefAddress: Add validation of CCW address
Peter Krempa [Fri, 11 Jun 2021 13:43:35 +0000 (15:43 +0200)] 
qemuValidateDomainDeviceDefAddress: Add validation of CCW address

Base the check on the logic from qemuDomainCheckCCWS390AddressSupport,
which will be removed later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Drop handling of devices with VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390
Peter Krempa [Fri, 11 Jun 2021 13:13:31 +0000 (15:13 +0200)] 
qemu: Drop handling of devices with VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390

We don't support any qemu which would support the 'virtio-s390'
addressing, thus we can drop all code related to it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: capabilities: Retire QEMU_CAPS_VIRTIO_S390
Peter Krempa [Fri, 11 Jun 2021 13:08:49 +0000 (15:08 +0200)] 
qemu: capabilities: Retire QEMU_CAPS_VIRTIO_S390

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuxml2*test: Remove QEMU_CAPS_VIRTIO_S390 flag
Peter Krempa [Fri, 11 Jun 2021 13:08:07 +0000 (15:08 +0200)] 
qemuxml2*test: Remove QEMU_CAPS_VIRTIO_S390 flag

The flag isn't used by the code in any way so it can be dropped from the
legacy test cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Remove last uses of QEMU_CAPS_VIRTIO_S390
Peter Krempa [Fri, 11 Jun 2021 12:59:05 +0000 (14:59 +0200)] 
qemu: Remove last uses of QEMU_CAPS_VIRTIO_S390

Modify the code in the last two instances in the code to behave as if
the flag is not asserted.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Always reject 'virtio-s390' addresses
Peter Krempa [Fri, 11 Jun 2021 12:51:21 +0000 (14:51 +0200)] 
qemu: Always reject 'virtio-s390' addresses

QEMU_CAPS_VIRTIO_S390 can never be asserted any more, add an explicit
check that will reject the 'virtio-s390' address type and remove the
code which would auto-fill them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuxml2argvtest: Use other bus capability for 'non-x86_64-timer-error' case
Peter Krempa [Fri, 11 Jun 2021 12:50:01 +0000 (14:50 +0200)] 
qemuxml2argvtest: Use other bus capability for 'non-x86_64-timer-error' case

Give the test QEMU_CAPS_CCW instead of QEMU_CAPS_VIRTIO_S390 since the
latter can never be asserted any more. This preserves what the tests
wants to check so that QEMU_CAPS_VIRTIO_S390 can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: capabilities: Don't probe device properties for 'virtio-*-s390' devices
Peter Krempa [Fri, 11 Jun 2021 09:16:28 +0000 (11:16 +0200)] 
qemu: capabilities: Don't probe device properties for 'virtio-*-s390' devices

The devices no longer exist in qemu since the 2.6 release. Drop the
probing of the device properties and fix the data for
qemucapabilitiestest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: capabilities: Remove probing of 'virtio-*-s390' devices
Peter Krempa [Fri, 11 Jun 2021 09:02:10 +0000 (11:02 +0200)] 
qemu: capabilities: Remove probing of 'virtio-*-s390' devices

QEMU commit 7b3fdbd9a826791bd98e649cf44c0a6129a44179 released in 2.6
dropped the legacy s390 virtio machine and it's devices. Remove our
probing based on the devices.

The probing of properties of the appropriate devices will be removed
subsequently.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: Remove 's390-virtio' machine caps faking
Peter Krempa [Fri, 11 Jun 2021 08:30:31 +0000 (10:30 +0200)] 
tests: Remove 's390-virtio' machine caps faking

The machine type was removed in qemu 2.6 and no tests now depend on it.
Remove the faking of the machine type support and the capabilities test
for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: domain: Remove hack for 's390-virtio' machine
Peter Krempa [Fri, 11 Jun 2021 08:27:20 +0000 (10:27 +0200)] 
qemu: domain: Remove hack for 's390-virtio' machine

qemuDomainDefAddDefaultDevices skipped adding the memballoon for the
's390-virtio' machine type, but since it was removed in qemu 2.6 we can
remove the hack now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemuxml2argv: Modernize 's390-allow-bogus-usb-controller' test
Peter Krempa [Fri, 11 Jun 2021 08:16:01 +0000 (10:16 +0200)] 
tests: qemuxml2argv: Modernize 's390-allow-bogus-usb-controller' test

The 's390-virtio' machine was removed from qemu in the 2.6 release.
Use the more modern s390-ccw-virtio machine type and use
VIR_TEST_CAPS_ARCH_LATEST to invoke it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemuxml2xml: Modernize 's390-defaultconsole' case
Peter Krempa [Fri, 11 Jun 2021 08:21:57 +0000 (10:21 +0200)] 
tests: qemuxml2xml: Modernize 's390-defaultconsole' case

Don't use the 's390-virtio' machine which was removed in qemu 2.6 and
use real capabilities for the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemuxml2argv: Modernize 's390-allow-bogus-usb-none' test
Peter Krempa [Fri, 11 Jun 2021 08:16:01 +0000 (10:16 +0200)] 
tests: qemuxml2argv: Modernize 's390-allow-bogus-usb-none' test

The 's390-virtio' machine was removed from qemu in the 2.6 release.
Use the more modern s390-ccw-virtio machine type and use
VIR_TEST_CAPS_ARCH_LATEST to invoke it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemuxml2argv: Remove redundant tests for the obsolete 'virtio-390' machine
Peter Krempa [Thu, 10 Jun 2021 15:11:39 +0000 (17:11 +0200)] 
tests: qemuxml2argv: Remove redundant tests for the obsolete 'virtio-390' machine

Remove the console, disk, and network test for the legacy s390 machine
which was removed in qemu 2.6. All of these have 'ccw' equivalents.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemuxml2argv: Modernize 'console-sclp' test
Peter Krempa [Thu, 10 Jun 2021 15:08:05 +0000 (17:08 +0200)] 
tests: qemuxml2argv: Modernize 'console-sclp' test

The 's390-virtio' machine was removed from qemu in the 2.6 release.
Modernize the test for sclp console since there isn't any other test for
it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemuxml2argv: Modernize 'watchdog-diag288' test
Peter Krempa [Thu, 10 Jun 2021 15:01:37 +0000 (17:01 +0200)] 
tests: qemuxml2argv: Modernize 'watchdog-diag288' test

The 's390-virtio' machine was removed from qemu in the 2.6 release.
Modernize the test for diag288 since there isn't any other test for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agobhyveConnectDomainXMLToNative: Fix memory leak in incorrect virCommandToString usage
Peter Krempa [Fri, 11 Jun 2021 08:08:37 +0000 (10:08 +0200)] 
bhyveConnectDomainXMLToNative: Fix memory leak in incorrect virCommandToString usage

virCommandToString returns an allocated buffer, so using it directly as
argument of virBufferAdd which doesn't consume the string causes it to
be leaked. Switch to virBufferToStringBuf since we are already using a
buffer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuxml2arvtest: Ensure newline at the end of generated .args files
Peter Krempa [Fri, 11 Jun 2021 07:45:12 +0000 (09:45 +0200)] 
qemuxml2arvtest: Ensure newline at the end of generated .args files

The switch to internal linebreaking of arguments caused a problem when
generating .args files with VIR_TEST_REGENERATE_OUTPUT as the last
argument isn't terminated with a newline.

Switch to using virCommandToStringBuf and append a newline.

Fixes: 0046e0b1c26c8e0167de4a35be2902b9327b0c51
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: command: Introduce virCommandToStringBuf
Peter Krempa [Thu, 10 Jun 2021 15:43:59 +0000 (17:43 +0200)] 
util: command: Introduce virCommandToStringBuf

The new version allows passing a virBuffer to format the string into.
This will be helpful in solving a memory lean in wrong usage of
virCommandToString and also in tests where we need to add a newline
after the command in certain cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agosyntax-check: Only prohibit empty first lines in non-empty files
Martin Kletzander [Mon, 14 Jun 2021 16:57:58 +0000 (18:57 +0200)] 
syntax-check: Only prohibit empty first lines in non-empty files

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
4 years agotest_driver: Implement virDomainGetSecurityLabel
Luke Yue [Mon, 7 Jun 2021 07:38:19 +0000 (15:38 +0800)] 
test_driver: Implement virDomainGetSecurityLabel

Signed-off-by: Luke Yue <lukedyue@gmail.com>
4 years agotest_driver: Implement virNodeGetSecurityModel
Luke Yue [Mon, 7 Jun 2021 07:38:18 +0000 (15:38 +0800)] 
test_driver: Implement virNodeGetSecurityModel

Signed-off-by: Luke Yue <lukedyue@gmail.com>
4 years agovirfile: Simplify virFindFileInPath() with g_find_program_in_path()
Luke Yue [Mon, 7 Jun 2021 06:10:48 +0000 (14:10 +0800)] 
virfile: Simplify virFindFileInPath() with g_find_program_in_path()

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoReplace virFileAbsPath() with g_canonicalize_filename()
Luke Yue [Mon, 7 Jun 2021 06:10:47 +0000 (14:10 +0800)] 
Replace virFileAbsPath() with g_canonicalize_filename()

Signed-off-by: Luke Yue <lukedyue@gmail.com>
4 years agodocs: add a link to Gitlab on the contributing page
Simon Chopin [Mon, 14 Jun 2021 08:23:50 +0000 (10:23 +0200)] 
docs: add a link to Gitlab on the contributing page

I expect to find a link to the repositories when clicking on
"Contribute", this patch fixes this. The wording is directly inspired by
the one on the hacking page.

Signed-off-by: Simon Chopin <chopin.simon@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: add launch-security-sev test with latest capabilities
Pavel Hrdina [Thu, 10 Jun 2021 13:58:15 +0000 (15:58 +0200)] 
tests: add launch-security-sev test with latest capabilities

QEMU 6.0.0 introduced `confidential-guest-support` -machine option as
a replacement for `memory-encryption`. In order to test it use 6.0.0
capabilities as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: use newer machine in qemuxml2argv launch-security-sev
Pavel Hrdina [Thu, 10 Jun 2021 13:55:52 +0000 (15:55 +0200)] 
tests: use newer machine in qemuxml2argv launch-security-sev

The pc-1.0 machine type was deprecated in QEMU 6.0.0. In our tests we
use 2.12.0 and 6.0.0 replies so switch to pc type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>