]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
4 years agoutil: refactor mdev_types method from PCI to mdev
Boris Fiuczynski [Fri, 23 Oct 2020 17:31:44 +0000 (19:31 +0200)]
util: refactor mdev_types method from PCI to mdev

Extract virPCIGetMdevTypes from PCI as virMediatedDeviceGetMdevTypes
into mdev for later reuse.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: node_device: fix mdev_types format and XML parsing code to match schema
Boris Fiuczynski [Fri, 23 Oct 2020 17:31:43 +0000 (19:31 +0200)]
conf: node_device: fix mdev_types format and XML parsing code to match schema

The nodedev schema defines that a mdev_types capability must have
one or more type elements. The XML parsing and the format allows to
accept and to write mdev_types capability without any type element.
This patches fixes this.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: add docs for 'fmode' and 'dmode' options
Brian Turek [Thu, 8 Oct 2020 14:32:26 +0000 (15:32 +0100)]
qemu: add docs for 'fmode' and 'dmode' options

Adds documentation for QEMU 9pfs 'fmode' and 'dmode' options.

Signed-off-by: Brian Turek <brian.turek@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: add support for 'fmode' and 'dmode'
Brian Turek [Thu, 8 Oct 2020 14:32:25 +0000 (15:32 +0100)]
qemu: add support for 'fmode' and 'dmode'

Add logic to validate and then pass through 'fmode' and 'dmode' to the
QEMU call.

Signed-off-by: Brian Turek <brian.turek@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: add 'fmode' and 'dmode' options
Brian Turek [Thu, 8 Oct 2020 14:32:24 +0000 (15:32 +0100)]
qemu: add 'fmode' and 'dmode' options

Expose QEMU's 9pfs 'fmode' and 'dmode' options via attributes on the
'filesystem' node in the domain XML. These options control the creation
mode of files and directories, respectively, when using
accessmode=mapped.

Signed-off-by: Brian Turek <brian.turek@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: capabilities: add QEMU_CAPS_FSDEV_CREATEMODE
Brian Turek [Thu, 8 Oct 2020 14:32:23 +0000 (15:32 +0100)]
qemu: capabilities: add QEMU_CAPS_FSDEV_CREATEMODE

The QEMU 9pfs 'fmode' and 'dmode' options have existed since QEMU 2.10.
Probe QEMU's command line set to check whether these options are
available, and if yes, enable this new QEMU_CAPS_FSDEV_CREATEMODE
capability on libvirt side.

Signed-off-by: Brian Turek <brian.turek@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agodoc: document new filters and not documented ones
Aleksandr Alekseev [Thu, 22 Oct 2020 18:15:52 +0000 (21:15 +0300)]
doc: document new filters and not documented ones

Signed-off-by: Aleksandr Alekseev <alexander.alekseev@virtuozzo.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoexample: add ipv6 filters examples
Aleksandr Alekseev [Thu, 22 Oct 2020 18:15:51 +0000 (21:15 +0300)]
example: add ipv6 filters examples

Signed-off-by: Aleksandr Alekseev <alexander.alekseev@virtuozzo.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoexample: fix typo and formatting
Aleksandr Alekseev [Thu, 22 Oct 2020 18:15:50 +0000 (21:15 +0300)]
example: fix typo and formatting

Signed-off-by: Aleksandr Alekseev <alexander.alekseev@virtuozzo.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64: compare CPU function is ignoring return value
Julio Faracco [Tue, 27 Oct 2020 16:04:24 +0000 (13:04 -0300)]
cpu_ppc64: compare CPU function is ignoring return value

Function to compare CPU on 64-bits PowerPC is ignoring the flag to avoid failure
in case of CPUs (host and guest) are incompatible. Basically, the function is
returning -1 even if it is set to continue.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agolibvirt-guests: Sync time for autostarted guests
Orion Poplawski [Wed, 28 Oct 2020 13:59:35 +0000 (14:59 +0100)]
libvirt-guests: Sync time for autostarted guests

Setting SYNC_TIME=1 does not work on autostarted guests.

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

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agostoragepoolxml2argvtest: Reorder gluster arguments
Roman Bolshakov [Tue, 3 Nov 2020 14:26:30 +0000 (17:26 +0300)]
storagepoolxml2argvtest: Reorder gluster arguments

Commit f00cde7f1133 changed order of mount arguments in
virStorageBackendFileSystemMountGlusterArgs() and introduced per-OS
mount options and new test data. Old test data was left unmodified with
prior order of arguments. That causes a test failure on all OSes but
Linux and FreeBSD, i.e. on macOS:

  15) Storage Pool XML-2-argv pool-netfs-gluster
      ...
  In
  '/Users/roolebo/dev/libvirt/tests/storagepoolxml2argvdata/pool-netfs-gluster.argv':
  Offset 39
  Expect [-o direct-io-mode=1 /mnt/gluster]
  Actual [/mnt/gluster -o direct-io-mode=1]

Fixes: f00cde7f1133 ("storage: Add default mount options for fs/netfs storage pools")
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agovirpcimock: Enable on macOS
Roman Bolshakov [Tue, 3 Nov 2020 14:26:29 +0000 (17:26 +0300)]
virpcimock: Enable on macOS

In general, it has little sense to use Linux pci mock on macOS but
virPCIDeviceAddressGetIOMMUGroupNum() is relying on the filesystem
layout mocked by virpcimock. And all tests that rely on correct
execution of virPCIDeviceAddressGetIOMMUGroupNum() fail.

The change fixes qemuhotplugtest, qemumemlocktest and qemuxml2xmltest.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agovirpcimock: Initialize real_close before using it
Roman Bolshakov [Tue, 3 Nov 2020 14:26:28 +0000 (17:26 +0300)]
virpcimock: Initialize real_close before using it

real_close() is not inialized by the first invocation of close(). That
causes an issue when the mock is used before others and a call of
real_close() results in a jump to NULL pointer.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agovircgroup: drop condition for absolute path from copyPlacement callbacks
Pavel Hrdina [Mon, 2 Nov 2020 22:06:19 +0000 (23:06 +0100)]
vircgroup: drop condition for absolute path from copyPlacement callbacks

Now that every caller to copyPlacement doesn't pass absolute path there
is no need to have a condition to handle that case.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: refactor virCgroupNewPartition
Pavel Hrdina [Mon, 2 Nov 2020 21:50:58 +0000 (22:50 +0100)]
vircgroup: refactor virCgroupNewPartition

The old code passed an absolute path to virCgroupNewFromParent() which
is not necessary. The code can take the current placement of parent
cgroup and append a relative path.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: move parentPath declaration
Pavel Hrdina [Mon, 2 Nov 2020 21:11:36 +0000 (22:11 +0100)]
vircgroup: move parentPath declaration

It's used only inside the if condition.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: refactor virCgroupEnableMissingControllers
Pavel Hrdina [Mon, 2 Nov 2020 15:05:07 +0000 (16:05 +0100)]
vircgroup: refactor virCgroupEnableMissingControllers

Use virStringSplit() to get the list of directories needed to be
created. This improves readability of the code and stops passing
absolute path to virCgroupNewFromParent().

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: drop @create from virCgroupNewDomainPartition
Pavel Hrdina [Wed, 21 Oct 2020 23:43:57 +0000 (01:43 +0200)]
vircgroup: drop @create from virCgroupNewDomainPartition

All callers pass true.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: introduce virCgroupSetPlacement
Pavel Hrdina [Wed, 21 Oct 2020 12:35:48 +0000 (14:35 +0200)]
vircgroup: introduce virCgroupSetPlacement

Currently this task is done by virCgroupCopyPlacement when the @path
starts with "/".

virCgroupNew is always called with @path starting with "/" and there is
no parent to copy path from. To make it obvious what the code is doing
introduce new helper.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: drop @pid argument from virCgroupNew
Pavel Hrdina [Thu, 15 Oct 2020 15:05:17 +0000 (17:05 +0200)]
vircgroup: drop @pid argument from virCgroupNew

Now it is always -1.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: no need to use PID in virCgroupEnableMissingControllers
Pavel Hrdina [Thu, 15 Oct 2020 14:59:03 +0000 (16:59 +0200)]
vircgroup: no need to use PID in virCgroupEnableMissingControllers

This function is relevant only with cgroups v1 where it creates
hierarchy for controllers that are not managed by systemd. PID is used
to detect a placement of current process but in this situation we are
building the hierarchy for already known placement.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: expand virCgroupDetect into virCgroupNew
Pavel Hrdina [Thu, 15 Oct 2020 11:11:28 +0000 (13:11 +0200)]
vircgroup: expand virCgroupDetect into virCgroupNew

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: virCgroupNew is now always called with absolute path
Pavel Hrdina [Thu, 15 Oct 2020 10:36:40 +0000 (12:36 +0200)]
vircgroup: virCgroupNew is now always called with absolute path

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: drop @parent from virCgroupNew
Pavel Hrdina [Wed, 14 Oct 2020 15:01:02 +0000 (17:01 +0200)]
vircgroup: drop @parent from virCgroupNew

Now it is always NULL.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: introduce virCgroupNewParent
Pavel Hrdina [Tue, 3 Nov 2020 12:27:08 +0000 (13:27 +0100)]
vircgroup: introduce virCgroupNewParent

The current code uses virCgroupNew() as a single point of entry and
calls into virCgroupDetect() as well. Both have logic for several paths
which is difficult to figure out.

Extract the actually used code path from the two functions to make
it obvious what's happening in this case.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: extract virCgroupNewDetect from virCgroupNew
Pavel Hrdina [Wed, 14 Oct 2020 09:23:27 +0000 (11:23 +0200)]
vircgroup: extract virCgroupNewDetect from virCgroupNew

The current code uses virCgroupNew() as a single point of entry and
calls into virCgroupDetect() as well. Both have logic for several paths
which is difficult to figure out.

Extract the actually used code path from the two functions to make
it obvious what's happening in this case.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: introduce virCgroupDetectControllers helper
Pavel Hrdina [Wed, 14 Oct 2020 09:17:26 +0000 (11:17 +0200)]
vircgroup: introduce virCgroupDetectControllers helper

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: introduce virCgroupValidatePlacement helper
Pavel Hrdina [Wed, 14 Oct 2020 09:15:53 +0000 (11:15 +0200)]
vircgroup: introduce virCgroupValidatePlacement helper

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: introduce virCgroupCopyPlacement helper
Pavel Hrdina [Wed, 14 Oct 2020 09:14:34 +0000 (11:14 +0200)]
vircgroup: introduce virCgroupCopyPlacement helper

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: introduce virCgroupCopyMounts helper
Pavel Hrdina [Wed, 14 Oct 2020 09:12:46 +0000 (11:12 +0200)]
vircgroup: introduce virCgroupCopyMounts helper

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: introduce virCgroupSetBackends helper
Pavel Hrdina [Wed, 14 Oct 2020 09:08:21 +0000 (11:08 +0200)]
vircgroup: introduce virCgroupSetBackends helper

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: remove useless cgroup->path variable
Pavel Hrdina [Wed, 14 Oct 2020 08:29:45 +0000 (10:29 +0200)]
vircgroup: remove useless cgroup->path variable

It is only used for debug and error purposes which can be easily
replaced by @placement.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroupv2: detect controllers enabled in parent cgroup
Pavel Hrdina [Thu, 29 Oct 2020 15:05:20 +0000 (16:05 +0100)]
vircgroupv2: detect controllers enabled in parent cgroup

With cgroups v2 working with controllers is a bit more complicated then
with cgroups v1 where the controller had to be mounted.

There are two files, cgroups.controllers and cgroup.subtree_control.
The file cgroup.controllers lists all controllers enabled in the current
cgroup and cgroups.subtree_control, as the name suggest, controls which
controllers are enabled for a subtree of cgroups.

Now the issue here is that the current code doesn't make any difference
if the @parent variable is NULL or not because ../cgroup.subtree_control
will list the same controllers as ./cgroup.controllers.

The whole point of the @parent variable is when we are building the
cgroup topology ourselves without systemd help we need to detect which
controllers are enabled in the parent cgroup in order to enable them for
the current cgroup as well and for that we need to check
cgroup.controllers of the parent group.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroupv2: properly detect placement of running VM
Pavel Hrdina [Tue, 13 Oct 2020 11:29:43 +0000 (13:29 +0200)]
vircgroupv2: properly detect placement of running VM

When libvirtd starts a VM it internally stores a path to the main
cgroup. When we restart libvirtd we should get to the same state.

When we start a VM on host with systemd the cgroup is created for us and
the process is already placed into that cgroup and we detect the path
created by systemd using /proc/$PID/cgroup. After that we create
sub-cgroups and move all threads there.

Once libvirtd is restarted we again detect the cgroup path using
/proc/$PID/cgroup, but in this case we will get a different path because
the main thread was moved to a "emulator" cgroup.

Instead of ignoring the "emulator" directory when validating cgroups
remove it completely when detecting cgroup otherwise cgroups will not
work properly when libvirtd is restarted.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroupv2: properly detect empty tasks
Pavel Hrdina [Tue, 13 Oct 2020 11:25:22 +0000 (13:25 +0200)]
vircgroupv2: properly detect empty tasks

With cgroups v2 the file cgroup.procs will never be empty if threading
is enabled as it will always have ID of all processes even if all
threads of the processes are moved to sub-cgroups. If that happens the
file cgroup.threads will be empty.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_dbus: use emulator cgroup for dbus-daemon
Pavel Hrdina [Wed, 28 Oct 2020 02:20:37 +0000 (03:20 +0100)]
qemu_dbus: use emulator cgroup for dbus-daemon

All other helper processes are moved to cgroup with QEMU emulator
thread as we keep the root VM cgroup without any processes. This
assumption is validated in qemuRestoreCgroupState() which is called
when libvirtd is restarted and reconnected to all running VMs.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: remove dead code that setup cgroups for helper processes
Pavel Hrdina [Wed, 28 Oct 2020 02:13:04 +0000 (03:13 +0100)]
qemu: remove dead code that setup cgroups for helper processes

In both cases priv->cgroup will always be NULL because it is called
before the QEMU process is started and cgroups are configured.

In qemuProcessLaunch() the call order is following:

    qemuExtDevicesStart()
    ...
    virCommandRun()
    ...
    qemuSetupCgroup()

where qemuDBusStart() is called from qemuExtDevicesStart() but we
cgroups are created in qemuSetupCgroup().

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_cgroup: remove unused @empty variable
Pavel Hrdina [Tue, 13 Oct 2020 11:24:32 +0000 (13:24 +0200)]
qemu_cgroup: remove unused @empty variable

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu_map: Unify apostrophe and quotation mark usage
Tim Wiederhake [Mon, 19 Oct 2020 07:36:15 +0000 (09:36 +0200)]
cpu_map: Unify apostrophe and quotation mark usage

Usage was mixed.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agohyperv: call openwsman's ws_serializer_free_mem
Matt Coleman [Tue, 3 Nov 2020 00:22:08 +0000 (19:22 -0500)]
hyperv: call openwsman's ws_serializer_free_mem

This should have been included with the upgrade to openwsman 2.6.3.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: minor formatting fix in hyperv_wmi.h
Matt Coleman [Tue, 3 Nov 2020 00:22:07 +0000 (19:22 -0500)]
hyperv: minor formatting fix in hyperv_wmi.h

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: consistent names for SettingData functions
Matt Coleman [Tue, 3 Nov 2020 00:22:06 +0000 (19:22 -0500)]
hyperv: consistent names for SettingData functions

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: move hypervGetProcSDByVSSDInstanceId to hyperv_wmi.c
Matt Coleman [Tue, 3 Nov 2020 00:22:05 +0000 (19:22 -0500)]
hyperv: move hypervGetProcSDByVSSDInstanceId to hyperv_wmi.c

This places it next to existing related functions.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: move hypervGetWmiClass to hyperv_wmi.h
Matt Coleman [Tue, 3 Nov 2020 00:22:04 +0000 (19:22 -0500)]
hyperv: move hypervGetWmiClass to hyperv_wmi.h

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: WMI class list function general cleanup
Matt Coleman [Tue, 3 Nov 2020 00:22:03 +0000 (19:22 -0500)]
hyperv: WMI class list function general cleanup

* use the same section comment in the header and code
* place the items in the same relative location within the .h and .c
* one parameter per line for multiline function definitions

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: remove spaces after hypervObject* casts
Matt Coleman [Tue, 3 Nov 2020 00:22:02 +0000 (19:22 -0500)]
hyperv: remove spaces after hypervObject* casts

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: g_autofree username and password in hypervConnectOpen()
Matt Coleman [Tue, 3 Nov 2020 00:22:01 +0000 (19:22 -0500)]
hyperv: g_autofree username and password in hypervConnectOpen()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoremove unnecessary cleanup labels and unused return variables
Laine Stump [Tue, 27 Oct 2020 21:49:11 +0000 (17:49 -0400)]
remove unnecessary cleanup labels and unused return variables

After converting all DIR* to g_autoptr(DIR), many cleanup: labels
ended up just having "return ret", and every place that set ret would
just immediately goto cleanup. Remove the cleanup label and its
return, and just return the set value immediately, thus eliminating
the need for the return variable itself.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoutil: refactor function to simplify and remove label
Laine Stump [Tue, 27 Oct 2020 02:04:31 +0000 (22:04 -0400)]
util:  refactor function to simplify and remove label

Once the DIR* in virPCIGetName() was made g_autoptr, the cleanup:
label just had a "return ret;", but the rest of the function was more
compilcated than it needed to be, doing funky things with the value of
ret inside multi-level conditionals and a while loop that might exit
early via a break with ret == 0 or exit early via a goto cleanup with
ret == -1.

It really didn't need to be nearly as complicated. After doing the
trivial replacements of "goto cleanup" with appropriate direct
returns, it became obvious that:

1) the outermost level of the nested conditional at the end of the
   function ("if (ret < 0)") was now redundant, since ret is now
   *always* < 0 by that point (otherwise the function has returned).

2) by switching the sense of the next level of the conditional (making
   it "if (!physPortID)", the "else" (which is now just "return 0;"
   becomes the "if", and the new "else" no longer needs to be inside
   the conditional.

3) the value of firstEntryName can be moved into *netname with
   g_steal_pointer()

Once that is all done, ret is no longer used and can be removed.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoutil: remove unused VIR_DIR_CLOSE() macro
Laine Stump [Mon, 26 Oct 2020 02:43:20 +0000 (22:43 -0400)]
util: remove unused VIR_DIR_CLOSE() macro

Since every single use of DIR* was converted to use g_autoptr, this
function is not currently needed. Even if someone comes up with a
usage for a non-g_autoptr DIR* in the future, they can just use
virDirClose(), since there is no longer a semantic difference between
the two (VIR_DIR_CLOSE() previously had an extra & on the pointer so
that it could be transparently passed as a DIR** to virDirClose(), but
that was removed several commits back.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf: convert final DIR* to g_autoptr
Laine Stump [Mon, 26 Oct 2020 02:40:40 +0000 (22:40 -0400)]
conf: convert final DIR* to g_autoptr

This use of DIR* was re-using the same function-scope DIR* each time
through a for loop, and due to multiple error gotos in the loop, it
needed to have the scope of the DIR* reduced to just the loop at the
same time as switching to g_autoptr. That's what this patch does.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agochange DIR* int g_autoptr(DIR) where appropriate
Laine Stump [Sun, 25 Oct 2020 21:50:51 +0000 (17:50 -0400)]
change DIR* int g_autoptr(DIR) where appropriate

All of these conversions are trivial - VIR_DIR_CLOSE() (aka
virDirClose()) is called only once on the DIR*, and it happens just
before going out of scope.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoutil: declare g_autoptr cleanup function to auto-close DIR*
Laine Stump [Mon, 19 Oct 2020 13:15:50 +0000 (09:15 -0400)]
util: declare g_autoptr cleanup function to auto-close DIR*

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoutil: change virDirClose to take a DIR* instead of DIR**.
Laine Stump [Tue, 13 Oct 2020 13:58:57 +0000 (09:58 -0400)]
util: change virDirClose to take a DIR* instead of DIR**.

In order to make a usable g_autoptr(DIR), we need to have a close
function that is a NOP when the pointer is NULL, but takes a simple
DIR*. But virDirClose() (candidate to be the g_autoptr cleanup
function) currently takes a DIR**, not DIR*. It does this so that it
can clear the pointer, thus making it safe to call virDirClose on the
same DIR multiple times.

In the past the clearing of the DIR* was essential in a few places,
but those few places have now been changed, so we can modify
virDirClose() to take a DIR*, and remove the side effect of clearing
the DIR*. This will make it directly usable as the g_autoptr cleanup,
and will mean that this:

   {
   DIR *dirp = NULL;
   blah blah ...
   VIR_DIR_CLOSE(dirp)
   }

is functionally identical to

   {
   g_autoptr(DIR) dirp = NULL;
   blah blah ...
   }

which will make conversion to using g_autoptr mechanical and simple to review.

(Note that virDirClose() will still check for NULL before attempting
to close, so that it can always be safely called, as long as the DIR*
was initialized to NULL (another prerequisite of becoming a g_autoptr
cleanup function)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoutil: manually set dirp to NULL after closing in virCapabilitiesInitCache()
Laine Stump [Mon, 26 Oct 2020 01:10:08 +0000 (21:10 -0400)]
util: manually set dirp to NULL after closing in virCapabilitiesInitCache()

In all uses of VIR_DIR_CLOSE() except one, the DIR* is never
referenced after closing all the way until it goes out of
scope. virCapabilitiesInitCaches(), however, reuses the same DIR* over
and over in a loop, but due to having many error conditions that
result in a goto out of the loop, it's not well suited to reducing the
scope of the variable until we introduce a g_autoptr cleanup function
for DIR*.

In preparation for doing just that, we need to get rid of the side
effect of VIR_DIR_CLOSE() setting the DIR* to NULL, so in this one
case, let's manually set the DIR* to NULL. Then in an upcoming patch
we can safely remove the side effect from VIR_DIR_CLOSE().

This extra/ugly bit of code is only temporary: once we introduce the
g_autoptr cleanup function for DIR*, we will remove this manual
close/clear completely anyway.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoutil: reduce scope of a DIR * in virCgroupV1SetOwner()
Laine Stump [Sun, 25 Oct 2020 21:31:53 +0000 (17:31 -0400)]
util: reduce scope of a DIR * in virCgroupV1SetOwner()

DIR *dh is being re-used each time through the for loop of this
function, so it must be closed and then re-opened, which means we
can't convert it to g_autoptr. By moving the definition of dh inside
the for loop, we make it possible to trivially convert to g_autoptr
(which will happen in a subsequent patch)

NB: VIR_DIR_CLOSE() is already called at the bottom of the for loop,
so removing the VIR_DIR_CLOSE() at the end of the function is *not*
creating a leak of a DIR*!

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agostorage: remove extraneous call to VIR_DIR_CLOSE()
Laine Stump [Mon, 26 Oct 2020 02:28:09 +0000 (22:28 -0400)]
storage: remove extraneous call to VIR_DIR_CLOSE()

VIR_DIR_CLOSE(dir) is called in the middle of
virStorageBackendRefreshLocal(), which is okay, but redundant - there
is no reference to dir between that call and the end of the function,
where VIR_DIR_CLOSE() is called again. Remove the extra call in the
middle to simplify the function and make the conversion to g_autoptr
trivial/mechanical.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agotools: reduce scope of a DIR* in virHostValidateIOMMU()
Laine Stump [Sun, 25 Oct 2020 21:56:22 +0000 (17:56 -0400)]
tools: reduce scope of a DIR* in virHostValidateIOMMU()

This will make the trivial nature of a conversion to g_autoptr (in a
later patch) more obvious.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconsistently use VIR_DIR_CLOSE() instead of virDirClose()
Laine Stump [Tue, 13 Oct 2020 13:40:54 +0000 (09:40 -0400)]
consistently use VIR_DIR_CLOSE() instead of virDirClose()

This will make it easier to review upcoming patches that use g_autoptr
to auto-close all DIRs.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirDomainNetDefParseXML: Fix error message for unknown value of //mac/@type
Michal Privoznik [Mon, 2 Nov 2020 19:49:38 +0000 (20:49 +0100)]
virDomainNetDefParseXML: Fix error message for unknown value of //mac/@type

In v6.6.0-rc1~124 we've introduced a new mechanism for MAC
addresses for ESX: ignore all checks (type='static') that libvirt
or ESX would do (and possibly fail) for specified MAC address.
Accepted values for the @type attribute are "generated" and
"static". But the error message mentions a different attribute.

Fixes 454e5961abf40c14f8b6d7ee216229e68fd170bf
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1892130
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: do not overwrite errors from hypervInvokeMethod()
Matt Coleman [Thu, 22 Oct 2020 16:38:24 +0000 (12:38 -0400)]
hyperv: do not overwrite errors from hypervInvokeMethod()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: reduce duplicate code for Msvm_ComputerSystem lookups
Matt Coleman [Thu, 22 Oct 2020 16:38:23 +0000 (12:38 -0400)]
hyperv: reduce duplicate code for Msvm_ComputerSystem lookups

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: remove unneeded braces in hypervDomainGetInfo() and hypervDomainGetXMLDesc()
Matt Coleman [Thu, 22 Oct 2020 16:38:22 +0000 (12:38 -0400)]
hyperv: remove unneeded braces in hypervDomainGetInfo() and hypervDomainGetXMLDesc()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: remove duplicate function hypervGetMemSDByVSSDInstanceId()
Matt Coleman [Thu, 22 Oct 2020 16:38:21 +0000 (12:38 -0400)]
hyperv: remove duplicate function hypervGetMemSDByVSSDInstanceId()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: remove duplicate function hypervGetVSSDFromUUID()
Matt Coleman [Thu, 22 Oct 2020 16:38:20 +0000 (12:38 -0400)]
hyperv: remove duplicate function hypervGetVSSDFromUUID()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: reformat WQL query strings
Matt Coleman [Thu, 22 Oct 2020 16:38:19 +0000 (12:38 -0400)]
hyperv: reformat WQL query strings

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: capabilities: Re-enable detection of QEMU_CAPS_BLOCK_EXPORT_ADD
Peter Krempa [Mon, 26 Oct 2020 12:09:17 +0000 (13:09 +0100)]
qemu: capabilities: Re-enable detection of QEMU_CAPS_BLOCK_EXPORT_ADD

Now that qemu stabilized it's interface and we've switched to the new
design we can re-enable use of 'block-export-add'

This reverts commit b87cfc957f57c1d9f7e5bf828ee4b23972085991

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: Update to new design of 'block-export-add'
Peter Krempa [Mon, 26 Oct 2020 12:06:17 +0000 (13:06 +0100)]
qemu: Update to new design of 'block-export-add'

qemu decided to modify the arguments of 'block-export-add' to include an
array of bitmaps rather than a single bitmap.

Since we've added the code prior to qemu setting the interface in stone
and thus it will be changed incompatibly and we already have tests for
the new interface we need to update the code and qemu capabilities data
at the same time.

Use a array of bitmaps as the 'bitmaps' argument instead of 'bitmap' and
bump qemu capabilities for the upcoming 5.2.0 release to
v5.1.0-2827-g2c6605389c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoutil: virhash: Standardize on 'opaque' for opaque data
Peter Krempa [Fri, 23 Oct 2020 09:45:16 +0000 (11:45 +0200)]
util: virhash: Standardize on 'opaque' for opaque data

Rename 'data' argument which is used for opaque data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Add test cases for 'host_cdrom' blockdev backend via <disk>
Peter Krempa [Thu, 15 Oct 2020 11:47:46 +0000 (13:47 +0200)]
qemu: Add test cases for 'host_cdrom' blockdev backend via <disk>

Simulate that the device is a cdrom when the path equals to /dev/cdrom
to provide testing for the 'host_cdrom' backend.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: page.xsl: Improve generation of paragraph anchor links
Peter Krempa [Mon, 26 Oct 2020 12:44:19 +0000 (13:44 +0100)]
docs: page.xsl: Improve generation of paragraph anchor links

Use the 'parent' axis to check whether the parent is a div with
class='section' rather than looking for 'toc-backref' anchor to see
whether to generate one of the headerlink alternatives. Both hare
docutils-specific thus apply to docs generated from RST documents.

This adds the links for pages generated from RST documents which don't
have a table of contents (and thus lack the 'toc-backref' anchors) and
thus fixes pages such as hacking.html and news.html to have reasonable
links which can be shared.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonews: Remove empty section
Andrea Bolognani [Mon, 2 Nov 2020 11:07:24 +0000 (12:07 +0100)]
news: Remove empty section

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
4 years agonews: Fix an RST alignment typo with '=' which breaks the pipeline
Erik Skultety [Mon, 2 Nov 2020 10:56:15 +0000 (11:56 +0100)]
news: Fix an RST alignment typo with '=' which breaks the pipeline

This is just a warning, but because we're invoking rst2html5 with
--strict, it will fail at encountering a single minor issue.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
4 years agoPost-release version bump to 6.10.0
Jiri Denemark [Mon, 2 Nov 2020 10:18:13 +0000 (11:18 +0100)]
Post-release version bump to 6.10.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-6.9.0
Jiri Denemark [Mon, 2 Nov 2020 10:16:26 +0000 (11:16 +0100)]
Release of libvirt-6.9.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agonews: mention vdpa support
Jonathon Jongsma [Fri, 30 Oct 2020 20:01:42 +0000 (15:01 -0500)]
news: mention vdpa support

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonode_device: fix leak of DIR*
Laine Stump [Wed, 28 Oct 2020 01:43:47 +0000 (21:43 -0400)]
node_device: fix leak of DIR*

Commit 53aec799fa31 introduced the function udevGetVDPACharDev(),
which scans a directory using virDirOpenIfExists() and
virDirRead(). It unfortunately forgets to close the DIR* when it is
finished with it. This patch fixes that omission.

Fixes: 53aec799fa31711ffaeacc7ec17ec6d3c2e3cadf
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Tue, 27 Oct 2020 09:32:02 +0000 (10:32 +0100)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10399 of 10399 strings)

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

Translated using Weblate (Ukrainian)

Currently translated at 99.3% (10328 of 10399 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 agoUpdate translation files
Weblate [Tue, 27 Oct 2020 09:32:00 +0000 (10:32 +0100)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agotests: fix stat mocking with Fedora rawhide
Daniel P. Berrangé [Thu, 29 Oct 2020 17:25:07 +0000 (17:25 +0000)]
tests: fix stat mocking with Fedora rawhide

GLibC has a really complicated way of dealing with the 'stat' function
historically, which means our mocks in turn have to look at four
different possible functions to replace, stat, stat64, __xstat,
__xstat64.

In Fedora 33 and earlier:

 - libvirt.so links to __xstat64
 - libc.so library exports stat, stat64, __xstat, __xstat64
 - sys/stat.h header exposes stat and __xstat

In Fedora 34 rawhide:

 - libvirt.so links to stat64
 - libc.so library exports stat, stat64, __xstat, __xstat64
 - sys/stat.h header exposes stat

Historically we only looked at the exported symbols from libc.so to
decide which to mock.

In F34 though we must not consider __xstat / __xstat64 though because
they only existance for binary compatibility. Newly built binaries
won't reference them.

Thus we must introduce a header file check into our logic for deciding
which symbol to mock. We must ignore the __xstat / __xstat64 symbols
if they don't appear in the sys/stat.h header, even if they appear
in libc.so

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agorpm: tell meson whether to use libssh or libssh2 explicitly
Daniel P. Berrangé [Wed, 28 Oct 2020 12:24:38 +0000 (12:24 +0000)]
rpm: tell meson whether to use libssh or libssh2 explicitly

The %meson macro sets "--auto-features=enabled", thus any feature in the
RPM which has a "with_XXX" condition, needs to explicitly pass a
"-DXXX=state" arg to %meson to override the auto features setting.

The with_libssh and with_libssh2 conditions were not exposed to meson,
so if either was set disabled, then meson would fail the build if the
-devel packages were not found.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpm: remove with_bash_completion condition
Daniel P. Berrangé [Wed, 28 Oct 2020 12:24:38 +0000 (12:24 +0000)]
rpm: remove with_bash_completion condition

The %meson macro sets "--auto-features=enabled", thus any feature in the
RPM which has a "with_XXX" condition, needs to explicitly pass a
"-DXXX=state" arg to %meson to override the auto features setting.

The with_bash_completion condition is always set to 1, so rather than
adding an arg to %meson, just remove the condition.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: capabilities: Disable detection of QEMU_CAPS_BLOCK_EXPORT_ADD
Peter Krempa [Mon, 26 Oct 2020 10:26:50 +0000 (11:26 +0100)]
qemu: capabilities: Disable detection of QEMU_CAPS_BLOCK_EXPORT_ADD

We use the capability to switch to using 'block-export-add' in the
upcoming qemu release instead of the at the same time deprecated
'nbd-server-add'.

Unfortunately qemu wants to change the interface of 'block-export-add'
before the release. Since we've tried to stay up to date and added the
code before it was written in stone, we need to disable the use of the
new interface for the upcoming libvirt release so that we don't have a
version of libvirt which would not work with the upcoming qemu version.

Remove the detection of 'block-export-add' until we are more sure how
the qemu interface will look.

This patch partially reverts commit adb9f7123adb94645

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoutil: Avoid double free in virProcessSetAffinity
Martin Kletzander [Tue, 27 Oct 2020 12:48:38 +0000 (13:48 +0100)]
util: Avoid double free in virProcessSetAffinity

The cpu mask was free()'d immediately on any error and at the end of the
function, where it was expected that it would either error out and return or
goto another allocation if the code was to fail.  However since commit
9514e24984ee the error path did not return in one new case which caused
double-free in such situation.  In order to make the code more straightforward
just free the mask after it's been used even before checking the return code of
the call.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonews: Mention nodedev support for CSS on S390
Boris Fiuczynski [Tue, 27 Oct 2020 12:52:04 +0000 (13:52 +0100)]
news: Mention nodedev support for CSS on S390

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu: honour fatal errors dealing with qemu slirp helper
Daniel P. Berrangé [Thu, 15 Oct 2020 11:12:15 +0000 (12:12 +0100)]
qemu: honour fatal errors dealing with qemu slirp helper

Currently all errors from qemuInterfacePrepareSlirp() are completely
ignored by the callers. The intention is that missing qemu-slirp binary
should cause the caller to fallback to the built-in slirp impl.

Many of the possible errors though should indeed be considered fatal.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoRevert "spec: Simplify setting features off by default"
Neal Gompa [Mon, 26 Oct 2020 21:53:55 +0000 (17:53 -0400)]
Revert "spec: Simplify setting features off by default"

As it turns out, the rather complicated structure that is
currently used for enabling or disabling features in the libvirt
build does not cleanly map well to RPM's bcond feature.

Consequently, we need these back in order to support trivially
activating these features through extra macros as build inputs.

This reverts commit 31d687a3218c9072d7050dd608e013e063ca180f.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonews: Mention virt-ssh-helper detection fix
Andrea Bolognani [Mon, 26 Oct 2020 23:25:53 +0000 (00:25 +0100)]
news: Mention virt-ssh-helper detection fix

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: Fix virt-ssh-helper detection
Andrea Bolognani [Mon, 26 Oct 2020 23:15:33 +0000 (00:15 +0100)]
rpc: Fix virt-ssh-helper detection

When trying to figure out whether virt-ssh-helper is available
on the remote host, we mistakenly look for the helper by the
name it had while the feature was being worked on instead of
the one that was ultimately picked, and thus end up using the
netcat fallback every single time.

Fixes: f8ec7c842df9e40c6607eae9b0223766cb226336
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agopo: Refresh potfile for v6.9.0
Jiri Denemark [Mon, 26 Oct 2020 17:56:11 +0000 (18:56 +0100)]
po: Refresh potfile for v6.9.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoqemuMonitorJSONCheckReply: Use g_autofree
Yi Li [Wed, 21 Oct 2020 09:23:40 +0000 (17:23 +0800)]
qemuMonitorJSONCheckReply: Use g_autofree

Eliminate cleanup code by using g_autofree.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoNEWS: Fix vertical spacing between sections
Andrea Bolognani [Mon, 26 Oct 2020 13:37:23 +0000 (14:37 +0100)]
NEWS: Fix vertical spacing between sections

Looking at the entire repository reveals we're not too consistent
about this, but at least in this specific document we mostly have
two blank lines between sections, so let's stick with that.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu_migration: Don't mangle NBD part of migration cookie
Michal Privoznik [Mon, 26 Oct 2020 10:28:13 +0000 (11:28 +0100)]
qemu_migration: Don't mangle NBD part of migration cookie

In recent commit v6.8.0-135-g518be41aaa the formatting of NBD
into migration cookie was moved into a separate function and with
it it was switched from direct printing into the output buffer to
virXMLFormatElement(). But there was a typo. The
virXMLFormatElement() accepts two buffers on input, one for
element attributes and another for child elements. Well, the line
that was supposed to add NBD port into the attributes buffer
printed the attribute directly into the output buffer which
produced this mangled XML:

<qemu-migration>
   port='49153'<nbd>
    <disk target='vda' capacity='8589934592'/>
    <disk target='vdb' capacity='12746752000'/>
  </nbd>
</qemu-migration>

Changing the incriminated line to print into the attributes
buffer fixes the problem.

Fixes: 518be41aaa3ebaac5f2307f268d24dc1b40b6b5c
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: Don't try to start NBD server twice
Michal Privoznik [Mon, 26 Oct 2020 08:49:35 +0000 (09:49 +0100)]
qemu: Don't try to start NBD server twice

In one of recent patches the way that we start NBD server for
incoming migration was reworked (v6.8.0-rc1~298). A new boolean
was introduced that tracks whether the NBD server was started so
that we don't start it twice nor record in the port in the port
allocator twice. Well, this idea is good, but in the
implementation the boolean is never set, so we are reserving the
port twice and would be starting the NBD server twice too if it
wasn't for port reservation fail.

Fixes: e74d627bb3bc2684cbe3edc1e2f7cc745b4e1ff3
Reported-by: Vjaceslavs Klimovs <vklimovs@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonews: introduce memory failure event
zhenwei pi [Fri, 23 Oct 2020 13:53:49 +0000 (21:53 +0800)]
news: introduce memory failure event

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirt-aa-helper: allow hard links for mounts
Christian Schoenebeck [Thu, 22 Oct 2020 14:58:00 +0000 (16:58 +0200)]
virt-aa-helper: allow hard links for mounts

Guests should be allowed to create hard links on mounted pathes, since
many applications rely on this functionality and would error on guest
with current "rw" AppArmor permission with 9pfs.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Don't pass mode when opening domain log file for reading
Michal Privoznik [Fri, 23 Oct 2020 17:39:03 +0000 (19:39 +0200)]
qemu: Don't pass mode when opening domain log file for reading

In qemuDomainLogContextNew() the domain log file is opened.
Twice, the first time for writing, and the second time for
reading (if required by caller). When opening the log file for
reading a mode is provided. This doesn't do much harm, but is
unnecessary. Drop the mode.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoInclude vdpa devices in node device list
Jonathon Jongsma [Wed, 14 Oct 2020 17:08:30 +0000 (12:08 -0500)]
Include vdpa devices in node device list

The current udev node device driver ignores all events related to vdpa
devices. Since libvirt now supports vDPA network devices, include these
devices in the device list.

Example output:

virsh # nodedev-list
[...ommitted long list of nodedevs...]
vdpa_vdpa0

virsh # nodedev-dumpxml vdpa_vdpa0
<device>
  <name>vdpa_vdpa0</name>
  <path>/sys/devices/vdpa0</path>
  <parent>computer</parent>
  <driver>
    <name>vhost_vdpa</name>
  </driver>
  <capability type='vdpa'>
    <chardev>/dev/vhost-vdpa-0</chardev>
  </capability>
</device>

NOTE: normally the 'parent' would be a PCI device instead of 'computer',
but this example output is from the vdpa_sim kernel module, so it
doesn't have a normal parent device.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoqemu: combine conditionals
Jonathon Jongsma [Fri, 23 Oct 2020 21:40:09 +0000 (16:40 -0500)]
qemu: combine conditionals

Trivial fix to improve readability by combining these into a compound
conditional.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>