]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agoPost-release version bump to 4.3.0
Michal Privoznik [Sun, 1 Apr 2018 10:32:36 +0000 (12:32 +0200)]
Post-release version bump to 4.3.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoRelease of libvirt-4.2.0
Daniel Veillard [Sun, 1 Apr 2018 08:07:38 +0000 (10:07 +0200)]
Release of libvirt-4.2.0

* docs/news.xml: updated
* po/*.po*: regenerated

Signed-off-by: Daniel Veillard <veillard@redhat.com>
7 years agovirsh: add missing help info of --source to domifaddr
Chen Hanxiao [Fri, 16 Mar 2018 02:03:15 +0000 (10:03 +0800)]
virsh: add missing help info of --source to domifaddr

commit b4b5c82ce forgot to add this.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
7 years agoremote: remove outdated comment about Solaris
Daniel P. Berrangé [Wed, 28 Mar 2018 15:11:53 +0000 (16:11 +0100)]
remote: remove outdated comment about Solaris

When removing a conditional in:

  commit da1ade7a52e040192c5e9396c15ec9225a0a2c48
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Fri Mar 23 10:50:59 2018 +0000

    remote: remove some __sun conditionals

the corresponding comment was mistakenly left behind.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoopenvz: Cleanup indention
John Ferlan [Mon, 23 Oct 2017 16:04:43 +0000 (12:04 -0400)]
openvz: Cleanup indention

Some of the indents were only 2 spaces, make consistent w/ 4 spaces.
Also some indents didn't align properly. Fix them all up.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoqemu: do not drop implicit controllers with non-implicit attributes
Ján Tomko [Sun, 25 Mar 2018 18:54:07 +0000 (20:54 +0200)]
qemu: do not drop implicit controllers with non-implicit attributes

If someone set a user alias or pcihole64 on an implicit controller,
we need to format it to migrate the domain properly.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Joseph Richard <Joseph.Richard@windriver.com>
7 years agovirDomainDeviceAliasIsUserAlias: tolerate NULL
Ján Tomko [Sun, 25 Mar 2018 19:14:21 +0000 (21:14 +0200)]
virDomainDeviceAliasIsUserAlias: tolerate NULL

Do not crash in virDomainDeviceInfoParseXML if someone provides
an 'alias' element without a 'name' attribute.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agopolkit: reintroduce check for pkcheck
Ján Tomko [Fri, 23 Mar 2018 18:10:35 +0000 (19:10 +0100)]
polkit: reintroduce check for pkcheck

Commit 2499d1a0 was too eager and possibly enabled polkit
on all platforms with D-Bus, regardless of whether they use polkit.

Reintroduce the usage of pkcheck as a witness for --with-polkit=check,
but do not require it for --with-polkit=yes.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Jiří Denemark <jdenemar@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agobuild: Remove --with-xml-catalog-file option
Rainer Müller [Fri, 23 Mar 2018 20:36:34 +0000 (21:36 +0100)]
build: Remove --with-xml-catalog-file option

After validation against XHTML 1.0 was dropped in f802c9de0,
the XML_CATALOG_FILE is not in use anymore. Therefore the checks in
configure can be removed.

Signed-off-by: Rainer Müller <raimue@codingfarm.de>
7 years agotests: qemucapabilities: Drop mostly duplicated data
Andrea Bolognani [Fri, 23 Mar 2018 12:31:14 +0000 (13:31 +0100)]
tests: qemucapabilities: Drop mostly duplicated data

When GIC support was introduced (QEMU 2.6 timeframe) we needed
to make sure both GICv2 hardware and GICv3 hardware were handled
correctly, and that was achieved by having separate capabilities
data for each.

Now that we have capabilities data for several QEMU versions we
can stop storing data for GICv2 and GICv3 hardware separately,
and instead have GICv2 data for QEMU <= 2.10 and GICv3 data for
QEMU >= 2.12, without losing any coverage.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agotests: domaincaps: Add QEMU 2.12
Andrea Bolognani [Fri, 23 Mar 2018 12:58:42 +0000 (13:58 +0100)]
tests: domaincaps: Add QEMU 2.12

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agotests: domaincaps: Order by architecture
Andrea Bolognani [Fri, 23 Mar 2018 12:38:32 +0000 (13:38 +0100)]
tests: domaincaps: Order by architecture

Test cases in qemucapabilitiestest are ordered by architecture
first, then by QEMU version. Use the same order here.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agonews: Update for virtio-gpu-ccw and virtio input ccw devices
Farhan Ali [Fri, 23 Mar 2018 17:22:43 +0000 (13:22 -0400)]
news: Update for virtio-gpu-ccw and virtio input ccw devices

Document support for the virtio-gpu-ccw and
virtio-{keyboard, mouse, tablet}-ccw devices.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
7 years agoqemu: Add support for virtio input ccw devices
Farhan Ali [Fri, 23 Mar 2018 17:22:42 +0000 (13:22 -0400)]
qemu: Add support for virtio input ccw devices

QEMU on S390 (since v2.11) can support virtio input ccw devices.
So build the qemu command line for ccw devices.

Also add test cases for virtio-{keyboard, mouse, tablet}-ccw.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
7 years agoqemu: Introduce capabilities for virtio input ccw devices
Farhan Ali [Fri, 23 Mar 2018 17:22:41 +0000 (13:22 -0400)]
qemu: Introduce capabilities for virtio input ccw devices

QEMU on S390 (since v2.11) can support virtio input ccw devices.
Introduce qemu capabilities for these devices.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
7 years agoqemu: Change default video model type to virtio for S390
Farhan Ali [Fri, 23 Mar 2018 17:22:40 +0000 (13:22 -0400)]
qemu: Change default video model type to virtio for S390

S390 guests can only support a virtio-gpu-ccw device as a video
device. So set default video model type to VIR_DOMAIN_VIDEO_TYPE_VIRTIO
for S390 guests.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
7 years agoqemu: Add support for virtio-gpu-ccw video device on S390
Farhan Ali [Fri, 23 Mar 2018 17:22:39 +0000 (13:22 -0400)]
qemu: Add support for virtio-gpu-ccw video device on S390

QEMU on S390 (since v2.11) can support the virtio-gpu-ccw device,
which can be used as a video device.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
7 years agoqemu: Introduce a new capability for virtio-gpu-ccw
Farhan Ali [Fri, 23 Mar 2018 17:22:38 +0000 (13:22 -0400)]
qemu: Introduce a new capability for virtio-gpu-ccw

QEMU on S390 (since v2.11) can support virtio-gpu-ccw device.
Let's introduce a new qemu capability for the device.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
7 years agoconf: avoid reporting errors when network driver is disabled
Daniel P. Berrangé [Fri, 23 Mar 2018 11:43:53 +0000 (11:43 +0000)]
conf: avoid reporting errors when network driver is disabled

In previous releases all these methods were a no-op if the network
driver is disabled. These helper methods are called unconditionally for
all types of network interface, so must be no-ops if missing. Other code
will already generate an error if the network driver is disabled and a
NIC with type=network is used.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: remove some __sun conditionals
Daniel P. Berrangé [Fri, 23 Mar 2018 10:50:59 +0000 (10:50 +0000)]
remote: remove some __sun conditionals

The libvirtd daemon has some arbitrary logic to drop privileges, but
only on Solaris platforms. This was added during Xen days, when Xen was
the only driver running in libvirtd. There's no expectation or testing
that this works with the new libxl stack, nor whether dropping
privileges breaks any of the secondary drivers. Finally, we'll be
splitting drivers out into their own independant daemons, so this won't
be applicable to libvirtd in future anyway.

The remote driver client meanwhile arbitrarily disables daemon
auto-spawn when connecting as non-root, breaking a key feature of
libvirt unprivileged connections.

Since we've not had any contributions for Solaris since circa 2012
and we don't do any CI testing we should consider this platform
unmaintained and thus reasonable to remove this cruft. If someone steps
forward to maintain Solaris again, this code would need re-evaluating to
come up with something more targetted.

There's various __sun conditionals in the Xen driver code, but those are
not touched. This is all for the legacy Xen driver, which will be
entirely removed at some point in future, so not benefit to hacking out
just the Solaris parts.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: Build smartcard command line more wisely
Michal Privoznik [Fri, 23 Mar 2018 13:24:14 +0000 (14:24 +0100)]
qemu: Build smartcard command line more wisely

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

Similarly to b133fac356324c3 we need to look up alias of CCID
controller when constructing smartcard command line instead of
relying on broken assumption it will always be 'ccid0'. After
user aliases it can be anything.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Fix virQEMUCapsCommands formatting
John Ferlan [Tue, 20 Mar 2018 15:45:15 +0000 (11:45 -0400)]
qemu: Fix virQEMUCapsCommands formatting

Starting with commit id 'fab9d6e1' the formatting of:

{ "command-name", QEMU_CAPS_NAME },

was altered to:

{ "command-name", QEMU_CAPS_NAME},

and then commit id 'e2b05c9a' altered that to:

{ "command-name", QEMU_CAPS_NAME}

So, let's just fix that up to make things consistent with the
rest of the structures.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: domain: Drop declaration of qemuDomainDefValidateDisk
Peter Krempa [Fri, 23 Mar 2018 12:07:37 +0000 (13:07 +0100)]
qemu: domain: Drop declaration of qemuDomainDefValidateDisk

There is no such function in our code. Commit abca72faa49 added it
spuriously.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: qemumonitorjson: Do some useful testing in the 'simple' tests
Peter Krempa [Thu, 22 Mar 2018 18:07:21 +0000 (19:07 +0100)]
tests: qemumonitorjson: Do some useful testing in the 'simple' tests

The 'simple' monitor tests were quite useless, since the code did not
even check whether the correct command was called.

This patch uses the QAPI schema validator to validate that the arguments
are in format according to the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: qemumonitor: Allow testing schema for fake monitor interactions
Peter Krempa [Thu, 22 Mar 2018 18:05:26 +0000 (19:05 +0100)]
tests: qemumonitor: Allow testing schema for fake monitor interactions

Add infrastructure that will allow testing schema of the commands we
pass to the fake monitor object, so that we can make sure that it
actually does something.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: qemumonitorjson: Fix few arguments of test cases
Peter Krempa [Thu, 22 Mar 2018 17:39:32 +0000 (18:39 +0100)]
tests: qemumonitorjson: Fix few arguments of test cases

Prepare for testing of the schema of used commands by changing few
arguments to values which will not be rejected.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: qemu: Add infrastructure for QAPI schema testing
Peter Krempa [Thu, 22 Mar 2018 16:07:43 +0000 (17:07 +0100)]
tests: qemu: Add infrastructure for QAPI schema testing

Add a function which will allow to test whether a JSON object conforms
to the QAPI schema. This greatly helps when developing formatters for
new JSON objects and will help make sure that the code will not break in
cases which have unit tests but were actually not function-tested
(mostly various disk access protocols).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: Add data file with QEMU QAPI schema
Peter Krempa [Thu, 22 Mar 2018 16:03:07 +0000 (17:03 +0100)]
tests: Add data file with QEMU QAPI schema

Add the QAPI schema (returned by 'query-qmp-schema' command) which will
be used for QAPI schema testing in upcoming patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: qapi: Return correct entry in virQEMUQAPISchemaTraverse
Peter Krempa [Wed, 21 Mar 2018 15:51:29 +0000 (16:51 +0100)]
qemu: qapi: Return correct entry in virQEMUQAPISchemaTraverse

virQEMUQAPISchemaTraverse would return previous-to-last queried item on
a query. It would not be a problem if checking if the given path exists
since error reporting works properly but if the caller is interested in
the result, it would be wrong.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: json: Add accessor for looking up JSON value type
Peter Krempa [Tue, 20 Mar 2018 13:07:26 +0000 (14:07 +0100)]
util: json: Add accessor for looking up JSON value type

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: monitor: Move processing of QMP schema to the new file
Peter Krempa [Tue, 20 Mar 2018 08:29:30 +0000 (09:29 +0100)]
qemu: monitor: Move processing of QMP schema to the new file

The JSON array was processed to the hash table used by the query apis in
the monitor code. Move it to a new helper in qemu_qapi.c.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: qapi: Fix naming of moved functions
Peter Krempa [Tue, 20 Mar 2018 07:57:44 +0000 (08:57 +0100)]
qemu: qapi: Fix naming of moved functions

Change the prefix of the functions to 'virQEMUQapi' and rename the two
public APIs so that the verb is put last.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: caps: Move QAPI schema related code into separate file
Peter Krempa [Tue, 20 Mar 2018 07:44:11 +0000 (08:44 +0100)]
qemu: caps: Move QAPI schema related code into separate file

Extract the code into qemu_qapi.c/h so that we separate it from various
parts of the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: buffer: Tolerate NULL 'buf' in virBufferStrcat
Peter Krempa [Thu, 22 Mar 2018 12:10:40 +0000 (13:10 +0100)]
util: buffer: Tolerate NULL 'buf' in virBufferStrcat

Most other buffer APIs tolerate the buffer being NULL.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agolxc: report error message raised by the failing function
Prafull [Thu, 22 Mar 2018 14:34:35 +0000 (20:04 +0530)]
lxc: report error message raised by the failing function

The code that calls VIR_WARN after a function fails, doesn't
report the error message raised by the failing function.
Such error messages are now reported in lxc/lxc_driver.c

Signed-off-by: Prafullkumar Tale <talep158@gmail.com>
7 years agodocs: introduce libvirt-dbus binding
Pavel Hrdina [Tue, 4 Jul 2017 14:50:00 +0000 (16:50 +0200)]
docs: introduce libvirt-dbus binding

libvirt-dbus is a new binding that wraps libvirt API into D-Bus calls.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7 years agodocs: fix a typo in docs.html page
Pavel Hrdina [Fri, 23 Mar 2018 11:52:13 +0000 (12:52 +0100)]
docs: fix a typo in docs.html page

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7 years agorpc: avoid duplicating config in virtlockd/virtlogd augeas tests
Daniel P. Berrangé [Wed, 21 Mar 2018 16:41:10 +0000 (16:41 +0000)]
rpc: avoid duplicating config in virtlockd/virtlogd augeas tests

Most of the augeas test files use ::CONFIG:: to pull in the master
config file for testing. This ensures that entries added to the config
file are actually tested by augeas.

This identified the missing admin_max_clients example in the virtlogd
config file, which in turn prompted a change in description of the
max_clients parameter, since these daemons don't have separate
readonly & readwrite sockets.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agorpc: remove remains of obsolete log_buffer_size config parameter
Daniel P. Berrangé [Wed, 21 Mar 2018 16:27:42 +0000 (16:27 +0000)]
rpc: remove remains of obsolete log_buffer_size config parameter

The global log buffer feature was deleted in:

  commit c0c8c1d7bb53e0420f8573ea961ef7e19b7fff85
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Mon Mar 3 14:54:33 2014 +0000

    Remove global log buffer feature entirely

    A earlier commit changed the global log buffer so that it only
    records messages that are explicitly requested via the log
    filters setting. This removes the performance burden, and
    improves the signal/noise ratio for messages in the global
    buffer. At the same time though, it is somewhat pointless, since
    all the recorded log messages are already going to be sent to an
    explicit log output like syslog, stderr or the journal. The
    global log buffer is thus just duplicating this data on stderr
    upon crash.

    The log_buffer_size config parameter is left in the augeas
    lens to prevent breakage for users on upgrade. It is however
    completely ignored hereafter.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This was in the 1.2.3 release, and 4 years is sufficient time for a
graceful upgrade path for augeas, so all remaining traces are now
removed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agovirt-aa-helper: test: check for expected profile content
Christian Ehrhardt [Wed, 21 Mar 2018 11:28:39 +0000 (12:28 +0100)]
virt-aa-helper: test: check for expected profile content

So far the virt-aa-helper tests only checked the return code and thereby
catched aborts like issues failing to parse the XML. But there is one
category of virt-aa-helper issues so far untested - not generating the
expected rule.

This adds a basic grep based checks after each test to match against the
rule that is expected to be added by the test.

Acked-by: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agotest_driver: Add testDomainDestroyFlags
Katerina Koukiou [Thu, 22 Mar 2018 18:42:27 +0000 (19:42 +0100)]
test_driver: Add testDomainDestroyFlags

Adding this for completeness

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
7 years agovirt-aa-helper: generate rules for nvdimm memory
Christian Ehrhardt [Tue, 20 Mar 2018 10:13:54 +0000 (11:13 +0100)]
virt-aa-helper: generate rules for nvdimm memory

nvdimm memory is backed by a path on the host. This currently works only via
hotplug where the AppArmor label is created via the domain label callbacks.

This adds the virt-aa-helper support for nvdimm memory devices to generate
rules for the needed paths from the initial guest definition as well.

Example in domain xml:
  <memory model='nvdimm'>
    <source>
      <path>/tmp/nvdimm-base</path>
    </source>
    <target>
     <size unit='KiB'>524288</size>
     <node>0</node>
    </target>
  </memory>
Works to start now and creates:
  "/tmp/nvdimm-base" rw,

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1757085
Acked-by: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agovirt-aa-helper: generate rules for passthrough input devices
Christian Ehrhardt [Tue, 20 Mar 2018 10:11:13 +0000 (11:11 +0100)]
virt-aa-helper: generate rules for passthrough input devices

Input devices can passthrough an event device. This currently works only via
hotplug where the AppArmor label is created via the domain label callbacks.

This adds the virt-aa-helper support for passthrough input devices to generate
rules for the needed paths from the initial guest definition as well.

Example in domain xml:
  <input type='passthrough' bus='virtio'>
          <source evdev='/dev/input/event0' />
  </input>
Works to start now and creates:
  "/dev/input/event0" rw,

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1757085
Acked-by: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agosecurity, apparmor: add (Set|Restore)InputLabel
Christian Ehrhardt [Mon, 19 Mar 2018 13:48:39 +0000 (14:48 +0100)]
security, apparmor: add (Set|Restore)InputLabel

d8116b5a "security: Introduce functions for input device hot(un)plug"
implemented the code (Set|Restore)InputLabel for several security modules,
this patch adds an AppArmor implementation for it as well.

That fixes hot-plugging event input devices by generating a rule for the
path that needs to be accessed.

Example hot adding:
  <input type='passthrough' bus='virtio'>
     <source evdev='/dev/input/event0' />
  </input>
Creates now:
  "/dev/input/event0" rwk,

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1755153
Acked-by: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agosecurity, apparmor: add (Set|Restore)MemoryLabel
Christian Ehrhardt [Mon, 19 Mar 2018 12:12:14 +0000 (13:12 +0100)]
security, apparmor: add (Set|Restore)MemoryLabel

Recent changes have made implementing this mandatory to hot add any
memory.
Implementing this in apparmor fixes this as well as allows hot-add of nvdimm
tpye memory with an nvdimmPath set generating a AppArmor rule for that
path.

Example hot adding:
  <memory model='nvdimm'>
    <source>
      <path>/tmp/nvdimm-test</path>
    </source>
    <target>
      <size unit='KiB'>524288</size>
      <node>0</node>
    </target>
  </memory>
Creates now:
  "/tmp/nvdimm-test" rwk,

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1755153
Acked-by: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agovirCommandFDIsSet: Update documentation
Michal Privoznik [Wed, 21 Mar 2018 16:19:29 +0000 (17:19 +0100)]
virCommandFDIsSet: Update documentation

The set of arguments was changed a long time ago (040d9963420
which dates back to July 2013)  but the corresponding
documentation was not updated.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
7 years agovirCommandPassFD: Give name to flags
Michal Privoznik [Wed, 21 Mar 2018 16:17:54 +0000 (17:17 +0100)]
virCommandPassFD: Give name to flags

The flags passed to virCommandPassFD() are unnamed and
documentation to this function doesn't list them either.
Give them name and mention it in documentation to functions
using them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
7 years agonews: Xen: announce removal of hard-code scheduler weight
Jim Fehlig [Wed, 21 Mar 2018 21:39:27 +0000 (15:39 -0600)]
news: Xen: announce removal of hard-code scheduler weight

Also describe a possible side-affect due to changes in the default
(unspecified) value from 1000 to 256.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agolibxl: don't hardcode scheduler weight
Jim Fehlig [Thu, 22 Feb 2018 18:52:56 +0000 (11:52 -0700)]
libxl: don't hardcode scheduler weight

Long ago in commit dfa1e1dd53 the scheduler weight was accidentally
hardcoded to 1000. Weight is a setting with no unit since it is
relative to the weight of other domains. If no weight is specified,
libxl defaults to 256.

Instead of hardcoding the weight to 1000, honor any <shares> specified
in <cputune>. libvirt's notion of shares is synonomous to libxl's
scheduler weight setting. If shares is unspecified, defer default
weight setting to libxl.

Removing the hardcoded weight required some test fixup. While at it,
add an explicit test for <shares> conversion to scheduler weight.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agolibxl: rename migration APIs to include Src or Dst in their name
Jim Fehlig [Tue, 20 Mar 2018 17:42:56 +0000 (11:42 -0600)]
libxl: rename migration APIs to include Src or Dst in their name

Inspired by commit ffb7954f to improve readability of the libxl
migration APIs.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agolibxl: remove needless 'else' in libxlDomainMigrationPrepare
Jim Fehlig [Mon, 19 Mar 2018 21:07:02 +0000 (15:07 -0600)]
libxl: remove needless 'else' in libxlDomainMigrationPrepare

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agolibxl: dont dereference NULL libxlDomainObjPrivatePtr
Jim Fehlig [Fri, 16 Mar 2018 21:00:17 +0000 (15:00 -0600)]
libxl: dont dereference NULL libxlDomainObjPrivatePtr

In libxlDomainMigrationPrepare it is possible to dereference a NULL
libxlDomainObjPrivatePtr in early error paths. Check for a valid
'priv' before using it.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agolibxl: convert DefineXMLFlags to use begin/end API pattern
Jim Fehlig [Fri, 16 Mar 2018 21:29:48 +0000 (15:29 -0600)]
libxl: convert DefineXMLFlags to use begin/end API pattern

Similar to other uses of virDomainObjListAdd, on success add a ref to the
virDomainObj so that virDomainObjEndAPI can be called as usual.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agolibxl: call EndJob in error case
Jim Fehlig [Fri, 16 Mar 2018 21:22:45 +0000 (15:22 -0600)]
libxl: call EndJob in error case

If starting the domain fails in libxlDomainCreateXML, we mistakenly
jumped to cleanup without calling libxlDomainObjEndJob. Remove the
jump to 'cleanup'.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agolibxl: lock virDomainObj after ListRemove
Jim Fehlig [Fri, 16 Mar 2018 21:15:07 +0000 (15:15 -0600)]
libxl: lock virDomainObj after ListRemove

Most libxl driver API use the pattern of lock and add a ref to
virDomainObj, perform API, then decrement ref and unlock in
virDomainEndAPI. In some cases the API may call
virDomainObjListRemove, which unlocks the virDomainObj. Relock
the object in such cases so EndAPI is called with a locked object.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agotests: Add capabilities data for QEMU 2.12
Andrea Bolognani [Wed, 21 Mar 2018 17:05:05 +0000 (18:05 +0100)]
tests: Add capabilities data for QEMU 2.12

The QEMU binary is compiled from the v2.12.0-rc0 tag.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agotests: Rename pseries-features-hpt test
Andrea Bolognani [Thu, 1 Mar 2018 17:13:23 +0000 (18:13 +0100)]
tests: Rename pseries-features-hpt test

We're going to use the same test case to exercise all optional
pSeries features, so a more generic name is needed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agodocs: update all GIT repo examples to use https:// protocol
Daniel P. Berrangé [Tue, 20 Mar 2018 12:35:00 +0000 (12:35 +0000)]
docs: update all GIT repo examples to use https:// protocol

The https:// protocol is much more reliably usable than git:// when
faced with unreasonably strict firewalls. The libvirt.org web server is
now setup to support the smart https:// protocol, which is just as fast
as git://, so change all the docs to use https://

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodocs: remove obsolete docs about gitorious and cvs access
Daniel P. Berrangé [Tue, 20 Mar 2018 12:29:27 +0000 (12:29 +0000)]
docs: remove obsolete docs about gitorious and cvs access

The gitorious.org service went away a long time ago now, and our main
download.html page tells people where all the official mirrors are
for every component.

Meanwhile telling people about CVS is a bad joke in 2018, and the CVS
server no longer exists on libvirt.org

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agorpm: fix incorrect expansion of macros with line continuations for args
Daniel P. Berrangé [Tue, 20 Mar 2018 16:55:12 +0000 (16:55 +0000)]
rpm: fix incorrect expansion of macros with line continuations for args

Macros in RPMs are expanded before line continuations, so when we write

   %systemd_preun foo \
                  bar

What happens is that it expands to

   if [ $1 -eq 0 ] ; then
        # Package removal, not upgrade
        systemctl --no-reload disable --now foo \ > /dev/null 2>&1 || :
   fi
                 bar

which is obviously complete garbage and not what we expected. It is
simply not safe to ever use line continuations in combination with
macros.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agolibvirt: Fix comments for two public APIs.
Han Han [Tue, 20 Mar 2018 07:32:26 +0000 (15:32 +0800)]
libvirt: Fix comments for two public APIs.

Fix comments for virConnectListAllNodeDevices and
virConnectListAllSecrets.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agotravis: Test both python2 and python3
Andrea Bolognani [Tue, 20 Mar 2018 14:29:31 +0000 (15:29 +0100)]
travis: Test both python2 and python3

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agovirDomainDeviceDefValidateAliasesIterator: Ignore some hostdevs
Michal Privoznik [Fri, 16 Mar 2018 11:33:12 +0000 (12:33 +0100)]
virDomainDeviceDefValidateAliasesIterator: Ignore some hostdevs

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

When defining a domain that has <interface type='hostdev'/> our
parser creates two entries in virDomainDef: one for <interface/>
and one for <hostdev/>. However, some info is shared between the
two which makes user alias validation fail because alias belongs
to the set of shared info.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agohyperv: Sync generator output between python versions
Cole Robinson [Mon, 19 Mar 2018 19:32:34 +0000 (15:32 -0400)]
hyperv: Sync generator output between python versions

Yet another dependency on dict() hash ordering

Signed-off-by: Cole Robinson <crobinso@redhat.com>
7 years agonews: Update for Python 3 compatibility
Andrea Bolognani [Tue, 20 Mar 2018 10:49:35 +0000 (11:49 +0100)]
news: Update for Python 3 compatibility

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomingw: Use Python 3 for building
Andrea Bolognani [Mon, 19 Mar 2018 17:06:09 +0000 (18:06 +0100)]
mingw: Use Python 3 for building

While RHEL / CentOS are still using Python 2 for the time being,
Fedora has already switched to Python 3 as the default Python
interpreter a while ago, so on that OS it doesn't make sense to
drag in Python 2 anymore.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agospec: Use Python 3 for building when possible
Andrea Bolognani [Mon, 19 Mar 2018 16:32:47 +0000 (17:32 +0100)]
spec: Use Python 3 for building when possible

While RHEL / CentOS are still using Python 2 for the time being,
Fedora has already switched to Python 3 as the default Python
interpreter a while ago, so on that OS it doesn't make sense to
drag in Python 2 anymore; the same applies to future RHEL versions.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconfigure: Allow (and prefer) Python 3
Andrea Bolognani [Mon, 19 Mar 2018 16:12:39 +0000 (17:12 +0100)]
configure: Allow (and prefer) Python 3

Our build process no longer depends on Python 2, so we can
finally allow Python 3 to satisfy our requirement for a Python
interpreter.

Since several distributions have now switched to installing
Python 3 by default and Python 2 is on its way out, prefer the
former when both are available.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agomingw: Require Fedora
Andrea Bolognani [Mon, 19 Mar 2018 17:04:34 +0000 (18:04 +0100)]
mingw: Require Fedora

Although it was never formally specified, it was always expected
that the mingw RPM build would happen on Fedora, if anything
because RHEL / CentOS don't ship the necessary mingw dependencies.

Make this fact explicit by erroring out if that's not the case,
the same way we already do in the main spec file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoapibuild: Simplify getline()
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:08 +0000 (06:49 +0000)]
apibuild: Simplify getline()

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Remove redundant parentheses
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:07 +0000 (06:49 +0000)]
apibuild: Remove redundant parentheses

http://pylint-messages.wikidot.com/messages:c0325

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Simplify parsing string tokens
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:06 +0000 (06:49 +0000)]
apibuild: Simplify parsing string tokens

Improve readability and reduce the complexity of the code that is
searching for string tokens (i.e. characters surrounded by a single
or double quote).

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Simplify merging of preproc tokens
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:05 +0000 (06:49 +0000)]
apibuild: Simplify merging of preproc tokens

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Use list comprehension insteand of map
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:04 +0000 (06:49 +0000)]
apibuild: Use list comprehension insteand of map

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Simplify type checking of literals
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:03 +0000 (06:49 +0000)]
apibuild: Simplify type checking of literals

Reduce the number of if-statements used to assign a literals
to corresponding class variables.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Simplify parseTypeComment()
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:02 +0000 (06:49 +0000)]
apibuild: Simplify parseTypeComment()

Improve readability and reduce complexity the method
parseTypeComment().

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Simplify strip_lead_star()
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:01 +0000 (06:49 +0000)]
apibuild: Simplify strip_lead_star()

The method strip_lead_star() removes a single leading asterisk
character from a string by ignoring leading whitespace, otherwise it
returns the original string.

This could be achieved with a single if-statement followed by replace.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Fix indentation not multiple of 4
Radostin Stoyanov [Tue, 20 Mar 2018 06:49:00 +0000 (06:49 +0000)]
apibuild: Fix indentation not multiple of 4

PEP8 recommends that the number of spaces used for indentation of
Python code to be a multiple of four [1] [2].

1: https://lintlyci.github.io/Flake8Rules/rules/E111.html
2: https://lintlyci.github.io/Flake8Rules/rules/E114.html

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Drop backslash between brackets
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:59 +0000 (06:48 +0000)]
apibuild: Drop backslash between brackets

Backslash between brackets in Python is redundant. [1]

1: https://lintlyci.github.io/Flake8Rules/rules/E502.html

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agopython3: cpu-reformat: Use the print() function
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:58 +0000 (06:48 +0000)]
python3: cpu-reformat: Use the print() function

Replace the print statement, that is only available in Py2, with a
print function that is available in both Py2 and Py3 and drop the
explicit python version in the shebang.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Avoid double sorting of ids
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:57 +0000 (06:48 +0000)]
apibuild: Avoid double sorting of ids

The uniq() function returns a sorted list, there is no need
to sort this list again.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Simplify uniq function
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:56 +0000 (06:48 +0000)]
apibuild: Simplify uniq function

Use a set (unordered collections of unique elements) [1] to remove
repeated elements in a list.

1: https://docs.python.org/3/tutorial/datastructures.html#sets

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoWmiClass: Don't share "versions" between instances
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:55 +0000 (06:48 +0000)]
WmiClass: Don't share "versions" between instances

Lists in Python are mutable and when used as a default value of a
parameter for class constructor, its value will be shared between
all class instances.

Example:

class Test:
    def __init__(self, mylist=[]):
        self.mylist = mylist

A = Test()
B = Test()
A.mylist.append("mylist from instance A")
print(B.mylist) # Will print ['mylist from instance A']

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agopython: Remove space around = in keyword args
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:54 +0000 (06:48 +0000)]
python: Remove space around = in keyword args

PEP8 recommends not having spaces around = in a keyword argument or
a default parameter value.

https://www.python.org/dev/peps/pep-0008/#other-recommendations

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Simplify conditional statements
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:53 +0000 (06:48 +0000)]
apibuild: Simplify conditional statements

Improve readability by reducing the complexity and length of
conditional statements.

Example: The following condition:

if (o >= 97 and o <= 122) or
   (o >= 65 and o <= 90) or
   (o >= 48 and o <= 57) or
   (" \t(){}:;,+-*/%&!|[]=><".find(line[i]) == -1):

Will be True for every character that is not in string:
" \t(){}:;,+-*/%&!|[]=><"

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agocfg.mk: check ctype_macros only on *.[c|h] files
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:52 +0000 (06:48 +0000)]
cfg.mk: check ctype_macros only on *.[c|h] files

The functions like isalnum(), isalpha(), isdigit(), etc. are also
available in Python, however `make syntax-check` do not intend to
prohibit them.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoesx_vi_generator: Simplify alignment function
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:51 +0000 (06:48 +0000)]
esx_vi_generator: Simplify alignment function

Generate whitespace using the standard function ljust() that is
available in both Py3 [1] and Py2 [2].

1: https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.ljust
2: https://docs.python.org/2.7/library/string.html#string.ljust

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoesx_vi_generator: Simplify get_occurrence_comment
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:50 +0000 (06:48 +0000)]
esx_vi_generator: Simplify get_occurrence_comment

Reduce the number of if-statements and use a single return.
Utilise a dictionary to map between occurrences and values.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoesx_vi_generator: Simplify generate_helper_header
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:49 +0000 (06:48 +0000)]
esx_vi_generator: Simplify generate_helper_header

The function generate_helper_header() only returns a formatted string.
This could be achieved without performing string concatenation.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoesx_vi_generator: Simplify generate_helper_source
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:48 +0000 (06:48 +0000)]
esx_vi_generator: Simplify generate_helper_source

The generate_helper_source() function returns a formatted string.
This could be achieved without the use of a local variable "source"
and string concatenation.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agopython: Add whitespace around = and % operators
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:47 +0000 (06:48 +0000)]
python: Add whitespace around = and % operators

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Remove whitespace before ', ' and ':'
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:46 +0000 (06:48 +0000)]
apibuild: Remove whitespace before ', ' and ':'

PEP8 recommends removing whitespace immediately before a comma,
semicolon, or colon [1]. In addition remove multiple spaces after
keyword (PEP8 - E271).

1: https://www.python.org/dev/peps/pep-0008/#whitespace-in-expressions-and-statements

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Split imports on separate lines
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:45 +0000 (06:48 +0000)]
apibuild: Split imports on separate lines

PEP8 recommends imports to be on separate lines. [1]

1: https://www.python.org/dev/peps/pep-0008/#imports

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoapibuild: Use isinstance for type checking
Radostin Stoyanov [Tue, 20 Mar 2018 06:48:44 +0000 (06:48 +0000)]
apibuild: Use isinstance for type checking

The isinstance() function [1] returns true if an object argument is an
instance of a classinfo argument or of a direct, indirect subclass
thereof.

1: https://docs.python.org/3/library/functions.html#isinstance

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agoqemu: Don't assign alias to disabled balloon device
Jiri Denemark [Mon, 19 Mar 2018 17:14:52 +0000 (18:14 +0100)]
qemu: Don't assign alias to disabled balloon device

<memballoon model='none'/> is the only way to disable balloon driver
since libvirt will add one automatically if the memballoon element is
missing. In other words, there's no balloon device if model is 'none'
and generating an alias for it makes no sense. The alias will be ignored
when parsing the XML and it will disappear once libvirtd is restarted.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agognulib: switch to use https:// instead of git:// protocol
Daniel P. Berrangé [Fri, 16 Mar 2018 17:27:14 +0000 (17:27 +0000)]
gnulib: switch to use https:// instead of git:// protocol

Some contributors are behind obnoxious firewalls that block everything
except http(s) traffic, preventing checkout of modules using the git://
protocol. Since git.savannah.gnu.org is using the modern, fast HTTP
transport, there's no real downside to using that by default.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agovirt-aa-helper: resolve file symlinks
Christian Ehrhardt [Mon, 19 Mar 2018 10:10:29 +0000 (11:10 +0100)]
virt-aa-helper: resolve file symlinks

In a recent change b932ed69: "virt-aa-helper: resolve yet to be created
paths" several cases with symlinks in paths were fixed, but it regressed
cases where the file being last element of the path was the actual link.

In the case of the last element being the symlink realpath can (and shall)
be called on the full path that was passed.

Examples would be zfs/lvm block devices like:
 <disk type='block' device='disk'>
    <driver name='qemu' type='raw'/>
    <source dev='/dev/mapper/testlvm-testvol1'/>
    <target dev='vdd' bus='virtio'/>
 </disk>
With the target being:
 /dev/mapper/testlvm-testvol1 -> ../dm-0

That currently is rendered as
 "/dev/mapper/testlvm-testvol1" rwk,
but instead should be (and is with the fix):
 "/dev/dm-0" rwk,

Fixes: b932ed69: "virt-aa-helper: resolve yet to be created paths"
Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1756394
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agotools: fix variable scope in in check_guests_shutdown
Christian Ehrhardt [Mon, 19 Mar 2018 11:44:31 +0000 (12:44 +0100)]
tools: fix variable scope in in check_guests_shutdown

libvirt-guests.sh when run with more active guests than requested to
shut down in parallel will run until it times out only shutting down
the first set of guests.

This patch fixes parallel shutdown by fixing a variable scope issue
where check_guests_shutdown unintentionally reset $guests which
prevented further progress.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1688508
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agopython: Drop explicit version where possible
Andrea Bolognani [Thu, 15 Mar 2018 16:56:34 +0000 (17:56 +0100)]
python: Drop explicit version where possible

Some of our scripts are known to work both with Python 2 and
Python 3, so for them we shouldn't be forcing any specific
version of the interpreter when they're called directly; we
always use $(PYTHON) explicitly in our build rules anyway.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: hostdev: Fix the error on VM start with an mdev when IOMMU is off
Erik Skultety [Thu, 15 Mar 2018 13:58:22 +0000 (14:58 +0100)]
qemu: hostdev: Fix the error on VM start with an mdev when IOMMU is off

Commit b4c2ac8d56 made a false assumption that IOMMU support necessary
for an mdev device to be assigned to a VM. Unlike direct PCI assignment,
IOMMU support is not needed for mediated devices, as the physical parent
device provides the isolation, therefore, simply checking for VFIO
presence is enough to successfully start a VM.

Luckily, this issue is not serious, since as of yet, libvirt mandates
mdevs to be pre-created prior to a domain's launch - if it is,
everything does work smoothly even with IOMMU disabled, because the
parent device will ensure the iommu groups we try to access exist.
However, if there are *no* IOMMU groups yet, thus no mdev exists yet, one
would see the following error:

"unsupported configuration: Mediated host device assignment requires VFIO
support"

The error msg above is simply wrong and doesn't even reflect the IOMMU
reality, so after applying this patch one would rather see the following
error in such case instead:

"device not found: mediated device '<UUID>' not found"

Signed-off-by: Erik Skultety <eskultet@redhat.com>