]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
4 years agovirDomainDiskSourceNetworkParse: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 15:51:32 +0000 (17:51 +0200)]
virDomainDiskSourceNetworkParse: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainDeviceInfoParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 15:51:31 +0000 (17:51 +0200)]
virDomainDeviceInfoParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirStorageEncryptionInfoParseCipher: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 15:51:30 +0000 (17:51 +0200)]
virStorageEncryptionInfoParseCipher: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainHostdevSubsysSCSIHostDefParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 15:51:29 +0000 (17:51 +0200)]
virDomainHostdevSubsysSCSIHostDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainDeviceDimmAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 15:51:28 +0000 (17:51 +0200)]
virDomainDeviceDimmAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirxml: Add virXMLPropULongLong
Tim Wiederhake [Wed, 21 Apr 2021 15:51:27 +0000 (17:51 +0200)]
virxml: Add virXMLPropULongLong

Convenience function to return the value of an unsigned long long XML
attribute.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuAppendKeyWrapMachineParm: Stricten parameter types
Tim Wiederhake [Wed, 21 Apr 2021 15:51:26 +0000 (17:51 +0200)]
qemuAppendKeyWrapMachineParm: Stricten parameter types

Follow up to the last patch.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainKeyWrapDef: Make members virTristateSwitch
Tim Wiederhake [Wed, 21 Apr 2021 15:51:25 +0000 (17:51 +0200)]
virDomainKeyWrapDef: Make members virTristateSwitch

With the last usage of `aes` and `dea` as int gone, these two can
become virTristateSwitch.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainKeyWrapCipherDefParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 15:51:24 +0000 (17:51 +0200)]
virDomainKeyWrapCipherDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agospec: Drop -bash-completion package
Andrea Bolognani [Tue, 20 Apr 2021 16:54:58 +0000 (18:54 +0200)]
spec: Drop -bash-completion package

It's now empty, so no point in keeping it around.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotools: Generate per-command bash completion script
Andrea Bolognani [Mon, 19 Apr 2021 16:40:14 +0000 (18:40 +0200)]
tools: Generate per-command bash completion script

The current setup uses a single script that is symlinked twice
and that tries to configure bash completion for both virsh and
virt-admin, even if only one of them is installed. This also
forces us to have a -bash-completion RPM package that only
contains the tiny shared file.

Rework bash completion support so that two scripts are
generated, each one tailored to a specific command.

Since the shared script no longer exists after this change,
the corresponding RPM package becomes empty.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agospec: Move systemtap probes from -client to -libs
Andrea Bolognani [Mon, 19 Apr 2021 16:31:10 +0000 (18:31 +0200)]
spec: Move systemtap probes from -client to -libs

Any application that uses the libraries can take advantage of
the systemtap probes, so they should be shipped in the -libs
package rather than in -client.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agospec: Move some files from -client to -daemon
Andrea Bolognani [Mon, 19 Apr 2021 16:29:25 +0000 (18:29 +0200)]
spec: Move some files from -client to -daemon

The -client package's purpose is enabling remote machines to
connect to a virtualization host, but the virt-host-validate
and libvirt-guests tools are designed to be run directly on
the virtualization host and as such are a better fit for the
-daemon package.

With this change, installing and removing the -client package
no longer needs to touch the systemd configuration.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agospec: Merge -admin package into -daemon
Andrea Bolognani [Mon, 19 Apr 2021 16:23:12 +0000 (18:23 +0200)]
spec: Merge -admin package into -daemon

It's useful to have virt-admin around when debugging issues
with libvirtd, and since it's a tiny binary we can simply
include it in the -daemon package to ensure it's always going
to be available when needed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Expand upon the contents of the -daemon package
Andrea Bolognani [Tue, 20 Apr 2021 16:00:24 +0000 (18:00 +0200)]
docs: Expand upon the contents of the -daemon package

It doesn't only contain the libvirtd binary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Use consistent vertical spacing
Andrea Bolognani [Tue, 20 Apr 2021 15:54:55 +0000 (17:54 +0200)]
docs: Use consistent vertical spacing

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agobash-completion: Fix argument passing to $1
Michal Privoznik [Tue, 20 Apr 2021 13:03:16 +0000 (15:03 +0200)]
bash-completion: Fix argument passing to $1

Our vsh bash completion string is merely just a wrapper over
virsh/virt-admin complete (cmdComplete) - a hidden command that
uses internal readline completion to generate list of candidates.
But this means that we have to pass some additional arguments to
the helper process: e.g. connection URI and R/O flag.

Candidates are printed on a separate line each (and can contain
space), which means that when bash is reading the helper's output
into an array, it needs to split items on '\n' char - hence the
IFS=$'\n' prefix on the line executing the helper. This was
introduced in b889594a70.

But this introduced a regression - those extra arguments we might
pass are stored in a string and previously were split on a space
character (because $IFS was kept untouched and by default
contains space). But now, after the fix that's no longer the case
and thus virsh/virt-admin sees ' -r -c URI' as one argument.

The solution is to take $IFS out of the picture by storing the
extra arguments in an array instead of string.

Fixes: b889594a7092440dc916e3f43eeeaca2684571ee
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoqemu: virtiofs: support <sandbox mode='chroot'/>
Cole Robinson [Fri, 26 Mar 2021 16:58:28 +0000 (12:58 -0400)]
qemu: virtiofs: support <sandbox mode='chroot'/>

This maps to `virtiofsd -o sandbox=chroot|namespace`, which was added
in qemu 5.2.0:

https://git.qemu.org/?p=qemu.git;a=commit;h=06844584b62a43384642f7243b0fc01c9fff0fc7

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
4 years agoconf: Introduce <sandbox mode='chroot'/> for <filesystem><binary>
Cole Robinson [Fri, 26 Mar 2021 15:24:37 +0000 (11:24 -0400)]
conf: Introduce <sandbox mode='chroot'/> for <filesystem><binary>

This adds a new XML element

<filesystem>
  <binary>
    <sandbox mode='chroot|namespace'/>
  </binary>
</filesystem>

This will be used by qemu virtiofs

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
4 years agostorage_backend_fs: use MKFS ony if WITH_STORAGE_FS is defined
Pavel Hrdina [Wed, 21 Apr 2021 13:31:12 +0000 (15:31 +0200)]
storage_backend_fs: use MKFS ony if WITH_STORAGE_FS is defined

The code in storage_backend_fs is used for storage_dir and storage_fs
drivers so some parts need to be guarded by checking for
WITH_STORAGE_FS.

Fixes: 16c69e7aaed4cabfd8e8c19cc326854d4c480437
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainLoaderDefParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:32 +0000 (15:33 +0200)]
virDomainLoaderDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainVsockDefParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:31 +0000 (15:33 +0200)]
virDomainVsockDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainVideoResolutionDefParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:30 +0000 (15:33 +0200)]
virDomainVideoResolutionDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainAudioJackParse: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:29 +0000 (15:33 +0200)]
virDomainAudioJackParse: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainChrSourceDefParseLog: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:28 +0000 (15:33 +0200)]
virDomainChrSourceDefParseLog: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainChrSourceDefParseFile: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:27 +0000 (15:33 +0200)]
virDomainChrSourceDefParseFile: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDiskSourceNVMeParse: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:26 +0000 (15:33 +0200)]
virDomainDiskSourceNVMeParse: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDeviceISAAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:25 +0000 (15:33 +0200)]
virDomainDeviceISAAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDeviceBootParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:24 +0000 (15:33 +0200)]
virDomainDeviceBootParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainVirtioOptionsParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 13:33:23 +0000 (15:33 +0200)]
virDomainVirtioOptionsParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agospec: Do not build qemu driver for Power on RHEL-9
Jiri Denemark [Wed, 21 Apr 2021 12:55:03 +0000 (14:55 +0200)]
spec: Do not build qemu driver for Power on RHEL-9

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: add socket for virtiofs filesystems
Ján Tomko [Sat, 13 Feb 2021 12:22:56 +0000 (13:22 +0100)]
qemu: add socket for virtiofs filesystems

Copy the socket path in qemuExtDevicesStart, because
for libvirt-managed virtiofsd daemons the path is filled there
in qemuVirtioFSStart.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: add socket for virtiofs filesystems
Ján Tomko [Mon, 7 Sep 2020 20:07:35 +0000 (22:07 +0200)]
conf: add socket for virtiofs filesystems

Allow passing a socket of an externally launched virtiofsd
to the vhost-user-fs device.

<filesystem type='mount'>
  <driver type='virtiofs' queue='1024'/>
  <source socket='/tmp/sock/'/>
</filesystem>

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: fs: allow missing accessmode in the formatter
Ján Tomko [Mon, 7 Sep 2020 15:12:56 +0000 (17:12 +0200)]
conf: fs: allow missing accessmode in the formatter

So far VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH is always set
in virDomainFSDefPostParse, but future commits aim to change
that.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: fs: fill out accessmode in post-parse
Ján Tomko [Mon, 7 Sep 2020 15:01:16 +0000 (17:01 +0200)]
conf: fs: fill out accessmode in post-parse

Move the default setting of accessmode to the post-parse phase.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: formatdomain: Fix quoting of ':since:' argument for <teaming>
Peter Krempa [Wed, 21 Apr 2021 13:33:19 +0000 (15:33 +0200)]
docs: formatdomain: Fix quoting of ':since:' argument for <teaming>

The end quote of the argument of :since: must not have a space in front
of it as it's then not considered as end of the argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirInterfaceLinkParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:08 +0000 (14:08 +0200)]
virInterfaceLinkParseXML: Use virXMLProp*

This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attribute `speed`, which does not make sense for
a value measured in Mbits per second.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDeviceUSBAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:07 +0000 (14:08 +0200)]
virDomainDeviceUSBAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDeviceCcidAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:06 +0000 (14:08 +0200)]
virDomainDeviceCcidAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDeviceVirtioSerialAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:05 +0000 (14:08 +0200)]
virDomainDeviceVirtioSerialAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDeviceDriveAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:04 +0000 (14:08 +0200)]
virDomainDeviceDriveAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDeviceCCWAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:03 +0000 (14:08 +0200)]
virDomainDeviceCCWAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirPCIDeviceAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:02 +0000 (14:08 +0200)]
virPCIDeviceAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirZPCIDeviceAddressParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:01 +0000 (14:08 +0200)]
virZPCIDeviceAddressParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainBackupDefParse: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:08:00 +0000 (14:08 +0200)]
virDomainBackupDefParse: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainBackupDiskDefParseXML: Use virXMLProp*
Tim Wiederhake [Wed, 21 Apr 2021 12:07:59 +0000 (14:07 +0200)]
virDomainBackupDiskDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: blockjob: Transition into 'ready' state only from expected states
Peter Krempa [Tue, 20 Apr 2021 10:58:28 +0000 (12:58 +0200)]
qemu: blockjob: Transition into 'ready' state only from expected states

In certain rare occasions qemu can transition a block job which was
already 'ready' into 'standby' and then back. If this happens in the
following order libvirt will get confused about the actual job state:

1) the block copy job is 'ready' (job->state == QEMU_BLOCKJOB_STATE_READY)

2) user calls qemuDomainBlockJobAbort with VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT
   flag but without VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC

3) the block job is switched to synchronous event handling

4) the block job blips to 'standby' and back to 'ready', the event is
   not processed since the blockjob is in sync mode for now

5) qemuDomainBlockJobPivot is called:
    5.1) 'job-complete' QMP command is issued
    5.2) job->state is set to QEMU_BLOCKJOB_STATE_PIVOTING

6) code for synchronous-wait for the job completion in qemuDomainBlockJobAbort
   is invoked

7) the waiting loop calls qemuBlockJobUpdate:

    7.1) job->newstate is QEMU_BLOCKJOB_STATE_READY due to 4)
    7.2) qemuBlockJobEventProcess is called
    7.3) the handler for QEMU_BLOCKJOB_STATE_READY overwrites
         job->state from QEMU_BLOCKJOB_STATE_PIVOTING to QEMU_BLOCKJOB_STATE_READY

8) qemuDomainBlockJobAbort is looking for a finished job, so waits again

9) qemu finishes the blockjob and transitions it into 'concluded' state

10) qemuBlockJobUpdate is triggered again, this time finalizing the job.
    10.1) job->newstate is = QEMU_BLOCKJOB_STATE_CONCLUDED
          job->state is = QEMU_BLOCKJOB_STATE_READY
    10.2) qemuBlockJobEventProcessConcluded is called, the function
          checks whether there was an error with the blockjob. Since
          there was no error job->newstate becomes
          QEMU_BLOCKJOB_STATE_COMPLETED.
    10.3) qemuBlockJobEventProcessConcludedTransition selects the action
          for the appropriate block job type where we have:

    case QEMU_BLOCKJOB_TYPE_COPY:
        if (job->state == QEMU_BLOCKJOB_STATE_PIVOTING && success)
            qemuBlockJobProcessEventConcludedCopyPivot(driver, vm, job, asyncJob);
        else
            qemuBlockJobProcessEventConcludedCopyAbort(driver, vm, job, asyncJob);
        break;

          Since job->state is QEMU_BLOCKJOB_STATE_READY,
          qemuBlockJobProcessEventConcludedCopyAbort is called.

This patch forbids transitions to QEMU_BLOCKJOB_STATE_READY if the
previous job state isn't QEMU_BLOCKJOB_STATE_RUNNING or
QEMU_BLOCKJOB_STATE_NEW.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1951507
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agostorage: use virFindFileInPath to validate presence of mkfs
Pavel Hrdina [Wed, 14 Apr 2021 23:09:21 +0000 (01:09 +0200)]
storage: use virFindFileInPath to validate presence of mkfs

Future patch will remove MKFS define as we will no longer check it
during compilation.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyvexml2argvtest: use virCommandToStringFull to strip command path
Pavel Hrdina [Fri, 16 Apr 2021 18:32:34 +0000 (20:32 +0200)]
bhyvexml2argvtest: use virCommandToStringFull to strip command path

Currently the tests would fail if the bhyve commands are installed in
different path then /usr/bin. Strip the command path to not depend on
the host environment.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: don't check collie as program for sheepdog
Pavel Hrdina [Thu, 15 Apr 2021 12:36:32 +0000 (14:36 +0200)]
meson: don't check collie as program for sheepdog

Upstream sheepdog changed collie to dog back in 2013 in version 0.7.0.
Looking into repology that version is no longer used by any distribution
supported by libvirt.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirnetdev: move virNetDevSetRootQDisc to virnetdevbandwidth
Pavel Hrdina [Wed, 14 Apr 2021 22:34:48 +0000 (00:34 +0200)]
virnetdev: move virNetDevSetRootQDisc to virnetdevbandwidth

The function in question uses "tc" binary so virnetdevbandwidth feels
like better place for it.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotests: use virfirewallmock instead of hasNetfilterTools
Pavel Hrdina [Wed, 14 Apr 2021 21:57:50 +0000 (23:57 +0200)]
tests: use virfirewallmock instead of hasNetfilterTools

Instead of checking for specific error that the binaries are not
available mock the virFindFileInPath function. This way we don't have
to skip these tests on host where the binaries are missing.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotests: introduce virfirewallmock
Pavel Hrdina [Wed, 14 Apr 2021 21:52:14 +0000 (23:52 +0200)]
tests: introduce virfirewallmock

This will allow us to run tests using firewall on hosts where the mocked
binaries are not available/installed instead of skipping these tests.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirfirewall: use virFindFileInPath instead of virFileIsExecutable
Pavel Hrdina [Thu, 15 Apr 2021 18:46:53 +0000 (20:46 +0200)]
virfirewall: use virFindFileInPath instead of virFileIsExecutable

Following patches will make this change necessary as we will stop
detecting the full path during compile time.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirdnsmasq: remove binaryPath argument from dnsmasqCapsNewFromBinary
Pavel Hrdina [Wed, 14 Apr 2021 15:57:08 +0000 (17:57 +0200)]
virdnsmasq: remove binaryPath argument from dnsmasqCapsNewFromBinary

We always pass DNSMASQ so there is no need for the argument at all.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirdnsmasq: remove binaryPath argument from dnsmasqCapsNewFromBuffer
Pavel Hrdina [Wed, 14 Apr 2021 15:46:47 +0000 (17:46 +0200)]
virdnsmasq: remove binaryPath argument from dnsmasqCapsNewFromBuffer

We always pass DNSMASQ so there is no need for the argument at all.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirdnsmasq: drop unused dnsmasqCapsRefresh function
Pavel Hrdina [Wed, 14 Apr 2021 15:19:11 +0000 (17:19 +0200)]
virdnsmasq: drop unused dnsmasqCapsRefresh function

Instead of removing binaryPath let's drop the function completely as
it is not used anywhere.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirdnsmasq: drop unused dnsmasqCapsNewFromFile function
Pavel Hrdina [Wed, 14 Apr 2021 15:01:43 +0000 (17:01 +0200)]
virdnsmasq: drop unused dnsmasqCapsNewFromFile function

Instead of removing binaryPath let's drop the function completely as
it is not used anywhere.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobridge_driver: fix comment about dnsmasqCaps
Pavel Hrdina [Wed, 14 Apr 2021 15:17:42 +0000 (17:17 +0200)]
bridge_driver: fix comment about dnsmasqCaps

We will never call dnsmasqCapsRefresh() so reflect what actually
happens.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: xml: Fix confusing semantics of VIR_XML_PROP_OPTIONAL flag
Peter Krempa [Wed, 21 Apr 2021 06:49:51 +0000 (08:49 +0200)]
util: xml: Fix confusing semantics of VIR_XML_PROP_OPTIONAL flag

The new enum helpers use a set of flags to modify their behaviour, but
the declared set of flags is semantically confusing:

 typedef enum {
     VIR_XML_PROP_OPTIONAL = 0, /* Attribute may be absent */
     VIR_XML_PROP_REQUIRED = 1 << 0, /* Attribute may not be absent */

Since VIR_XML_PROP_OPTIONAL is declared as 0 any other flag shadows it
and makes it impossible to detect. The functions are not able to detect
a semantic nonsense of VIR_XML_PROP_OPTIONAL | VIR_XML_PROP_REQUIRED and
it's a perfectly valid statement for the compilers.

In general having two flags to do the same boolean don't make sense and
the implementation doesn't fix any shortcomings either.

To prevent mistakes, rename VIR_XML_PROP_OPTIONAL to VIR_XML_PROP_NONE,
so that there's always an enum value used with the calls but it doesn't
imply that the flag makes the property optional when the actual value is
0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: xml: Remove VIR_XML_PROP_WRAPNEGATIVE
Peter Krempa [Wed, 21 Apr 2021 06:41:00 +0000 (08:41 +0200)]
util: xml: Remove VIR_XML_PROP_WRAPNEGATIVE

As I've pointed out in my review, the negative number wrapping for
unsigned variables is an anti-feature which should not be promoted in
any way.

Remove VIR_XML_PROP_WRAPNEGATIVE which would make it more accessible.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotestUpdateQEMUCaps: Fix memory leak
Tim Wiederhake [Tue, 20 Apr 2021 11:27:52 +0000 (13:27 +0200)]
testUpdateQEMUCaps: Fix memory leak

testUpdateQEMUCaps is called multiple times. Use virQEMUCapsUpdateHostCPUModel
instead of virQEMUCapsInitHostCPUModel to not overwrite (and leak) the
pointers in qemuCaps->kvm.hostCPU and qemuCaps->tcg.hostCPU.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Introduce virQEMUCapsUpdateHostCPUModel
Tim Wiederhake [Tue, 20 Apr 2021 11:27:51 +0000 (13:27 +0200)]
qemu: Introduce virQEMUCapsUpdateHostCPUModel

Function will be used by next patch.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoxenParseHypervisorFeatures: Remove superfluous VIR_FREE
Tim Wiederhake [Tue, 20 Apr 2021 11:27:50 +0000 (13:27 +0200)]
xenParseHypervisorFeatures: Remove superfluous VIR_FREE

Fixes: 4eb7c621985dad4de911ec394ac628bd1a5b29ab
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirxml: Fix schema validation of individual nodes
Tim Wiederhake [Tue, 20 Apr 2021 11:27:49 +0000 (13:27 +0200)]
virxml: Fix schema validation of individual nodes

xmlDocSetRootElement removes the node from its previous document tree,
effectively removing the "<cpu>" node from "<domain>" in virCPUDefParseXML.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoReplace AbsPath judgement method with g_path_is_absolute()
Luke Yue [Tue, 20 Apr 2021 04:44:12 +0000 (12:44 +0800)]
Replace AbsPath judgement method with g_path_is_absolute()

The g_path_is_absolute() considers more situations
than just a simply "path[0] == '/'".

Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirshCheckpointListCollect: Do not pass NULL to qsort
Tim Wiederhake [Mon, 19 Apr 2021 11:54:15 +0000 (13:54 +0200)]
virshCheckpointListCollect: Do not pass NULL to qsort

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agocmdSnapshotList: Fix memory leak
Tim Wiederhake [Mon, 19 Apr 2021 11:54:14 +0000 (13:54 +0200)]
cmdSnapshotList: Fix memory leak

Fixes: 3caa28dc50df7ec215713075d669b20bef6473a2
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agocmdCheckpointList: Fix memory leak
Tim Wiederhake [Mon, 19 Apr 2021 11:54:13 +0000 (13:54 +0200)]
cmdCheckpointList: Fix memory leak

Fixes: 3caa28dc50df7ec215713075d669b20bef6473a2
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agovirDomainFeaturesDefParse: Fix memory leak
Tim Wiederhake [Mon, 19 Apr 2021 11:54:12 +0000 (13:54 +0200)]
virDomainFeaturesDefParse: Fix memory leak

Fixes: 94013ee04e3945307a71f5c4897d78729e7eaff4
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoxenParseHypervisorFeatures: Fix memory leak
Tim Wiederhake [Mon, 19 Apr 2021 11:54:11 +0000 (13:54 +0200)]
xenParseHypervisorFeatures: Fix memory leak

Fixes:b523e22521afe733165869c9e1ae18e88536acd6
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agotests: nodedev: remove unnecessary cleanup label
Jonathon Jongsma [Tue, 13 Apr 2021 20:29:15 +0000 (15:29 -0500)]
tests: nodedev: remove unnecessary cleanup label

Now that the last cleanup task was removed in the previous commit, just
remove the label and return early on error rather than goto cleanup.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agotests: nodedev: remove unused variable
Jonathon Jongsma [Fri, 9 Apr 2021 20:32:04 +0000 (15:32 -0500)]
tests: nodedev: remove unused variable

This variable was leftover from previous changes but is no longer used.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agotests: nodedev: remove virt type from test macros
Jonathon Jongsma [Fri, 9 Apr 2021 20:30:01 +0000 (15:30 -0500)]
tests: nodedev: remove virt type from test macros

We only use the virt_type "QEMU" in this tests, so simply hard-code it
in the test function rather than specifying it in the test macro.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agotests: nodedev: remove 'create' from test macros
Jonathon Jongsma [Fri, 9 Apr 2021 20:30:01 +0000 (15:30 -0500)]
tests: nodedev: remove 'create' from test macros

We can figure out the appropriate value for 'create' from the command
type, so push that into the test function rather than specifying it in
the test macro.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agotests: nodedev: Make the mdevctl test function and helper generic
Erik Skultety [Wed, 31 Mar 2021 13:40:36 +0000 (15:40 +0200)]
tests: nodedev: Make the mdevctl test function and helper generic

Now that we have a generic mdevctl command generator, we can unify the
test infrastructure as well.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonodedev: Remove GetMdevctl*Command() wrappers
Jonathon Jongsma [Wed, 31 Mar 2021 22:03:08 +0000 (17:03 -0500)]
nodedev: Remove GetMdevctl*Command() wrappers

These per-command generator functions were only exposed in the header to
allow the commandline generation to be tested. Now that we have a
generic mdevctl command generator, we can get rid of the per-command
wrappers and reduce the noise in the header.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonodedev: driver: Create a generic mdevctl command translator
Erik Skultety [Wed, 31 Mar 2021 13:24:47 +0000 (15:24 +0200)]
nodedev: driver: Create a generic mdevctl command translator

Currently there are dedicated wrappers to construct mdevctl command.
These are mostly fine except for the one that translates both "start"
and "define" commands, only because mdevctl takes the same set of
arguments. Instead, keep the wrappers, but let them call a single
global translator that handles all the mdevctl command differences and
commonalities.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonodedev: driver: Introduce internal mdevctl commands enum
Erik Skultety [Wed, 31 Mar 2021 13:20:50 +0000 (15:20 +0200)]
nodedev: driver: Introduce internal mdevctl commands enum

This is not a 1:1 mapping to mdevctl commands because mdevctl doesn't
support a separate 'create' command. mdevctl uses 'start' for both
starting a pre-defined device as well as for creating and starting a new
transient device. The libvirt code will be more readable if we treat
these as separate commands. When we need to actually execute mdevctl,
the 'create' command will be translated into the appropriate 'mdevctl
start' command.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agonodedev: Switch to using long options for mdevctl
Jonathon Jongsma [Thu, 8 Apr 2021 21:53:27 +0000 (16:53 -0500)]
nodedev: Switch to using long options for mdevctl

rather than using short opentions (e.g. "-p 0000:00:02.0"), use long
options everywhere (e.g. "--parent=0000:00:02.0")

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonodedev: driver: Swap virMdevctlStart and virMdevctlCreate
Erik Skultety [Wed, 31 Mar 2021 13:32:44 +0000 (15:32 +0200)]
nodedev: driver: Swap virMdevctlStart and virMdevctlCreate

"start" in libvirt means - "take this object and create an
instance out of it"

"create" in libvirt most of the time means - "take and XML description,
make an object out of it and use it to create an instance"

This gets confusing with mdevctl which uses "start" for both. So, this
patch proposes to use virMdevctlStart in cases where from libvirt's POV
we're starting a defined device (unlike mdevctl). Similarly, use
virMdevctlCreate in scenarios where XML description is passed to
libvirt and a transient device is supposed to be created.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agotests: nodedev: switch all test macros to accept a filename
Jonathon Jongsma [Thu, 8 Apr 2021 15:25:48 +0000 (10:25 -0500)]
tests: nodedev: switch all test macros to accept a filename

Rather than specifying a UUID string to some test macros, just pass a
filename to an xml definition. This helps work toward unifying the test
macros and making it more maintainable.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonodedev: avoid use of VIR_ERR_NO_* errors internally
Jonathon Jongsma [Tue, 30 Mar 2021 15:12:07 +0000 (10:12 -0500)]
nodedev: avoid use of VIR_ERR_NO_* errors internally

These errors are demoted to debug statements[1] since they're only
intended to be used as return values for public APIs.  This makes it
difficult to debug the problem when something goes wrong since no error
message is logged. Switch instead to VIR_ERR_INTERNAL_ERROR so that the
error is logged as expected.

[1] See the implementation of daemonErrorLogFilter() for details:
https://gitlab.com/libvirt/libvirt/-/blob/e2f82a3704f680fbb37a733476d870c19232c23e/src/remote/remote_daemon.c#L89

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonodedev: don't log error in nodeDeviceFindAddressByName()
Jonathon Jongsma [Fri, 9 Apr 2021 19:29:43 +0000 (14:29 -0500)]
nodedev: don't log error in nodeDeviceFindAddressByName()

The calling function will log the error. Just return NULL if a device
cannot be found.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoconf: domain: Refactor virDomainDiskDefParseXML
Peter Krempa [Fri, 16 Apr 2021 07:10:55 +0000 (09:10 +0200)]
conf: domain: Refactor virDomainDiskDefParseXML

Use the new virXMLProp helpers and XPath queries to get rid of the old
style of iteration through element children.

Note that in case of def->blockio.logical_block_size,
def->blockio.physical_block_size and def->rotation_rate the wraparound
behaviour of 'virStrToLong_ui' was _not_ forward ported to the new code
as it makes no sense with the attributes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Convert virDomainDiskDef's 'device' to virDomainDiskDevice
Peter Krempa [Fri, 16 Apr 2021 08:46:00 +0000 (10:46 +0200)]
conf: domain: Convert virDomainDiskDef's 'device' to virDomainDiskDevice

Use the appropriate type for the variable and refactor the XML parser to
parse it correctly using virXMLPropEnum.

Changes to other places using switch statements were required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Convert virDomainDiskDef's 'bus' to virDomainDiskBus
Peter Krempa [Fri, 16 Apr 2021 08:46:00 +0000 (10:46 +0200)]
conf: domain: Convert virDomainDiskDef's 'bus' to virDomainDiskBus

Use the appropriate type for the variable and refactor the XML parser to
parse it correctly using virXMLPropEnum.

Changes to other places using switch statements were required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Convert virDomainDiskDef's 'snapshot' to unsigned int
Peter Krempa [Fri, 16 Apr 2021 08:46:00 +0000 (10:46 +0200)]
conf: domain: Convert virDomainDiskDef's 'snapshot' to unsigned int

Unfortunately virDomainSnapshotLocation is declared in snapshot_conf.h
which includes domain_conf.h. To avoid a circular dependency use
'unsigned int' for now.

Use XML parser can use virXMLPropEnum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Convert virDomainDiskDef's 'model' to virDomainDiskModel
Peter Krempa [Fri, 16 Apr 2021 08:46:00 +0000 (10:46 +0200)]
conf: domain: Convert virDomainDiskDef's 'model' to virDomainDiskModel

Use the appropriate type for the variable and refactor the XML parser to
parse it correctly using virXMLPropEnum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Convert virDomainDiskDef's 'sgio' to virDomainDeviceSGIO
Peter Krempa [Fri, 16 Apr 2021 08:46:00 +0000 (10:46 +0200)]
conf: domain: Convert virDomainDiskDef's 'sgio' to virDomainDeviceSGIO

Use the appropriate type for the variable and refactor the XML parser to
parse it correctly using virXMLPropEnum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Convert virDomainDiskDef's 'rawio' to virTristateBool
Peter Krempa [Fri, 16 Apr 2021 08:46:00 +0000 (10:46 +0200)]
conf: domain: Convert virDomainDiskDef's 'rawio' to virTristateBool

Use the appropriate type for the variable and refactor the XML parser to
parse it correctly using virXMLPropEnum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Convert virDomainDiskDef's 'removable' to virTristateSwitch
Peter Krempa [Fri, 16 Apr 2021 08:46:00 +0000 (10:46 +0200)]
conf: domain: Convert virDomainDiskDef's 'removable' to virTristateSwitch

Use the appropriate type for the variable and refactor the XML parser to
parse it correctly using virXMLPropEnum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Move checks from virDomainDiskDefParseXML to virDomainDiskDefValidate
Peter Krempa [Thu, 15 Apr 2021 15:27:01 +0000 (17:27 +0200)]
conf: domain: Move checks from virDomainDiskDefParseXML to virDomainDiskDefValidate

Move the rest of the validations to the vaidation code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Move default setting from virDomainDiskDefParseXML to virDomainDiskDefP...
Peter Krempa [Thu, 15 Apr 2021 15:15:26 +0000 (17:15 +0200)]
conf: domain: Move default setting from virDomainDiskDefParseXML to virDomainDiskDefPostParse

Move the setting of read-only state, the default disk bus and setting of
'snapshot' state for read-only disks to the post parse callback to clean
up the disk parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovmx: Mark CDROM disk elements as read-only
Peter Krempa [Thu, 15 Apr 2021 15:08:45 +0000 (17:08 +0200)]
vmx: Mark CDROM disk elements as read-only

Mark it explicitly as read only in accordance with the comment outlining
configuration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: domain: Introduce VIR_DOMAIN_DISK_BUS_NONE
Peter Krempa [Thu, 15 Apr 2021 14:58:19 +0000 (16:58 +0200)]
conf: domain: Introduce VIR_DOMAIN_DISK_BUS_NONE

Add a disk bus value represending no selected bus. This will help split
up the XML parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: Move disk target 'ioemu:' stripping to virDomainDiskDefPostParse
Peter Krempa [Wed, 14 Apr 2021 07:59:22 +0000 (09:59 +0200)]
conf: Move disk target 'ioemu:' stripping to virDomainDiskDefPostParse

Modifications of the data such as this one don't belong into the parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: Move checks from virDomainDiskDefPostParse to virDomainDiskDefValidate
Peter Krempa [Wed, 14 Apr 2021 07:36:57 +0000 (09:36 +0200)]
conf: Move checks from virDomainDiskDefPostParse to virDomainDiskDefValidate

The moved code contains only checks and does not modify the parsed
document so it doesn't belong into the PostParse code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: Move disk vendor and product pritability check to domain_validate
Peter Krempa [Wed, 14 Apr 2021 07:31:05 +0000 (09:31 +0200)]
conf: Move disk vendor and product pritability check to domain_validate

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: Move code from virDomainDiskDefParseValidate to virDomainDiskDefValidate
Peter Krempa [Wed, 14 Apr 2021 07:21:36 +0000 (09:21 +0200)]
conf: Move code from virDomainDiskDefParseValidate to virDomainDiskDefValidate

Unify the two distinct disk definition validators.

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