]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
6 years agovirStoragePRDefFormat: Suppress path formatting for migratable XML
Michal Privoznik [Tue, 3 Jul 2018 11:58:33 +0000 (13:58 +0200)]
virStoragePRDefFormat: Suppress path formatting for migratable XML

If there are managed reservations for a disk source, the path to
the pr-helper socket is generated automatically by libvirt when
needed and points somewhere under priv->libDir. Therefore it is
very unlikely that the path will work even on migration
destination (the libDir is derived from domain short name and its
ID).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemuDomainValidateStorageSource: Relax PR validation
Michal Privoznik [Tue, 3 Jul 2018 11:24:48 +0000 (13:24 +0200)]
qemuDomainValidateStorageSource: Relax PR validation

Rather than rejecting the user provided path and alias for the
managed PR reservation we will ignore the provided path. The
reason is that migration XML does contain path even for managed
reservations.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemuProcessStartPRDaemonHook: Try to set NS iff domain was started with one
Michal Privoznik [Tue, 3 Jul 2018 11:19:59 +0000 (13:19 +0200)]
qemuProcessStartPRDaemonHook: Try to set NS iff domain was started with one

Users have possibility to disable qemu namespace feature (e.g.
because they are running on *BSD which lacks Linux NS support).
If that's the case we should not try to move qemu-pr-helper into
the same namespace as qemu is in.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: command: Format rerror/werror with -device instead of -drive
Peter Krempa [Mon, 9 Jul 2018 15:09:03 +0000 (17:09 +0200)]
qemu: command: Format rerror/werror with -device instead of -drive

Use the new proper location for the read/write error policy selection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: capabilities: Add capability for werror/rerror for 'usb-device' frontend
Peter Krempa [Mon, 9 Jul 2018 14:35:02 +0000 (16:35 +0200)]
qemu: capabilities: Add capability for werror/rerror for 'usb-device' frontend

Support for specifying it with the -device frontend was added recently.
Add a capability for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemuxml2argv: Add CAPS_LATEST version for the disk error policy test
Peter Krempa [Mon, 9 Jul 2018 15:06:41 +0000 (17:06 +0200)]
tests: qemuxml2argv: Add CAPS_LATEST version for the disk error policy test

Add output arguments generated with the latest qemu capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemuxml2argv: Unify all tests for disk error policy
Peter Krempa [Mon, 9 Jul 2018 15:00:12 +0000 (17:00 +0200)]
tests: qemuxml2argv: Unify all tests for disk error policy

Add multiple drives with the various configurations rather than having
multiple tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: block: Add support for RBD authentication for blockdev
Peter Krempa [Mon, 9 Jul 2018 14:05:16 +0000 (16:05 +0200)]
qemu: block: Add support for RBD authentication for blockdev

To allow using -blockdev with RBD we need to support the recently added
RBD authentication.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemucaps: Add test data for upcoming qemu 3.0.0
Peter Krempa [Mon, 9 Jul 2018 10:42:46 +0000 (12:42 +0200)]
tests: qemucaps: Add test data for upcoming qemu 3.0.0

Based on qemu commit ab3257c281c1a1a91da1090ac9e38ddd8f860c63

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: remove qemuqapischema.json
Peter Krempa [Mon, 9 Jul 2018 13:47:24 +0000 (15:47 +0200)]
tests: remove qemuqapischema.json

We now take the schema from the qemucapabilitiestest data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemu: Use qmp schema data from the qemucapabilities test
Peter Krempa [Mon, 9 Jul 2018 13:44:52 +0000 (15:44 +0200)]
tests: qemu: Use qmp schema data from the qemucapabilities test

Add helpers that allow using the latest schema from the replies from an
actual qemu which are recorded for the purpose of the qemucapabilities
test instead of an unsynced copy stored in qemuqapischema.json.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Rename qemuBuildDriveDevStr to qemuBuildDiskDeviceStr
Peter Krempa [Tue, 10 Jul 2018 08:41:04 +0000 (10:41 +0200)]
qemu: command: Rename qemuBuildDriveDevStr to qemuBuildDiskDeviceStr

It builds the string for '-device' from a virDomainDiskDef.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Refactor floppy controller command formatting
Peter Krempa [Mon, 25 Jun 2018 15:40:14 +0000 (17:40 +0200)]
qemu: command: Refactor floppy controller command formatting

Aggregate the code for the two separate formats used according to the
machine type and add some supporting code so that the function is
actually readable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Don't generate disk drive alias manually for floppies
Peter Krempa [Mon, 25 Jun 2018 06:59:37 +0000 (08:59 +0200)]
qemu: command: Don't generate disk drive alias manually for floppies

qemuBulildFloppyCommandLineOptions built its own version of the -drive
alias. Replace it by qemuAliasDiskDriveFromDisk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Split out formatting of disk source commandline
Peter Krempa [Thu, 7 Jun 2018 10:25:02 +0000 (12:25 +0200)]
qemu: command: Split out formatting of disk source commandline

Further split qemuBuildDiskCommandLine to separate formatting of the
source part.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Add warning regarding SD hotplug
Peter Krempa [Mon, 11 Jun 2018 11:36:56 +0000 (13:36 +0200)]
qemu: hotplug: Add warning regarding SD hotplug

SD card hotplug should not be implemented until they can be used via
-blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Rename and export qemuDiskBusNeedsDeviceArg
Peter Krempa [Thu, 7 Jun 2018 10:01:24 +0000 (12:01 +0200)]
qemu: command: Rename and export qemuDiskBusNeedsDeviceArg

Change the semantics to exactly opposite and rename it to
qemuDiskBusNeedsDriveArg. This will be necessary as some devices can't
be used with -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Remove disk from 'serial-unix-chardev' test
Peter Krempa [Mon, 9 Jul 2018 10:05:56 +0000 (12:05 +0200)]
tests: Remove disk from 'serial-unix-chardev' test

We are testing character devices so the disk is not necessary. Minimize
the configuration. This will prevent changes when switching to blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Reject copy_on_read for read-only disks
Peter Krempa [Tue, 10 Jul 2018 08:18:53 +0000 (10:18 +0200)]
qemu: domain: Reject copy_on_read for read-only disks

The sectors read from the backing image need to be written to the top
level image. If a disk is marked read-only the image can't be written.

QEMU handled that by disabling copy_on_read and reporting a warning:

-drive file=/var/lib/libvirt/images/c,format=qcow2,if=none,
    id=drive-scsi0-0-1,readonly=on,copy-on-read=on:
    warning: disabling copy-on-read on read-only drive

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Remove code assuming disk format probing
Peter Krempa [Tue, 10 Jul 2018 08:09:05 +0000 (10:09 +0200)]
qemu: domain: Remove code assuming disk format probing

After commit c95f50cb021ea9a297 we always set a disk format in the
post parse callback so the code that mandates use of explicit format for
shareable disks no longer makes sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: validate: Enforce compile time switch type checking for videos
Erik Skultety [Thu, 28 Jun 2018 08:55:47 +0000 (10:55 +0200)]
qemu: validate: Enforce compile time switch type checking for videos

There wasn't an explicit type case to the video type enum in
qemuDomainDeviceDefValidateVideo, _TYPE_GOP was also missing from the
switch.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Introduce virDomainDefPostParseVideo helper
Erik Skultety [Thu, 28 Jun 2018 07:46:27 +0000 (09:46 +0200)]
conf: Introduce virDomainDefPostParseVideo helper

Move the video post parse bits into a separate helper as the logic is
going to be extended in the future.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Introduce virDomainVideoDefClear helper
Erik Skultety [Thu, 28 Jun 2018 07:36:26 +0000 (09:36 +0200)]
conf: Introduce virDomainVideoDefClear helper

Future patches rely on the ability to reset the contents of the
virDomainVideoDef structure rather than re-allocating it.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: address: Handle all the video devices within a single loop
Erik Skultety [Wed, 23 May 2018 13:55:36 +0000 (15:55 +0200)]
qemu: address: Handle all the video devices within a single loop

Since 133fb140 moved the validation of a video device into a separate
function, the code handling PCI slot assignment for video devices has
been the same for both the primary device and the secondary devices.
Let's merge these and thus handle all the devices within the existing
'for' loop.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: command: Fix building of the SDL display command line
Erik Skultety [Tue, 19 Jun 2018 16:04:57 +0000 (18:04 +0200)]
qemu: command: Fix building of the SDL display command line

QEMU uses a shorthand '-sdl' which maps to '-display sdl'. However, if
there are any options to be passed to SDL, the full command version must
be used. Everything seemingly worked for us until commit 5038b300437
introduced OpenGL support for SDL and added ',gl=on/off' option which as
mentioned above could have never worked with the shorthand version of
the command. Indeed starting a domain with an SDL display and OpenGL
enabled, QEMU produces a rather cryptic error:

-sdl: Could not open 'gl=on': No such file or directory

This patch provides fixes to both the SDL cmdline generation and the
test suite.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Replace error label with cleanup in virDomainGraphicsDefParseVNCXML
Erik Skultety [Thu, 21 Jun 2018 13:50:01 +0000 (15:50 +0200)]
conf: Replace error label with cleanup in virDomainGraphicsDefParseVNCXML

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: command: Add virReportEnumRangeError to BuildHostdevCommandline
Erik Skultety [Fri, 8 Jun 2018 11:47:31 +0000 (13:47 +0200)]
qemu: command: Add virReportEnumRangeError to BuildHostdevCommandline

Adding the 'default' case to our enum-typecasted switches is the current
safety trend, so add it here for mdevs too.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: command: Move graphics iteration to its own function
Erik Skultety [Fri, 25 May 2018 13:57:11 +0000 (15:57 +0200)]
qemu: command: Move graphics iteration to its own function

It should be the command line helper who takes care of the iteration
rather than the caller.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Remove a redundant model/address-type check in mdev post parse
Erik Skultety [Fri, 25 May 2018 07:47:03 +0000 (09:47 +0200)]
conf: Remove a redundant model/address-type check in mdev post parse

It's pointless to check the same thing multiple times.
Fix the indentation along the way too.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirsh: sata support for virsh attach-disk --address
Han Han [Wed, 4 Jul 2018 03:05:00 +0000 (11:05 +0800)]
virsh: sata support for virsh attach-disk --address

Adding sata bus address support to the optional address parameter of virsh
attach-disk. The address is used as controller.bus.unit. e.g.
sata:0.0.0

Signed-off-by: Han Han <hhan@redhat.com>
6 years agovirsh: usb support for virsh attach-disk --address
Han Han [Wed, 4 Jul 2018 03:04:59 +0000 (11:04 +0800)]
virsh: usb support for virsh attach-disk --address

Adding usb bus address support to the optional address parameter
of virsh attach-disk. The address is used as bus:port. e.g. usb:1:1.

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Fix typo in qemu_command.c
Boris Fiuczynski [Mon, 9 Jul 2018 14:23:25 +0000 (16:23 +0200)]
qemu: Fix typo in qemu_command.c

Rename qemuBulildFloppyCommandLineOptions into
qemuBuildFloppyCommandLineOptions.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
6 years agoqemu: monitor: Use 'target' instead of 'arch' in reply of 'query-cpus-fast'
Peter Krempa [Mon, 9 Jul 2018 10:32:39 +0000 (12:32 +0200)]
qemu: monitor: Use 'target' instead of 'arch' in reply of 'query-cpus-fast'

qemu changed the output field name for the architecture from 'arch' to
'target'. Note the change and fix the code so that the arch-specific
extraction works.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: monitor: Remove qemuMonitorJSONExtractCPUArchInfo wrapper
Peter Krempa [Mon, 9 Jul 2018 10:53:51 +0000 (12:53 +0200)]
qemu: monitor: Remove qemuMonitorJSONExtractCPUArchInfo wrapper

The wraper is quite pointless and also the 'arch' field may depend on
whether query-cpus-fast is used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodomain_nwfilter: Return early if net has no name in virDomainConfNWFilterTeardownImpl
Michal Privoznik [Mon, 9 Jul 2018 12:05:06 +0000 (14:05 +0200)]
domain_nwfilter: Return early if net has no name in virDomainConfNWFilterTeardownImpl

This function is called from various clean up paths (e.g.
from qemuBuildInterfaceCommandLine). However, depending on the
stage the interface creation process failed at, net->ifname might
still be not filled in when control jumps to cleanup label. If
that is the case return early (avoiding useless error message
produced in virNWFilterBindingLookupByPortDev) as there is no
NWFilter to tear down anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemuBuildSCSIiSCSIHostdevDrvStr: Don't leak @netsource and @srcprops
Michal Privoznik [Sat, 7 Jul 2018 07:33:00 +0000 (09:33 +0200)]
qemuBuildSCSIiSCSIHostdevDrvStr: Don't leak @netsource and @srcprops

After 6b770f9a3bdabb1 both @netsource and @srcprops are leaked
because of early return introduced in the commit.

==1812== 644 bytes in 4 blocks are definitely lost in loss record 835 of 885
==1812==    at 0x4C2F12F: realloc (vg_replace_malloc.c:785)
==1812==    by 0x8846393: xmlSaveUriRealloc (in /usr/lib64/libxml2.so.2.9.8)
==1812==    by 0x8846B1C: xmlSaveUri (in /usr/lib64/libxml2.so.2.9.8)
==1812==    by 0x5DDA619: virURIFormat (viruri.c:256)
==1812==    by 0x56E941B: qemuBuildNetworkDriveURI (qemu_command.c:781)
==1812==    by 0x56E979A: qemuBuildNetworkDriveStr (qemu_command.c:859)
==1812==    by 0x56F3A0B: qemuBuildSCSIiSCSIHostdevDrvStr (qemu_command.c:4664)
==1812==    by 0x56F3D1F: qemuBuildSCSIHostdevDrvStr (qemu_command.c:4732)
==1812==    by 0x56F57F7: qemuBuildHostdevCommandLine (qemu_command.c:5337)
==1812==    by 0x570303A: qemuBuildCommandLine (qemu_command.c:10376)
==1812==    by 0x57604EE: qemuProcessCreatePretendCmd (qemu_process.c:6649)
==1812==    by 0x11352A: testCompareXMLToArgv (qemuxml2argvtest.c:566)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoAUTHORS: Avoid duplicated entries
Andrea Bolognani [Wed, 4 Jul 2018 07:34:46 +0000 (09:34 +0200)]
AUTHORS: Avoid duplicated entries

Instead of simply dumping the list of authors as obtained
from git, we can be a bit smarter and filter out maintainers
so that their names don't appear twice.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agomailmap: Consolidate current and past maintainers
Andrea Bolognani [Wed, 4 Jul 2018 11:42:01 +0000 (13:42 +0200)]
mailmap: Consolidate current and past maintainers

We can't do this in general, but for maintainers we have
the data in AUTHORS.in to use as a source of truth.

This gets rid of several duplicated lines in the generated
AUTHORS file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agomailmap: Fix consolidation rules
Andrea Bolognani [Wed, 4 Jul 2018 11:22:58 +0000 (13:22 +0200)]
mailmap: Fix consolidation rules

The basic mailmap syntax works for simple cases, but
sometimes it requires two entiries or doesn't work at all;
switch to the more complex syntax in those cases.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoAUTHORS: Fix entries disagreeing with mailmap
Andrea Bolognani [Wed, 4 Jul 2018 12:15:43 +0000 (14:15 +0200)]
AUTHORS: Fix entries disagreeing with mailmap

Based on which of the two files has been updated most
recently, and what name is used for recent commits.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoAUTHORS: Remove unnecessary remark
Andrea Bolognani [Wed, 4 Jul 2018 07:32:41 +0000 (09:32 +0200)]
AUTHORS: Remove unnecessary remark

While technically correct (you have to send patches for
your name to appear on the list) the remark was clearly
intended for a time before AUTHORS was partially generated
from the git log.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoexamples: Remove config.h from hellolibvirt and openauth
Marcos Paulo de Souza [Sun, 8 Jul 2018 18:56:53 +0000 (15:56 -0300)]
examples: Remove config.h from hellolibvirt and openauth

These two examples do not use any definition from config.h, and by
removing it these examples can be compiled standalone.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agostorage: Rename btrfsCloneFile to support other filesystems.
Julio Faracco [Fri, 6 Jul 2018 13:43:01 +0000 (10:43 -0300)]
storage: Rename btrfsCloneFile to support other filesystems.

This commit renames and adds other macros to support aother filesystems
when a reflink is performed. After that, XFS filesystems (and others)
with reflink support will be able to clone.

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

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoconfigure: Adding XFS library/headers check.
Julio Faracco [Fri, 6 Jul 2018 13:43:00 +0000 (10:43 -0300)]
configure: Adding XFS library/headers check.

This commit checks for xfs.h library to use XFS_IOC_CLONE which is
defined into that library file. So, after that it is possible to use
thie macro to create reflinks.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
6 years agoqemu: fix UNIX socket chardevs operating in client mode
Daniel P. Berrangé [Fri, 6 Jul 2018 10:00:11 +0000 (11:00 +0100)]
qemu: fix UNIX socket chardevs operating in client mode

When support was adding for passing a pre-opened listener socket to UNIX
chardevs, it accidentally passed the listener socket for client mode
chardevs too with predictable amounts of fail resulting. This affects
libvirt when using QEMU >= 2.12

Expand the unit test coverage to validate that we are only doing FD
passing when operating in server mode.

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

Tested-by: Richard W.M. Jones <rjones@redhat.com>
Reported-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: don't use chardev FD passing for vhostuser backend
Daniel P. Berrangé [Wed, 4 Jul 2018 13:28:14 +0000 (14:28 +0100)]
qemu: don't use chardev FD passing for vhostuser backend

QEMU chardevs have a bug which makes the vhostuser backend complain
about lack of support for FD passing when validating the chardev.
While this is ultimately QEMU's responsibility to fix, libvirt needs to
avoid tickling the bug.

Simply disabling chardev FD passing just for vhostuser's chardev is
the most prudent approach, avoiding need for a QEMU version number
check.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: consolidate parameters of qemuBuildChrChardevStr into flags
Daniel P. Berrangé [Wed, 4 Jul 2018 13:20:40 +0000 (14:20 +0100)]
qemu: consolidate parameters of qemuBuildChrChardevStr into flags

There are two boolean parameters passed to qemuBuildChrChardevStr,
and soon there will be a third. It will be clearer to understand
from callers' POV if we use named flags instead.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: remove chardevStdioLogd param from vhostuser code path
Daniel P. Berrangé [Thu, 5 Jul 2018 10:59:22 +0000 (11:59 +0100)]
qemu: remove chardevStdioLogd param from vhostuser code path

The vhostuser network backend is only supported with the UNIX domain
socket chardev backend, so passing around chardevStdioLogd is not
required.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovirDomainConfNWFilterInstantiate: initialize @xml to avoid random crash
Luyao Huang [Thu, 5 Jul 2018 04:34:11 +0000 (12:34 +0800)]
virDomainConfNWFilterInstantiate: initialize @xml to avoid random crash

If the code jump to the cleanup before assigning value to @xml
libvirtd may crash when it tries to free an uninitialized pointer.

backtrace:

0  0x00007ffff428d59c in free () from /lib64/libc.so.6
1  0x00007ffff721314a in virFree (ptrptr=ptrptr@entry=0x7fffc67f1b00) at util/viralloc.c:582
2  0x00007ffff7345ac4 in virDomainConfNWFilterInstantiate (vmname=<optimized out>,
   vmuuid=vmuuid@entry=0x7fffc0181ca8 "߉\237\\۔H\262\206z\340\302f\265\233z", net=<optimized out>,
   ignoreExists=ignoreExists@entry=true) at conf/domain_nwfilter.c:122
3  0x00007fffca5a77f6 in qemuProcessFiltersInstantiate (ignoreExists=true, def=0x7fffc0181ca0) at qemu/qemu_process.c:3028
4  qemuProcessReconnect (opaque=<optimized out>) at qemu/qemu_process.c:7653
5  0x00007ffff72c4895 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
6  0x00007ffff45dcdd5 in start_thread () from /lib64/libpthread.so.0
7  0x00007ffff4305ead in clone () from /lib64/libc.so.6

Signed-off-by: Luyao Huang <lhuang@redhat.com>
6 years agovirsh.pod: Drop --persistent for detach-device-alias
Michal Privoznik [Thu, 5 Jul 2018 07:25:49 +0000 (09:25 +0200)]
virsh.pod: Drop --persistent for detach-device-alias

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

The detach-device-alias never supported --persistent argument.
Drop it from the man page.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agosrc: Mention DEVICE_REMOVAL_FAILED event in virDomainDetachDeviceAlias docs
Michal Privoznik [Wed, 4 Jul 2018 11:17:58 +0000 (13:17 +0200)]
src: Mention DEVICE_REMOVAL_FAILED event in virDomainDetachDeviceAlias docs

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

We are mentioning the positive outcome of the function and not
the case when live detaching a device is denied and event is
issued.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoqemuDomainNestedJobAllowed: Allow QEMU_JOB_NONE
Michal Privoznik [Wed, 4 Jul 2018 11:03:42 +0000 (13:03 +0200)]
qemuDomainNestedJobAllowed: Allow QEMU_JOB_NONE

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

When creating a snapshot with --quiesce an async job is grabbed
and just before executing guest fs-freeze command an agent job is
grabbed. This is achieved by calling

  qemuDomainObjBeginJobInternal(job = QEMU_JOB_NONE,
                                agentJob = QEMU_AGENT_JOB_MODIFY);

Since there already is an async job set on the domain (by the
same thread) qemuDomainNestedJobAllowed(priv, job) is consulted
if @job is allowed by job mask. But this function returns false
(meaning sync @job is not allowed) which leads to a deadlock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoesx: Use ESX_VI_CHECK_ARG_LIST macro to avoid code duplication
Marcos Paulo de Souza [Wed, 4 Jul 2018 02:31:23 +0000 (23:31 -0300)]
esx: Use ESX_VI_CHECK_ARG_LIST macro to avoid code duplication

By using this macro we can avoid boilerplate code to check for arrays of
objects from ESX driver. This replacement was done using the coccinelle
script bellow:

@@
identifier ptr;
@@

-if (!ptr || *ptr) { ... }
+ESX_VI_CHECK_ARG_LIST(ptr);

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>