]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoqemu: domain: Add 'errmsg' field to qemuDomainJobInfo
Peter Krempa [Thu, 16 Apr 2020 09:21:51 +0000 (11:21 +0200)]
qemu: domain: Add 'errmsg' field to qemuDomainJobInfo

The field can be used by jobs to add an optional error message to a
completed (failed) job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoAPI: Add VIR_DOMAIN_JOB_ERRMSG domain job statistics field
Peter Krempa [Wed, 15 Apr 2020 10:27:53 +0000 (12:27 +0200)]
API: Add VIR_DOMAIN_JOB_ERRMSG domain job statistics field

In some cases it's useful to report the error which caused the domain
job to fail. Add an optional field for holding the error message so that
it can be later retrieved from statistics of a completed job.

Add the field name macro and code for extracting it in virsh.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: Add free and copy function for qemuDomainJobInfo and use it
Peter Krempa [Thu, 26 Mar 2020 16:55:00 +0000 (17:55 +0100)]
qemu: Add free and copy function for qemuDomainJobInfo and use it

In order to add a string to qemuDomainJobInfo we must ensure that it's
freed and copied properly. Add helpers to copy and free the structure
and adjust the code to use them properly for the new semantics.

Additionally also allocation is changed to g_new0 as it includes the
type and thus it's very easy to grep for all the allocations of a given
type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoremote: remoteDispatchDomainGetJobStats: Encode typed parameter strings
Peter Krempa [Thu, 16 Apr 2020 09:14:00 +0000 (11:14 +0200)]
remote: remoteDispatchDomainGetJobStats: Encode typed parameter strings

String typed parameter values were introduced in v0.9.7-30-g40624d32fb.
virDomainGetJobStats was introduced in v1.0.2-239-g4dd00f4238 so all
clients already support typed parameter stings at that time thus we can
enable it unconditionally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuhotplugtest: detach: Remove commands which are not issued
Peter Krempa [Thu, 23 Apr 2020 08:36:59 +0000 (10:36 +0200)]
qemuhotplugtest: detach: Remove commands which are not issued

The 'human-monitor-command' equates to the 'drive-del' command issued by
the hotplug code on successful detach of a device. This means that it's
not issued for failed attempts and thus should not be added to the
expected list. Unfortunately our test monitor doesn't ensure that all
expected commands were consumed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agomock: qemuDomainGetUnplugTimeout: Decrease timeout
Peter Krempa [Thu, 23 Apr 2020 08:33:58 +0000 (10:33 +0200)]
mock: qemuDomainGetUnplugTimeout: Decrease timeout

We always queue the DEVICE_DELETED events before successful return from
the command so that tests are reliable. This means we can decrease the
unplug timeout as it's guaranteed to be executed in correct order.

According to my testing it shaves off ~450ms of test run:

real 0m0.721s

vs.

real 0m0.259s

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agomock:qemuDomainGetUnplugTimeout: Remove unused attribute for '@vm'
Peter Krempa [Thu, 23 Apr 2020 08:32:22 +0000 (10:32 +0200)]
mock:qemuDomainGetUnplugTimeout: Remove unused attribute for '@vm'

'@vm' is used to use a different timeout for ppc64 guests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemuDomainGetUnplugTimeout: Add G_GNUC_NO_INLINE
Peter Krempa [Thu, 23 Apr 2020 08:30:13 +0000 (10:30 +0200)]
qemuDomainGetUnplugTimeout: Add G_GNUC_NO_INLINE

The function is mocked in qemuhotplugmock.so. Recent clang versions
decided to inline it so the mock stopped working resulting in
qemuhotplugtest wasting 15 seconds waiting for timeouts.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemucapstest: Refresh data for qemu 5.0 on x86_64
Peter Krempa [Wed, 22 Apr 2020 10:39:10 +0000 (12:39 +0200)]
qemucapstest: Refresh data for qemu 5.0 on x86_64

Bump to v5.0.0-rc3-8-g3119154db0 and make sure that 'liburing' is picked
up by qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainSaveImageOpen: Refactor handling of errors
Peter Krempa [Wed, 22 Apr 2020 14:52:24 +0000 (16:52 +0200)]
qemuDomainSaveImageOpen: Refactor handling of errors

Return error codes directly and fix weird reporting of errors via
temporary variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainSaveImageOpen: Use 'g_new0' instead of VIR_ALLOC(_N)
Peter Krempa [Wed, 22 Apr 2020 14:22:58 +0000 (16:22 +0200)]
qemuDomainSaveImageOpen: Use 'g_new0' instead of VIR_ALLOC(_N)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainSaveImageOpen: Automatically close 'fd' if unneeded
Peter Krempa [Wed, 22 Apr 2020 14:19:21 +0000 (16:19 +0200)]
qemuDomainSaveImageOpen: Automatically close 'fd' if unneeded

Use VIR_AUTOCLOSE to declare it and remove all internal closing of the
filedescriptor. This will allow getting rid of 'error' completely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainSaveImageOpen: Use g_autoptr for 'def'
Peter Krempa [Wed, 22 Apr 2020 14:16:19 +0000 (16:16 +0200)]
qemuDomainSaveImageOpen: Use g_autoptr for 'def'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirQEMUSaveData: Register autoclear function and use it in qemuDomainSaveImageOpen
Peter Krempa [Wed, 22 Apr 2020 14:12:39 +0000 (16:12 +0200)]
virQEMUSaveData: Register autoclear function and use it in qemuDomainSaveImageOpen

In an attempt to simplify qemuDomainSaveImageOpen we need to add
automatic pointer clearing for virQEMUSaveData.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: fix domain start with corrupted save file
Peter Krempa [Wed, 22 Apr 2020 14:03:37 +0000 (16:03 +0200)]
qemu: fix domain start with corrupted save file

Commit 21ad56e932 introduced a regression where a VM with a corrupted
save image file would fail to start on the first attempt. This was
caused by returning a wrong return code as 'fd' was abused to also hold
the return code.

Since it's easy to miss this nuance, introduce a 'ret' variable for the
return code and return it' value in the error section.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
5 years agoutil: remove virRun
Ján Tomko [Wed, 22 Apr 2020 14:20:10 +0000 (16:20 +0200)]
util: remove virRun

Everything is using virCommand now.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: remove references to virRun/virExec
Ján Tomko [Wed, 22 Apr 2020 14:10:17 +0000 (16:10 +0200)]
util: remove references to virRun/virExec

virCommand is now used everywhere.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Suggested-by: Sebastian Mitterle <smitterl@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoRemove all usage of virRun
Ján Tomko [Wed, 22 Apr 2020 14:25:24 +0000 (16:25 +0200)]
Remove all usage of virRun

Catch the individual usage not removed in previous commits.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovmware: use virCommand instead of virRun
Ján Tomko [Tue, 21 Apr 2020 17:17:59 +0000 (19:17 +0200)]
vmware: use virCommand instead of virRun

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoopenvz: switch from virRun to virCommand
Ján Tomko [Wed, 22 Apr 2020 14:25:19 +0000 (16:25 +0200)]
openvz: switch from virRun to virCommand

Construct the command in multiple steps instead of using a sentinel
in the args array.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonetworkxml2xmltest: Complete renaming of @actual
Michal Privoznik [Thu, 23 Apr 2020 10:28:43 +0000 (12:28 +0200)]
networkxml2xmltest: Complete renaming of @actual

In 97a0aa2467 the @actual variable was renamed to @confactual.
However, the commit missed non-Linux case resulting in a broken
build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: Add tests for <lease/> to cover dnsmasq settings
Julio Faracco [Wed, 22 Apr 2020 20:05:58 +0000 (17:05 -0300)]
tests: Add tests for <lease/> to cover dnsmasq settings

New tests are required to cover some new XML syntax entry for
<lease/> option. This includes schema testing and other features
like unit attribute and lease value. This commit includes hostsfile
checks adding new files for each test case that is manipulating <host/>
tag.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: Add <lease/> option for <dhcp/> settings
Julio Faracco [Wed, 22 Apr 2020 20:05:57 +0000 (17:05 -0300)]
conf: Add <lease/> option for <dhcp/> settings

If an user is trying to configure a dhcp neetwork settings, it is not
possible to change the leasetime of a range or a host entry. This is
available using dnsmasq extra options, but they are associated with
dhcp-range or dhcp-hosts fields. This patch implements a leasetime for
range and hosts tags. They can be defined under that settings:

    <dhcp>
      <range ...>
        <lease/>
      </range>
      <host ...>
        <lease/>
      </host>
    </dhcp>

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

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: drvqemu: trivial fix for qemu commands passthrough
Chen Hanxiao [Wed, 22 Apr 2020 16:02:20 +0000 (12:02 -0400)]
docs: drvqemu: trivial fix for qemu commands passthrough

element <qemu:commandline> should be the child of <domain>

Signed-off-by: Chen Hanxiao <chen_han_xiao@126.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agonews: Document new Xen hypervisor features
Jim Fehlig [Tue, 21 Apr 2020 22:05:40 +0000 (16:05 -0600)]
news: Document new Xen hypervisor features

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoudevHandleOneDevice: Remove old instance of device on "move"
Michal Privoznik [Mon, 20 Apr 2020 14:12:03 +0000 (16:12 +0200)]
udevHandleOneDevice: Remove old instance of device on "move"

When a device is "move"-d (this basically means it was renamed),
we add the new device onto our list but keep the old there too.
Fortunately, udev sets this DEVPATH_OLD property which points to
the old device path. We can use it to remove the old instance.

To test this try renaming an interface, for instance:

  # ip link set tunl0 name tunl1
  # ip link set tunl1 name tunl0

One problem with udev is that it sends old ifname in INTERFACE
property, which creates a problem for us, the property is where
we get the ifname from and use it then to query all kind of info
about the interface. Well, if it is non-existent then we can't
query anything. This happens if ifname rename is suppressed
(net.ifnames=0 on kernel cmd line for instance). Fortunately, we
can use "kernel" source for udev events which has always the
fresh info.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
5 years agonode_device_udev: Split udevRemoveOneDevice() into two
Michal Privoznik [Mon, 20 Apr 2020 13:59:19 +0000 (15:59 +0200)]
node_device_udev: Split udevRemoveOneDevice() into two

Move internals of udevRemoveOneDevice() into a separate function
which accepts sysfs path as an argument and actually removes the
device from the internal list. It will be reused later.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
5 years agoudevRemoveOneDevice: Unlock node device obj upon return
Michal Privoznik [Mon, 20 Apr 2020 13:40:01 +0000 (15:40 +0200)]
udevRemoveOneDevice: Unlock node device obj upon return

When removing a node device object from the internal list the
udevRemoveOneDevice() function does plain unref over the object.
This is not sufficient. If there is another thread that's waiting
for the object lock it will wait forever.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: split out virDomainFeaturesDefParse
Ján Tomko [Tue, 21 Apr 2020 16:35:59 +0000 (18:35 +0200)]
conf: split out virDomainFeaturesDefParse

The virDomainDefParseXML function has grown so large it broke the build:
../../src/conf/domain_conf.c:20362:1: error: stack frame size of 4168 bytes
in function 'virDomainDefParseXML' [-Werror,-Wframe-larger-than=]

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu-cgroup: remove unnecessary include
Marc-André Lureau [Wed, 8 Apr 2020 17:23:51 +0000 (19:23 +0200)]
qemu-cgroup: remove unnecessary include

The file doesn't use virSystemd functions directly.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu-dbus: register DBus bus to the VM cgroup
Marc-André Lureau [Wed, 8 Apr 2020 17:23:50 +0000 (19:23 +0200)]
qemu-dbus: register DBus bus to the VM cgroup

External devices are started before cgroup is created. Add the DBus
daemon to the VM cgroup with the rest of the external devices.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu-dbus: remove unused variable
Marc-André Lureau [Wed, 8 Apr 2020 17:23:49 +0000 (19:23 +0200)]
qemu-dbus: remove unused variable

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu-dbus: prevent double start of the bus daemon
Marc-André Lureau [Wed, 8 Apr 2020 17:23:48 +0000 (19:23 +0200)]
qemu-dbus: prevent double start of the bus daemon

Allow calling qemuDBusStart() multiple times (as may be done by
qemu-slirp already).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoslirp: add helper to VM cgroup
Marc-André Lureau [Wed, 8 Apr 2020 17:23:47 +0000 (19:23 +0200)]
slirp: add helper to VM cgroup

The slirp helper process should be associated with the VM cgroup, like
other helpers.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoslirp: leave the dbus daemon running on error
Marc-André Lureau [Wed, 8 Apr 2020 17:23:46 +0000 (19:23 +0200)]
slirp: leave the dbus daemon running on error

Don't stop the DBus daemon if a slirp helper failed to start, as it
may be shared with other helpers.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovirsh: Fix return code for dump and migrate
Andrea Bolognani [Tue, 21 Apr 2020 17:06:16 +0000 (19:06 +0200)]
virsh: Fix return code for dump and migrate

When the job monitoring logic was refactored, these two commands
were not converted properly and the result is that a successful
dump or migration (char '0') would be reported as a failed one
(int 48) instead.

Fixes: dc0771cfa2e78ffecd7c8234538ee548748d7bef
Reported-by: Brian Rak <brak@gameservers.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Remove stray parenthesis
Jim Fehlig [Tue, 21 Apr 2020 22:09:24 +0000 (16:09 -0600)]
docs: Remove stray parenthesis

Commit fadbaa2375 introduced a stray parenthesis in formatdomain.html.in.
Remove it.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
5 years agoCONTRIBUTING: Include information on build dependencies
Andrea Bolognani [Mon, 20 Apr 2020 10:49:09 +0000 (12:49 +0200)]
CONTRIBUTING: Include information on build dependencies

libvirt depends on a ton of packages, so trying to install them
all by using the classic approach of repeatedly running configure
and reacting to each failure by installing the corresponding
missing package will inevitably lead to frustration.

Luckily there's an easy solution to get most dependencies
installed in one fell swoop, and we just need to document it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
5 years agotests: check conversion of passthrough hypervisor feature
Jim Fehlig [Fri, 17 Apr 2020 20:19:16 +0000 (14:19 -0600)]
tests: check conversion of passthrough hypervisor feature

Add a new test to check the 'mode' attribute of the passthrough element
and augment an existing, related test to check enablement of the
passthrough element only.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoxenconfig: Add support for 'passthrough' hypervisor feature
Jim Fehlig [Thu, 16 Apr 2020 14:31:48 +0000 (08:31 -0600)]
xenconfig: Add support for 'passthrough' hypervisor feature

Add support for xl.cfg(5) 'passthrough' option in the domXML-to-xenconfig
configuration converter.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolibxl: refactor cpu and hypervisor feature parser/formatter
Jim Fehlig [Thu, 16 Apr 2020 03:48:42 +0000 (21:48 -0600)]
libxl: refactor cpu and hypervisor feature parser/formatter

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolibxl: make use of passthrough hypervisor feature
Jim Fehlig [Wed, 15 Apr 2020 23:18:25 +0000 (17:18 -0600)]
libxl: make use of passthrough hypervisor feature

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: add xen hypervisor feature 'passthrough'
Jim Fehlig [Wed, 15 Apr 2020 22:34:54 +0000 (16:34 -0600)]
conf: add xen hypervisor feature 'passthrough'

'passthrough' is Xen-Specific guest configuration option new to Xen 4.13
that enables IOMMU mappings for a guest and hence whether it supports PCI
passthrough. The default is disabled. See the xl.cfg(5) man page and
xen.git commit babde47a3fe for more details.

The default state of disabled prevents hotlugging PCI devices. However,
if the guest configuration contains a PCI passthrough device at time of
creation, libxl will automatically enable 'passthrough' and subsequent
hotplugging of PCI devices will also be possible. It is not possible to
unconditionally enable 'passthrough' since it would introduce a migration
incompatibility due to guest ABI change. Instead, introduce another Xen
hypervisor feature that can be used to enable guest PCI passthrough

  <features>
    <xen>
      <passthrough state='on'/>
    </xen>
  </features>

To allow finer control over how IOMMU maps to guest P2M table, the
passthrough element also supports a 'mode' attribute with values
restricted to snyc_pt and share_pt, similar to xl.cfg(5) 'passthrough'
setting .

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: check e820_host option handling
Marek Marczykowski-Górecki [Tue, 14 Apr 2020 02:37:07 +0000 (04:37 +0200)]
tests: check e820_host option handling

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
5 years agoxenconfig: parse e820_host option
Marek Marczykowski-Górecki [Tue, 14 Apr 2020 02:37:06 +0000 (04:37 +0200)]
xenconfig: parse e820_host option

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
5 years agolibxl: make use of e820_host feature
Marek Marczykowski-Górecki [Tue, 14 Apr 2020 02:37:05 +0000 (04:37 +0200)]
libxl: make use of e820_host feature

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
5 years agoconf: add xen specific feature: e820_host
Marek Marczykowski-Górecki [Tue, 14 Apr 2020 02:37:04 +0000 (04:37 +0200)]
conf: add xen specific feature: e820_host

e820_host is a Xen-specific option, only available for PV domains, that
provides the domain a virtual e820 memory map based on the host one. It
is enabled with a new Xen hypervisor feature, e.g.

  <features>
    <xen>
      <e820_host state='on'/>
    </xen>
  </features>

e820_host is required when using PCI passthrough and is generally
considered safe for any PV kernel. e820_host is silently ignored if set
in HVM domain configuration. See xl.cfg(5) man page in the Xen
documentation for more details.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
5 years agoREADME: Add GitLab CI badge
Andrea Bolognani [Tue, 14 Apr 2020 13:19:54 +0000 (15:19 +0200)]
README: Add GitLab CI badge

We've moved most of our CI jobs to GitLab, so we should display
the corresponding badge prominently.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoCONTRIBUTING: Include in release archives
Andrea Bolognani [Tue, 14 Apr 2020 11:56:36 +0000 (13:56 +0200)]
CONTRIBUTING: Include in release archives

The file, added with commit

  commit 874952f80c6d68c1a7a75e71c11a576f96f75dc2
  Author: Andrea Bolognani <abologna@redhat.com>
  Date:   Mon Apr 6 11:56:58 2020 +0200

    CONTRIBUTING: Add entry point for new contributors

should be included in release archives.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoAvoid unnecessary error messages handling udev events
Mark Asselstine [Thu, 16 Apr 2020 15:57:46 +0000 (11:57 -0400)]
Avoid unnecessary error messages handling udev events

The udev monitor thread "udevEventHandleThread()" will lag the
actual/real view of devices in sysfs as it serially processes udev
monitor events. So for instance if you were to run the following cmd
to create a new veth pair and rename one of the veth endpoints

you might see the following monitor events and real world that looks like

                                     time
              |    create v0 sysfs entry
wake udevEventHandleThread            |    create v1 sysfs entry
udev_monitor_receive_device(v1-add)   |    move v0 sysfs to v2
udevHandleOneDevice(v1)               |
udev_monitor_receive_device(v0-add)   |
udevHandleOneDevice(v0)               | <--- error msgs in virNetDevGetLinkInfo()
udev_monitor_receive_device(v2-move)  |      as v0 no longer exists
udevHandleOneDevice(v2)               |
                                     \/

As you can see the changes in sysfs can take place well before we get
to act on the events in the udevEventHandleThread(), so by the time we
get around to processing the v0 add event, the sysfs entry has been
moved to v2.

To work around this we check if the sysfs entry is valid before
attempting to read it and don't bother trying to read link info if
not. This is safe since we will never read sysfs entries earlier than
it existing, ie. if the entry is not there it has either been removed
in the time since we enumerated the device or something bigger is
busted, in either case, no sysfs entry, no link info. In the case
described above we will eventually get the link info as we work
through the queue of monitor events and get to the 'move' event.

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

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonode_device_udev: handle move events
Mark Asselstine [Thu, 16 Apr 2020 15:57:45 +0000 (11:57 -0400)]
node_device_udev: handle move events

It is possible and common to rename some devices, this is especially
true for ethernet devices such as veth pairs.

In the udevEventHandleThread() we will be notified of this change but
currently we only process "add", "change" and "remove"
events. Renaming a device such as above results in a "move" event, not
a "remove" followed by and "add" or vise versa. This change will add
the new/destination device to our records but unfortunately there is
no usable mechanism to identify the old/source device to remove it
from the records. So this is admittedly only a partial fix.

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodoc/python: Update to Python 3
Philipp Hahn [Mon, 20 Apr 2020 13:01:11 +0000 (15:01 +0200)]
doc/python: Update to Python 3

Convert the simple example to Python 3 syntax:
- print() is a function
- do not use bare except
- libvirt.open*() does not return None but raises an exception

The referenced source for the example was removed with
5bb2a245abbde4c0a407f631660e2f2c81bc4c02

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Philipp Hahn <hahn@univention.de>
5 years agodocs: add news about virtualbox version support changes
Daniel P. Berrangé [Fri, 17 Apr 2020 11:56:25 +0000 (12:56 +0100)]
docs: add news about virtualbox version support changes

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: add support for version 6.1 SDK
Daniel P. Berrangé [Fri, 17 Apr 2020 10:57:54 +0000 (11:57 +0100)]
vbox: add support for version 6.1 SDK

Changes in the API:

 - APIs related to the graphics adapter are no longer on the
   IMachine interface, but on a IGraphicsAdapter interface
 - The LaunchVMProcess method takes a list of env variables
   instead of a single variable containing a concatenated
   list. Since we only ever pass a single env variable, we
   can simply stuff it straight into a list.
 - The DHCP server start method no longer needs the network
   name

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: add version 6.1 CAPI header
Daniel P. Berrangé [Fri, 17 Apr 2020 11:16:41 +0000 (12:16 +0100)]
vbox: add version 6.1 CAPI header

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: add support for version 6.0 SDK
Daniel P. Berrangé [Fri, 17 Apr 2020 10:57:54 +0000 (11:57 +0100)]
vbox: add support for version 6.0 SDK

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: add version 6.0 CAPI header
Daniel P. Berrangé [Fri, 17 Apr 2020 11:16:41 +0000 (12:16 +0100)]
vbox: add version 6.0 CAPI header

Changes in the API:

 - The CreatedSharedFolder method now accepts a target mount
   point. Since we don't request automount, we're just passing
   NULL. We could, however, use this to pass the desired
   mount target from the XML config in future.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: remove unused support for Windows MSCOM
Daniel P. Berrangé [Fri, 17 Apr 2020 11:12:09 +0000 (12:12 +0100)]
vbox: remove unused support for Windows MSCOM

Long ago we switched the vbox driver to run inside libvirtd to avoid
libvirt.so being polluted with GPLv2-only code. Since libvirtd is not
built on Windows, we disabled vbox on Windows builds. Thus the MSCOM
glue code is not required.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: remove version 5.1 CAPI header
Daniel P. Berrangé [Fri, 17 Apr 2020 11:05:36 +0000 (12:05 +0100)]
vbox: remove version 5.1 CAPI header

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: remove support for version 5.1 API
Daniel P. Berrangé [Fri, 17 Apr 2020 11:03:50 +0000 (12:03 +0100)]
vbox: remove support for version 5.1 API

This is no longer supported since 2018/04

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: remove version 5.0 CAPI header
Daniel P. Berrangé [Fri, 17 Apr 2020 11:05:36 +0000 (12:05 +0100)]
vbox: remove version 5.0 CAPI header

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovbox: remove support for version 5.0 API
Daniel P. Berrangé [Fri, 17 Apr 2020 11:03:50 +0000 (12:03 +0100)]
vbox: remove support for version 5.0 API

This is no longer supported since 2017/05

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirnetdev.c: Use g_auto*()
Michal Privoznik [Sun, 19 Apr 2020 05:24:40 +0000 (07:24 +0200)]
virnetdev.c: Use g_auto*()

While I'm at it, use more g_autofree and g_autoptr() in this
file. This also fixes a possible mem-leak in
virNetDevGetVirtualFunctions().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirNetDevSwitchdevFeature: Make failure to get 'family_id' non-fatal
Michal Privoznik [Sun, 19 Apr 2020 05:25:34 +0000 (07:25 +0200)]
virNetDevSwitchdevFeature: Make failure to get 'family_id' non-fatal

I've just got a new machine and I'm still converging on the
kernel config. Anyway, since I don't have enabled any of SRIO-V
drivers, my kernel doesn't have NET_DEVLINK enabled (i.e.
virNetDevGetFamilyId() returns 0). But this makes nodedev driver
ignore all interfaces, because when enumerating all devices via
udev, the control reaches virNetDevSwitchdevFeature() eventually
and subsequently virNetDevGetFamilyId() which 'fails'. Well, it's
not really a failure - the virNetDevSwitchdevFeature() stub
simply returns 0.

Also, move the call a few lines below, just around the place
where it's needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirNetDevGetFamilyId: Change signature
Michal Privoznik [Sun, 19 Apr 2020 06:26:04 +0000 (08:26 +0200)]
virNetDevGetFamilyId: Change signature

Introduced in v3.8.0-rc1~96, the virNetDevGetFamilyId() gets
netlink family ID for passed family name (even though it's used
only for getting "devlink" ID). Nevertheless, the function
returns 0 on an error or if no family ID was found. This makes it
harder for a caller to distinguish these two. Change the retval
so that a negative value is returned upon error, zero is no ID
found (but no error encountered) and a positive value is returned
on successful translation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Do not include sys/wait.h on Win32
Jiri Denemark [Fri, 17 Apr 2020 18:27:00 +0000 (20:27 +0200)]
util: Do not include sys/wait.h on Win32

This fixes build on mingw broken by my previous commit 36e125296a.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu: Label restore path outside of secdriver transactions
Michal Privoznik [Fri, 3 Apr 2020 08:28:17 +0000 (10:28 +0200)]
qemu: Label restore path outside of secdriver transactions

As explained in the previous commit, we need to relabel the file
we are restoring the domain from. That is the FD that is passed
to QEMU. If the file is not under /dev then the file inside the
namespace is the very same as the one in the host. And regardless
of using transactions, the file will be relabeled. But, if the
file is under /dev then when using transactions only the copy
inside the namespace is relabeled and the one in the host is not.
But QEMU is reading from the one in the host, actually.

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agosecurity: Introduce virSecurityManagerDomainSetPathLabelRO
Michal Privoznik [Fri, 3 Apr 2020 12:31:35 +0000 (14:31 +0200)]
security: Introduce virSecurityManagerDomainSetPathLabelRO

This API allows drivers to separate out handling of @stdin_path
of virSecurityManagerSetAllLabel(). The thing is, the QEMU driver
uses transactions for virSecurityManagerSetAllLabel() which
relabels devices from inside of domain's namespace. This is what
we usually want. Except when resuming domain from a file. The
file is opened before any namespace is set up and the FD is
passed to QEMU to read the migration stream from. Because of
this, the file lives outside of the namespace and if it so
happens that the file is a block device (i.e. it lives under
/dev) its copy will be created in the namespace. But the FD that
is passed to QEMU points to the original living in the host and
not in the namespace. So relabeling the file inside the namespace
helps nothing.

But if we have a separate API for relabeling the restore file
then the QEMU driver can continue calling
virSecurityManagerSetAllLabel() with transactions enabled and
call this new API without transactions.

We already have an API for relabeling a single file
(virSecurityManagerDomainSetPathLabel()) but in case of SELinux
it uses @imagelabel (which allows RW access) and we want to use
@content_context (which allows RO access).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agoutil: Fix virDaemonForkIntoBackground
Jiri Denemark [Thu, 16 Apr 2020 13:11:06 +0000 (15:11 +0200)]
util: Fix virDaemonForkIntoBackground

This commit partially reverts

    commit c360ea28dc267802690e129fbad08ca2f22a44e9
    Refs: v6.2.0-rc1-1-gc360ea28dc
    Author:     Rafael Fonseca <r4f4rfs@gmail.com>
    AuthorDate: Fri Mar 27 18:40:47 2020 +0100
    Commit:     Michal Prívozník <mprivozn@redhat.com>
    CommitDate: Mon Mar 30 09:48:22 2020 +0200

    util: virdaemon: fix compilation on mingw

    The daemons are not supported on Win32 and therefore were not compiled
    in that platform. However, with the daemon code sharing, all the code in
    utils *is* compiled and it failed because `waitpid`, `fork`, and
    `setsid` are not available. So, as before, let's not build them on
    Win32 and make the code more portable by using existing vir* wrappers.

Not compiling virDaemonForkIntoBackground on Win32 is good, but the
second part of the original patch incorrectly replaced waitpid and fork
with our virProcessWait and virFork APIs. These APIs are more than just
simple wrappers and we don't want any of the extra functionality.
Especially virFork would reset any setup made before
virDaemonForkIntoBackground is called, such as logging, signal handling,
etc.

As a result of the change the additional fix in v6.2.0-67-ga87e4788d2
(util: virdaemon: fix waiting for child processes) is no longer
needed and it is effectively reverted by this commit.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: Improve zPCI section in pci-addresses.rst
Boris Fiuczynski [Fri, 17 Apr 2020 12:27:34 +0000 (14:27 +0200)]
docs: Improve zPCI section in pci-addresses.rst

Improving the zPCI example by choosing more distinct values and
adding explanation for fid.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: Update introduction in pci-addresses.rst
Andrea Bolognani [Fri, 17 Apr 2020 12:27:33 +0000 (14:27 +0200)]
docs: Update introduction in pci-addresses.rst

Changing the introduction to bring the idea of this document better across.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
5 years agodocs: Add section about code blocks to styleguide.rst
Andrea Bolognani [Thu, 16 Apr 2020 16:36:48 +0000 (18:36 +0200)]
docs: Add section about code blocks to styleguide.rst

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: fix mistaken description of the read-only socket units
Daniel P. Berrangé [Thu, 16 Apr 2020 13:18:42 +0000 (14:18 +0100)]
docs: fix mistaken description of the read-only socket units

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: remove old unused favicon file
Daniel P. Berrangé [Thu, 16 Apr 2020 11:52:13 +0000 (12:52 +0100)]
docs: remove old unused favicon file

The use of 32favicon.png was removed when the new favicons were
introduced in

  commit 40cb5581c4ace6c4a5b68990aaac4dff1b656054
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Jul 26 18:22:11 2017 +0100

    docs: add full set of "favicon" files to support modern clients

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: add missing files to static asset list
Daniel P. Berrangé [Thu, 16 Apr 2020 11:49:29 +0000 (12:49 +0100)]
docs: add missing files to static asset list

The various favicon files were missing from the favicon list, so never
installed, as was an example code diagram.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: fix handling of static assets in build dir
Daniel P. Berrangé [Thu, 16 Apr 2020 11:41:52 +0000 (12:41 +0100)]
docs: fix handling of static assets in build dir

We previously added a hack to symlink CSS files from the source dir into
the build dir, to allow the website to be browsed locally. We should
have also done this for any images.

This change merges several variables into one "$(assets)" so that we
treat all static files in the root dir the same way.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobhyve: add missing param to virDomainPCIAddressBusSetModel
Daniel P. Berrangé [Thu, 16 Apr 2020 10:39:49 +0000 (10:39 +0000)]
bhyve: add missing param to virDomainPCIAddressBusSetModel

Fixes build error introduced in

  commit aa15e9259f1f246e69fb9742581ced720c88695d
  Author: Laine Stump <laine@redhat.com>
  Date:   Sun Apr 5 22:40:37 2020 -0400

    qemu/conf: set HOTPLUGGABLE connect flag during PCI address set init

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: Trivial comment fix
Leonid Bloch [Thu, 16 Apr 2020 11:24:54 +0000 (14:24 +0300)]
conf: Trivial comment fix

Trivial comment fix, reflecting the changes in
4ee2b31804f4d3477ee83bac28d9991afb0c3393.

Signed-off-by: Leonid Bloch <lb.workbox@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemuDomainDefPostParse: Fail if unable to fill machine type
Michal Privoznik [Thu, 16 Apr 2020 12:18:28 +0000 (14:18 +0200)]
qemuDomainDefPostParse: Fail if unable to fill machine type

Previously, we used virCapabilitiesDomainDataLookup() to fill
machine type in post parse callback if none was provided in the
domain XML. If machine type couldn't be filled in an error was
reported. After 4a4132b4625 we've changed it to
virQEMUCapsGetPreferredMachine() which returns NULL, but we no
longer report an error and proceed with the post parse callbacks
processing. This may lead to a crash because the code later on
assumes def->os.machine is not NULL.

Fixes: 4a4132b4625
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
5 years agoqemu: Revoke access to mirror on failed blockcopy
Michal Privoznik [Tue, 14 Apr 2020 09:18:02 +0000 (11:18 +0200)]
qemu: Revoke access to mirror on failed blockcopy

When preparing to do a blockcopy, the mirror image is modified so
that QEMU can access it. For instance, the mirror has seclabels
set, if it is a NVMe disk it is detached from the host and so on.
And usually, the restore is done upon successful finish of the
blockcopy operation. But, if something fails then we need to
explicitly revoke the access to the mirror image (and thus
reattach NVMe disk back to the host).

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1822538
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
5 years agodocs: Remove one example from pci-addresses.rst
Andrea Bolognani [Wed, 15 Apr 2020 17:12:46 +0000 (19:12 +0200)]
docs: Remove one example from pci-addresses.rst

The idea behind this document is to show, with actual examples,
that users should not expect PCI addresses in the domain XML and
in the guest OS to match.

The first zPCI example already serves this purpose perfectly, so
in the interest of keeping the page as brief and easy to digest
as possible the second one is removed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
5 years agodocs: Remove MAC addresses from pci-addresses.rst
Andrea Bolognani [Wed, 15 Apr 2020 17:11:18 +0000 (19:11 +0200)]
docs: Remove MAC addresses from pci-addresses.rst

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
5 years agodocs: Move sections around in pci-addresses.rst
Andrea Bolognani [Wed, 15 Apr 2020 17:11:01 +0000 (19:11 +0200)]
docs: Move sections around in pci-addresses.rst

The section about VFIO devices is kept separate from the rest
because it's less about domain XML and guest OS disagreeing on the
PCI address of a device, and more about which of the two PCI
addresses in the domain XML is even relevant to the guest OS.

The section on zPCI addresses, on the other hand, falls squarely
in the "more complex cases" category, so it should live in the
corresponding section.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
5 years agodocs: Use consistent style in pci-addresses.rst
Andrea Bolognani [Wed, 15 Apr 2020 17:09:34 +0000 (19:09 +0200)]
docs: Use consistent style in pci-addresses.rst

Indent all code snippets by the same number of spaces, and don't
embed the :: marker in the line preceding a code block.

This commit is best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
5 years agoqemu: fix hang in p2p + xbzrle compression + parallel migration
Lin Ma [Thu, 16 Apr 2020 04:44:51 +0000 (12:44 +0800)]
qemu: fix hang in p2p + xbzrle compression + parallel migration

When we do parallel migration, The multifd-channels migration parameter
needs to be set on the destination side as well before incoming migration
URI, unless we accept the default number of connections(2).

Usually, This can be correctly handled by libvirtd. But in this case if
we use p2p + xbzrle compression without parameter '--comp-xbzrle-cache',
qemuMigrationParamsDump returns too early, The corresponding migration
parameter will not be set on the destination side, It results QEMU hangs.

Reproducer:
virsh migrate --live --p2p --comp-methods xbzrle \
--parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system

or

virsh migrate --live --p2p --compressed \
--parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system

Signed-off-by: Lin Ma <lma@suse.com>
Message-Id: <20200416044451.21134-1-lma@suse.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agogitlab: Enable improved ccache usage
Andrea Bolognani [Mon, 30 Mar 2020 16:29:06 +0000 (18:29 +0200)]
gitlab: Enable improved ccache usage

Setting CC="ccache cc" works in most cases, but sometimes it will
break the build: in particular, we have experienced issues in the
past with that approach when using cgo to build our Go bindings.

A more robust approach is to have a directory containing symlinks
from the compiler name to the ccache binary: in that case, ccache
itself will invoke the compiler, and the build system will be none
the wiser.

Since libvirt-ci commit 2563aebb6c5c, container images contain a
suitable symlink directory, so all that's needed to enable the new
approach is to add this directory to $PATH.

Since we're touching this anyway, we make a few more changes:
$CCACHE_DIR is no longer created manually, because ccache will
take care of creating it for us if it doesn't already exist; the
ccache setup is moved out of the job template and into
script_variables, removing unnecessary duplication; a limit is
set on the size of the cache (500 MB, which is twice the amount
used by a fresh build on my Fedora 31 machine).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitlab: Don't define $MAKE
Andrea Bolognani [Mon, 30 Mar 2020 16:26:16 +0000 (18:26 +0200)]
gitlab: Don't define $MAKE

Since libvirt-ci commit 27cfddee8835, paths to build tools such as
ninja and make are exported in the container's environment and can
be used directly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: add zpci information to pci-addresses.rst
Cornelia Huck [Wed, 15 Apr 2020 10:51:51 +0000 (12:51 +0200)]
docs: add zpci information to pci-addresses.rst

Add some information on how pci address work on s390x.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: Fix word repetition in pci-addresses.rst
Andrea Bolognani [Wed, 15 Apr 2020 08:49:42 +0000 (10:49 +0200)]
docs: Fix word repetition in pci-addresses.rst

Fixes: 2923e7a3dd984c46202703d390dce3ff4ea4048c
Reported-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
5 years agoapparmor: avoid denials on libpmem initialization
Christian Ehrhardt [Wed, 8 Apr 2020 14:47:58 +0000 (16:47 +0200)]
apparmor: avoid denials on libpmem initialization

With libpmem support compiled into qemu it will trigger the following
denials on every startup.
  apparmor="DENIED" operation="open" name="/"
  apparmor="DENIED" operation="open" name="/sys/bus/nd/devices/"

This is due to [1] that tries to auto-detect if the platform supports
auto flush for all region.

Once we know all the paths that are potentially needed if this feature
is really used we can add them conditionally in virt-aa-helper and labelling
calls in case </pmem> is enabled.

But until then the change here silences the denial warnings seen above.

[1]: https://github.com/pmem/pmdk/blob/master/src/libpmem2/auto_flush_linux.c#L131

Bug: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1871354

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Acked-by: Jamie Strandboge <jamie@canonical.com>
5 years agodocs: Add pci-addresses.rst
Andrea Bolognani [Tue, 14 Apr 2020 17:37:09 +0000 (19:37 +0200)]
docs: Add pci-addresses.rst

This document describes the relationship between PCI addresses as
seen in the domain XML and by the guest OS, which is a topic that
people get confused by time and time again.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
5 years agobackup: Allow 'encryption' of backups and scratch images
Peter Krempa [Thu, 9 Apr 2020 13:50:40 +0000 (15:50 +0200)]
backup: Allow 'encryption' of backups and scratch images

Add the appropriate entries into the schema to allow encryption of the
backup or scratch image. Since we use blockdev internals for everything
no changes to the code are actually necessary.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: backup: Remove references to push backup to network disk
Peter Krempa [Thu, 9 Apr 2020 14:19:59 +0000 (16:19 +0200)]
docs: backup: Remove references to push backup to network disk

It was never implemented and for now I don't think there's demand to do
it. Remove the reference.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: Don't format http cookies unless VIR_DOMAIN_DEF_FORMAT_SECURE is used
Peter Krempa [Tue, 14 Apr 2020 08:31:02 +0000 (10:31 +0200)]
conf: Don't format http cookies unless VIR_DOMAIN_DEF_FORMAT_SECURE is used

Starting with 3b076391befc3fe72deb0c244ac6c2b4c100b410
(v6.1.0-122-g3b076391be) we support http cookies. Since they may contain
somewhat sensitive information we should not format them into the XML
unless VIR_DOMAIN_DEF_FORMAT_SECURE is asserted.

Reported-by: Han Han <hhan@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agovirstoragetest: testBackingParse: Use VIR_DOMAIN_DEF_FORMAT_SECURE when formatting xml
Peter Krempa [Tue, 14 Apr 2020 08:26:24 +0000 (10:26 +0200)]
virstoragetest: testBackingParse: Use VIR_DOMAIN_DEF_FORMAT_SECURE when formatting xml

We want to format even the secure information in tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agovirsh: cmdUndefine: Properly extract delete-storage-volume-snapshots flag
Peter Krempa [Thu, 9 Apr 2020 13:25:35 +0000 (15:25 +0200)]
virsh: cmdUndefine: Properly extract delete-storage-volume-snapshots flag

Commit 86608f787ee added the above flag as an alias for ambiguous
'delete-snapshots' flag, but forgot to actually change the code that
extracts it, thus the new version actually doesn't work.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: backup: Fix handling of backing store for backup target images
Peter Krempa [Tue, 31 Mar 2020 13:43:46 +0000 (15:43 +0200)]
qemu: backup: Fix handling of backing store for backup target images

We always tried to install backing store for the image even if it didn't
make sense, e.g. for a full backup into a raw image. Additionally we
didn't record the backing file into the qcow2 metadata so the image
itself contained the diff of data but reading from it would be
incomplete as it depends on the backing image.

This patch fixes both issues by carefully installing the correct backing
file when appropriate and also recording it into the metadata when
creating the image.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoConvert all remaining Markdown files to reStructuredText
Andrea Bolognani [Tue, 14 Apr 2020 10:59:04 +0000 (12:59 +0200)]
Convert all remaining Markdown files to reStructuredText

We've adopted reStructuredText as the primary markup language for
our documentation and, given that both GitLab and GitHub can render
documents in this format just fine, it makes sense to get rid of
the few last remaining bits of Markdown and standardize on
reStructuredText across the board.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolibvirt-stream: Convert to the g_autofree usage
Seeteena Thoufeek [Mon, 13 Apr 2020 12:49:26 +0000 (18:19 +0530)]
libvirt-stream: Convert to the g_autofree usage

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agodriver: Yet 1 more g_autofree conversion change
Seeteena Thoufeek [Mon, 13 Apr 2020 12:48:57 +0000 (18:18 +0530)]
driver: Yet 1 more g_autofree conversion change

This is the last missing g_autofree conversion change in the module after
commit 1e2ae2e311c took care of the VIR_AUTOFREE conversion.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>