]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoUse G_GNUC_UNUSED everywhere
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
Use G_GNUC_UNUSED everywhere

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovz: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
vz: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovbox: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
vbox: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
util: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotools: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:44:29 +0000 (14:44 +0200)]
tools: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:03 +0000 (14:45 +0200)]
tests: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotest: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
test: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agostorage: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
storage: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agosecurity: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
security: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agorpc: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
rpc: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoremote: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
remote: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
qemu: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoopenvz: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
openvz: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonwfilter: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
nwfilter: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonode_device: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
node_device: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonetwork: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
network: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolxc: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
lxc: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agologging: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
logging: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolocking: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
locking: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolibxl: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
libxl: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoesx: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
esx: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agocpu: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
cpu: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
conf: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agobhyve: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
bhyve: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoadmin: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
admin: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoaccess: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
access: use G_GNUC_UNUSED

Use G_GNUC_UNUSED from GLib instead of ATTRIBUTE_UNUSED.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: use G_GNUC_UNUSED
Ján Tomko [Mon, 14 Oct 2019 12:45:33 +0000 (14:45 +0200)]
examples: use G_GNUC_UNUSED

Name the macro G_GNUC_UNUSED instead of ATTRIBUTE_UNUSED
to match the rest of libvirt code.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoUse G_GNUC_WARN_UNUSED_RESULT instead of ATTRIBUTE_RETURN_CHECK
Ján Tomko [Mon, 14 Oct 2019 12:25:14 +0000 (14:25 +0200)]
Use G_GNUC_WARN_UNUSED_RESULT instead of ATTRIBUTE_RETURN_CHECK

Introduced in GLib 2.10.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agouse G_GNUC_NULL_TERMINATED instead of ATTRIBUTE_SENTINEL
Ján Tomko [Mon, 14 Oct 2019 12:13:31 +0000 (14:13 +0200)]
use G_GNUC_NULL_TERMINATED instead of ATTRIBUTE_SENTINEL

Prefer G_GNUC_NULL_TERMINATED which was introduced in GLib 2.8.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agouse G_GNUC_NORETURN instead of ATTRIBUTE_NORETURN
Ján Tomko [Mon, 14 Oct 2019 12:07:39 +0000 (14:07 +0200)]
use G_GNUC_NORETURN instead of ATTRIBUTE_NORETURN

Remove all usage of ATTRIBUTE_NORETURN in favor of GLib's
G_GNUC_NORETURN.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoapibuild: ignore GLib macros too
Ján Tomko [Mon, 14 Oct 2019 12:31:15 +0000 (14:31 +0200)]
apibuild: ignore GLib macros too

Add an exception for the GLib versions of the macros we already ignore.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: remove MIN and MAX macros
Ján Tomko [Wed, 2 Oct 2019 20:38:01 +0000 (22:38 +0200)]
util: remove MIN and MAX macros

They are already defined in glib.h.

(libxml2 also has them defined)

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agosecurity_stack: Perform rollback if one of stacked drivers fails
Michal Privoznik [Wed, 11 Sep 2019 09:19:06 +0000 (11:19 +0200)]
security_stack: Perform rollback if one of stacked drivers fails

In order to have multiple security drivers hidden under one
virSecurity* call, we have virSecurityStack driver which holds a
list of registered security drivers and for every virSecurity*
call it iterates over the list and calls corresponding callback
in real security drivers. For instance, for
virSecurityManagerSetAllLabel() it calls
domainSetSecurityAllLabel callback sequentially in NOP, DAC and
(possibly) SELinux or AppArmor drivers. This works just fine if
the callback from every driver returns success. Problem arises
when one of the drivers fails. For instance, aforementioned
SetAllLabel() succeeds for DAC but fails in SELinux in which
case all files that DAC relabelled are now owned by qemu:qemu (or
whomever runs qemu) and thus permissions are leaked. This is even
more visible with XATTRs which remain set for DAC.

The solution is to perform a rollback on failure, i.e. call
opposite action on drivers that succeeded.

I'm providing rollback only for set calls and intentionally
omitting restore calls for two reasons:

1) restore calls are less likely to fail (they merely remove
XATTRs and chown()/setfilecon() file - all of these operations
succeeded in set call),

2) we are not really interested in restore failures - in a very
few places we check for retval of a restore function we do so
only to print a warning.

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity_stack: Turn list of nested drivers into a doubly linked list
Michal Privoznik [Wed, 11 Sep 2019 08:33:19 +0000 (10:33 +0200)]
security_stack: Turn list of nested drivers into a doubly linked list

In near future we will need to walk through the list of internal
drivers in reversed order. The simplest solution is to turn
singly linked list into a doubly linked list.
We will not need to start from the end really, so there's no tail
pointer kept.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: Introduce virSecurityManagerGetDriver()
Michal Privoznik [Wed, 11 Sep 2019 09:40:04 +0000 (11:40 +0200)]
security: Introduce virSecurityManagerGetDriver()

This function returns the name of the secdriver. Since the name
is invariant we don't really need to lock the manager - it won't
change.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: Rename virSecurityManagerGetDriver() to virSecurityManagerGetVirtDriver()
Michal Privoznik [Wed, 11 Sep 2019 09:20:53 +0000 (11:20 +0200)]
security: Rename virSecurityManagerGetDriver() to virSecurityManagerGetVirtDriver()

This function is in fact returning the name of the virtualization
driver that registered the security manager/driver.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: Pass @migrated to virSecurityManagerSetAllLabel
Michal Privoznik [Wed, 11 Sep 2019 05:53:09 +0000 (07:53 +0200)]
security: Pass @migrated to virSecurityManagerSetAllLabel

In upcoming commits, virSecurityManagerSetAllLabel() will perform
rollback in case of failure by calling
virSecurityManagerRestoreAllLabel(). But in order to do that, the
former needs to have @migrated argument so that it can be passed
to the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agobuild: remove use of usleep gnulib module in favour of g_usleep
Daniel P. Berrangé [Wed, 2 Oct 2019 17:01:11 +0000 (18:01 +0100)]
build: remove use of usleep gnulib module in favour of g_usleep

The usleep function was missing on older mingw versions, but we can rely
on it existing everywhere these days. It may only support times upto 1
second in duration though, so we'll prefer to use g_usleep instead.

The commandhelper program is not changed since that can't link to glib.
Fortunately it doesn't need to build on Windows platforms either.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: replace strerror/strerror_r with g_strerror
Daniel P. Berrangé [Wed, 2 Oct 2019 15:30:36 +0000 (16:30 +0100)]
util: replace strerror/strerror_r with g_strerror

g_strerror is offers the safety/correctness benefits of strerror_r, with
the API design convenience of strerror.

Use of virStrerror should be eliminated through the codebase in favour
of g_strerror.

commandhelper.c is a special case as its a tiny single threaded test
program, not linked to glib, so it just uses traditional strerror().

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: convert over to use GRegex for regular expressions
Daniel P. Berrangé [Fri, 20 Sep 2019 14:01:41 +0000 (15:01 +0100)]
conf: convert over to use GRegex for regular expressions

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agolibxl: convert over to use GRegex for regular expressions
Daniel P. Berrangé [Fri, 20 Sep 2019 14:01:41 +0000 (15:01 +0100)]
libxl: convert over to use GRegex for regular expressions

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: convert virIdentity class to use GObject
Daniel P. Berrangé [Thu, 19 Sep 2019 14:38:03 +0000 (15:38 +0100)]
util: convert virIdentity class to use GObject

Converting from virObject to GObject is reasonably straightforward,
as illustrated by this patch for virIdentity

In the header file

 - Remove

     typedef struct _virIdentity virIdentity

 - Add

     #define VIR_TYPE_IDENTITY virIdentity_get_type ()
     G_DECLARE_FINAL_TYPE (virIdentity, vir_identity, VIR, IDENTITY, GObject);

   Which provides the typedef we just removed, and class
   declaration boilerplate and various other constants/macros.

In the source file

 - Change 'virObject parent' to 'GObject parent' in the struct
 - Remove the virClass variable and its initializing call
 - Add

      G_DEFINE_TYPE(virIdentity, vir_identity, G_TYPE_OBJECT)

   which declares the instance & class constructor functions

 - Add an impl of the instance & class constructors
   wiring up the finalize method to point to our dispose impl

In all files

 - Replace VIR_AUTOUNREF(virIdentityPtr) with g_autoptr(virIdentity)

 - Replace virObjectRef/Unref with g_object_ref/unref. Note
   the latter functions do *NOT* accept a NULL object where as
   libvirt's do. If you replace g_object_unref with g_clear_object
   it is NULL safe, but also clears the pointer.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoremote: convert methods using virIdentityPtr to auto free macros
Daniel P. Berrangé [Tue, 1 Oct 2019 14:37:09 +0000 (15:37 +0100)]
remote: convert methods using virIdentityPtr to auto free macros

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agorpc: convert methods using virIdentityPtr to auto free macros
Daniel P. Berrangé [Tue, 1 Oct 2019 14:37:09 +0000 (15:37 +0100)]
rpc: convert methods using virIdentityPtr to auto free macros

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoadmin: convert admin server code to use auto free macros
Daniel P. Berrangé [Tue, 1 Oct 2019 14:29:39 +0000 (15:29 +0100)]
admin: convert admin server code to use auto free macros

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoaccess: convert polkit driver to auto free memory
Daniel P. Berrangé [Mon, 30 Sep 2019 15:06:41 +0000 (16:06 +0100)]
access: convert polkit driver to auto free memory

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: convert virIdentity implementation and test suite to g_autoptr
Daniel P. Berrangé [Tue, 1 Oct 2019 16:38:12 +0000 (17:38 +0100)]
util: convert virIdentity implementation and test suite to g_autoptr

To simplify the later conversion from virObject to GObject, introduce
the use of g_autoptr to the virIdentity implementnation and test suite.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: use glib base64 encoding/decoding APIs
Daniel P. Berrangé [Mon, 16 Sep 2019 12:29:20 +0000 (13:29 +0100)]
util: use glib base64 encoding/decoding APIs

Replace use of the gnulib base64 module with glib's own base64 API family.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: convert virSecretObj APIs to use autofree
Daniel P. Berrangé [Fri, 4 Oct 2019 11:21:07 +0000 (12:21 +0100)]
conf: convert virSecretObj APIs to use autofree

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: add support for g_autoptr with virObject instances
Daniel P. Berrangé [Fri, 4 Oct 2019 16:14:10 +0000 (17:14 +0100)]
src: add support for g_autoptr with virObject instances

Libvirt currently uses the VIR_AUTOUNREF macro for auto cleanup of
virObject instances. GLib approaches things differently with GObject,
reusing their g_autoptr() concept.

This introduces support for g_autoptr() with virObject, to facilitate
the conversion to GObject.

Only virObject classes which are currently used with VIR_AUTOREF are
updated. Any others should be converted to GObject before introducing
use of autocleanup.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: rewrite auto cleanup macros to use glib's equivalent
Daniel P. Berrangé [Tue, 1 Oct 2019 09:52:28 +0000 (10:52 +0100)]
util: rewrite auto cleanup macros to use glib's equivalent

To facilitate porting over to glib, this rewrites the auto cleanup
macros to use glib's equivalent.

As a result it is now possible to use g_autoptr/VIR_AUTOPTR, and
g_auto/VIR_AUTOCLEAN, g_autofree/VIR_AUTOFREE interchangably, regardless
of which macros were used to declare the cleanup types.

Within the scope of any single method, code must remain consistent
using either GLib or Libvirt macros, never mixing both. New code
must preferentially use the GLib macros, and old code will be
converted incrementally.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: convert virSystemdActivation to use VIR_DEFINE_AUTOPTR_FUNC
Daniel P. Berrangé [Tue, 1 Oct 2019 09:50:34 +0000 (10:50 +0100)]
util: convert virSystemdActivation to use VIR_DEFINE_AUTOPTR_FUNC

Using the standard macro will facilitate the conversion to glib's
auto cleanup macros.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: use glib string allocation/formatting functions
Daniel P. Berrangé [Fri, 6 Sep 2019 12:10:24 +0000 (13:10 +0100)]
util: use glib string allocation/formatting functions

Convert the string duplication APIs to use the g_strdup family of APIs.

We previously used the 'strdup-posix' gnulib module because mingw does
not set errno to ENOMEM on failure

We previously used the 'strndup' gnulib module because this function
does not exist on mingw.

We previously used the 'vasprintf' gnulib module because of many GNU
supported format specifiers not working on non-Linux platforms. glib's
own equivalent standardizes on GNU format specifiers too.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: use glib memory allocation functions
Daniel P. Berrangé [Mon, 7 Oct 2019 16:56:08 +0000 (17:56 +0100)]
util: use glib memory allocation functions

Convert the VIR_ALLOC family of APIs with use of the g_malloc family of
APIs. Use of VIR_ALLOC related functions should be incrementally phased
out over time, allowing return value checks to be dropped. Use of
VIR_FREE should be replaced with auto-cleanup whenever possible.

We previously used the 'calloc-posix' gnulib module because mingw does
not set errno to ENOMEM on failure.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: link to glib library
Daniel P. Berrangé [Thu, 29 Aug 2019 15:12:24 +0000 (16:12 +0100)]
build: link to glib library

Add the main glib.h to internal.h so that all common code can use it.

Historically glib allowed applications to register an alternative
memory allocator, so mixing g_malloc/g_free with malloc/free was not
safe.

This was feature was dropped in 2.46.0 with:

      commit 3be6ed60aa58095691bd697344765e715a327fc1
      Author: Alexander Larsson <alexl@redhat.com>
      Date:   Sat Jun 27 18:38:42 2015 +0200

        Deprecate and drop support for memory vtables

Applications are still encourged to match g_malloc/g_free, but it is no
longer a mandatory requirement for correctness, just stylistic. This is
explicitly clarified in

    commit 1f24b36607bf708f037396014b2cdbc08d67b275
    Author: Daniel P. Berrangé <berrange@redhat.com>
    Date:   Thu Sep 5 14:37:54 2019 +0100

        gmem: clarify that g_malloc always uses the system allocator

Applications can still use custom allocators in general, but they must
do this by linking to a library that replaces the core malloc/free
implemenentation entirely, instead of via a glib specific call.

This means that libvirt does not need to be concerned about use of
g_malloc/g_free causing an ABI change in the public libary, and can
avoid memory copying when talking to external libraries.

This patch probes for glib, which provides the foundation layer with
a collection of data structures, helper APIs, and platform portability
logic.

Later patches will introduce linkage to gobject which provides the
object type system, built on glib, and gio which providing objects
for various interesting tasks, most notably including DBus client
and server support and portable sockets APIs, but much more too.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: probe for glib-2 library in configure
Daniel P. Berrangé [Tue, 30 Jul 2019 09:13:36 +0000 (10:13 +0100)]
build: probe for glib-2 library in configure

Prepare for linking with glib by probing for it at configure
time. Per supported platforms target, the min glib versions on
relevant distros are:

  RHEL-8: 2.56.1
  RHEL-7: 2.50.3
  Debian (Buster): 2.58.3
  Debian (Stretch): 2.50.3
  OpenBSD (Ports): 2.58.3
  FreeBSD (Ports): 2.56.3
  OpenSUSE Leap 15: 2.54.3
  SLE12-SP2: 2.48.2
  Ubuntu (Xenial): 2.48.0
  macOS (Homebrew): 2.56.0

This suggests that a minimum glib of 2.48 is a reasonable target.
This aligns with the minimum version required by qemu too.

We must disable the bad-function-cast warning as various GLib APIs
and macros will trigger this.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosecurity: selinux: Label externalDataStore
Cole Robinson [Mon, 7 Oct 2019 20:20:16 +0000 (16:20 -0400)]
security: selinux: Label externalDataStore

We mirror the labeling strategy that was used for its top image

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: break out SetImageLabelRelative
Cole Robinson [Mon, 7 Oct 2019 19:40:49 +0000 (15:40 -0400)]
security: selinux: break out SetImageLabelRelative

This will be used for recursing into externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: Restore image label for externalDataStore
Cole Robinson [Sat, 5 Oct 2019 23:45:21 +0000 (19:45 -0400)]
security: selinux: Restore image label for externalDataStore

Rename the existing virSecuritySELinuxRestoreImageLabelInt
to virSecuritySELinuxRestoreImageLabelSingle, and extend the new
ImageLabelInt handle externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: Add is_toplevel to SetImageLabelInternal
Cole Robinson [Mon, 7 Oct 2019 19:55:20 +0000 (15:55 -0400)]
security: selinux: Add is_toplevel to SetImageLabelInternal

This will simplify future patches and make the logic easier to follow

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: Drop !parent handling in SetImageLabelInternal
Cole Robinson [Mon, 7 Oct 2019 19:53:27 +0000 (15:53 -0400)]
security: selinux: Drop !parent handling in SetImageLabelInternal

The only caller always passes in a non-null parent

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: Simplify SetImageLabelInternal
Cole Robinson [Sat, 5 Oct 2019 14:24:44 +0000 (10:24 -0400)]
security: selinux: Simplify SetImageLabelInternal

All the SetFileCon calls only differ by the label they pass in.
Rework the conditionals to track what label we need, and use a
single SetFileCon call

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: Label externalDataStore
Cole Robinson [Mon, 7 Oct 2019 20:20:12 +0000 (16:20 -0400)]
security: dac: Label externalDataStore

We mirror the labeling strategy that was used for its sibling
image

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: break out SetImageLabelRelative
Cole Robinson [Mon, 7 Oct 2019 20:12:22 +0000 (16:12 -0400)]
security: dac: break out SetImageLabelRelative

This will be used for recursing into externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: Restore image label for externalDataStore
Cole Robinson [Sat, 5 Oct 2019 23:47:43 +0000 (19:47 -0400)]
security: dac: Restore image label for externalDataStore

Rename the existing virSecurityDACRestoreImageLabelInt
to virSecurityDACRestoreImageLabelSingle, and extend the new
ImageLabelInt handle externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: Add is_toplevel to SetImageLabelInternal
Cole Robinson [Mon, 7 Oct 2019 20:14:02 +0000 (16:14 -0400)]
security: dac: Add is_toplevel to SetImageLabelInternal

This will simplify future patches and make the logic easier to follow

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: Drop !parent handling in SetImageLabelInternal
Cole Robinson [Mon, 7 Oct 2019 20:13:19 +0000 (16:13 -0400)]
security: dac: Drop !parent handling in SetImageLabelInternal

The only caller always passes in a non-null parent

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Fill in meta->externalDataStore
Cole Robinson [Sat, 5 Oct 2019 18:39:32 +0000 (14:39 -0400)]
storagefile: Fill in meta->externalDataStore

Add virStorageSourceNewFromExternalData, similar to
virStorageSourceNewFromBacking and use it to fill in a
virStorageSource for externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Add externalDataStore member
Cole Robinson [Sat, 5 Oct 2019 18:39:22 +0000 (14:39 -0400)]
storagefile: Add externalDataStore member

Add the plumbing to track a externalDataStoreRaw as a virStorageSource

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Split out virStorageSourceNewFromChild
Cole Robinson [Sat, 5 Oct 2019 18:13:46 +0000 (14:13 -0400)]
storagefile: Split out virStorageSourceNewFromChild

Future patches will use this for external data file handling

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Don't access backingStoreRaw directly in FromBackingRelative
Cole Robinson [Sat, 5 Oct 2019 18:07:06 +0000 (14:07 -0400)]
storagefile: Don't access backingStoreRaw directly in FromBackingRelative

For the only usage, the rel == parent->backingStoreRaw, so drop
the direct access

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Fill in meta->externalDataStoreRaw
Cole Robinson [Sat, 5 Oct 2019 00:19:22 +0000 (20:19 -0400)]
storagefile: Fill in meta->externalDataStoreRaw

Call qcow2GetExtensions to actually fill in the virStorageSource
externalDataStoreRaw member

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Add externalDataStoreRaw member
Cole Robinson [Fri, 4 Oct 2019 21:18:21 +0000 (17:18 -0400)]
storagefile: Add externalDataStoreRaw member

Add the plumbing to track a qcow2 external data file path in
virStorageSource

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Fix backing format \0 check
Cole Robinson [Fri, 4 Oct 2019 23:41:36 +0000 (19:41 -0400)]
storagefile: Fix backing format \0 check

From qemu.git docs/interop/qcow2.txt

  == String header extensions ==

  Some header extensions (such as the backing file format name and
  the external data file name) are just a single string. In this case,
  the header extension length is the string length and the string is
  not '\0' terminated. (The header extension padding can make it look
  like a string is '\0' terminated, but neither is padding always
  necessary nor is there a guarantee that zero bytes are used
  for padding.)

So we shouldn't be checking for a \0 byte at the end of the backing
format section. I think in practice there always is a \0 but we
shouldn't depend on that.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Rename qcow2GetExtensions 'format' argument
Cole Robinson [Fri, 4 Oct 2019 22:47:24 +0000 (18:47 -0400)]
storagefile: Rename qcow2GetExtensions 'format' argument

To backingFormat, which makes it more clear. Move it to the end of
the argument list which will scale nicer with future patches

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Rename qcow2GetBackingStoreFormat
Cole Robinson [Fri, 4 Oct 2019 23:59:23 +0000 (19:59 -0400)]
storagefile: Rename qcow2GetBackingStoreFormat

...to qcow2GetExtensions. We will extend it for more extension
parsing in future patches

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Push extension_end calc to qcow2GetBackingStoreFormat
Cole Robinson [Fri, 4 Oct 2019 23:57:55 +0000 (19:57 -0400)]
storagefile: Push extension_end calc to qcow2GetBackingStoreFormat

This is a step towards making this qcow2GetBackingStoreFormat into
a generic qcow2 extensions parser

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Push 'start' into qcow2GetBackingStoreFormat
Cole Robinson [Fri, 4 Oct 2019 23:51:31 +0000 (19:51 -0400)]
storagefile: Push 'start' into qcow2GetBackingStoreFormat

This is a step towards making this qcow2GetBackingStoreFormat into
a generic qcow2 extensions parser

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Use qcowXGetBackingStore directly
Cole Robinson [Fri, 4 Oct 2019 22:14:49 +0000 (18:14 -0400)]
storagefile: Use qcowXGetBackingStore directly

The qcow1 and qcow2 variants are identical, so remove the wrappers

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Drop now unused isQCow2 argument
Cole Robinson [Fri, 4 Oct 2019 22:13:21 +0000 (18:13 -0400)]
storagefile: Drop now unused isQCow2 argument

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Check version to determine if qcow2 or not
Cole Robinson [Fri, 4 Oct 2019 22:12:14 +0000 (18:12 -0400)]
storagefile: Check version to determine if qcow2 or not

Rather than require a boolean to be passed in

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: qcow1: Let qcowXGetBackingStore fill in format
Cole Robinson [Fri, 4 Oct 2019 22:04:46 +0000 (18:04 -0400)]
storagefile: qcow1: Let qcowXGetBackingStore fill in format

Letting qcowXGetBackingStore fill in format gives the same behavior
we were opencoding in qcow1GetBackingStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: qcow1: Fix check for empty backing file
Cole Robinson [Fri, 4 Oct 2019 22:00:55 +0000 (18:00 -0400)]
storagefile: qcow1: Fix check for empty backing file

From f772b3d91fd the intention of this code seems to be to set
format=NONE when the image does not have a backing file. However
'buf' here is the whole qcow1 file header. What we want to be
checking is 'res' which is the parsed backing file path.
qcowXGetBackingStore sets this to NULL when there's no backing file.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: qcow1: Check for BACKING_STORE_OK
Cole Robinson [Fri, 4 Oct 2019 21:57:32 +0000 (17:57 -0400)]
storagefile: qcow1: Check for BACKING_STORE_OK

Check explicitly for BACKING_STORE_OK and not its 0 value

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Make GetMetadataInternal static
Cole Robinson [Sat, 5 Oct 2019 19:17:48 +0000 (15:17 -0400)]
storagefile: Make GetMetadataInternal static

It is only used in virstoragefile.c

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agotests: add a test for driver.c:virConnectValidateURIPath()
Daniel Henrique Barboza [Wed, 9 Oct 2019 19:11:44 +0000 (16:11 -0300)]
tests: add a test for driver.c:virConnectValidateURIPath()

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agosecurity: Don't remember labels for TPM
Michal Privoznik [Tue, 1 Oct 2019 08:32:26 +0000 (10:32 +0200)]
security: Don't remember labels for TPM

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

The /dev/tpmN file can be opened only once, as implemented in
drivers/char/tpm/tpm-dev.c:tpm_open() from the kernel's tree. Any
other attempt to open the file fails. And since we're opening the
file ourselves and passing the FD to qemu we will not succeed
opening the file again when locking it for seclabel remembering.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity_dac: Allow selective remember/recall for chardevs
Michal Privoznik [Tue, 1 Oct 2019 09:02:36 +0000 (11:02 +0200)]
security_dac: Allow selective remember/recall for chardevs

While in most cases we want to remember/recall label for a
chardev, there are some special ones (like /dev/tpm0) where we
don't want to remember the seclabel nor recall it. See next
commit for rationale behind.

While the easiest way to implement this would be to just add new
argument to virSecurityDACSetChardevLabel() this one is also a
callback for virSecurityManagerSetChardevLabel() and thus has
more or less stable set of arguments. Therefore, the current
virSecurityDACSetChardevLabel() is renamed to
virSecurityDACSetChardevLabelHelper() and the original function
is set to call the new one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: Try to lock only paths with remember == true
Michal Privoznik [Tue, 1 Oct 2019 08:30:05 +0000 (10:30 +0200)]
security: Try to lock only paths with remember == true

So far all items on the chown/setfilecon list have the same
.remember value.  But this will change shortly. Therefore, don't
try to lock paths which we won't manipulate XATTRs for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: apparmor: Allow RO /usr/share/edk2/
Cole Robinson [Wed, 9 Oct 2019 18:21:24 +0000 (14:21 -0400)]
security: apparmor: Allow RO /usr/share/edk2/

On Fedora, already whitelisted paths to AAVMF and OVMF binaries
are symlinks to binaries under /usr/share/edk2/. Add that directory
to the RO whitelist so virt-aa-helper-test passes

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agotests: Add capabilities for QEMU 4.2.0 on aarch64
Andrea Bolognani [Thu, 10 Oct 2019 13:38:37 +0000 (15:38 +0200)]
tests: Add capabilities for QEMU 4.2.0 on aarch64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: Add capabilities for QEMU 4.2.0 on ppc64
Andrea Bolognani [Thu, 10 Oct 2019 10:44:20 +0000 (12:44 +0200)]
tests: Add capabilities for QEMU 4.2.0 on ppc64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agolibxl: add slic_table <-> acpi_firmware conversion
Marek Marczykowski-Górecki [Sun, 15 Sep 2019 19:43:24 +0000 (21:43 +0200)]
libxl: add slic_table <-> acpi_firmware conversion

This isn't exactly equivalent setting (acpi_firmware may point to
non-SLIC ACPI table), but it's the most behavior preserving option.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
5 years agotests: libxl: ACPI slic table test
Marek Marczykowski-Górecki [Sun, 15 Sep 2019 19:43:23 +0000 (21:43 +0200)]
tests: libxl: ACPI slic table test

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
5 years agolibxl: add acpi slic table support
Ivan Kardykov [Sun, 15 Sep 2019 19:43:22 +0000 (21:43 +0200)]
libxl: add acpi slic table support

Libxl driver did not support setup additional acpi firmware to xen
guest. It is necessary to activate OEM Windows installs. This patch
allow to define in OS section acpi table param (which supported domain
common schema).

Signed-off-by: Ivan Kardykov <kardykov@tabit.pro>
[added info to docs/formatdomain.html.in]
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
5 years agosrc/driver.c: remove duplicated code in virGetConnect* functions
Daniel Henrique Barboza [Tue, 8 Oct 2019 21:02:00 +0000 (18:02 -0300)]
src/driver.c: remove duplicated code in virGetConnect* functions

All the 6 virGetConnect* functions in driver.c shares the
same code base. This patch creates a new static function
virGetConnectGeneric() that contains the common code to
be used with all other virGetConnect*.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agotests: delete objectlocking test code
Daniel P. Berrangé [Tue, 8 Oct 2019 15:18:00 +0000 (16:18 +0100)]
tests: delete objectlocking test code

The object locking test code is not run by any CI tests and has
bitrotted to the point where it isn't worth the effort to try to
fix it.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu_process: Initialize domain definition for QMP query
Michal Privoznik [Thu, 10 Oct 2019 07:44:12 +0000 (09:44 +0200)]
qemu_process: Initialize domain definition for QMP query

When constructing QMP capabilities we allocate a dummy domain
object to pass to qemuMonitorOpen(). However, after 75dd595861
the function also expects domain definition to be allocated for
the domain object. The referenced commit already fixed
qemumonitortestutils.c but forgot to fix the other caller:
qemuProcessQMPConnectMonitor().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonews: Update for the ccf-assist pSeries feature
Daniel Henrique Barboza [Tue, 8 Oct 2019 20:06:25 +0000 (17:06 -0300)]
news: Update for the ccf-assist pSeries feature

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: Implement the ccf-assist pSeries feature
Daniel Henrique Barboza [Tue, 8 Oct 2019 20:06:24 +0000 (17:06 -0300)]
qemu: Implement the ccf-assist pSeries feature

This patch adds the implementation of the ccf-assist pSeries
feature, based on the QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST
capability that was added in the previous patch.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>