]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agobuild: Fix accidental revert of .gnulib update
John Ferlan [Thu, 19 Jul 2018 19:48:34 +0000 (15:48 -0400)]
build: Fix accidental revert of .gnulib update

Commit id 1bff5bbe25eb7a7e7a4e0067c4ca7cbc1cb34999 accidentally
reverted .gnulib back to d6397dde2e127e246e3eeb5254a21f42cac783c8
which was two updates ago.

Update to the latest 68df637b5f1b5c10370f6981d2a43a5cf74368df
which includes three changes since the previous fetch of
cdbf3d385a32ff904c96f20c26f3470bd8345248.

> autoupdate
> hard-locale: simplify by removing hard-locale.m4
> gnulib-tool: limit line length for git send-email

Signed-off-by: John Ferlan <jferlan@redhat.com>
6 years agotest: Implement virConnectListAllInterfaces
Cole Robinson [Tue, 10 Jul 2018 19:01:45 +0000 (15:01 -0400)]
test: Implement virConnectListAllInterfaces

This adds some generic virinterfaceobj code, roughly matching what
is used by other stateful drivers like network, storage, etc.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoqemu: Fix broken autostart symlink after renaming domain
Julio Faracco [Thu, 19 Jul 2018 04:21:48 +0000 (01:21 -0300)]
qemu: Fix broken autostart symlink after renaming domain

If a domain is configured to start on boot, it has a symlink to the
domain definition inside the autostart directory. If you rename this
domain, the definition is renamed too. The symlink need to be pointed to
this renamed file. This commit recreates the symlink after renaming the
XML file.

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

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: set OOM in virCopyLastError if error is not set
Nikolay Shirokovskiy [Mon, 2 Jul 2018 11:16:52 +0000 (14:16 +0300)]
util: set OOM in virCopyLastError if error is not set

virCopyLastError is intended to be used after last error is set.
However due to virLastErrorObject failures (very unlikely though
as thread local error is allocated on first use) we can have zero
fields in a copy as a result. In particular code field can be set
to VIR_ERR_OK.

In some places (qemu monitor, qemu agent and qemu migaration code
for example) we use copy result as a flag and this leads to bugs.

Let's set OOM-like error in copy in case of virLastErrorObject failures.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agolocking: don't create qemu-sanlock.conf file when QEMU isn't enabled
Daniel P. Berrangé [Wed, 18 Jul 2018 16:59:51 +0000 (17:59 +0100)]
locking: don't create qemu-sanlock.conf file when QEMU isn't enabled

The test targets result in the qemu-sanlock.conf file being created
when sanlock is enabled, even if QEMU is not enabled. As a result it
never gets cleaned up when distclean is run, breaking distcheck.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodocs: news: Provide an update about the video type 'none'
Erik Skultety [Thu, 12 Jul 2018 14:52:44 +0000 (16:52 +0200)]
docs: news: Provide an update about the video type 'none'

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Introduce new video type 'none'
Erik Skultety [Mon, 21 May 2018 12:29:26 +0000 (14:29 +0200)]
conf: Introduce new video type 'none'

Historically, we've always enabled an emulated video device every time we
see that graphics should be supported with a guest. With the appearance
of mediated devices which can support QEMU's vfio-display capability,
users might want to use such a device as the only video device.
Therefore introduce a new, effectively a 'disable', type for video
device.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agodocs: Rephrase the mediated devices hostdev section a bit
Erik Skultety [Thu, 12 Jul 2018 08:57:12 +0000 (10:57 +0200)]
docs: Rephrase the mediated devices hostdev section a bit

Currently it reads:
Refer MDEV to create a mediated device on the host

...even though it resembles English, it's not a proper English.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agodocs: Update news about the VNC console enablement for mdevs
Erik Skultety [Mon, 9 Jul 2018 13:12:50 +0000 (15:12 +0200)]
docs: Update news about the VNC console enablement for mdevs

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: command: Enable formatting vfio-pci.display option onto cmdline
Erik Skultety [Fri, 25 May 2018 13:55:42 +0000 (15:55 +0200)]
qemu: command: Enable formatting vfio-pci.display option onto cmdline

Since QEMU 2.12, QEMU understands a new vfio-pci device option 'display'
which can be used to turn on display capabilities on vgpu-enabled
mediated devices, IOW emulated GPU devices like QXL will no longer be
needed with vgpu-enable mdevs.
QEMU defaults to 'auto' for the 'display' attribute, which is not
foolproof, so we need to play it safe here and default to display='off'
if this attribute wasn't provided in the XML explicitly.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Introduce new <hostdev> attribute 'display'
Erik Skultety [Thu, 24 May 2018 14:04:26 +0000 (16:04 +0200)]
conf: Introduce new <hostdev> attribute 'display'

QEMU 2.12 introduced a new type of display for mediated devices using
vfio-pci backend which allows a mediated device to be used as a VGA
compatible device as an alternative to an emulated video device. QEMU
exposes this feature via a vfio device property 'display' with supported
values 'on/off/auto' (libvirt will default to 'off').

This patch adds the necessary bits to domain config handling in order to
expose this feature. Since there's no convenient way for libvirt to come
up with usable defaults for the display setting, simply because libvirt
is not able to figure out which of the display implementations - dma-buf
which requires OpenGL support vs vfio regions which doesn't need OpenGL
(works with OpenGL enabled too) - the underlying mdev uses.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Replace 'error' with 'cleanup' in virDomainHostdevDefParseXMLSubsys
Erik Skultety [Wed, 11 Jul 2018 11:09:51 +0000 (13:09 +0200)]
conf: Replace 'error' with 'cleanup' in virDomainHostdevDefParseXMLSubsys

The exit path is the same for both success and failure, so the label
should be called cleanup.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Introduce virDomainGraphicsDefHasOpenGL helper
Erik Skultety [Sat, 30 Jun 2018 16:20:33 +0000 (18:20 +0200)]
conf: Introduce virDomainGraphicsDefHasOpenGL helper

A simple helper which will loop through all the graphics elements and
checks whether at least one of them enables OpenGL support, either by
containing <gl enable='yes'/> or being of type 'egl-headless'.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: caps: Add vfio-pci.display capability
Erik Skultety [Thu, 24 May 2018 15:27:33 +0000 (17:27 +0200)]
qemu: caps: Add vfio-pci.display capability

QEMU 2.12 introduced a new vfio-pci device option 'display=on/off/auto'.
This patch introduces the necessary capability.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Introduce a new graphics display type 'headless'
Erik Skultety [Sat, 30 Jun 2018 14:23:01 +0000 (16:23 +0200)]
qemu: Introduce a new graphics display type 'headless'

Since 2.10 QEMU supports a new display type egl-headless which uses the
drm nodes for OpenGL rendering copying back the rendered bits back to
QEMU into a dma-buf which can be accessed by standard "display" apps
like VNC or SPICE. Although this display type can be used on its own,
for any practical use case it makes sense to pair it with either VNC or
SPICE display. The clear benefit of this display is that VNC gains
OpenGL support, which it natively doesn't have, and SPICE gains remote
OpenGL support (native OpenGL support only works locally through a UNIX
socket, i.e. listen type=socket/none).

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: caps: Introduce a capability for egl-headless
Erik Skultety [Sat, 30 Jun 2018 14:16:24 +0000 (16:16 +0200)]
qemu: caps: Introduce a capability for egl-headless

Since QEMU 2.10, it's possible to use a new type of display -
egl-headless which uses drm nodes to provide OpenGL support. This patch
adds a capability for that. However, since QEMU doesn't provide a QMP
command to probe it, we have to base the capability on specific QEMU
version.

Acked-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: qemuBuildHostdevCommandLine: Use a helper variable mdevsrc
Erik Skultety [Wed, 18 Jul 2018 12:07:39 +0000 (14:07 +0200)]
qemu: qemuBuildHostdevCommandLine: Use a helper variable mdevsrc

Decrease the number of accessors we have to use.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agom4: Introduce STABLE_ORDERING_JANSSON
Ján Tomko [Tue, 3 Jul 2018 14:46:04 +0000 (16:46 +0200)]
m4: Introduce STABLE_ORDERING_JANSSON

Add a second check for Jansson >= 2.8, which includes
fixes to preserve ordering of object keys.

Use this constant to guard tests that depend on stable ordering.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agobuild: require Jansson if QEMU driver is enabled
Ján Tomko [Fri, 11 May 2018 12:27:02 +0000 (14:27 +0200)]
build: require Jansson if QEMU driver is enabled

If the QEMU driver was requested, require Jansson, since we need to use
the JSON monitor to probe capabilities for all QEMU version supported
by libvirt.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agobuild: switch --with-qemu default from yes to check
Ján Tomko [Fri, 11 May 2018 12:25:33 +0000 (14:25 +0200)]
build: switch --with-qemu default from yes to check

Unless explicitly requested, enable the QEMU driver
only if the Jansson library is present.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoRemove virJSONValueNewStringLen
Ján Tomko [Tue, 15 May 2018 12:16:27 +0000 (14:16 +0200)]
Remove virJSONValueNewStringLen

It is no longer used.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agobuild: remove references to WITH_YAJL for SETUID_RPC_CLIENT
Ján Tomko [Fri, 11 May 2018 12:45:43 +0000 (14:45 +0200)]
build: remove references to WITH_YAJL for SETUID_RPC_CLIENT

We no longer allow building WITH_YAJL, remove the remaining
uses of the macro.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoRemove functions using yajl
Ján Tomko [Fri, 11 May 2018 11:59:47 +0000 (13:59 +0200)]
Remove functions using yajl

We no longer support building WITH_YAJL, remove the dead code
as well as the virJSONParser structures that are no longer used.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoSwitch from yajl to Jansson
Ján Tomko [Wed, 2 May 2018 15:17:01 +0000 (17:17 +0200)]
Switch from yajl to Jansson

Yajl has not seen much activity upstream recently.
Switch to using Jansson >= 2.5.

All the platforms we target on https://libvirt.org/platforms.html
have a version >= 2.7 listed on the sites below:
https://repology.org/metapackage/jansson/versions
https://build.opensuse.org/package/show/devel:libraries:c_c++/libjansson

Additionally, Ubuntu 14.04 on Travis-CI has 2.5. Set the requirement
to 2.5 since we don't use anything from newer versions.

Implement virJSONValue{From,To}String using Jansson, delete the yajl
code (and the related virJSONParser structure) and report an error
if someone explicitly specifies --with-yajl.

Also adjust the test data to account for Jansson's different whitespace
usage for empty arrays and tune up the specfile to keep 'make rpm'
working when bisecting.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agobuild: undef WITH_JANSSON for SETUID_RPC_CLIENT
Ján Tomko [Wed, 9 May 2018 12:32:05 +0000 (14:32 +0200)]
build: undef WITH_JANSSON for SETUID_RPC_CLIENT

There is no code using WITH_JANSSON yet, but once we add it,
it should not be compiled for the setuid_rpc_client.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agobuild: add --with-jansson
Ján Tomko [Wed, 2 May 2018 15:16:46 +0000 (17:16 +0200)]
build: add --with-jansson

Introduce the configure argument and check for Jansson >= 2.5

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: vnc: switch to tls-creds-x509
Ján Tomko [Tue, 17 Jul 2018 13:10:23 +0000 (15:10 +0200)]
qemu: vnc: switch to tls-creds-x509

The tls, x509 and x509verify options were deprecated in QEMU v2.5.0:

commit 3e305e4a4752f70c0b5c3cf5b43ec957881714f7
Author:     Daniel P. Berrange <berrange@redhat.com>

    ui: convert VNC server to use QCryptoTLSSession

Use the tls-creds-x509 object when available.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemu: test more versions for graphics-vnc-tls
Ján Tomko [Mon, 16 Jul 2018 13:15:21 +0000 (15:15 +0200)]
tests: qemu: test more versions for graphics-vnc-tls

Add a test with QEMU 2.4.0 capabilites, as well as the latest caps.

The code paths for formatting TLS options will be altered and
2.4.0 is the newest version where QEMU_CAPS_OBJECT_TLS_CREDS_X509
is not supported.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agodocs: formatdomain: unify naming for CPUs/vCPUs
Katerina Koukiou [Wed, 18 Jul 2018 09:52:42 +0000 (11:52 +0200)]
docs: formatdomain: unify naming for CPUs/vCPUs

CPU is an acronym and should be written in uppercase
when part of plain text and not refering to an element.

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoexamples: Add clean-traffic-gateway into nwfilters
Ales Musil [Wed, 18 Jul 2018 08:33:03 +0000 (10:33 +0200)]
examples: Add clean-traffic-gateway into nwfilters

The filter purpose is to simulate isolated private VLAN.

The behavior can be achieved by limiting network traffic
to traffic between VM and gateway. Because there is no
concept of the PVLAN in the linux bridge.

The filter also contains parts from clean-traffic
to prevent VM from spoofing its IP and MAC address.

To use this filter the user just needs to set
the GATEWAY_MAC variable to gateway MAC address.

Signed-off-by: Ales Musil <amusil@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
6 years agotests: qemu: Remove disk from graphics-vnc-tls
Ján Tomko [Mon, 16 Jul 2018 13:37:28 +0000 (15:37 +0200)]
tests: qemu: Remove disk from graphics-vnc-tls

The disk command line is tested elsewhere.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agospec: remove libcgroup and cgconfig
Pavel Hrdina [Wed, 18 Jul 2018 10:29:35 +0000 (12:29 +0200)]
spec: remove libcgroup and cgconfig

RHEL-6/CentOS-6 is no longer supported, let's remove dependency on
libcgroup and code that enables/starts cgconfig service.

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

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agodocs: formatdomain: clarify period cputune subelement
Katerina Koukiou [Wed, 18 Jul 2018 09:34:12 +0000 (11:34 +0200)]
docs: formatdomain: clarify period cputune subelement

Although the name of the element is not self-explanatory,
it's affecting only the vcpu threads.

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agodocs: formatdomain: add info about global_period and global_quota for cputune
Katerina Koukiou [Tue, 17 Jul 2018 15:20:05 +0000 (17:20 +0200)]
docs: formatdomain: add info about global_period and global_quota for cputune

Commit 4d92d5 and 55ecda introduced the parameters but didn't update the docs.

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agotest: Implement virConnectListAllNodeDevices
Cole Robinson [Fri, 23 Feb 2018 20:08:46 +0000 (15:08 -0500)]
test: Implement virConnectListAllNodeDevices

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoconf: nodedev: Don't refresh host caps in testdriver
Cole Robinson [Fri, 23 Feb 2018 23:09:20 +0000 (18:09 -0500)]
conf: nodedev: Don't refresh host caps in testdriver

Add a 'skipUpdateCaps' bool that we set for test_driver.c nodedevs
which will skip accessing host resources via virNodeDeviceUpdateCaps

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoAUTHORS: Add Katerina Koukiou
Ján Tomko [Mon, 16 Jul 2018 14:31:53 +0000 (16:31 +0200)]
AUTHORS: Add Katerina Koukiou

$ git log --format=oneline --committer=kkoukiou | wc -l
3

Also set up the mailmap entry to avoid duplicates in the
generated authors file.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agotests: Update capabilities data for QEMU 3.0.0 x86_64
Erik Skultety [Mon, 16 Jul 2018 14:33:20 +0000 (16:33 +0200)]
tests: Update capabilities data for QEMU 3.0.0 x86_64

The original capabilities didn't include a patched kernel for spectre,
SPICE gl support and had xen support enabled which we already have
dropped.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agotests: Add capabilities data for QEMU 2.11 x86_64
Erik Skultety [Mon, 16 Jul 2018 14:48:39 +0000 (16:48 +0200)]
tests: Add capabilities data for QEMU 2.11 x86_64

We were missing these for x86_64 arch, so this is just for completeness.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoUpdate to latest gnulib to fix ffs() detection on mingw
Daniel P. Berrangé [Tue, 17 Jul 2018 09:27:14 +0000 (10:27 +0100)]
Update to latest gnulib to fix ffs() detection on mingw

ffs() was not correctly detected on mingw with previous gnulib rebase:

  https://lists.gnu.org/archive/html/bug-gnulib/2018-07/msg00061.html.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: Add entry for balloon stat stat-disk-caches
Tomáš Golembiovský [Mon, 2 Jul 2018 11:19:42 +0000 (13:19 +0200)]
qemu: Add entry for balloon stat stat-disk-caches

QEMU commit bf1e7140e adds reporting of new balloon statistic to QEMU
2.12. Value represents the amount of memory that can be quickly
reclaimed without additional I/O. Let's add that too.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Fix setting global_period cputune element
Katerina Koukiou [Mon, 16 Jul 2018 13:08:44 +0000 (15:08 +0200)]
qemu: Fix setting global_period cputune element

When VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD is matched "cputune.global_period"
should be updated and not "cputune.period".

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1600427
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Drop virArgvToString()
Andrea Bolognani [Mon, 16 Jul 2018 10:51:12 +0000 (12:51 +0200)]
util: Drop virArgvToString()

The last use has been removed in 026ae4933c6a.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Remove ATTRIBUTE_NONNULL from virNetDevTapInterfaceStats
John Ferlan [Sun, 15 Jul 2018 12:39:25 +0000 (08:39 -0400)]
util: Remove ATTRIBUTE_NONNULL from virNetDevTapInterfaceStats

Commit id 318d54e520 altered the code to check for a NULL
first parameter, but neglected to alter the prototype.

Signed-off-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: hotplug: report error when changing rom enabled attr for net iface
Katerina Koukiou [Fri, 13 Jul 2018 13:07:58 +0000 (15:07 +0200)]
qemu: hotplug: report error when changing rom enabled attr for net iface

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

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: don't overwrite error message in qemuDomainAttachNetDevice
Katerina Koukiou [Fri, 13 Jul 2018 15:01:44 +0000 (17:01 +0200)]
qemu: hotplug: don't overwrite error message in qemuDomainAttachNetDevice

Since commit f14c37, virDomainConfVMNWFilterTeardown is reporting errors
thus any previously reported error gets overwritten.
We need to save the errors in qemuDomainAttachNetDevice before calling
this function when we are in cleanup code.

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

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirmodule: Fix virModuleLoad stub
Michal Privoznik [Sun, 15 Jul 2018 10:09:09 +0000 (12:09 +0200)]
virmodule: Fix virModuleLoad stub

When building without dlfcn.h we are providing a virModuleLoad()
stub which is supposed to report an error. However, the format
string in virReportSystemError() call there requires two strings
but we are passing just one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoutil: remove unused variable inside virFileReadValueString().
Julio Faracco [Sat, 14 Jul 2018 16:14:06 +0000 (13:14 -0300)]
util: remove unused variable inside virFileReadValueString().

The commit 69b937f0358 introduced VIR_AUTOFREE and this macro removed
VIR_FREE. This change showed that 'str' variable was not being used
inside this method. This commit removes this unused variable.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
6 years agoutil: identity: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:09 +0000 (23:25 +0530)]
util: identity: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: filecache: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:08 +0000 (23:25 +0530)]
util: filecache: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: eventpoll: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:07 +0000 (23:25 +0530)]
util: eventpoll: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: fcp: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:06 +0000 (23:25 +0530)]
util: fcp: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: audit: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:05 +0000 (23:25 +0530)]
util: audit: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: arptable: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:04 +0000 (23:25 +0530)]
util: arptable: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: iohelper: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:03 +0000 (23:25 +0530)]
util: iohelper: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: bitmap: use VIR_AUTOPTR for aggregate types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:02 +0000 (23:25 +0530)]
util: bitmap: use VIR_AUTOPTR for aggregate types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: bitmap: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:55:00 +0000 (23:25 +0530)]
util: bitmap: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
viralloc.h include, since that has moved from the source module into the
header.

When a variable of type virBitmapPtr is declared using
VIR_AUTOPTR, the function virBitmapFree will be run
automatically on it when it goes out of scope.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: json: use VIR_AUTOPTR for aggregate types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:59 +0000 (23:24 +0530)]
util: json: use VIR_AUTOPTR for aggregate types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: json: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:58 +0000 (23:24 +0530)]
util: json: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: json: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:56 +0000 (23:24 +0530)]
util: json: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
viralloc.h include, since that has moved from the source module into the
header.

When a variable of type virJSONValuePtr is declared using
VIR_AUTOPTR, the function virJSONValueFree will be run
automatically on it when it goes out of scope.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: auth: use VIR_AUTOPTR for aggregate types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:55 +0000 (23:24 +0530)]
util: auth: use VIR_AUTOPTR for aggregate types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: auth: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:54 +0000 (23:24 +0530)]
util: auth: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: authconfig: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:52 +0000 (23:24 +0530)]
util: authconfig: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: authconfig: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:50 +0000 (23:24 +0530)]
util: authconfig: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
viralloc.h include, since that has moved from the source module into the
header.

When a variable of type virAuthConfigPtr is declared using
VIR_AUTOPTR, the function virAuthConfigFree will be run
automatically on it when it goes out of scope.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: file: use VIR_AUTOPTR for aggregate types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:49 +0000 (23:24 +0530)]
util: file: use VIR_AUTOPTR for aggregate types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: file: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:48 +0000 (23:24 +0530)]
util: file: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: file: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:46 +0000 (23:24 +0530)]
util: file: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope.  Also, drop the redundant
viralloc.h include, since that has moved from the source module into the
header.

When a variable of type virFileWrapperFdPtr is declared using
VIR_AUTOPTR, the function virFileWrapperFdFree will be run
automatically on it when it goes out of scope.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: command: use VIR_AUTOPTR for aggregate types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:45 +0000 (23:24 +0530)]
util: command: use VIR_AUTOPTR for aggregate types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: command: use VIR_AUTOFREE instead of VIR_FREE for scalar types
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:44 +0000 (23:24 +0530)]
util: command: use VIR_AUTOFREE instead of VIR_FREE for scalar types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: command: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:42 +0000 (23:24 +0530)]
util: command: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
viralloc.h include, since that has moved from the source module into the
header.

When a variable of type virCommandPtr is declared using VIR_AUTOPTR,
the function virCommandFree will be run automatically on it when it
goes out of scope.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: string: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:41 +0000 (23:24 +0530)]
util: string: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope.

Alias virString to (char *) so that the new cleanup macros
can be used for a list of strings (char **).

When a list of strings (virString *) is declared using VIR_AUTOPTR,
the function virStringListFree will be run automatically on it when
it goes out of scope.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agocfg.mk: variable initialization when declared with cleanup macro
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:40 +0000 (23:24 +0530)]
cfg.mk: variable initialization when declared with cleanup macro

A variable, which is never assigned a value in the function, might get
passed into the cleanup function which may or may not raise any errors.

To maintain the correct usage, the variable must be initialized, either
with a value or with NULL. This syntax-check rule takes care of that.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: alloc: add macros for implementing automatic cleanup functionality
Sukrit Bhatnagar [Fri, 13 Jul 2018 17:54:39 +0000 (23:24 +0530)]
util: alloc: add macros for implementing automatic cleanup functionality

New macros are introduced which help in adding GNU C's cleanup
attribute to variable declarations. Variables declared with these
macros will have their allocated memory freed automatically when
they go out of scope.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agomaint: update to latest gnulib
Michal Privoznik [Sat, 14 Jul 2018 06:51:27 +0000 (08:51 +0200)]
maint: update to latest gnulib

The changelog is quite long because we haven't updated gnulib in
a while. Anyway, among the new changes you'll find GCC 8 support,
faster build time, mingw fixes and many others.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu_cgroup: Allow/disallow devmapper control iff available
Michal Privoznik [Fri, 13 Jul 2018 12:34:28 +0000 (14:34 +0200)]
qemu_cgroup: Allow/disallow devmapper control iff available

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

On kernels without device mapper support there won't be
/dev/mapper/control. Therefore it doesn't make much sense to
put it into devices CGroup.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovirDevMapperGetTargetsImpl: Be tolerant to kernels without DM support
Michal Privoznik [Fri, 13 Jul 2018 12:31:16 +0000 (14:31 +0200)]
virDevMapperGetTargetsImpl: Be tolerant to kernels without DM support

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

If kernel is compiled without CONFIG_BLK_DEV_DM enabled, there is
no /dev/mapper/control device and since dm_task_create() actually
does some ioctl() over it creating a task may fail.
To cope with this handle ENOENT and ENODEV gracefully.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovirnetdevtap: Don't crash on !ifname in virNetDevTapInterfaceStats
Michal Privoznik [Fri, 13 Jul 2018 09:08:32 +0000 (11:08 +0200)]
virnetdevtap: Don't crash on !ifname in virNetDevTapInterfaceStats

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

Some domain <interfaces/> do not have a name (because they are
not TAP devices). Therefore, if
virNetDevTapInterfaceStats(net->ifname, ...) is called an instant
crash occurs. In Linux version of the function strlen() is called
over the name and in BSD version STREQ() is called.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agotests: qemumonitorjson: Do QMP schema validation for DO_TEST_GEN
Peter Krempa [Thu, 12 Jul 2018 11:53:25 +0000 (13:53 +0200)]
tests: qemumonitorjson: Do QMP schema validation for DO_TEST_GEN

Test some more QMP commands against the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemumonitorjson: Fix schema testing of monitor commands
Peter Krempa [Thu, 12 Jul 2018 11:40:00 +0000 (13:40 +0200)]
tests: qemumonitorjson: Fix schema testing of monitor commands

The 'simpleFunc' data structure is overwritten by the code generated
from the macros which initiate the tests. This means that most of the
tests would get NULL 'schema' member which means that the schema
validation would not take place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemumonitorjson: Raise the necessary debug level for QAPI schema checks
Peter Krempa [Thu, 12 Jul 2018 11:36:48 +0000 (13:36 +0200)]
tests: qemumonitorjson: Raise the necessary debug level for QAPI schema checks

The debug output of the schema validator on success is not so
interesting that it should be printed when basic debugging is enabled.

Print it only when test debugging is set to 3 and more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemumonitorutils: Don't crash on wrong monitor command
Peter Krempa [Thu, 12 Jul 2018 11:27:40 +0000 (13:27 +0200)]
tests: qemumonitorutils: Don't crash on wrong monitor command

virQEMUQAPISchemaPathGet returns success when a given schema path was
not found but the returned object is set to NULL. This meant that we'd
call testQEMUSchemaValidate with the schemaroot being NULL which lead to
a crash if a mistyped monitor command was tested.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuschema: Add line break to debug message
Peter Krempa [Thu, 12 Jul 2018 11:20:34 +0000 (13:20 +0200)]
tests: qemuschema: Add line break to debug message

Message stating which schema replies file is being used would be
squashed with other messages.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuschema: Fix copy-paste error in function name
Peter Krempa [Thu, 12 Jul 2018 11:19:33 +0000 (13:19 +0200)]
tests: qemuschema: Fix copy-paste error in function name

s/testQEMUSchemaValidateArrayBuiltin/testQEMUSchemaValidateBuiltin/

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agodocs: schema: Add missing <alias> to vsock device
Han Han [Thu, 12 Jul 2018 06:28:17 +0000 (14:28 +0800)]
docs: schema: Add missing <alias> to vsock device

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

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovirsh.pod: Fix a command name typo in nwfilter-binding-undefine
Han Han [Thu, 12 Jul 2018 04:40:09 +0000 (12:40 +0800)]
virsh.pod: Fix a command name typo in nwfilter-binding-undefine

The true name of the command is nwfilter-binding-delete.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: Fix ATTRIBUTE_NONNULL for qemuMonitorAddObject
John Ferlan [Thu, 12 Jul 2018 19:41:32 +0000 (15:41 -0400)]
qemu: Fix ATTRIBUTE_NONNULL for qemuMonitorAddObject

Commit id fac0dacd was trying to make things more robust;
however, the ATTRIBUTE_NONNULL(1) would be for the @mon,
not the intended (2) and the @props argument as described
in the commit message.

Found by Coverity build.

Signed-off-by: John Ferlan <jferlan@redhat.com>
6 years agoNew virsh feature: domif-setlink --domain --interface --state completer
Simon Kobyda [Thu, 12 Jul 2018 14:07:59 +0000 (16:07 +0200)]
New virsh feature: domif-setlink --domain --interface --state completer

After you go through command mentioned above, completer
finds what state the device is currently in, and suggests
an opposite state.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agocompleter: Doesn't alloc enough space for null terminated array of strings
Simon Kobyda [Thu, 12 Jul 2018 14:00:08 +0000 (16:00 +0200)]
completer: Doesn't alloc enough space for null terminated array of strings

Functions virshSecretEventNameCompleter, virshPoolEventNameCompleter,
virshNodedevEventNameCompleter allocates only enough space
for array of N strings.

However these are null terminated strings, so program needs to
alloc space for array of N + 1 strings.

How to replicate error: valgrind virsh, use completer for
'nodedev-event --event' or 'pool-event --event' or
'secret-event --event'.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
6 years agospec: Explicitly require matching libvirt-libs
Jiri Denemark [Mon, 9 Jul 2018 15:45:45 +0000 (17:45 +0200)]
spec: Explicitly require matching libvirt-libs

All drivers now link directly to libvirt.so rather than getting the
symbols from the daemon. Let's explicitly mention this dependency in the
spec file instead of relying on transitive dependency from
libvirt-daemon.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agophyp_driver: Set remoteOnly member of virConnectDriver
Marcos Paulo de Souza [Tue, 10 Jul 2018 23:31:02 +0000 (20:31 -0300)]
phyp_driver: Set remoteOnly member of virConnectDriver

Phyp driver can't function without a server being informed, so this flag
makes libvirt to check for a valid server before calling connectOpen.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agohyperv_driver: Set remoteOnly member of virConnectDriver
Marcos Paulo de Souza [Tue, 10 Jul 2018 23:31:01 +0000 (20:31 -0300)]
hyperv_driver: Set remoteOnly member of virConnectDriver

HyperV driver can't function without a server being informed, so this flag
makes libvirt to check for a valid server before calling connectOpen.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoesx_driver: Set remoteOnly member of virConnectDriver
Marcos Paulo de Souza [Tue, 10 Jul 2018 23:31:00 +0000 (20:31 -0300)]
esx_driver: Set remoteOnly member of virConnectDriver

ESX driver can't function without a server being informed, so this flag
makes libvirt to check for a valid server before calling connectOpen.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agolibvirt.c: Return error when remoteOnly is set but server is empty
Marcos Paulo de Souza [Tue, 10 Jul 2018 23:30:59 +0000 (20:30 -0300)]
libvirt.c: Return error when remoteOnly is set but server is empty

Some drivers require a server in order to work, so this flag removes the
burden of esach driver to check for an server by doing it in
virConnectOpenInternal.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
6 years agodriver.h: Add remoteOnly member to virConnectDriver struct
Marcos Paulo de Souza [Tue, 10 Jul 2018 23:30:58 +0000 (20:30 -0300)]
driver.h: Add remoteOnly member to virConnectDriver struct

This new flag will be set when a driver needs a remote URL in order to
work, as ESX, HyperV and Phyp.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
6 years agostoragePoolDefineXML: prefer using newDef to save config file
Shichangkuo [Tue, 10 Jul 2018 07:15:24 +0000 (07:15 +0000)]
storagePoolDefineXML: prefer using newDef to save config file

When re-defining an active storage pool, due to a bug the config
file on disk is not changed. This is because we are passing old
definition instead of new one to virStoragePoolObjSaveDef.
This issue was introduced by bfcd8fc9,

Signed-off-by: Changkuo Shi <shi.changkuo@h3c.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: monitor: Make qemuMonitorAddObject more robust against programming errors
Peter Krempa [Wed, 4 Jul 2018 14:36:37 +0000 (16:36 +0200)]
qemu: monitor: Make qemuMonitorAddObject more robust against programming errors

Document and check that @props contains a pointer to a json object and
check that both necessary fields are present. Also mark @props as
NONNULL.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Do not try to add secret object for TLS if it does not exist
Peter Krempa [Wed, 4 Jul 2018 14:28:58 +0000 (16:28 +0200)]
qemu: hotplug: Do not try to add secret object for TLS if it does not exist

The check whether the object holding secret for decryption of the TLS
environment was wrong and would always attempt to add the object. This
lead to a crash due to recent refactors.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Fetch pr-helper process info on reconnect
Michal Privoznik [Wed, 27 Jun 2018 13:57:30 +0000 (15:57 +0200)]
qemu: Fetch pr-helper process info on reconnect

If qemu-pr-helper process died while libvirtd was not running no
event is emitted. Therefore, when reconnecting to the monitor we
must check the qemu-pr-helper process status and act accordingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu_monitor: Introduce qemuMonitorJSONGetPRManagerInfo
Michal Privoznik [Tue, 3 Jul 2018 10:07:30 +0000 (12:07 +0200)]
qemu_monitor: Introduce qemuMonitorJSONGetPRManagerInfo

This function fetches status of all pr-managers. So far, qemu
reports only a single attribute "connected" but that fits our
needs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Wire up PR_MANAGER_STATUS_CHANGED event
Michal Privoznik [Wed, 27 Jun 2018 10:17:59 +0000 (12:17 +0200)]
qemu: Wire up PR_MANAGER_STATUS_CHANGED event

This event is emitted on the monitor if one of pr-managers lost
connection to its pr-helper process. What libvirt needs to do is
restart the pr-helper process iff it corresponds to managed
pr-manager.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>