Re: [libvirt] [RFC v2] external (pull) backup API

2018-04-12 Thread John Snow


On 04/12/2018 10:08 AM, Vladimir Sementsov-Ogievskiy wrote:
> 
> I propose, not to say that bitmap represents a checkpoint. It is simpler
> to say (and it reflects the reality) that bitmap is a difference between
> two consecutive checkpoints. And we can say, that active state is some
> kind of a checkpoint, current point in time.
> 
> So, we have checkpoints (5* is an active state) which are points in time:
> 
> 1 2 3 4 5*
> 

Oh -- the most recent checkpoint there doesn't belong to a ***specific
time*** yet. It's a floating checkpoint -- it always represents the most
current version. It's not really a checkpoint at all.

1, 2, 3, and 4 however are associated with a specific timestamp though.

> And bitmaps, first three are disabled, last is enabled:
> 
> "1->2", "2->3", "3->4", "4->5*"
> 

OK; so 1->2, 2->3 and 3->4 define deltas between two ***defined***
points in time.

4->5* however is only anchored by one specific point in time, and is
floating just like the most recent checkpoint is floating.

> So, remove first checkpoint: just remove bitmap "A->B".

I assume you mean "1->2" here.

And... yes, I agree -- if you don't care about your very first
checkpoint anymore, you can just delete the first bitmap, too.

> Remove any other checkpoint N: create new bitmap "(N-1)->(N+1)" =
> merge("(N-1)->N", "N->(N+1)"), drop bitmaps "(N-1)->N" and "N->(N+1)".

err, okay, so let's say we want to drop checkpoint 3:

create: "2->4"
merge: "2->3", "3->4" [and presumably store in "2->4"]
drop: 2->3, 3->4

OK, that makes more sense to me. In essence;

(1) We could consider this 2->3 absorbing 3->4, or
(2) 3->4 absorbing 2->3

and in either case it's the same, really.

> If the latter was active, the new one becomes active. And we cant remove
> 5* checkpoint, as it is an active state, not an actual checkpoint.

OK, crystal.

--js

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [RFC v2] external (pull) backup API

2018-04-12 Thread John Snow


On 04/12/2018 08:57 AM, Nikolay Shirokovskiy wrote:
> 
> 
> On 12.04.2018 07:14, John Snow wrote:
>>
>>
>> On 04/11/2018 12:32 PM, Eric Blake wrote:
>>> On 04/03/2018 07:01 AM, Nikolay Shirokovskiy wrote:
 Hi, all.   
   

   
 This is another RFC on pull backup API. This API provides means to read 
 domain   
 disks in a snapshotted state so that client can back them up as well as 
 means
 to write domain disks to revert them to backed up state. The previous 
 version
 of RFC is [1]. I'll also describe the API implementation details to shed 
 light   
 on misc qemu dirty bitmap commands usage.  
   
>>>
> 
> 
> 
> [snip]
> 
> 

 Qemu can track what disk's blocks are changed from snapshotted state so on 
 next
 backup client can backup only changed blocks. 
 virDomainBlockSnapshotCreateXML
 accepts VIR_DOMAIN_BLOCK_SNAPSHOT_CREATE_CHECKPOINT flag to turn this 
 option
 for snapshot which means to track changes from this particular snapshot. I 
 used
 checkpoint term and not [dirty] bitmap because many qemu dirty bitmaps are 
 used
 to provide changed blocks from the given checkpoint to current snapshot in
 current implementation (see *Implemenation* section for more details). Also
 bitmap keeps block changes and thus itself changes in time and checkpoint 
 is
 a more statical terms means you can query changes from that moment in time.

 Checkpoints are visible in active domain xml:

 
   ..
   
   
   
   
   ..
 

>>
>> It makes sense to avoid the bitmap name in libvirt, but do these indeed
>> correlate 1:1 with bitmaps?
>>
>> I assume each bitmap will have name=%%UUID%% ?
> 
> There is 1:1 correlation but names are different. Checkout checkpoints 
> subsection
> of *implementation details* section below for naming scheme.
> 

Yeah, I saw later. You have both "checkpoints" (associated with bitmaps)
and then the bitmaps themselves.

>>
 Every checkpoint requires qemu dirty bitmap which eats 16MiB of RAM with 
 default
 dirty block size of 64KiB for 1TiB disk and the same amount of disk space 
 is used.
 So client need to manage checkpoints and delete unused. Thus next API 
 function:


> 
> 
> 
> [snip]
> 
> 
> 
 First a few facts about qemu dirty bitmaps.

 Bitmap can be either in active or disable state. In disabled state it does 
 not
 get changed on guest writes. And oppositely in active state it tracks guest
 writes. This implementation uses approach with only one active bitmap at
 a time. This should reduce guest write penalties in the presence of
 checkpoints. So on first snapshot we create bitmap B_1. Now it tracks 
 changes
 from the snapshot 1. On second snapshot we create bitmap B_2 and disable 
 bitmap
 B1 and so on. Now bitmap B1 keep changes from snaphost 1 to snapshot 2, B2
 - changes from snaphot 2 to snapshot 3 and so on. Last bitmap is active and
 gets most disk change after latest snapshot.
>>
>> So you are trying to optimize away write penalties if you have, say, ten
>> bitmaps representing checkpoints so we don't have to record all new
>> writes to all ten.
>>
>> This makes sense, and I would have liked to formalize the concept in
>> QEMU, but response to that idea was very poor at the time.
>>
>> Also my design was bad :)
>>

 Getting changed blocks bitmap from some checkpoint in past till current 
 snapshot
 is quite simple in this scheme. For example if the last snapshot is 7 then
 to get changes from snapshot 3 to latest snapshot we need to merge bitmaps 
 B3,
 B4, B4 and B6. Merge is just logical OR on bitmap bits.

 Deleting a checkpoint somewhere in the middle of checkpoint sequence 
 requires
 merging correspondent bitmap to the previous bitmap in this scheme.

>>
>> Previous, or next?
> 
> In short previous.
> 
>>
>> Say we've got bitmaps (in chronological order from oldest to newest)
>>
>> A B C D E F G H
>>
>> and we want to delete bitmap (or "checkpoint") 'C':
>>
>> A B   D E F G H
>>
>> the bitmap representing checkpoint 'D' should now contain the bits that
>> used to be in 'C', right? That way all the checkpoints still represent
>> their appropriate points in time.
> 
> I merge to previous due to definition above. "A" contains changes from
> point in time A to point in time B an so no. So if you delete C in
> order for B to keep changes from point in time B to point in time D
> (next in checkpoint chain) you need merge C to B.
> 

I'm not 

Re: [libvirt] [RFC v2] external (pull) backup API

2018-04-12 Thread John Snow

On 04/12/2018 04:58 AM, Nikolay Shirokovskiy wrote:
> On 11.04.2018 19:32, Eric Blake wrote:
>> On 04/03/2018 07:01 AM, Nikolay Shirokovskiy wrote:


[snip]


>>
>> I'm trying to figure out how BlockCheckpoint and BlockSnapshots relate.
>> Maybe it will be more clear when I read the implementation section
>> below.  Is the idea that I can't create a BlockSnapshot without first
>> having a checkpoint available?  If so, where does that fit in the
>>  XML?
> 
> No, you can create snapshot without available checkpoints. Actually the first 
> snapshot
> is like that.
> 
> Now if you create a snapshot with checkpoint and then delete the snapshot
> the checkpoint remains, so we need an API to delete them if we wish.
> 

Hmm - OK, you are being careful to label three notions separately:

(1) Checkpoints (which are metadata objects in libvirt supported by
bitmaps in QEMU, roughly)
(2) BlockSnapshots (which expose data using checkpoints as metadata)
(3) Backups (which are made by a 3rd party client using a snapshot)

In this case, though, if a snapshot is requested it probably ought to be
*prepared* to create a checkpoint in case that snapshot is used by the
third party client to make a backup, right?

IOW, a snapshot -- though ignorant of how it is used -- can be and often
will be used to accomplish an incremental backup and as such must be
prepared to manipulate the checkpoints/bitmaps/etc in such a way to be
able to make a new checkpoint.

Right?


[snip]


>> Earlier, you said that the new virDomainBlockSnapshotPtr are
>> independent, with no relations between them.  But here, you are wanting
>> to keep incremental backups related to one another.
> 
> Yes, but backups are not snapshots. All backup relation management are on
> client. In pull backup scheme libvirt is only here to export a snapshotted
> disk state with optionally a CBT from some point in time. Client itself
> makes backups and track their relationships.
> 
> However as we use chain of disabled bitmaps with one active bitmap on tip
> of the chain and qemu does not track their order we need to do it in
> libvirt.
> 

Well, you seem to be tracking it in *qemu*, by using the name field.
Should we not make a commitment to whether or not we store this lineage
information in either qemu OR libvirt, but not distributed across both...?

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [RFC v2] external (pull) backup API

2018-04-12 Thread John Snow


On 04/03/2018 08:01 AM, Nikolay Shirokovskiy wrote:
> Hi, all.  
>
>   
>
> This is another RFC on pull backup API. This API provides means to read 
> domain   
> disks in a snapshotted state so that client can back them up as well as means 
>
> to write domain disks to revert them to backed up state. The previous version 
>
> of RFC is [1]. I'll also describe the API implementation details to shed 
> light   
> on misc qemu dirty bitmap commands usage. 
>
>   
>
> This API does not use existent disks snapshots. Instead it introduces 
> snapshots  
> provided by qemu's blockdev-backup command. The reason is we need snapshotted 
>
> disk state only temporarily for duration of backup operation and newly
>
> introduced snapshots can be easily discarded at the end of operation without  
>
> block commit operation. Technically difference is next. On usual snapshot we  
>
> create new image backed by original and all new data goes to the new image 
> thus  
> original image stays in a snapshotted state. In temporary snapshots we create 
>
> new image backed by original and all new data still goes to the original 
> image   
> but before new data is written old data to be overwritten is popped out to 
> the new   
> image thus we get snapshotted state thru new image.   
>
>   
>
> Disks snapshots as well as disks itself are avaiable to read/write thru qemu  
>
> NBD server.   
>

[snip!]

Do you think it's possible to characterize this API proposal as two
mechanisms:

(1) A mechanism for creating and manipulating "checkpoints" -- which are
book-ended by bitmap objects in QEMU -- implemented by the creation,
deletion, 'disabling' and 'merging' of bitmaps, and

(2) A mechanism for the consumption of said checkpoints via NBD / the
"fleecing" mechanisms that allow a live export of a static view of the
disk at that time (block snapshots + NBD exports)

If this is the case, do you think it is possible to consider (1) and (2)
somewhat orthogonal items -- in so far as it might be possible to add
support to libvirt directly to add push-model support for writing out
these checkpoints?

i.e.

once you have created a temporary snapshot and merged the various
component bitmaps into it, instead of creating an ephemeral block
snapshot and exporting it via NBD, we request a `blockdev-backup` with a
libvirt-specified target instead?

You don't have to add support for this right away, but I would really
enjoy if any API we check in here has the capacity to support both
push-and-pull paradigms without getting too ugly.

Does that sound like it can easily fit in with your designs so far?

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] Add function that raises error if domain is not active

2018-04-12 Thread Clementine Hayat
Add a function named virDomainObjCheckIsActive in src/conf/domain_conf.c.
It calls virDomainObjIsActive, raises error and returns.

There is a lot of occurence of this pattern and it will save 3 lines on
each call. Knowing that there is over 100 occurences, it will remove 300
lines from the code base.

Signed-off-by: Clementine Hayat 
---
Patch proposed for gsoc2018.

 src/conf/domain_conf.c   | 11 +
 src/conf/domain_conf.h   |  2 +
 src/libvirt_private.syms |  1 +
 src/qemu/qemu_driver.c   | 96 +---
 4 files changed, 34 insertions(+), 76 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d23182f18..86d28c26a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6003,6 +6003,17 @@ virDomainDefValidate(virDomainDefPtr def,
 return 0;
 }
 
+int
+virDomainObjCheckIsActive(virDomainObjPtr dom)
+{
+if (!virDomainObjIsActive(dom)) {
+   virReportError(VIR_ERR_OPERATION_INVALID,
+  "%s", _("domain is not running"));
+   return -1;
+}
+return 0;
+}
+
 
 /**
  * virDomainDeviceLoadparmIsValid
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index bbaa24137..8de4c4145 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2722,6 +2722,8 @@ virDomainObjIsActive(virDomainObjPtr dom)
 return dom->def->id != -1;
 }
 
+int virDomainObjCheckIsActive(virDomainObjPtr dom);
+
 int virDomainDefSetVcpusMax(virDomainDefPtr def,
 unsigned int vcpus,
 virDomainXMLOptionPtr xmlopt);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index cab324c4d..d90df3583 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -474,6 +474,7 @@ virDomainNostateReasonTypeFromString;
 virDomainNostateReasonTypeToString;
 virDomainObjAssignDef;
 virDomainObjBroadcast;
+virDomainObjCheckIsActive;
 virDomainObjCopyPersistentDef;
 virDomainObjEndAPI;
 virDomainObjFormat;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fcd79bd71..22cc9bddb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3537,11 +3537,8 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, 
const char *dxml,
 if (virDomainSaveFlagsEnsureACL(dom->conn, vm->def) < 0)
 goto cleanup;
 
-if (!virDomainObjIsActive(vm)) {
-virReportError(VIR_ERR_OPERATION_INVALID,
-   "%s", _("domain is not running"));
+if (virDomainObjCheckIsActive(vm) < 0)
 goto cleanup;
-}
 
 ret = qemuDomainSaveInternal(driver, vm, path, compressed,
  compressedpath, dxml, flags);
@@ -3595,11 +3592,9 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int 
flags)
 if (virDomainManagedSaveEnsureACL(dom->conn, vm->def) < 0)
 goto cleanup;
 
-if (!virDomainObjIsActive(vm)) {
-virReportError(VIR_ERR_OPERATION_INVALID,
-   "%s", _("domain is not running"));
+if (virDomainObjCheckIsActive(vm) < 0)
 goto cleanup;
-}
+
 if (!vm->persistent) {
 virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot do managed save for transient domain"));
@@ -3939,11 +3934,8 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom,
VIR_DOMAIN_JOB_OPERATION_DUMP) < 0)
 goto cleanup;
 
-if (!virDomainObjIsActive(vm)) {
-virReportError(VIR_ERR_OPERATION_INVALID,
-   "%s", _("domain is not running"));
+if (virDomainObjCheckIsActive(vm) < 0)
 goto endjob;
-}
 
 priv = vm->privateData;
 priv->job.current->statsType = QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP;
@@ -4054,11 +4046,8 @@ qemuDomainScreenshot(virDomainPtr dom,
 if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
 goto cleanup;
 
-if (!virDomainObjIsActive(vm)) {
-virReportError(VIR_ERR_OPERATION_INVALID,
-   "%s", _("domain is not running"));
+if (virDomainObjCheckIsActive(vm) < 0)
 goto endjob;
-}
 
 /* Well, even if qemu allows multiple graphic cards, heads, whatever,
  * screenshot command does not */
@@ -4165,11 +4154,8 @@ processWatchdogEvent(virQEMUDriverPtr driver,
 goto cleanup;
 }
 
-if (!virDomainObjIsActive(vm)) {
-virReportError(VIR_ERR_OPERATION_INVALID,
-   "%s", _("domain is not running"));
+if (virDomainObjCheckIsActive(vm) < 0)
 goto endjob;
-}
 
 flags |= cfg->autoDumpBypassCache ? VIR_DUMP_BYPASS_CACHE: 0;
 if ((ret = doCoreDump(driver, vm, dumpfile, flags,
@@ -10841,11 +10827,8 @@ qemuDomainBlockResize(virDomainPtr dom,
 if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
 goto cleanup;
 
-if (!virDomainObjIsActive(vm)) {
-virReportError(VIR_ERR_OPERATION_INVALID,
-   

Re: [libvirt] [PATCH v3 1/2] util: Add helper APIs to get/verify VF Representor name

2018-04-12 Thread John Ferlan


On 04/04/2018 12:29 PM, Jai Singh Rana wrote:
> Switchdev VF representor interface name on host is queried based on
> Bus:Device:Function information of pci SR-IOV device in Domain's
> 'hostdev' structure and subsequently verifying the required net sysfs
> directory and file entries of VF representor according to switchdev
> model.

You are missing the S-o-b:

The someone new policy is that:

Contributors to libvirt projects must assert that they are in compliance
with the Developer Certificate of Origin 1.1. This is achieved by adding
a "Signed-off-by" line containing the contributor's name and e-mail to
every commit message. The presence of this line attests that the
contributor has read the above lined DCO and agrees with its statements.

https://developercertificate.org/

> ---
> v3 includes changes based on v2's[1] feedback and suggestions. Fixes
> warnings reported by syntax-check.
> [1] https://www.redhat.com/archives/libvir-list/2018-February/msg00562.html
> 
>  po/POTFILES.in  |   1 +
>  src/libvirt_private.syms|   7 +
>  src/util/Makefile.inc.am|   2 +
>  src/util/virhostdev.c   |   2 +-
>  src/util/virhostdev.h   |   8 +
>  src/util/virnetdevhostdev.c | 374 
> 
>  src/util/virnetdevhostdev.h |  35 +
>  7 files changed, 428 insertions(+), 1 deletion(-)
>  create mode 100644 src/util/virnetdevhostdev.c
>  create mode 100644 src/util/virnetdevhostdev.h
> 

You probably don't have cppi installed, but if you did it would have
pointed out a few more syntax-check issues...

> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index d84859a4e..8cd6b86e8 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -234,6 +234,7 @@ src/util/virmdev.c
>  src/util/virnetdev.c
>  src/util/virnetdevbandwidth.c
>  src/util/virnetdevbridge.c
> +src/util/virnetdevhostdev.c
>  src/util/virnetdevip.c
>  src/util/virnetdevmacvlan.c
>  src/util/virnetdevmidonet.c
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index f6897915c..fad235206 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1923,6 +1923,7 @@ virHostCPUStatsAssign;
>  virHostdevFindUSBDevice;
>  virHostdevIsSCSIDevice;
>  virHostdevManagerGetDefault;
> +virHostdevNetDevice;
>  virHostdevPCINodeDeviceDetach;
>  virHostdevPCINodeDeviceReAttach;
>  virHostdevPCINodeDeviceReset;
> @@ -2306,6 +2307,12 @@ virNetDevBridgeSetSTPDelay;
>  virNetDevBridgeSetVlanFiltering;
>  
>  
> +# util/virnetdevhostdev.h
> +virNetdevHostdevCheckVFRIfName;
> +virNetdevHostdevGetVFRIfName;
> +virNetdevHostdevVFRIfStats;
> +
> +
>  # util/virnetdevip.h
>  virNetDevIPAddrAdd;
>  virNetDevIPAddrDel;
> diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
> index a3c3b711f..31fe11c68 100644
> --- a/src/util/Makefile.inc.am
> +++ b/src/util/Makefile.inc.am
> @@ -104,6 +104,8 @@ UTIL_SOURCES = \
>   util/virnetdevbandwidth.h \
>   util/virnetdevbridge.c \
>   util/virnetdevbridge.h \
> + util/virnetdevhostdev.c \
> + util/virnetdevhostdev.h \
>   util/virnetdevip.c \
>   util/virnetdevip.h \
>   util/virnetdevmacvlan.c \
> diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
> index a12224c58..4f7b46a04 100644
> --- a/src/util/virhostdev.c
> +++ b/src/util/virhostdev.c
> @@ -306,7 +306,7 @@ virHostdevIsVirtualFunction(virDomainHostdevDefPtr 
> hostdev)
>  }
>  
>  
> -static int
> +int
>  virHostdevNetDevice(virDomainHostdevDefPtr hostdev,
>  int pfNetDevIdx,
>  char **linkdev,
> diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h
> index 54e1c66be..735220add 100644
> --- a/src/util/virhostdev.h
> +++ b/src/util/virhostdev.h
> @@ -60,6 +60,14 @@ struct _virHostdevManager {
>  };
>  
>  virHostdevManagerPtr virHostdevManagerGetDefault(void);
> +
> +int
> +virHostdevNetDevice(virDomainHostdevDefPtr hostdev,
> +int pfNetDevIdx,
> +char **linkdev,
> +int *vf)
> +ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
> +
>  int
>  virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
>  const char *drv_name,
> diff --git a/src/util/virnetdevhostdev.c b/src/util/virnetdevhostdev.c
> new file mode 100644
> index 0..19f95bfdd
> --- /dev/null
> +++ b/src/util/virnetdevhostdev.c
> @@ -0,0 +1,374 @@
> +/*
> + * virnetdevhostdev.c: utilities to get/verify Switchdev VF Representor
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General 

[libvirt] [PATCH v1 4/7] qemu_monitor: Introduce qemuMonitorGetObjectProps

2018-04-12 Thread Michal Privoznik
Now that we've gotten rid of misleading names we can introduce
qemuMonitorGetObjectProps() function which queries -object
properties. Again, some parts of code can be reused.

Signed-off-by: Michal Privoznik 
---
 src/qemu/qemu_monitor.c  | 13 ++
 src/qemu/qemu_monitor.h  |  3 +++
 src/qemu/qemu_monitor_json.c | 62 ++--
 src/qemu/qemu_monitor_json.h |  4 +++
 4 files changed, 68 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 8a4350f6b2..278c2ec517 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3954,6 +3954,19 @@ qemuMonitorGetDeviceProps(qemuMonitorPtr mon,
 }
 
 
+int
+qemuMonitorGetObjectProps(qemuMonitorPtr mon,
+  const char *object,
+  char ***props)
+{
+VIR_DEBUG("object=%s props=%p", object, props);
+
+QEMU_CHECK_MONITOR_JSON(mon);
+
+return qemuMonitorJSONGetObjectProps(mon, object, props);
+}
+
+
 char *
 qemuMonitorGetTargetArch(qemuMonitorPtr mon)
 {
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index b797ea800e..94620b2b76 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1097,6 +1097,9 @@ int qemuMonitorGetObjectTypes(qemuMonitorPtr mon,
 int qemuMonitorGetDeviceProps(qemuMonitorPtr mon,
   const char *device,
   char ***props);
+int qemuMonitorGetObjectProps(qemuMonitorPtr mon,
+  const char *object,
+  char ***props);
 char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
 
 int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index a90762a4ff..31992c5bee 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6033,29 +6033,23 @@ int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr mon,
 #undef MAKE_SET_CMD
 
 
-int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
-  const char *device,
-  char ***props)
+static int
+qemuMonitorJSONParsePropsList(qemuMonitorPtr mon,
+  virJSONValuePtr cmd,
+  char ***props)
 {
-int ret = -1;
-virJSONValuePtr cmd;
 virJSONValuePtr reply = NULL;
 virJSONValuePtr data;
 char **proplist = NULL;
 ssize_t n = 0;
 size_t i;
-
-*props = NULL;
-
-if (!(cmd = qemuMonitorJSONMakeCommand("device-list-properties",
-   "s:typename", device,
-   NULL)))
-return -1;
+int ret = -1;
 
 if (qemuMonitorJSONCommand(mon, cmd, ) < 0)
 goto cleanup;
 
-if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) {
+if (qemuMonitorJSONHasError(reply, "DeviceNotFound") ||
+qemuMonitorJSONHasError(reply, "CommandNotFound")) {
 ret = 0;
 goto cleanup;
 }
@@ -6090,12 +6084,52 @@ int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
 
  cleanup:
 virStringListFree(proplist);
-virJSONValueFree(cmd);
 virJSONValueFree(reply);
 return ret;
 }
 
 
+int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
+  const char *device,
+  char ***props)
+{
+int ret = -1;
+virJSONValuePtr cmd;
+
+*props = NULL;
+
+if (!(cmd = qemuMonitorJSONMakeCommand("device-list-properties",
+   "s:typename", device,
+   NULL)))
+return -1;
+
+ret = qemuMonitorJSONParsePropsList(mon, cmd, props);
+virJSONValueFree(cmd);
+return ret;
+}
+
+
+int
+qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
+  const char *object,
+  char ***props)
+{
+int ret = -1;
+virJSONValuePtr cmd;
+
+*props = NULL;
+
+if (!(cmd = qemuMonitorJSONMakeCommand("qom-list-properties",
+   "s:typename", object,
+   NULL)))
+return -1;
+
+ret = qemuMonitorJSONParsePropsList(mon, cmd, props);
+virJSONValueFree(cmd);
+return ret;
+}
+
+
 char *
 qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon)
 {
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index df91b0b5dc..e2826ae4c6 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -445,6 +445,10 @@ int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
   const char *device,
   char ***props)
 ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
+  const char *object,
+  char ***props)
+

[libvirt] [PATCH v1 2/7] qemu_capabilities: s/ObjectProps/DeviceProps/g

2018-04-12 Thread Michal Privoznik
So far all the properties we are trying to fetch are device
properties, i.e. -device $dev on qemu command line. Change
misleading variable names to express what's queried for better.

Signed-off-by: Michal Privoznik 
---
 src/qemu/qemu_capabilities.c | 202 +--
 1 file changed, 101 insertions(+), 101 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 407c3229c3..1d2110eef3 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1106,14 +1106,14 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] 
= {
 { "pcie-pci-bridge", QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
 { "deflate-on-oom", QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE },
 { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY },
 { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM },
 { "ats", QEMU_CAPS_VIRTIO_PCI_ATS },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBlk[] = {
 { "bootindex", QEMU_CAPS_BOOTINDEX },
 { "ioeventfd", QEMU_CAPS_VIRTIO_IOEVENTFD },
 { "event_idx", QEMU_CAPS_VIRTIO_BLK_EVENT_IDX },
@@ -1126,7 +1126,7 @@ static struct virQEMUCapsStringFlags 
virQEMUCapsObjectPropsVirtioBlk[] = {
 { "ats", QEMU_CAPS_VIRTIO_PCI_ATS },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioNet[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioNet[] = {
 { "tx", QEMU_CAPS_VIRTIO_TX_ALG },
 { "event_idx", QEMU_CAPS_VIRTIO_NET_EVENT_IDX },
 { "rx_queue_size", QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE },
@@ -1137,87 +1137,87 @@ static struct virQEMUCapsStringFlags 
virQEMUCapsObjectPropsVirtioNet[] = {
 { "ats", QEMU_CAPS_VIRTIO_PCI_ATS },
 };
 
-static struct virQEMUCapsStringFlags 
virQEMUCapsObjectPropsSpaprPCIHostBridge[] = {
+static struct virQEMUCapsStringFlags 
virQEMUCapsDevicePropsSpaprPCIHostBridge[] = {
 { "numa_node", QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioSCSI[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioSCSI[] = {
 { "iothread", QEMU_CAPS_VIRTIO_SCSI_IOTHREAD },
 { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY },
 { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM },
 { "ats", QEMU_CAPS_VIRTIO_PCI_ATS },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsPCIAssign[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsPCIAssign[] = {
 { "configfd", QEMU_CAPS_PCI_CONFIGFD },
 { "bootindex", QEMU_CAPS_PCI_BOOTINDEX },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVfioPCI[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVfioPCI[] = {
 { "bootindex", QEMU_CAPS_VFIO_PCI_BOOTINDEX },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSCSIDisk[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsSCSIDisk[] = {
 { "channel", QEMU_CAPS_SCSI_DISK_CHANNEL },
 { "wwn", QEMU_CAPS_SCSI_DISK_WWN },
 { "share-rw", QEMU_CAPS_DISK_SHARE_RW },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsIDEDrive[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsIDEDrive[] = {
 { "wwn", QEMU_CAPS_IDE_DRIVE_WWN },
 { "share-rw", QEMU_CAPS_DISK_SHARE_RW },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsPiix4PM[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsPiix4PM[] = {
 { "disable_s3", QEMU_CAPS_PIIX_DISABLE_S3 },
 { "disable_s4", QEMU_CAPS_PIIX_DISABLE_S4 },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUSBRedir[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsUSBRedir[] = {
 { "filter", QEMU_CAPS_USB_REDIR_FILTER },
 { "bootindex", QEMU_CAPS_USB_REDIR_BOOTINDEX },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUSBHost[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsUSBHost[] = {
 { "bootindex", QEMU_CAPS_USB_HOST_BOOTINDEX },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSCSIGeneric[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsSCSIGeneric[] = {
 { "bootindex", QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsI440FXPCIHost[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsI440FXPCIHost[] = {
 { "pci-hole64-size", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsQ35PCIHost[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsQ35PCIHost[] = {
 { "pci-hole64-size", 

[libvirt] [PATCH v1 1/7] qemu: Rename qemuMonitorGetObjectProps to qemuMonitorGetDeviceProps

2018-04-12 Thread Michal Privoznik
This function is indeed getting -device properties and not
-object properties. The current name is misleading.

Signed-off-by: Michal Privoznik 
---
 src/qemu/qemu_capabilities.c | 2 +-
 src/qemu/qemu_monitor.c  | 8 
 src/qemu/qemu_monitor.h  | 4 ++--
 src/qemu/qemu_monitor_json.c | 6 +++---
 src/qemu/qemu_monitor_json.h | 4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 27180e8509..407c3229c3 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2091,7 +2091,7 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps,
 if (cap >= 0 && !virQEMUCapsGet(qemuCaps, cap))
 continue;
 
-if ((nvalues = qemuMonitorGetObjectProps(mon,
+if ((nvalues = qemuMonitorGetDeviceProps(mon,
  type,
  )) < 0)
 return -1;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 7b647525b3..8a4350f6b2 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3942,15 +3942,15 @@ qemuMonitorGetObjectTypes(qemuMonitorPtr mon,
 
 
 int
-qemuMonitorGetObjectProps(qemuMonitorPtr mon,
-  const char *type,
+qemuMonitorGetDeviceProps(qemuMonitorPtr mon,
+  const char *device,
   char ***props)
 {
-VIR_DEBUG("type=%s props=%p", type, props);
+VIR_DEBUG("device=%s props=%p", device, props);
 
 QEMU_CHECK_MONITOR_JSON(mon);
 
-return qemuMonitorJSONGetObjectProps(mon, type, props);
+return qemuMonitorJSONGetDeviceProps(mon, device, props);
 }
 
 
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index d04148e568..b797ea800e 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1094,8 +1094,8 @@ int qemuMonitorGetKVMState(qemuMonitorPtr mon,
 
 int qemuMonitorGetObjectTypes(qemuMonitorPtr mon,
   char ***types);
-int qemuMonitorGetObjectProps(qemuMonitorPtr mon,
-  const char *type,
+int qemuMonitorGetDeviceProps(qemuMonitorPtr mon,
+  const char *device,
   char ***props);
 char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
 
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 57c2c4de0f..a90762a4ff 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6033,8 +6033,8 @@ int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr mon,
 #undef MAKE_SET_CMD
 
 
-int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
-  const char *type,
+int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
+  const char *device,
   char ***props)
 {
 int ret = -1;
@@ -6048,7 +6048,7 @@ int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
 *props = NULL;
 
 if (!(cmd = qemuMonitorJSONMakeCommand("device-list-properties",
-   "s:typename", type,
+   "s:typename", device,
NULL)))
 return -1;
 
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 045df4919f..df91b0b5dc 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -441,8 +441,8 @@ int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr mon,
  qemuMonitorJSONObjectPropertyPtr prop)
 ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
 
-int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
-  const char *type,
+int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
+  const char *device,
   char ***props)
 ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
 char *qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon);
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH v2 6/6] jobs: Introduce {all_machines} and {rpm_machines}

2018-04-12 Thread Andrea Bolognani
We're running most of the jobs on all machines, with the major
notable exception being the various *-rpm jobs which of course
only make sense for RPM-based distributions.

Instead of listing machines over and over again, define two
list globally and refer to them by name. Ad-hoc machine lists
are still needed in a few places, but overall this cuts down on
repetition significantly.

Signed-off-by: Andrea Bolognani 
---
 jobs/defaults.yaml| 14 ++
 projects/libosinfo.yaml   | 16 ++--
 projects/libvirt-cim.yaml |  6 +-
 projects/libvirt-glib.yaml| 16 ++--
 projects/libvirt-go-xml.yaml  | 10 +-
 projects/libvirt-go.yaml  | 10 +-
 projects/libvirt-perl.yaml| 16 ++--
 projects/libvirt-python.yaml  | 16 ++--
 projects/libvirt.yaml | 27 +++
 projects/osinfo-db-tools.yaml | 16 ++--
 projects/osinfo-db.yaml   | 16 ++--
 projects/virt-viewer.yaml | 16 ++--
 12 files changed, 42 insertions(+), 137 deletions(-)

diff --git a/jobs/defaults.yaml b/jobs/defaults.yaml
index 23f8555..9fe69de 100644
--- a/jobs/defaults.yaml
+++ b/jobs/defaults.yaml
@@ -3,6 +3,20 @@
 name: global
 branch: master
 node: libvirt
+all_machines:
+  - libvirt-centos-7
+  - libvirt-debian-8
+  - libvirt-debian-9
+  - libvirt-fedora-26
+  - libvirt-fedora-27
+  - libvirt-fedora-rawhide
+  - libvirt-freebsd-10
+  - libvirt-freebsd-11
+rpm_machines:
+  - libvirt-centos-7
+  - libvirt-fedora-26
+  - libvirt-fedora-27
+  - libvirt-fedora-rawhide
 global_env: |
 local_env: |
 smp: 3
diff --git a/projects/libosinfo.yaml b/projects/libosinfo.yaml
index ac04027..0d25447 100644
--- a/projects/libosinfo.yaml
+++ b/projects/libosinfo.yaml
@@ -1,15 +1,7 @@
 
 - project:
 name: libosinfo
-machines:
-  - libvirt-centos-7
-  - libvirt-debian-8
-  - libvirt-debian-9
-  - libvirt-fedora-26
-  - libvirt-fedora-27
-  - libvirt-fedora-rawhide
-  - libvirt-freebsd-10
-  - libvirt-freebsd-11
+machines: '{all_machines}'
 title: libosinfo
 jobs:
   - autotools-build-job:
@@ -20,8 +12,4 @@
   parent_jobs: 'libosinfo-master-syntax-check'
   - autotools-rpm-job:
   parent_jobs: 'libosinfo-master-check'
-  machines:
-- libvirt-centos-7
-- libvirt-fedora-26
-- libvirt-fedora-27
-- libvirt-fedora-rawhide
+  machines: '{rpm_machines}'
diff --git a/projects/libvirt-cim.yaml b/projects/libvirt-cim.yaml
index 160faaf..dff3976 100644
--- a/projects/libvirt-cim.yaml
+++ b/projects/libvirt-cim.yaml
@@ -1,11 +1,7 @@
 
 - project:
 name: libvirt-cim
-machines:
-  - libvirt-centos-7
-  - libvirt-fedora-26
-  - libvirt-fedora-27
-  - libvirt-fedora-rawhide
+machines: '{rpm_machines}'
 title: libvirt CIM
 jobs:
   - autotools-build-job:
diff --git a/projects/libvirt-glib.yaml b/projects/libvirt-glib.yaml
index 74f7642..741ac44 100644
--- a/projects/libvirt-glib.yaml
+++ b/projects/libvirt-glib.yaml
@@ -1,15 +1,7 @@
 
 - project:
 name: libvirt-glib
-machines:
-  - libvirt-centos-7
-  - libvirt-debian-8
-  - libvirt-debian-9
-  - libvirt-fedora-26
-  - libvirt-fedora-27
-  - libvirt-fedora-rawhide
-  - libvirt-freebsd-10
-  - libvirt-freebsd-11
+machines: '{all_machines}'
 title: Libvirt GLib
 jobs:
   - autotools-build-job:
@@ -21,8 +13,4 @@
   parent_jobs: 'libvirt-glib-master-syntax-check'
   - autotools-rpm-job:
   parent_jobs: 'libvirt-glib-master-check'
-  machines:
-- libvirt-centos-7
-- libvirt-fedora-26
-- libvirt-fedora-27
-- libvirt-fedora-rawhide
+  machines: '{rpm_machines}'
diff --git a/projects/libvirt-go-xml.yaml b/projects/libvirt-go-xml.yaml
index 126058b..1f26751 100644
--- a/projects/libvirt-go-xml.yaml
+++ b/projects/libvirt-go-xml.yaml
@@ -1,15 +1,7 @@
 
 - project:
 name: libvirt-go-xml
-machines:
-  - libvirt-centos-7
-  - libvirt-debian-8
-  - libvirt-debian-9
-  - libvirt-fedora-26
-  - libvirt-fedora-27
-  - libvirt-fedora-rawhide
-  - libvirt-freebsd-10
-  - libvirt-freebsd-11
+machines: '{all_machines}'
 title: Libvirt Go XML
 local_env: |
   export TEST_ARGS="-tags xmlroundtrip"
diff --git a/projects/libvirt-go.yaml b/projects/libvirt-go.yaml
index 141c862..f40f523 100644
--- a/projects/libvirt-go.yaml
+++ b/projects/libvirt-go.yaml
@@ -1,15 +1,7 @@
 
 - project:
 name: libvirt-go
-machines:
-  - libvirt-centos-7
-  - libvirt-debian-8
-  - libvirt-debian-9
-  - libvirt-fedora-26
-  - libvirt-fedora-27
-  - libvirt-fedora-rawhide
-  - libvirt-freebsd-10
-  - 

[libvirt] [jenkins-ci PATCH v2 1/6] jobs: Introduce autotools-website-job

2018-04-12 Thread Andrea Bolognani
libvirt recently dropped support for running on CentOS 6, but
the libvirt.org website still runs on that platform, so we
need to be able to at least build documentation and create
distribution tarballs a little while longer.

autotools-website-job is the template for an ad-hoc job that
does exactly that, thus guaranteeing that the bare minimum
functionality we still need to work in CentOS 6 will, even as
the library itself moves forward and possibly stops building
on the OS altogether.

Signed-off-by: Andrea Bolognani 
---
 jobs/autotools.yaml | 67 +
 1 file changed, 67 insertions(+)

diff --git a/jobs/autotools.yaml b/jobs/autotools.yaml
index 0c164d3..9b26bc3 100644
--- a/jobs/autotools.yaml
+++ b/jobs/autotools.yaml
@@ -257,3 +257,70 @@
   recipients: '{obj:spam}'
   notify-every-unstable-build: true
   send-to-individuals: false
+
+- job-template:
+id: autotools-website-job
+name: '{name}-{branch}-website'
+project-type: matrix
+description: '{title} Website'
+autogen_args: ''
+workspace: '{name}-{branch}-website'
+child-workspace: '.'
+block-downstream: true
+block-upstream: true
+wrappers:
+  - timeout:
+  abort: true
+  type: absolute
+  timeout: 90
+  write-description: 'Aborted build after 90 minutes'
+properties:
+  - build-discarder:
+  days-to-keep: 30
+  num-to-keep: 1000
+scm:
+  - git:
+  url: git://n64.pufty.ci.centos.org/{name}.git
+  branches:
+- origin/{branch}
+  clean:
+after: true
+  skip-tag: true
+  wipe-workspace: false
+triggers:
+  - reverse:
+  jobs: '{obj:parent_jobs}'
+  - pollscm:
+  cron: "H/20 * * * *"
+axes:
+  - axis:
+  name: systems
+  type: slave
+  values: '{obj:machines}'
+builders:
+  - shell: |
+  {global_env}
+  {local_env}
+
+  # This job type is specifically tailored for the libvirt project
+  # and won't work anywhere else. Checking for libvirt.spec.in is
+  # a quick way to make sure the template is not being misused
+  test -e libvirt.spec.in
+
+  mkdir build
+  cd build
+
+  # Disable libvirtd and macvtap support to cut down the number
+  # of dependencies we need to install on the build worker
+  ../autogen.sh --without-libvirtd --without-macvtap
+
+  # Build the website itself
+  $MAKE -j{smp} -C docs/
+
+  # Make sure we can build nightly source snapshots
+  $MAKE -j{smp} dist
+publishers:
+  - email:
+  recipients: '{obj:spam}'
+  notify-every-unstable-build: true
+  send-to-individuals: false
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH v2 5/6] guests: Drop projects from CentOS 6

2018-04-12 Thread Andrea Bolognani
Since the build jobs no longer target the platform, we can
avoid installing all the extra packages.

Signed-off-by: Andrea Bolognani 
---
 guests/host_vars/libvirt-centos-6/main.yml | 4 
 1 file changed, 4 deletions(-)

diff --git a/guests/host_vars/libvirt-centos-6/main.yml 
b/guests/host_vars/libvirt-centos-6/main.yml
index 8261c3d..fe9a47b 100644
--- a/guests/host_vars/libvirt-centos-6/main.yml
+++ b/guests/host_vars/libvirt-centos-6/main.yml
@@ -3,8 +3,4 @@ PERL5LIB: $VIRT_PREFIX/lib64/perl5
 PYTHONPATH: $VIRT_PREFIX/lib64/python2.6/site-packages
 
 projects:
-  - libvirt
   - libvirt+website
-  - libvirt-cim
-  - libvirt-perl
-  - libvirt-python
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH v2 2/6] guests: Introduce libvirt+website project

2018-04-12 Thread Andrea Bolognani
Building the website and creating distribution tarballs
requires very few dependencies compared to performing a full
build of libvirt, so we introduce a separate, leaner project
for the purpose.

Signed-off-by: Andrea Bolognani 
---
 guests/vars/projects/libvirt+website.yml | 5 +
 1 file changed, 5 insertions(+)
 create mode 100644 guests/vars/projects/libvirt+website.yml

diff --git a/guests/vars/projects/libvirt+website.yml 
b/guests/vars/projects/libvirt+website.yml
new file mode 100644
index 000..128ed8c
--- /dev/null
+++ b/guests/vars/projects/libvirt+website.yml
@@ -0,0 +1,5 @@
+---
+packages:
+  - libxml2
+  - rpcgen
+  - xsltproc
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH v2 3/6] projects: Add libvirt-master-website job

2018-04-12 Thread Andrea Bolognani
This will ensure libvirt maintains the minimum amount of
compatibility with CentOS 6 that running its website on that
platform requires.

Signed-off-by: Andrea Bolognani 
---
 guests/host_vars/libvirt-centos-6/main.yml | 1 +
 projects/libvirt.yaml  | 4 
 2 files changed, 5 insertions(+)

diff --git a/guests/host_vars/libvirt-centos-6/main.yml 
b/guests/host_vars/libvirt-centos-6/main.yml
index 422d033..8261c3d 100644
--- a/guests/host_vars/libvirt-centos-6/main.yml
+++ b/guests/host_vars/libvirt-centos-6/main.yml
@@ -4,6 +4,7 @@ PYTHONPATH: $VIRT_PREFIX/lib64/python2.6/site-packages
 
 projects:
   - libvirt
+  - libvirt+website
   - libvirt-cim
   - libvirt-perl
   - libvirt-python
diff --git a/projects/libvirt.yaml b/projects/libvirt.yaml
index 13f39f9..427cf6a 100644
--- a/projects/libvirt.yaml
+++ b/projects/libvirt.yaml
@@ -43,3 +43,7 @@
   parent_jobs:
   machines:
 - libvirt-fedora-rawhide
+  - autotools-website-job:
+  parent_jobs:
+  machines:
+- libvirt-centos-6
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH v2 4/6] projects: Stop building on CentOS 6

2018-04-12 Thread Andrea Bolognani
CentOS 6 is no longer a supported target platform for libvirt,
which means all other projects can't target it either.

Signed-off-by: Andrea Bolognani 
---
 projects/libvirt-cim.yaml| 1 -
 projects/libvirt-perl.yaml   | 1 -
 projects/libvirt-python.yaml | 2 --
 projects/libvirt.yaml| 3 ---
 4 files changed, 7 deletions(-)

diff --git a/projects/libvirt-cim.yaml b/projects/libvirt-cim.yaml
index c1a0914..160faaf 100644
--- a/projects/libvirt-cim.yaml
+++ b/projects/libvirt-cim.yaml
@@ -2,7 +2,6 @@
 - project:
 name: libvirt-cim
 machines:
-  - libvirt-centos-6
   - libvirt-centos-7
   - libvirt-fedora-26
   - libvirt-fedora-27
diff --git a/projects/libvirt-perl.yaml b/projects/libvirt-perl.yaml
index 3912876..eb1ee77 100644
--- a/projects/libvirt-perl.yaml
+++ b/projects/libvirt-perl.yaml
@@ -2,7 +2,6 @@
 - project:
 name: libvirt-perl
 machines:
-  - libvirt-centos-6
   - libvirt-centos-7
   - libvirt-debian-8
   - libvirt-debian-9
diff --git a/projects/libvirt-python.yaml b/projects/libvirt-python.yaml
index dd8ac13..26accf4 100644
--- a/projects/libvirt-python.yaml
+++ b/projects/libvirt-python.yaml
@@ -2,7 +2,6 @@
 - project:
 name: libvirt-python
 machines:
-  - libvirt-centos-6
   - libvirt-centos-7
   - libvirt-debian-8
   - libvirt-debian-9
@@ -20,7 +19,6 @@
   - python-distutils-rpm-job:
   parent_jobs: 'libvirt-python-master-check'
   machines:
-- libvirt-centos-6
 - libvirt-centos-7
 - libvirt-fedora-26
 - libvirt-fedora-27
diff --git a/projects/libvirt.yaml b/projects/libvirt.yaml
index 427cf6a..2715164 100644
--- a/projects/libvirt.yaml
+++ b/projects/libvirt.yaml
@@ -2,7 +2,6 @@
 - project:
 name: libvirt
 machines:
-  - libvirt-centos-6
   - libvirt-centos-7
   - libvirt-debian-8
   - libvirt-debian-9
@@ -15,7 +14,6 @@
   - autotools-build-job:
   parent_jobs:
   machines:
-- libvirt-centos-6
 - libvirt-centos-7
 - libvirt-debian-8
 - libvirt-debian-9
@@ -34,7 +32,6 @@
   - autotools-rpm-job:
   parent_jobs: 'libvirt-master-check'
   machines:
-- libvirt-centos-6
 - libvirt-centos-7
 - libvirt-fedora-26
 - libvirt-fedora-27
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCHv3 2/6] qemu: use query-cpus-fast in JSON monitor

2018-04-12 Thread John Ferlan


On 04/04/2018 10:45 AM, Viktor Mihajlovski wrote:
> Use query-cpus-fast instead of query-cpus if supported by QEMU.
> Based on the QEMU_CAPS_QUERY_CPUS_FAST capability.
> 
> Signed-off-by: Viktor Mihajlovski 
> ---
>  src/qemu/qemu_domain.c   | 14 +++---
>  src/qemu/qemu_monitor.c  | 30 ++
>  src/qemu/qemu_monitor.h  |  7 +--
>  src/qemu/qemu_monitor_json.c | 37 +++--
>  src/qemu/qemu_monitor_json.h |  3 ++-
>  tests/qemumonitorjsontest.c  |  4 ++--
>  6 files changed, 65 insertions(+), 30 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 9d1c33b..662937b 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -9006,7 +9006,12 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
>  if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
>  return -1;
>  

Count me as one of those that would prefer to see:

bool fast;
...
fast = virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
  QEMU_CAPS_QUERY_CPUS_FAST);
...

> -rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), , maxvcpus, 
> hotplug);
> +rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm),
> +   ,
> +   maxvcpus,
> +   hotplug,
> +   
> virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
> +  QEMU_CAPS_QUERY_CPUS_FAST));

   rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), , maxvcpus,
  hotplug, fast);

>  
>  if (qemuDomainObjExitMonitor(driver, vm) < 0)
>  goto cleanup;
> @@ -9025,7 +9030,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
>   * thread, but it runs every vCPU in that same thread. So it
>   * is impossible to setup different affinity per thread.
>   *
> - * What's more the 'query-cpus' command returns bizarre
> + * What's more the 'query-cpus[-fast]' command returns bizarre
>   * data for the threads. It gives the TCG thread for the
>   * vCPU 0, but for vCPUs 1-> N, it actually replies with
>   * the main process thread ID.
> @@ -9126,7 +9131,10 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
>  if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
>  return -1;
>  
> -haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus);


> +haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm),
> +maxvcpus,
> +
> virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
> +   
> QEMU_CAPS_QUERY_CPUS_FAST));

Likewise,

 bool fast;
...

 fast = virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
   QEMU_CAPS_QUERY_CPUS_FAST);
 haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus,
 fast);

>  
>  if (qemuDomainObjExitMonitor(driver, vm) < 0 || !haltedmap)
>  goto cleanup;

[...]

John

If you're OK with this I can make the alterations...  What you have
works - it's just one of those preferential things related to seeing
and/or relying on function calls within function calls.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] tests: remove FLAG_JSON from xml2argvtest

2018-04-12 Thread Ján Tomko
Unused as of commit <1e9a083>.

Signed-off-by: Ján Tomko 
---
Pushed as trivial.

 tests/qemuxml2argvtest.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 3a328e02a2..472f7b28fe 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -265,8 +265,7 @@ static virStorageDriver fakeStorageDriver = {
 typedef enum {
 FLAG_EXPECT_FAILURE = 1 << 0,
 FLAG_EXPECT_PARSE_ERROR = 1 << 1,
-FLAG_JSON   = 1 << 2,
-FLAG_FIPS   = 1 << 3,
+FLAG_FIPS   = 1 << 2,
 } virQemuXML2ArgvTestFlags;
 
 struct testInfo {
@@ -462,9 +461,6 @@ testCompareXMLToArgv(const void *data)
 virSetConnectSecret(conn);
 virSetConnectStorage(conn);
 
-if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_MONITOR_JSON))
-flags |= FLAG_JSON;
-
 if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
 flags |= FLAG_FIPS;
 
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt PATCH v2 11/44] Deprecate QEMU_CAPS_NO_USER_CONFIG

2018-04-12 Thread Ján Tomko

On Thu, Apr 12, 2018 at 10:07:50AM +0200, Andrea Bolognani wrote:

On Mon, 2018-04-09 at 17:20 +0200, Ján Tomko wrote:

Implied by QEMU >= 1.2.0.

Delete this one first, because QEMU_CAPS_NODEFCONFIG is only used
when QEMU_CAPS_NO_USER_CONFIG is unsupported.


Is there a specific reason for the 6-patch gap between dropping
NO_USER_CONFIG and dropping NODEFCONFIG? It would IMHO make more
sense to drop them one immediately after the other.



I originally wrote them in the order they apper in
virQEMUCapsInitQMPBasic, then relized inserting -nodefconfig everywhere
just to replace it with -no-user-config later is pointless and moved it
right after the first patch that touched all the test files
(QEMU_CAPS_MONITOR_JSON)

Jano


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 3/8] driver: introduce a driver method for probing default URIs

2018-04-12 Thread Daniel P . Berrangé
On Wed, Apr 11, 2018 at 02:08:51PM +0200, Michal Privoznik wrote:
> On 04/09/2018 05:45 PM, Daniel P. Berrangé wrote:
> > Currently the virDrvConnectOpen method is supposed to handle both
> > opening an explicit URI and auto-probing a driver if no URI is
> > given. Introduce a dedicated virDrvConnectURIProbe method to enable the
> > probing functionality to be split from the driver opening functionality.
> > 
> > It is still possible for NULL to be passed to the virDrvConnectOpen
> > method after this change, because the remote driver needs special
> > handling to enable probing of the URI against a remote libvirtd daemon.
> > 
> > Signed-off-by: Daniel P. Berrangé 
> > ---
> >  docs/hvsupport.pl  |  6 +++---
> >  src/bhyve/bhyve_driver.c   | 18 +-
> >  src/driver-hypervisor.h|  4 
> >  src/libvirt.c  | 13 +
> >  src/libxl/libxl_driver.c   | 17 -
> >  src/lxc/lxc_driver.c   | 17 -
> >  src/openvz/openvz_driver.c | 24 
> >  src/qemu/qemu_driver.c | 30 +-
> >  src/uml/uml_driver.c   | 20 +---
> >  src/vbox/vbox_common.c | 13 ++---
> >  10 files changed, 117 insertions(+), 45 deletions(-)
> > 
> > diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl
> > index fc6eb1f152..a2b980c502 100755
> > --- a/docs/hvsupport.pl
> > +++ b/docs/hvsupport.pl
> > @@ -184,7 +184,7 @@ foreach my $drivertable (@drivertable) {
> >  my $api;
> >  if (exists $apis{"vir$name"}) {
> >  $api = "vir$name";
> > -} elsif ($name =~ /\w+(Open|Close)/) {
> > +} elsif ($name =~ /\w+(Open|Close|URIProbe)/) {
> >  next;
> >  } else {
> >  die "driver $name does not have a public API";
> > @@ -241,12 +241,12 @@ foreach my $src (@srcs) {
> >  
> >  next if $api eq "no" || $api eq "name";
> >  
> > -die "Method $meth in $src is missing version" unless 
> > defined $vers;
> > +die "Method $meth in $src is missing version" unless 
> > defined $vers || $api eq "connectURIProbe";
> >  
> >  die "Driver method for $api is NULL in $src" if $meth eq 
> > "NULL";
> >  
> >  if (!exists($groups{$ingrp}->{apis}->{$api})) {
> > -next if $api =~ /\w(Open|Close)/;
> > +next if $api =~ /\w(Open|Close|URIProbe)/;
> >  
> >  die "Found unexpected method $api in $ingrp\n";
> >  }
> > diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
> > index 849d3abcd3..a0bc400480 100644
> > --- a/src/bhyve/bhyve_driver.c
> > +++ b/src/bhyve/bhyve_driver.c
> > @@ -180,6 +180,17 @@ bhyveDomObjFromDomain(virDomainPtr domain)
> >  return vm;
> >  }
> >  
> > +
> > +static int
> > +bhyveConnectURIProbe(char **uri)
> > +{
> > +if (bhyve_driver == NULL)
> > +return 0;
> > +
> > +return VIR_STRDUP(*uri, "bhyve:///system");
> > +}
> 
> make check fails because it thinks this function (and others) is missing
> ACL check.

IMHO, we don't need ACLs on this. This isn't doing anything functional,
and the caller will trigger  the .connectOpen method next which already
has an ACL check. So I think we just whitelist it

diff --git a/src/check-aclrules.pl b/src/check-aclrules.pl
index 5b6c711dc8..8b146d8dba 100755
--- a/src/check-aclrules.pl
+++ b/src/check-aclrules.pl
@@ -59,6 +59,7 @@ my %whitelist = (
 "storageClose" => 1,
 "interfaceOpen" => 1,
 "interfaceClose" => 1,
+"connectURIProbe" => 1,
 );
 
 # Temp hack - remove it once xen driver is fixed


Heh, and that last comment tells me we've got some stuff that can be
purged now :-)

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt PATCH v2 09/44] Remove qemuDomainSupportsNetdev

2018-04-12 Thread Ján Tomko

On Wed, Apr 11, 2018 at 07:20:46PM +0200, Andrea Bolognani wrote:

On Mon, 2018-04-09 at 17:20 +0200, Ján Tomko wrote:

Now that we assume QEMU_CAPS_NETDEV, the only thing left to check
is whether we need to use the legacy -net syntax because of
a non-conforming armchitecture.


I see you're having "pun" writing these commit messages ;)

[...]

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 05cc4903a4..4e8c4a7bd4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8217,7 +8217,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
 unsigned int queues = net->driver.virtio.queues;
 char *nic = NULL;

-if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
+if (!qemuDomainSupportsNicdev(def, net)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Netdev support unavailable"));


With the change, this error message becomes misleading: it's not
that -netdev support is unavailable, it's just that -device can't
be used for the NIC and we can't (won't?) use -netdev without it.

I guess you can just s/Netdev/nicdev/ and call it a day, it's not
like it makes the error message any harder, or easier, to grasp.


@@ -8552,23 +8552,14 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
 goto cleanup;
 }

-/* Possible combinations:
- *
- *  1. Old way:   -net nic,model=e1000,vlan=1 -net tap,vlan=1
- *  2. Semi-new:  -device e1000,vlan=1-net tap,vlan=1
- *  3. Best way:  -netdev type=tap,id=netdev1 -device e1000,id=netdev1
- *
- * NB, no support for -netdev without use of -device
- */


I think you should leave the comment in, because most of it still
applies even in our brave new, legacy-free world.

Basically all you should do is drop option 2, and (optionally)
rework option 3 a little. The result could look like

 * Old way: -net nic,model=e1000,vlan=1 -net tap,vlan=1
 * New way: -device e1000,id=netdev1-netdev type=tap,id=netdev1

I suggest reworking the "new way" line because I think having the
guest part and host part listed in the same order both times makes
the whole thing easier to understand.



I added a note instead of reworking, to keep them in command-line order:
NB: The backend and frontend are reversed


-if (qemuDomainSupportsNetdev(def, qemuCaps, net)) {
+if (qemuDomainSupportsNicdev(def, net)) {
 if (!(host = qemuBuildHostNetStr(net, driver,
  ',', vlan,
  tapfdName, tapfdSize,
  vhostfdName, vhostfdSize)))
 goto cleanup;
 virCommandAddArgList(cmd, "-netdev", host, NULL);
-}
-if (qemuDomainSupportsNicdev(def, net)) {
+
 if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
vhostfdSize, qemuCaps)))
 goto cleanup;
@@ -8658,7 +8648,7 @@ qemuBuildNetCommandLine(virQEMUDriverPtr driver,
 int vlan;

 /* VLANs are not used with -netdev, so don't record them */
-if (qemuDomainSupportsNetdev(def, qemuCaps, net))
+if (qemuDomainSupportsNicdev(def, net))
 vlan = -1;
 else
 vlan = i;


Again, you probably want to mention that -netdev requires -device,
so that the comment won't look completely out of place or require
developers to be intimately aware of how the two work together.

[...]

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index c145c42bcd..8aacd8376f 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -956,7 +956,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
 queueSize = net->driver.virtio.queues;
 if (!queueSize)
 queueSize = 1;
-if (!qemuDomainSupportsNetdev(vm->def, priv->qemuCaps, net)) {
+if (!qemuDomainSupportsNicdev(vm->def, net)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Netdev support unavailable"));
 goto cleanup;


Same as the first instance.


diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index cebb490221..24c0174bf9 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -646,7 +646,7 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def,
  * option), don't try to open the device.
  */
 if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) &&
-  qemuDomainSupportsNetdev(def, qemuCaps, net))) {
+  qemuDomainSupportsNicdev(def, net))) {
 if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("vhost-net is not supported with "


The full comment, only half of which is contained in the hunk, is

 If qemu doesn't support vhost-net mode (including the -netdev
 command option), don't try to open the device.


[libvirt] [dbus PATCH v2 21/22] Implement SetMemory method for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 26 ++
 2 files changed, 32 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 5d4323b..0937cbb 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -167,6 +167,12 @@
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"/>
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMemoryFlags"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetVcpusFlags"/>
diff --git a/src/domain.c b/src/domain.c
index 85395aa..a8d3e6c 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -915,6 +915,31 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED,
 virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainSetMemory(GVariant *inArgs,
+GUnixFDList *inFDs G_GNUC_UNUSED,
+const gchar *objectPath,
+gpointer userData,
+GVariant **outArgs G_GNUC_UNUSED,
+GUnixFDList **outFDs G_GNUC_UNUSED,
+GError **error)
+
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+gulong memory;
+guint flags;
+
+g_variant_get(inArgs, "(tu)", , );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainSetMemoryFlags(domain, memory, flags) < 0)
+return virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainSetVcpus(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1044,6 +1069,7 @@ static virtDBusGDBusMethodTable 
virtDBusDomainMethodTable[] = {
 { "Reset", virtDBusDomainReset },
 { "Resume", virtDBusDomainResume },
 { "SetVcpus", virtDBusDomainSetVcpus },
+{ "SetMemory", virtDBusDomainSetMemory },
 { "Shutdown", virtDBusDomainShutdown },
 { "Suspend", virtDBusDomainSuspend },
 { "Undefine", virtDBusDomainUndefine },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 20/22] Implement MigrateSetMaxSpeed method for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 25 +
 2 files changed, 31 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 1ce1918..5d4323b 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -147,6 +147,12 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetMaxSpeed"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReboot"/>
diff --git a/src/domain.c b/src/domain.c
index 2383870..85395aa 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -823,6 +823,30 @@ virtDBusDomainMigrateSetMaxDowntime(GVariant *inArgs,
 return virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainMigrateSetMaxSpeed(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs G_GNUC_UNUSED,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+guint64 bandwidth;
+guint flags;
+
+g_variant_get(inArgs, "(tu)", , );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainMigrateSetMaxSpeed(domain, bandwidth, flags) < 0)
+return virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainReboot(GVariant *inArgs,
  GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1015,6 +1039,7 @@ static virtDBusGDBusMethodTable 
virtDBusDomainMethodTable[] = {
 { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
 { "MigrateGetMaxSpeed", virtDBusDomainMigrateGetMaxSpeed },
 { "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
+{ "MigrateSetMaxSpeed", virtDBusDomainMigrateSetMaxSpeed },
 { "Reboot", virtDBusDomainReboot },
 { "Reset", virtDBusDomainReset },
 { "Resume", virtDBusDomainResume },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 14/22] Implement ManagedSaveRemove method for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  5 +
 src/domain.c| 24 
 test/test_domain.py |  2 ++
 3 files changed, 31 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 57e5ea4..087b64e 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -101,6 +101,11 @@
 value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSave"/>
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSaveRemove"/>
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats"/>
diff --git a/src/domain.c b/src/domain.c
index 26f6bbf..336128e 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -593,6 +593,29 @@ virtDBusDomainManagedSave(GVariant *inArgs,
 virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainManagedSaveRemove(GVariant *inArgs,
+GUnixFDList *inFDs G_GNUC_UNUSED,
+const gchar *objectPath,
+gpointer userData,
+GVariant **outArgs G_GNUC_UNUSED,
+GUnixFDList **outFDs G_GNUC_UNUSED,
+GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+guint flags;
+
+g_variant_get(inArgs, "(u)", );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainManagedSaveRemove(domain, flags) < 0)
+virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainMemoryStats(GVariant *inArgs,
   GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -839,6 +862,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
 { "HasManagedSaveImage", virtDBusDomainHasManagedSaveImage },
 { "ManagedSave", virtDBusDomainManagedSave },
+{ "ManagedSaveRemove", virtDBusDomainManagedSaveRemove },
 { "MemoryStats", virtDBusDomainMemoryStats },
 { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
 { "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
diff --git a/test/test_domain.py b/test/test_domain.py
index 13f27f7..45a99f9 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -59,6 +59,8 @@ class TestDomain(libvirttest.BaseTestClass):
 assert domain.HasManagedSaveImage(0) == dbus.Boolean(True)
 state = obj.Get('org.libvirt.Domain', 'State', 
dbus_interface=dbus.PROPERTIES_IFACE)
 assert state == 'shutoff'
+domain.ManagedSaveRemove(0)
+assert domain.HasManagedSaveImage(0) == dbus.Boolean(False)
 
 self.main_loop()
 
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 17/22] Implement GetBlkioParameters method for domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 37 +
 2 files changed, 43 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index db9a93e..576f415 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -66,6 +66,12 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlkioParameters"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobInfo"/>
diff --git a/src/domain.c b/src/domain.c
index 1f907e0..0ae093a 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -416,6 +416,42 @@ virtDBusDomainDetachDevice(GVariant *inArgs,
 return virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainGetBlkioParameters(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+g_autofree virTypedParameterPtr params = NULL;
+gint nparams = 0;
+guint flags;
+GVariant *grecords;
+
+g_variant_get(inArgs, "(u)", );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainGetBlkioParameters(domain, NULL, , flags) == 0 &&
+nparams != 0) {
+if ((params = g_new0(virTypedParameter, nparams)) == NULL)
+return;
+if (virDomainGetBlkioParameters(domain, params, , flags))
+return virtDBusUtilSetLastVirtError(error);
+}
+
+grecords = virtDBusUtilTypedParamsToGVariant(params,
+ nparams);
+
+*outArgs = g_variant_new_tuple(, 1);
+}
+
 static void
 virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED,
  GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -917,6 +953,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "Create", virtDBusDomainCreate },
 { "Destroy", virtDBusDomainDestroy },
 { "DetachDevice", virtDBusDomainDetachDevice },
+{ "GetBlkioParameters", virtDBusDomainGetBlkioParameters },
 { "GetJobInfo", virtDBusDomainGetJobInfo },
 { "GetMemoryParameters", virtDBusDomainGetMemoryParameters },
 { "GetStats", virtDBusDomainGetStats },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 13/22] Implement HasManagedSaveImage method for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 29 +
 test/test_domain.py |  2 +-
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 382b062..57e5ea4 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -90,6 +90,12 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainHasManagedSaveImage"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSave"/>
diff --git a/src/domain.c b/src/domain.c
index 53f8798..26f6bbf 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -542,6 +542,34 @@ virtDBusDomainGetXMLDesc(GVariant *inArgs,
 *outArgs = g_variant_new("(s)", xml);
 }
 
+static void
+virtDBusDomainHasManagedSaveImage(GVariant *inArgs,
+  GUnixFDList *inFDs G_GNUC_UNUSED,
+  const gchar *objectPath,
+  gpointer userData,
+  GVariant **outArgs,
+  GUnixFDList **outFDs G_GNUC_UNUSED,
+  GError **error)
+
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+gint managedSaveImage;
+guint flags;
+
+g_variant_get(inArgs, "(u)", );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+managedSaveImage = virDomainHasManagedSaveImage(domain, flags);
+if (managedSaveImage < 0)
+return virtDBusUtilSetLastVirtError(error);
+
+*outArgs = g_variant_new("(u)", managedSaveImage);
+}
+
 static void
 virtDBusDomainManagedSave(GVariant *inArgs,
   GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -809,6 +837,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "GetStats", virtDBusDomainGetStats },
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
+{ "HasManagedSaveImage", virtDBusDomainHasManagedSaveImage },
 { "ManagedSave", virtDBusDomainManagedSave },
 { "MemoryStats", virtDBusDomainMemoryStats },
 { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
diff --git a/test/test_domain.py b/test/test_domain.py
index 31348ce..13f27f7 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -56,7 +56,7 @@ class TestDomain(libvirttest.BaseTestClass):
 
 obj, domain = self.domain()
 domain.ManagedSave(0)
-
+assert domain.HasManagedSaveImage(0) == dbus.Boolean(True)
 state = obj.Get('org.libvirt.Domain', 'State', 
dbus_interface=dbus.PROPERTIES_IFACE)
 assert state == 'shutoff'
 
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 03/22] Introduce virtDBusDomainMemoryStatTypeToString helper function

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 src/domain.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/domain.c b/src/domain.c
index f775fd4..9b3de57 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -3,6 +3,20 @@
 
 #include 
 
+VIRT_DBUS_ENUM_DECL(virtDBusDomainMemoryStat)
+VIRT_DBUS_ENUM_IMPL(virtDBusDomainMemoryStat,
+VIR_DOMAIN_MEMORY_STAT_LAST,
+"swap_in",
+"swap_out",
+"major_fault",
+"minor_fault",
+"unused",
+"available",
+"actual_baloon",
+"rss",
+"usable",
+"last_update")
+
 static virDomainPtr
 virtDBusDomainGetVirDomain(virtDBusConnect *connect,
const gchar *objectPath,
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 12/22] Implement ManagedSave method for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  5 +
 src/domain.c| 24 
 test/test_domain.py | 15 +++
 3 files changed, 44 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 3903689..382b062 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -90,6 +90,11 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSave"/>
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats"/>
diff --git a/src/domain.c b/src/domain.c
index e1b2d72..53f8798 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -542,6 +542,29 @@ virtDBusDomainGetXMLDesc(GVariant *inArgs,
 *outArgs = g_variant_new("(s)", xml);
 }
 
+static void
+virtDBusDomainManagedSave(GVariant *inArgs,
+  GUnixFDList *inFDs G_GNUC_UNUSED,
+  const gchar *objectPath,
+  gpointer userData,
+  GVariant **outArgs G_GNUC_UNUSED,
+  GUnixFDList **outFDs G_GNUC_UNUSED,
+  GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+guint flags;
+
+g_variant_get(inArgs, "(u)", );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainManagedSave(domain, flags) < 0)
+virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainMemoryStats(GVariant *inArgs,
   GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -786,6 +809,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "GetStats", virtDBusDomainGetStats },
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
+{ "ManagedSave", virtDBusDomainManagedSave },
 { "MemoryStats", virtDBusDomainMemoryStats },
 { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
 { "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
diff --git a/test/test_domain.py b/test/test_domain.py
index a7cf962..31348ce 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -47,6 +47,21 @@ class TestDomain(libvirttest.BaseTestClass):
 autostart_current = domain.Get('org.libvirt.Domain', 'Autostart', 
dbus_interface=dbus.PROPERTIES_IFACE)
 assert autostart_current == dbus.Boolean(autostart_expected)
 
+def test_domain_managed_save(self):
+def domain_stopped(path, _event):
+assert isinstance(path, dbus.ObjectPath)
+self.loop.quit()
+
+self.connect.connect_to_signal('DomainEvent', domain_stopped, 
arg1='Stopped')
+
+obj, domain = self.domain()
+domain.ManagedSave(0)
+
+state = obj.Get('org.libvirt.Domain', 'State', 
dbus_interface=dbus.PROPERTIES_IFACE)
+assert state == 'shutoff'
+
+self.main_loop()
+
 def test_resume(self):
 def domain_resumed(path, _event):
 assert isinstance(path, dbus.ObjectPath)
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 18/22] Implement Updated property for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  4 
 src/domain.c| 22 ++
 test/test_domain.py |  1 +
 3 files changed, 27 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 576f415..4b0d02f 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -36,6 +36,10 @@
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState"/>
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsUpdated"/>
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/>
diff --git a/src/domain.c b/src/domain.c
index 0ae093a..4e93c2e 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -262,6 +262,27 @@ virtDBusDomainGetState(const gchar *objectPath,
 *value = g_variant_new("s", string);
 }
 
+static void
+virtDBusDomainGetUpdated(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+gint updated;
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+updated = virDomainIsUpdated(domain);
+if (updated < 0)
+return virtDBusUtilSetLastVirtError(error);
+
+*value = g_variant_new("b", !!updated);
+}
+
 static void
 virtDBusDomainGetUUID(const gchar *objectPath,
   gpointer userData,
@@ -943,6 +964,7 @@ static virtDBusGDBusPropertyTable 
virtDBusDomainPropertyTable[] = {
 { "Persistent", virtDBusDomainGetPersistent, NULL },
 { "SchedulerType", virtDBusDomainGetSchedulerType, NULL},
 { "State", virtDBusDomainGetState, NULL },
+{ "Updated", virtDBusDomainGetUpdated, NULL },
 { "UUID", virtDBusDomainGetUUID, NULL },
 { 0 }
 };
diff --git a/test/test_domain.py b/test/test_domain.py
index 31e09bf..f2ae215 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -20,6 +20,7 @@ class TestDomain(libvirttest.BaseTestClass):
 isinstance(props['SchedulerType'][0], dbus.String),
 isinstance(props['SchedulerType'][1], dbus.Int32)])
 assert isinstance(props['State'], dbus.String)
+assert isinstance(props['Updated'], dbus.Boolean)
 assert isinstance(props['UUID'], dbus.String)
 
 # Call all methods except Reset and GetStats, because the test backend
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 19/22] Implement MigrateGetMaxSpeed method for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 28 
 2 files changed, 34 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 4b0d02f..1ce1918 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -135,6 +135,12 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateGetMaxSpeed"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetMaxDowntime"/>
diff --git a/src/domain.c b/src/domain.c
index 4e93c2e..2383870 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -772,6 +772,33 @@ virtDBusDomainMigrateGetMaxDowntime(GVariant *inArgs,
 *outArgs = g_variant_new("(t)", downtime);
 }
 
+static void
+virtDBusDomainMigrateGetMaxSpeed(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+guint64 bandwidth;
+guint flags;
+
+g_variant_get(inArgs, "(u)", );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainMigrateGetMaxSpeed(domain, , flags) < 0)
+return virtDBusUtilSetLastVirtError(error);
+
+*outArgs = g_variant_new("(t)", bandwidth);
+}
+
 static void
 virtDBusDomainMigrateSetMaxDowntime(GVariant *inArgs,
 GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -986,6 +1013,7 @@ static virtDBusGDBusMethodTable 
virtDBusDomainMethodTable[] = {
 { "ManagedSaveRemove", virtDBusDomainManagedSaveRemove },
 { "MemoryStats", virtDBusDomainMemoryStats },
 { "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
+{ "MigrateGetMaxSpeed", virtDBusDomainMigrateGetMaxSpeed },
 { "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
 { "Reboot", virtDBusDomainReboot },
 { "Reset", virtDBusDomainReset },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 02/22] Implement SchedulerType property for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  4 
 src/domain.c| 23 +++
 test/test_domain.py |  3 +++
 3 files changed, 30 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index b8ee5b8..dbeafce 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -28,6 +28,10 @@
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsPersistent"/>
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedulerType"/>
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState"/>
diff --git a/src/domain.c b/src/domain.c
index 82682ef..f775fd4 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -149,6 +149,28 @@ virtDBusDomainGetPersistent(const gchar *objectPath,
 *value = g_variant_new("b", !!persistent);
 }
 
+static void
+virtDBusDomainGetSchedulerType(const gchar *objectPath,
+   gpointer userData,
+   GVariant **value,
+   GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+g_autofree gchar *schedtype = NULL;
+gint nparams;
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+schedtype = virDomainGetSchedulerType(domain, );
+if (!schedtype)
+return virtDBusUtilSetLastVirtError(error);
+
+*value = g_variant_new("(si)", schedtype, nparams);
+}
+
 static void
 virtDBusDomainGetState(const gchar *objectPath,
gpointer userData,
@@ -517,6 +539,7 @@ static virtDBusGDBusPropertyTable 
virtDBusDomainPropertyTable[] = {
 { "Name", virtDBusDomainGetName, NULL },
 { "OSType", virtDBusDomainGetOsType, NULL },
 { "Persistent", virtDBusDomainGetPersistent, NULL },
+{ "SchedulerType", virtDBusDomainGetSchedulerType, NULL},
 { "State", virtDBusDomainGetState, NULL },
 { "UUID", virtDBusDomainGetUUID, NULL },
 { 0 }
diff --git a/test/test_domain.py b/test/test_domain.py
index 7fa9aad..a7cf962 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -16,6 +16,9 @@ class TestDomain(libvirttest.BaseTestClass):
 assert isinstance(props['Name'], dbus.String)
 assert isinstance(props['OSType'], dbus.String)
 assert isinstance(props['Persistent'], dbus.Boolean)
+assert any([isinstance(props['SchedulerType'], dbus.Struct),
+isinstance(props['SchedulerType'][0], dbus.String),
+isinstance(props['SchedulerType'][1], dbus.Int32)])
 assert isinstance(props['State'], dbus.String)
 assert isinstance(props['UUID'], dbus.String)
 
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 11/22] Implement MigrateGetMaxDowntime method for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 31 +++
 2 files changed, 37 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index c509b4e..3903689 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -97,6 +97,12 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateGetMaxDowntime"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetMaxDowntime"/>
diff --git a/src/domain.c b/src/domain.c
index c42e1c6..e1b2d72 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -575,6 +575,36 @@ virtDBusDomainMemoryStats(GVariant *inArgs,
 *outArgs = g_variant_new_tuple(, 1);
 }
 
+static void
+virtDBusDomainMigrateGetMaxDowntime(GVariant *inArgs,
+GUnixFDList *inFDs G_GNUC_UNUSED,
+const gchar *objectPath,
+gpointer userData,
+GVariant **outArgs G_GNUC_UNUSED,
+GUnixFDList **outFDs G_GNUC_UNUSED,
+GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+guint64 downtime;
+guint flags;
+gint ret;
+
+g_variant_get(inArgs, "(u)", );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+ret = virDomainMigrateGetMaxDowntime(domain,
+ (long long unsigned int *),
+ flags);
+if (ret < 0)
+return virtDBusUtilSetLastVirtError(error);
+
+*outArgs = g_variant_new("(t)", downtime);
+}
+
 static void
 virtDBusDomainMigrateSetMaxDowntime(GVariant *inArgs,
 GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -757,6 +787,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
 { "MemoryStats", virtDBusDomainMemoryStats },
+{ "MigrateGetMaxDowntime", virtDBusDomainMigrateGetMaxDowntime },
 { "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
 { "Reboot", virtDBusDomainReboot },
 { "Reset", virtDBusDomainReset },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 04/22] Implement MemoryStats for Domain Interface

2018-04-12 Thread Katerina Koukiou
This method is not tested for now since the test driver
doesn't support this API.

Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  7 ++
 src/domain.c| 52 +
 2 files changed, 59 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index dbeafce..6795d30 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -69,6 +69,13 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats"/>
+  
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReboot"/>
diff --git a/src/domain.c b/src/domain.c
index 9b3de57..59118b9 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -17,6 +17,24 @@ VIRT_DBUS_ENUM_IMPL(virtDBusDomainMemoryStat,
 "usable",
 "last_update")
 
+static GVariant *
+virtDBusDomainMemoryStatsToGVariant(virDomainMemoryStatPtr stats,
+gint nr_stats)
+{
+GVariantBuilder builder;
+
+g_variant_builder_init(, G_VARIANT_TYPE("a{st}"));
+
+for (gint i = 0; i < nr_stats; i++) {
+const gchar *memoryStat = 
virtDBusDomainMemoryStatTypeToString(stats[i].tag);
+if (!memoryStat)
+return 0;
+g_variant_builder_add(, "{st}", memoryStat, stats[i].val);
+}
+
+return g_variant_builder_end();
+}
+
 static virDomainPtr
 virtDBusDomainGetVirDomain(virtDBusConnect *connect,
const gchar *objectPath,
@@ -412,6 +430,39 @@ virtDBusDomainGetXMLDesc(GVariant *inArgs,
 *outArgs = g_variant_new("(s)", xml);
 }
 
+static void
+virtDBusDomainMemoryStats(GVariant *inArgs,
+  GUnixFDList *inFDs G_GNUC_UNUSED,
+  const gchar *objectPath,
+  gpointer userData,
+  GVariant **outArgs,
+  GUnixFDList **outFDs G_GNUC_UNUSED,
+  GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+g_autofree virDomainMemoryStatPtr stats = NULL;
+guint max_stats;
+gint nr_stats;
+guint flags;
+GVariant *gstats;
+
+g_variant_get(inArgs, "(uu)", _stats, );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+stats = g_new0(virDomainMemoryStatStruct, max_stats);
+nr_stats = virDomainMemoryStats(domain, stats, max_stats, flags);
+if (nr_stats == -1)
+return virtDBusUtilSetLastVirtError(error);
+
+gstats = virtDBusDomainMemoryStatsToGVariant(stats, nr_stats);
+
+*outArgs = g_variant_new_tuple(, 1);
+}
+
 static void
 virtDBusDomainReboot(GVariant *inArgs,
  GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -565,6 +616,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "GetStats", virtDBusDomainGetStats },
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
+{ "MemoryStats", virtDBusDomainMemoryStats },
 { "Reboot", virtDBusDomainReboot },
 { "Reset", virtDBusDomainReset },
 { "Resume", virtDBusDomainResume },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 07/22] Introduce virtDBusDomainJobTypeToString function

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 src/domain.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/domain.c b/src/domain.c
index cd44d6b..bf352a7 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -3,6 +3,16 @@
 
 #include 
 
+VIRT_DBUS_ENUM_DECL(virtDBusDomainJob)
+VIRT_DBUS_ENUM_IMPL(virtDBusDomainJob,
+VIR_DOMAIN_JOB_LAST,
+"none",
+"bounded",
+"unbounded",
+"completed",
+"failed",
+"canceled")
+
 VIRT_DBUS_ENUM_DECL(virtDBusDomainMemoryStat)
 VIRT_DBUS_ENUM_IMPL(virtDBusDomainMemoryStat,
 VIR_DOMAIN_MEMORY_STAT_LAST,
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 10/22] Implement MigrateSetMaxDowntime method for Domain interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 25 +
 2 files changed, 31 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 152ed4b..c509b4e 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -97,6 +97,12 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetMaxDowntime"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReboot"/>
diff --git a/src/domain.c b/src/domain.c
index d1be665..c42e1c6 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -575,6 +575,30 @@ virtDBusDomainMemoryStats(GVariant *inArgs,
 *outArgs = g_variant_new_tuple(, 1);
 }
 
+static void
+virtDBusDomainMigrateSetMaxDowntime(GVariant *inArgs,
+GUnixFDList *inFDs G_GNUC_UNUSED,
+const gchar *objectPath,
+gpointer userData,
+GVariant **outArgs G_GNUC_UNUSED,
+GUnixFDList **outFDs G_GNUC_UNUSED,
+GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+guint64 downtime;
+guint flags;
+
+g_variant_get(inArgs, "(tu)", , );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainMigrateSetMaxDowntime(domain, downtime, flags) < 0)
+return virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainReboot(GVariant *inArgs,
  GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -733,6 +757,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
 { "MemoryStats", virtDBusDomainMemoryStats },
+{ "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime },
 { "Reboot", virtDBusDomainReboot },
 { "Reset", virtDBusDomainReset },
 { "Resume", virtDBusDomainResume },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 06/22] Implement DetachDevice method for Domain Interface

2018-04-12 Thread Katerina Koukiou
This method is not tested for now since the test driver
doesn't suport this API.

Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 25 +
 2 files changed, 31 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index b620939..83e37bc 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -56,6 +56,12 @@
 value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags"/>
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDeviceFlags"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainListGetStats"/>
diff --git a/src/domain.c b/src/domain.c
index cfdd820..cd44d6b 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -362,6 +362,30 @@ virtDBusDomainDestroy(GVariant *inArgs,
 virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainDetachDevice(GVariant *inArgs,
+   GUnixFDList *inFDs G_GNUC_UNUSED,
+   const gchar *objectPath,
+   gpointer userData,
+   GVariant **outArgs G_GNUC_UNUSED,
+   GUnixFDList **outFDs G_GNUC_UNUSED,
+   GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+const gchar *xml;
+guint flags;
+
+g_variant_get(inArgs, "()", , );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainDetachDeviceFlags(domain, xml, flags) == -1)
+return virtDBusUtilSetLastVirtError(error);
+}
+
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, 
virDomainStatsRecordListFree);
 
 static void
@@ -638,6 +662,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "AttachDevice", virtDBusDomainAttachDevice },
 { "Create", virtDBusDomainCreate },
 { "Destroy", virtDBusDomainDestroy },
+{ "DetachDevice", virtDBusDomainDetachDevice },
 { "GetStats", virtDBusDomainGetStats },
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 16/22] Implement GetMemoryParameters method for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 37 +
 2 files changed, 43 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 7f58cbd..db9a93e 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -71,6 +71,12 @@
 value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobInfo"/>
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMemoryParameters"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainListGetStats"/>
diff --git a/src/domain.c b/src/domain.c
index 1896590..1f907e0 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -450,6 +450,42 @@ virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED,
  jobInfo->fileRemaining);
 }
 
+static void
+virtDBusDomainGetMemoryParameters(GVariant *inArgs,
+  GUnixFDList *inFDs G_GNUC_UNUSED,
+  const gchar *objectPath,
+  gpointer userData,
+  GVariant **outArgs,
+  GUnixFDList **outFDs G_GNUC_UNUSED,
+  GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+g_autofree virTypedParameterPtr params = NULL;
+gint nparams = 0;
+guint flags;
+GVariant *grecords;
+
+g_variant_get(inArgs, "(u)", );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainGetMemoryParameters(domain, NULL, , flags) == 0 &&
+nparams != 0) {
+if ((params = g_new0(virTypedParameter, nparams)) == NULL)
+return;
+if (virDomainGetMemoryParameters(domain, params, , flags))
+return virtDBusUtilSetLastVirtError(error);
+}
+
+grecords = virtDBusUtilTypedParamsToGVariant(params,
+ nparams);
+
+*outArgs = g_variant_new_tuple(, 1);
+}
+
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, 
virDomainStatsRecordListFree);
 
 static void
@@ -882,6 +918,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "Destroy", virtDBusDomainDestroy },
 { "DetachDevice", virtDBusDomainDetachDevice },
 { "GetJobInfo", virtDBusDomainGetJobInfo },
+{ "GetMemoryParameters", virtDBusDomainGetMemoryParameters },
 { "GetStats", virtDBusDomainGetStats },
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 09/22] Implement AbortJob for Domain interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  4 
 src/domain.c| 21 +
 2 files changed, 25 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 2e0339b..152ed4b 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -40,6 +40,10 @@
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/>
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAbortJob"/>
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAttachDeviceFlags"/>
diff --git a/src/domain.c b/src/domain.c
index e80749b..d1be665 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -302,6 +302,26 @@ virtDBusDomainSetAutostart(GVariant *value,
 return virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainAbortJob(GVariant *inArgs G_GNUC_UNUSED,
+   GUnixFDList *inFDs G_GNUC_UNUSED,
+   const gchar *objectPath,
+   gpointer userData,
+   GVariant **outArgs G_GNUC_UNUSED,
+   GUnixFDList **outFDs G_GNUC_UNUSED,
+   GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainAbortJob(domain) < 0)
+virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainAttachDevice(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -703,6 +723,7 @@ static virtDBusGDBusPropertyTable 
virtDBusDomainPropertyTable[] = {
 };
 
 static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
+{ "AbortJob", virtDBusDomainAbortJob },
 { "AttachDevice", virtDBusDomainAttachDevice },
 { "Create", virtDBusDomainCreate },
 { "Destroy", virtDBusDomainDestroy },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 01/22] Implement Setter for Autostart property for Domain interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  5 +++--
 src/domain.c| 22 +-
 test/test_domain.py |  7 +++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 78378bb..b8ee5b8 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -7,9 +7,10 @@
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsActive"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart and
+   
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetAutostart"/>
 
 
   https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH v2 00/22] More APIs for Domain Interface

2018-04-12 Thread Katerina Koukiou
Changes from v1:
Added some more APIs.

Katerina Koukiou (22):
  Implement Setter for Autostart property for Domain interface
  Implement SchedulerType property for Domain Interface
  Introduce virtDBusDomainMemoryStatTypeToString helper function
  Implement MemoryStats for Domain Interface
  Implement AttachDevice method for Domain Interface
  Implement DetachDevice method for Domain Interface
  Introduce virtDBusDomainJobTypeToString function
  Implement GetJobInfo method for Domain interface
  Implement AbortJob for Domain interface
  Implement MigrateSetMaxDowntime method for Domain interface
  Implement MigrateGetMaxDowntime method for Domain Interface
  Implement ManagedSave method for Domain Interface
  Implement HasManagedSaveImage method for Domain Interface
  Implement ManagedSaveRemove method for Domain Interface
  Implement SetVcpus method for Domain Interface
  Implement GetMemoryParameters method for Domain Interface
  Implement GetBlkioParameters method for domain Interface
  Implement Updated property for Domain Interface
  Implement MigrateGetMaxSpeed method for Domain Interface
  Implement MigrateSetMaxSpeed method for Domain Interface
  Implement SetMemory method for Domain Interface
  Implement GetSchedulerParameters method for Domain Interface

 data/org.libvirt.Domain.xml | 111 +++-
 src/domain.c| 599 +++-
 test/test_domain.py |  37 ++-
 3 files changed, 742 insertions(+), 5 deletions(-)

-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH jenkins-ci 2/2] Enable mingw build for virt-viewer project

2018-04-12 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé 
---
 guests/vars/mappings.yml | 66 
 guests/vars/projects/virt-viewer.yml | 24 +
 projects/virt-viewer.yaml|  4 +++
 3 files changed, 94 insertions(+)

diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index f4eb4a2..3d6a686 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -328,6 +328,9 @@ mappings:
 default: make
 FreeBSD: gmake
 
+  mingw32-adwaita-icon-theme:
+FedoraRawhide: mingw32-adwaita-icon-theme
+
   mingw32-curl:
 FedoraRawhide: mingw32-curl
 
@@ -346,12 +349,33 @@ mappings:
   mingw32-glib2:
 FedoraRawhide: mingw32-glib2
 
+  mingw32-glib-networking:
+FedoraRawhide: mingw32-glib-networking
+
   mingw32-gnutls:
 FedoraRawhide: mingw32-gnutls
 
+  mingw32-gstreamer1-plugins-bad-free:
+FedoraRawhide: mingw32-gstreamer1-plugins-bad-free
+
+  mingw32-gstreamer1-plugins-good:
+FedoraRawhide: mingw32-gstreamer1-plugins-good
+
+  mingw32-gtk3:
+FedoraRawhide: mingw32-gtk3
+
+  mingw32-gtk-vnc:
+FedoraRawhide: mingw32-gtk-vnc
+
+  mingw32-libgovirt:
+FedoraRawhide: mingw32-libgovirt
+
   mingw32-libssh2:
 FedoraRawhide: mingw32-libssh2
 
+  mingw32-libusbx:
+FedoraRawhide: mingw32-libusbx
+
   mingw32-libxml2:
 FedoraRawhide: mingw32-libxml2
 
@@ -367,6 +391,18 @@ mappings:
   mingw32-readline:
 FedoraRawhide: mingw32-readline
 
+  mingw32-rest:
+FedoraRawhide: mingw32-rest
+
+  mingw32-spice-gtk3:
+FedoraRawhide: mingw32-spice-gtk3
+
+  mingw32-usbredir:
+FedoraRawhide: mingw32-usbredir
+
+  mingw64-adwaita-icon-theme:
+FedoraRawhide: mingw64-adwaita-icon-theme
+
   mingw64-curl:
 FedoraRawhide: mingw64-curl
 
@@ -385,12 +421,33 @@ mappings:
   mingw64-glib2:
 FedoraRawhide: mingw64-glib2
 
+  mingw64-glib-networking:
+FedoraRawhide: mingw64-glib-networking
+
   mingw64-gnutls:
 FedoraRawhide: mingw64-gnutls
 
+  mingw64-gstreamer1-plugins-bad-free:
+FedoraRawhide: mingw64-gstreamer1-plugins-bad-free
+
+  mingw64-gstreamer1-plugins-good:
+FedoraRawhide: mingw64-gstreamer1-plugins-good
+
+  mingw64-gtk3:
+FedoraRawhide: mingw64-gtk3
+
+  mingw64-gtk-vnc:
+FedoraRawhide: mingw64-gtk-vnc
+
+  mingw64-libgovirt:
+FedoraRawhide: mingw64-libgovirt
+
   mingw64-libssh2:
 FedoraRawhide: mingw64-libssh2
 
+  mingw64-libusbx:
+FedoraRawhide: mingw64-libusbx
+
   mingw64-libxml2:
 FedoraRawhide: mingw64-libxml2
 
@@ -406,6 +463,15 @@ mappings:
   mingw64-readline:
 FedoraRawhide: mingw64-readline
 
+  mingw64-rest:
+FedoraRawhide: mingw64-rest
+
+  mingw64-spice-gtk3:
+FedoraRawhide: mingw64-spice-gtk3
+
+  mingw64-usbredir:
+FedoraRawhide: mingw64-usbredir
+
   nano:
 default: nano
 
diff --git a/guests/vars/projects/virt-viewer.yml 
b/guests/vars/projects/virt-viewer.yml
index 6f3dbf9..85d1589 100644
--- a/guests/vars/projects/virt-viewer.yml
+++ b/guests/vars/projects/virt-viewer.yml
@@ -6,5 +6,29 @@ packages:
   - intltool
   - libgovirt
   - libxml2
+  - mingw32-adwaita-icon-theme
+  - mingw32-glib2
+  - mingw32-glib-networking
+  - mingw32-gstreamer1-plugins-bad-free
+  - mingw32-gstreamer1-plugins-good
+  - mingw32-gtk3
+  - mingw32-gtk-vnc
+  - mingw32-libgovirt
+  - mingw32-libusbx
+  - mingw32-rest
+  - mingw32-spice-gtk3
+  - mingw32-usbredir
+  - mingw64-adwaita-icon-theme
+  - mingw64-glib2
+  - mingw64-glib-networking
+  - mingw64-gstreamer1-plugins-bad-free
+  - mingw64-gstreamer1-plugins-good
+  - mingw64-gtk3
+  - mingw64-gtk-vnc
+  - mingw64-libgovirt
+  - mingw64-libusbx
+  - mingw64-rest
+  - mingw64-spice-gtk3
+  - mingw64-usbredir
   - spice-gtk3
   - xmllint
diff --git a/projects/virt-viewer.yaml b/projects/virt-viewer.yaml
index 90cd787..2d8a6f9 100644
--- a/projects/virt-viewer.yaml
+++ b/projects/virt-viewer.yaml
@@ -25,3 +25,7 @@
 - libvirt-fedora-26
 - libvirt-fedora-27
 - libvirt-fedora-rawhide
+  - autotools-mingw-job:
+  parent_jobs:
+  machines:
+- libvirt-fedora-rawhide
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH jenkins-ci 1/2] Enable mingw build for libvirt-glib project

2018-04-12 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé 
---
 guests/vars/mappings.yml  | 6 ++
 guests/vars/projects/libvirt-glib.yml | 2 ++
 projects/libvirt-glib.yaml| 4 
 3 files changed, 12 insertions(+)

diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index e074648..f4eb4a2 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -343,6 +343,9 @@ mappings:
   mingw32-gettext:
 FedoraRawhide: mingw32-gettext
 
+  mingw32-glib2:
+FedoraRawhide: mingw32-glib2
+
   mingw32-gnutls:
 FedoraRawhide: mingw32-gnutls
 
@@ -379,6 +382,9 @@ mappings:
   mingw64-gettext:
 FedoraRawhide: mingw64-gettext
 
+  mingw64-glib2:
+FedoraRawhide: mingw64-glib2
+
   mingw64-gnutls:
 FedoraRawhide: mingw64-gnutls
 
diff --git a/guests/vars/projects/libvirt-glib.yml 
b/guests/vars/projects/libvirt-glib.yml
index 13a5128..bb21ae0 100644
--- a/guests/vars/projects/libvirt-glib.yml
+++ b/guests/vars/projects/libvirt-glib.yml
@@ -5,4 +5,6 @@ packages:
   - gtk-doc
   - intltool
   - libxml2
+  - mingw32-glib2
+  - mingw64-glib2
   - vala
diff --git a/projects/libvirt-glib.yaml b/projects/libvirt-glib.yaml
index 74f7642..3873c40 100644
--- a/projects/libvirt-glib.yaml
+++ b/projects/libvirt-glib.yaml
@@ -26,3 +26,7 @@
 - libvirt-fedora-26
 - libvirt-fedora-27
 - libvirt-fedora-rawhide
+  - autotools-mingw-job:
+  parent_jobs:
+  machines:
+- libvirt-fedora-rawhide
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH jenkins-ci 0/2] Enable virt-viewer mingw build

2018-04-12 Thread Daniel P . Berrangé
Daniel P. Berrangé (2):
  Enable mingw build for libvirt-glib project
  Enable mingw build for virt-viewer project

 guests/vars/mappings.yml  | 72 +++
 guests/vars/projects/libvirt-glib.yml |  2 +
 guests/vars/projects/virt-viewer.yml  | 24 
 projects/libvirt-glib.yaml|  4 ++
 projects/virt-viewer.yaml |  4 ++
 5 files changed, 106 insertions(+)

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [RFC v2] external (pull) backup API

2018-04-12 Thread Vladimir Sementsov-Ogievskiy

12.04.2018 15:57, Nikolay Shirokovskiy wrote:


On 12.04.2018 07:14, John Snow wrote:


On 04/11/2018 12:32 PM, Eric Blake wrote:

On 04/03/2018 07:01 AM, Nikolay Shirokovskiy wrote:

Hi, all.
  
This is another RFC on pull backup API. This API provides means to read domain

disks in a snapshotted state so that client can back them up as well as means
to write domain disks to revert them to backed up state. The previous version
of RFC is [1]. I'll also describe the API implementation details to shed light
on misc qemu dirty bitmap commands usage.



[snip]



Qemu can track what disk's blocks are changed from snapshotted state so on next
backup client can backup only changed blocks. virDomainBlockSnapshotCreateXML
accepts VIR_DOMAIN_BLOCK_SNAPSHOT_CREATE_CHECKPOINT flag to turn this option
for snapshot which means to track changes from this particular snapshot. I used
checkpoint term and not [dirty] bitmap because many qemu dirty bitmaps are used
to provide changed blocks from the given checkpoint to current snapshot in
current implementation (see *Implemenation* section for more details). Also
bitmap keeps block changes and thus itself changes in time and checkpoint is
a more statical terms means you can query changes from that moment in time.

Checkpoints are visible in active domain xml:

 
   ..
   
   
   
   
   ..
 


It makes sense to avoid the bitmap name in libvirt, but do these indeed
correlate 1:1 with bitmaps?

I assume each bitmap will have name=%%UUID%% ?

There is 1:1 correlation but names are different. Checkout checkpoints 
subsection
of *implementation details* section below for naming scheme.


Every checkpoint requires qemu dirty bitmap which eats 16MiB of RAM with default
dirty block size of 64KiB for 1TiB disk and the same amount of disk space is 
used.
So client need to manage checkpoints and delete unused. Thus next API function:





[snip]




First a few facts about qemu dirty bitmaps.

Bitmap can be either in active or disable state. In disabled state it does not
get changed on guest writes. And oppositely in active state it tracks guest
writes. This implementation uses approach with only one active bitmap at
a time. This should reduce guest write penalties in the presence of
checkpoints. So on first snapshot we create bitmap B_1. Now it tracks changes
from the snapshot 1. On second snapshot we create bitmap B_2 and disable bitmap
B1 and so on. Now bitmap B1 keep changes from snaphost 1 to snapshot 2, B2
- changes from snaphot 2 to snapshot 3 and so on. Last bitmap is active and
gets most disk change after latest snapshot.

So you are trying to optimize away write penalties if you have, say, ten
bitmaps representing checkpoints so we don't have to record all new
writes to all ten.

This makes sense, and I would have liked to formalize the concept in
QEMU, but response to that idea was very poor at the time.

Also my design was bad :)


Getting changed blocks bitmap from some checkpoint in past till current snapshot
is quite simple in this scheme. For example if the last snapshot is 7 then
to get changes from snapshot 3 to latest snapshot we need to merge bitmaps B3,
B4, B4 and B6. Merge is just logical OR on bitmap bits.

Deleting a checkpoint somewhere in the middle of checkpoint sequence requires
merging correspondent bitmap to the previous bitmap in this scheme.


Previous, or next?

In short previous.


Say we've got bitmaps (in chronological order from oldest to newest)

A B C D E F G H

and we want to delete bitmap (or "checkpoint") 'C':

A B   D E F G H

the bitmap representing checkpoint 'D' should now contain the bits that
used to be in 'C', right? That way all the checkpoints still represent
their appropriate points in time.

I merge to previous due to definition above. "A" contains changes from
point in time A to point in time B an so no. So if you delete C in
order for B to keep changes from point in time B to point in time D
(next in checkpoint chain) you need merge C to B.



The only problem comes when you delete a checkpoint on the end and the
bits have nowhere to go:

A B C

A B _

In this case you really do lose a checkpoint -- but depending on how we
annotate this, it may or may not be possible to delete the most recent
checkpoint. Let's assume that the currently active bitmap that doesn't
represent *any* point in time yet (because it's still active and
recording new writes) is noted as 'X':

A B C X

If we delete C now, then, that bitmap can get re-merged into the *active
bitmap* X:

A B _ X

You can delete any bitmap (and accordingly any checkpoint). If checkpoint
is last we just merge last bitmap to previous and additioanlly make the
previous bitmap active.


I propose, not to say that bitmap represents a checkpoint. It is simpler 
to say (and it reflects the reality) that bitmap is a difference between 
two consecutive 

Re: [libvirt] [jenkins-ci PATCH] jobs: Unset $CC for Go and MinGW jobs

2018-04-12 Thread Daniel P . Berrangé
On Thu, Apr 12, 2018 at 02:55:27PM +0200, Andrea Bolognani wrote:
> We want $CC to be set so that ccache is used by default, but
> some jobs (Go and MinGW) don't like that very much.
> 
> Later on, we might consider building a link farm so that we
> can use ccache without having to set $CC; for the time being,
> work around the issue at the job level.
> 
> Signed-off-by: Andrea Bolognani 
> ---
>  jobs/autotools.yaml | 7 +++
>  jobs/go.yaml| 8 
>  2 files changed, 15 insertions(+)
> 
> diff --git a/jobs/autotools.yaml b/jobs/autotools.yaml
> index 98bb1b0..b882803 100644
> --- a/jobs/autotools.yaml
> +++ b/jobs/autotools.yaml
> @@ -223,6 +223,10 @@
>- shell: |
>{global_env}
>{local_env}
> +  # The way we perform MinGW builds doesn't play well with the $CC
> +  # variable containing whitespace, so we have to unset it here.

Fix the comment:

  # The MinGW build needs to use the MinGW compiler toolchain,
  # while $CC is pointing to the native toolchain, so we have
  # to unset it here

> +  export CC=
> +
>mkdir -p build32
>cd build32
>  
> @@ -235,6 +239,9 @@
>- shell: |
>{global_env}
>{local_env}
> +  # See above
> +  export CC=
> +
>mkdir -p build64
>cd build64
>  
> diff --git a/jobs/go.yaml b/jobs/go.yaml
> index 29a9f51..2634cb2 100644
> --- a/jobs/go.yaml
> +++ b/jobs/go.yaml
> @@ -42,6 +42,11 @@
>- shell: |
>{global_env}
>{local_env}
> +  # go doesn't handle the $CC variable containing whitespace
> +  # correctly, so we have to make sure it's unset when building.
> +  # See https://github.com/golang/go/issues/11685
> +  export CC=
> +
>go build -v
>  publishers:
>- email:
> @@ -80,6 +85,9 @@
>- shell: |
>{global_env}
>{local_env}
> +  # See above
> +  export CC=
> +
>go test $TEST_ARGS
>  publishers:
>- email:

With the comment fixed:

  Reviewed-by: Daniel P. Berrangé 


Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [RFC v2] external (pull) backup API

2018-04-12 Thread Vladimir Sementsov-Ogievskiy

03.04.2018 15:01, Nikolay Shirokovskiy wrote:

Hi, all.
  
This is another RFC on pull backup API. This API provides means to read domain

disks in a snapshotted state so that client can back them up as well as means
to write domain disks to revert them to backed up state. The previous version
of RFC is [1]. I'll also describe the API implementation details to shed light
on misc qemu dirty bitmap commands usage.
  


[...]


3. Checkpoints (the most interesting part)

First a few facts about qemu dirty bitmaps.

Bitmap can be either in active or disable state. In disabled state it does not
get changed on guest writes. And oppositely in active state it tracks guest
writes. This implementation uses approach with only one active bitmap at
a time. This should reduce guest write penalties in the presence of
checkpoints.


And this give us great possibility to store disabled bitmaps in qcow2, 
not in RAM



  So on first snapshot we create bitmap B_1. Now it tracks changes
from the snapshot 1. On second snapshot we create bitmap B_2 and disable bitmap
B1 and so on. Now bitmap B1 keep changes from snaphost 1 to snapshot 2, B2
- changes from snaphot 2 to snapshot 3 and so on. Last bitmap is active and
gets most disk change after latest snapshot.

Getting changed blocks bitmap from some checkpoint in past till current snapshot
is quite simple in this scheme. For example if the last snapshot is 7 then
to get changes from snapshot 3 to latest snapshot we need to merge bitmaps B3,
B4, B4 and B6. Merge is just logical OR on bitmap bits.

Deleting a checkpoint somewhere in the middle of checkpoint sequence requires
merging correspondent bitmap to the previous bitmap in this scheme.

We use persitent bitmaps in the implementation. This means upon qemu process
termination bitmaps are saved in disks images metadata and restored back on
qemu process start.


note, that it currently works only for qcow2 disks


  This makes checkpoint a persistent property that is we
keep them across domain start/stops. Qemu does not try hard to keep bitmaps.
If upon save something goes wrong bitmap is dropped. The same is applied to the
migration process too. For backup process it is not critical. If we don't
discover a checkpoint we always can make a full backup. Also qemu provides no
special means to track order of bitmaps. These facts are critical for
implementation with one active bitmap at a time. We need right order of bitmaps 
upon
merge - for snapshot N and block changes from snanpshot K, K < N to N we need
to merge bitmaps B_{K}, ..., B_{N-1}. Also if one of the bitmaps to be merged
is missing we can't calculate desired block changes too.


[...]



*Restore operation nuances*

As it was written above to restore a domain one needs to start it in paused
state, export domain's disks and write them from backup. However qemu currently 
does
not let export disks for write even for a domain that never starts guests CPU.
We have an experimental qemu command option -x-vz-nbd-restore (passed together
with -incoming option) to fix it.


Yes. "-incoming x-vz-nbd-restore", it works like -incoming defer, but 
without logic related to qmp migrate-incoming.
So, it is just starting a vm in paused mode with inactive disks. Then we 
can call qmp cont to resume.




*Links*

[1] Previous version of RFC
https://www.redhat.com/archives/libvir-list/2017-November/msg00514.html



--
Best regards,
Vladimir

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [RFC v2] external (pull) backup API

2018-04-12 Thread Vladimir Sementsov-Ogievskiy

12.04.2018 11:58, Nikolay Shirokovskiy wrote:


On 11.04.2018 19:32, Eric Blake wrote:

On 04/03/2018 07:01 AM, Nikolay Shirokovskiy wrote:

Hi, all.
  
This is another RFC on pull backup API. This API provides means to read domain

disks in a snapshotted state so that client can back them up as well as means
to write domain disks to revert them to backed up state. The previous version
of RFC is [1]. I'll also describe the API implementation details to shed light
on misc qemu dirty bitmap commands usage.

This is a first-pass review (making comments as I first encounter
something, even if it gets explained later in the email)

  
This API does not use existent disks snapshots. Instead it introduces snapshots

provided by qemu's blockdev-backup command. The reason is we need snapshotted
disk state only temporarily for duration of backup operation and newly
introduced snapshots can be easily discarded at the end of operation without
block commit operation. Technically difference is next. On usual snapshot we
create new image backed by original and all new data goes to the new image thus
original image stays in a snapshotted state. In temporary snapshots we create
new image backed by original and all new data still goes to the original image
but before new data is written old data to be overwritten is popped out to the 
new
image thus we get snapshotted state thru new image.

So, rewriting this to make sure I understand, let's start with a disk
with contents A, then take a snapshot, then write B:

In the existing libvirt snapshot APIs, the data gets distributed as:

base (contents A) <- new active (contents B)

where you want the new API:

base, remains active (contents B) ~~~ backup (contents A)


Exactly

  
Disks snapshots as well as disks itself are avaiable to read/write thru qemu

NBD server.

So the biggest reason for a new libvirt API is that we need management
actions to control which NBD images from qemu are exposed and torn down
at the appropriate sequences.

  
Here is typical actions on domain backup:
  
- create temporary snapshot of domain disks of interest

- export snaphots thru NBD
- back them up
- remove disks from export
- delete temporary snapshot
  
and typical actions on domain restore:
  
- start domain in paused state

- export domain disks of interest thru NBD for write
- restore them
- remove disks from export
- resume or destroy domain
  
Now let's write down API in more details. There are minor changes in comparison

with previous version [1].
  
  
*Temporary snapshot API*


In previous version it is called 'Fleece API' after qemu terms and I'll still
use BlockSnapshot prefix for commands as in previous RFC instead of
TmpSnapshots which I inclined more now.

virDomainBlockSnapshotPtr
virDomainBlockSnapshotCreateXML(virDomainPtr domain,
 const char *xmlDesc,
 unsigned int flags);

Just to make sure, we have the existing API of:

virDomainSnapshotPtr virDomainSnapshotCreateXML(virDomainPtr domain,
 const char *xmlDesc,
 unsigned int flags);

So you are creating a new object (virDomainBlockSnapshotPtr) rather than
reusing the existing VirDomainSnapshotPtr, and although the two commands
are similar, we get to design a new XML schema from scratch rather than
trying to overload yet even more functionality onto the existing API.

Yes. Existing snapshots are different from temporary snapshots in many ways.
The former for example form a tree structure and the latter are not.


Should we also have:

const char *virDomainBlockSnapshotGetName(virDomainBlockSnapshotPtr
snapshot);
virDomainPtr virDomainBlockSnapshotGetDomain(virDomainBlockSnapshotPtr
snapshot);
virConnectPtr virDomainBlockSnapshotGetConnect(virDomainBlockSnapshotPtr
snapshot);

for symmetry with existing snapshot API?

Yes. I ommited these calls in RFC as they are trivial and don't need
to be considered to grasp the picture.


virDomainBlockSnapshotDelete(virDomainBlockSnapshotPtr snapshot,
   

[libvirt] [PATCH 3/5] po: add rules for integration with zanata

2018-04-12 Thread Daniel P . Berrangé
Add rules to handle pushing libvirt.pot to zanata, and refreshing .po
files with new content from zanata.

Signed-off-by: Daniel P. Berrangé 
---
 po/Makefile.am | 8 
 1 file changed, 8 insertions(+)

diff --git a/po/Makefile.am b/po/Makefile.am
index 95e5ab72bf..973ecb42e5 100644
--- a/po/Makefile.am
+++ b/po/Makefile.am
@@ -60,6 +60,14 @@ update-po: $(POFILES)
 
 update-gmo: $(GMOFILES)
 
+push-pot: $(POTFILE)
+   zanata push --push-type=source
+
+pull-po: $(POTFILE)
+   zanata pull --create-skeletons
+   $(MAKE) update-po
+   $(MAKE) update-gmo
+
 $(POTFILE): POTFILES $(POTFILE_DEPS)
$(XGETTEXT) -o $(srcdir)/$@-t $(XGETTEXT_ARGS) \
  --files-from=$(abs_srcdir)/POTFILES
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 2/5] po: remove language list from zanata configuration

2018-04-12 Thread Daniel P . Berrangé
The  element in zanata.xml is no longer relevant as this info
is recorded server side.

Signed-off-by: Daniel P. Berrangé 
---
 po/zanata.xml | 99 ---
 1 file changed, 99 deletions(-)

diff --git a/po/zanata.xml b/po/zanata.xml
index 0d05ab9870..421980a3e3 100644
--- a/po/zanata.xml
+++ b/po/zanata.xml
@@ -4,103 +4,4 @@
   libvirt
   master
   gettext
-
-  
-sq
-ar
-as
-ast
-bal
-eu
-bn
-bn-IN
-brx
-bs
-br
-bg
-ca
-zh-CN
-zh-HK
-zh-TW
-kw
-kw-GB
-cs
-da
-nl
-en-GB
-eo
-et
-fi
-fr
-gl
-ka
-de
-el
-gu
-he
-hi
-hu
-is
-id
-ia
-it
-ja
-kn
-kk
-km
-ky
-ko
-lt
-nds
-mk
-mai
-ms
-ml
-mr
-mn
-ne
-nb
-nn
-or
-pa
-fa
-pl
-pt
-pt-BR
-ro
-ru
-sr
-sr@latin
-si
-sk
-sl
-es
-sv
-tg
-ta
-te
-bo
-tr
-uk
-ur
-wba
-cy
-lv
-kw@uccor
-kw@kkcor
-af
-am
-be
-hr
-de-CH
-th
-vi
-zu
-ilo
-nso
-tw
-yo
-anp
-  
-
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 5/5] po: minimize & canonicalize translations stored in git

2018-04-12 Thread Daniel P . Berrangé
Similar to the libvirt.pot, .po files contain line numbers and file
names identifying where in the source a translatable string comes from.
The source locations in the .po files are thrown away and replaced with
content from the libvirt.pot whenever msgmerge is run, so this is not
precious information that needs to be stored in git.

When msgmerge processes a .po file, it will add in any msgids from the
libvirt.pot that were not already present. Thus, if a particular msgid
currently has no translation, it can be considered redundant and again
does not need storing in git.

When msgmerge processes a .po file and can't find an exact existing
translation match, it will try todo fuzzy matching instead, marking such
entries with a "# fuzzy" comment to alert the translator to take a
look and either discard, edit or accept the match. Looking at the
existing fuzzy matches in .po files shows that the quality is awful,
with many having a completely different set of printf format specifiers
between the msgid and fuzzy msgstr entry. Fortunately when msgfmt
generates the .gmo, the fuzzy entries are all ignored anyway. The fuzzy
entries could be useful to translators if they were working on the .po
files directly from git, but Libvirt outsourced translation to the
Fedora Zanata system, so keeping fuzzy matches in git is not much help.

Finally, by default msgids are sorted based on source location. Thus, if
a bit of code with translatable text is moved from one file to another,
it may shift around in the .po file, despite the msgid not itself changing.
If the msgids were sorted alphabetically, the .po files would have
stable ordering when code is refactored.

This patch takes advantage of the above observations to canonicalize
and minimize the content stored for .po files in git. Instead of storing
the real .po files, we now store .mini.po files.

The .mini.po files are the same file format as .po files, but have no
source location comments, are sorted alphabetically, and all fuzzy
msgstrs and msgids with no translation are discarded. This cuts the size
of content in the po directory from 109MB to 19MB.

Users working from a libvirt git checkout who need the full .po files
can run "make update-po", which merges the libvirt.pot and .mini.po
file to create a .po file containing all the content previously stored
in git.

Conversely if a full .po file has been modified, for example, by
downloading new content from Zanata, the .mini.po files can be updated
by running "make update-mini-po". The resulting diffs of the .mini.po
file will clearly show the changed translations without any of the noise
that previously obscured content. Being able to see content changes
clearly actually identified a bug in the zanata python client where it
was adding bogus "fuzzy" annotations to many messages:

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

Users working from libvirt releases should not see any difference in
behaviour, since the tarballs only contain the full .po files, not the
.mini.po files.

As an added benefit, generating tarballs with "make dist", will no
longer cause creation of dirty files in git, since it won't touch the
.mini.po files, only the .po files which are no longer kept in git.

To avoid creating a single commit 100+MB in size, each language is
minimized separately in a following commit.

Signed-off-by: Daniel P. Berrangé 
---
 .gitignore   |  3 +++
 build-aux/minimize-po.pl | 37 +
 po/Makefile.am   | 30 ++-
 po/README.md | 53 +---
 4 files changed, 102 insertions(+), 21 deletions(-)
 create mode 100755 build-aux/minimize-po.pl

diff --git a/.gitignore b/.gitignore
index 121c2caed1..df0ac8e3d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -101,6 +101,9 @@
 /mingw-libvirt.spec
 /mkinstalldirs
 /po/*gmo
+/po/*po
+!/po/*.mini.po
+/po/*pot
 /proxy/
 /python/
 /run
diff --git a/build-aux/minimize-po.pl b/build-aux/minimize-po.pl
new file mode 100755
index 00..3099178970
--- /dev/null
+++ b/build-aux/minimize-po.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+my @block;
+my $msgstr = 0;
+my $empty = 0;
+my $unused = 0;
+my $fuzzy = 0;
+while (<>) {
+if (/^$/) {
+if (!$empty && !$unused && !$fuzzy) {
+print @block;
+print;
+}
+@block = ();
+$msgstr = 0;
+$fuzzy = 0;
+} else {
+if (/^msgstr/) {
+$msgstr = 1;
+$empty = 1;
+}
+if (/^#.*fuzzy/) {
+$fuzzy = 1;
+}
+if (/^#~ msgstr/) {
+$unused = 1;
+}
+if ($msgstr && /".+"/) {
+$empty = 0;
+}
+push @block, $_;
+}
+}
+
+if (@block && !$empty && !$unused) {
+print @block;
+}
diff --git a/po/Makefile.am b/po/Makefile.am
index 973ecb42e5..ee1175a524 100644
--- a/po/Makefile.am
+++ b/po/Makefile.am
@@ -20,6 +20,8 @@ 

[libvirt] [PATCH 0/5] Improve translation handling

2018-04-12 Thread Daniel P . Berrangé
This series aims to improve the way we handle translations.

The key problems with our current approach

 - The pot & po files stored in GIT contain huge set of
   annotations about source file names & line numbers.
   These are out of date as soon as a change is commited
   to git following a translation refresh. This makes
   diffs impossible to meaningfully review, as they are
   98% noise, 2% signal.

 - The po file messages are sorted by source location,
   so when we move code between files, or rename files,
   the po file message order changes for no good reason.
   This makes diffs even more impossible to review.

 - The po files contain entries for all messages even
   if most have no translation, bloating size of po/
   data stored in git

 - Whenever 'make dist' is run, it alters all the pot
   and po files, so developers need to then reset their
   content to match git HEAD manually. This is caused
   by having auto-generated content (source file locations)
   mixed in with the static content (the actual translated
   strings)

Overall the *.po  files we store consume 100MB, and when
I refresh content from Zanata, it results in git commits
that are many 10's of MB in size and impossible todo any
meaningful review on.

After this series, we only minimized po files in git, with
the redundated & outdated source locations info stripped.
This stripped info is re-added automatically during build
to create the real .po files, that we distribute, and/or
upload to translators in Zanata.

As a result the po directory is only 19MB in size, and
when refreshing from Zanata, we have git commits that
clearly show *only* the altered translations, nothing
else. The importance of this cannot be overstated - by
having these clear diffs I discovered a serious bug in
the Zanata client that has been screwing up translations
in every project that uses Zanata by adding bogus "fuzzy"
annotations.

Note that what I've posted here is a cut-down version of
what will actually be pushed. I have cut out the 99 other
patches that actally change the .po files. There's no
meaningful way to review those commits because of the
noise in the original .po files we're replacing. I have
gone through manual steps, however, to validate that the
.po files we generate from the new .mini.po files are
identical to the original .po files we used to store,
aside from the bogus fuzzy annotations due to broken
Zanata.

The diffstat shown below covers the full set of patches
on the branch at:

   https://github.com/berrange/libvirt/commits/i18n-4

The killer statistic is:

   418787 insertions(+), 4388281 deletions(-)

Daniel P. Berrangé (5):
  po: provide custom make rules for po file management
  po: remove language list from zanata configuration
  po: add rules for integration with zanata
  po: stop storing libvirt.pot in git
  po: minimize & canonicalize translations stored in git

 .gitignore   | 9 +-
 ABOUT-NLS| 1 +
 autogen.sh   | 3 +-
 bootstrap.conf   |38 -
 build-aux/minimize-po.pl |37 +
 configure.ac |33 +-
 m4/virt-nls.m4   |70 +
 po/Makefile.am   |   107 +
 po/{POTFILES.in => POTFILES} | 0
 po/README.md |75 +
 po/af.mini.po|20 +
 po/af.po | 46395 --
 po/am.mini.po|20 +
 po/am.po | 46395 --
 po/anp.mini.po   |20 +
 po/anp.po| 46395 --
 po/ar.mini.po|   762 +
 po/ar.po | 46685 --
 po/{as.po => as.mini.po} | 54246 ++-
 po/ast.mini.po   |20 +
 po/ast.po| 46395 --
 po/bal.mini.po   |20 +
 po/bal.po| 46395 --
 po/be.mini.po|21 +
 po/be.po | 46396 --
 po/bg.mini.po|  1204 +
 po/bg.po | 46733 --
 po/bn.mini.po|   761 +
 po/bn.po | 46684 --
 po/bn_IN.mini.po |  9131 ++
 po/bn_IN.po  | 46729 --
 po/bo.mini.po|20 +
 po/bo.po | 46395 --
 po/br.mini.po|20 +
 po/br.po | 46395 --
 po/brx.mini.po   |20 +
 po/brx.po| 46395 --
 po/bs.mini.po|   767 +
 po/bs.po | 46693 --
 po/ca.mini.po|  1618 ++
 po/ca.po | 46555 

Re: [libvirt] [jenkins-ci PATCH 04/10] guests: Move ccache configuration to shell profile

2018-04-12 Thread Andrea Bolognani
On Thu, 2018-04-12 at 13:09 +0100, Daniel P. Berrangé wrote:
> IIUC, this appears to have broken the Go compiler. Unsetting 'CC' makes
> it work again. IIUC this wasn't a problem with normal Fedora setup for
> ccache, because that doesn't set 'CC', it just puts the ccache 'gcc'
> binary into $PATH.
> 
> It looks like its a limitation of "Go" - it doesn't like it when
> "CC" contains multiple words - it drops everything except the first
> word. So when we set CC="ccache cc", go just runs "ccache $args"
> instead of "ccache cc $args"

MinGW (or at least the way we do MinGW builds) has a similar issue.

I've posted a workaround:

  https://www.redhat.com/archives/libvir-list/2018-April/msg01000.html

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [jenkins-ci PATCH] jobs: Unset $CC for Go and MinGW jobs

2018-04-12 Thread Andrea Bolognani
We want $CC to be set so that ccache is used by default, but
some jobs (Go and MinGW) don't like that very much.

Later on, we might consider building a link farm so that we
can use ccache without having to set $CC; for the time being,
work around the issue at the job level.

Signed-off-by: Andrea Bolognani 
---
 jobs/autotools.yaml | 7 +++
 jobs/go.yaml| 8 
 2 files changed, 15 insertions(+)

diff --git a/jobs/autotools.yaml b/jobs/autotools.yaml
index 98bb1b0..b882803 100644
--- a/jobs/autotools.yaml
+++ b/jobs/autotools.yaml
@@ -223,6 +223,10 @@
   - shell: |
   {global_env}
   {local_env}
+  # The way we perform MinGW builds doesn't play well with the $CC
+  # variable containing whitespace, so we have to unset it here.
+  export CC=
+
   mkdir -p build32
   cd build32
 
@@ -235,6 +239,9 @@
   - shell: |
   {global_env}
   {local_env}
+  # See above
+  export CC=
+
   mkdir -p build64
   cd build64
 
diff --git a/jobs/go.yaml b/jobs/go.yaml
index 29a9f51..2634cb2 100644
--- a/jobs/go.yaml
+++ b/jobs/go.yaml
@@ -42,6 +42,11 @@
   - shell: |
   {global_env}
   {local_env}
+  # go doesn't handle the $CC variable containing whitespace
+  # correctly, so we have to make sure it's unset when building.
+  # See https://github.com/golang/go/issues/11685
+  export CC=
+
   go build -v
 publishers:
   - email:
@@ -80,6 +85,9 @@
   - shell: |
   {global_env}
   {local_env}
+  # See above
+  export CC=
+
   go test $TEST_ARGS
 publishers:
   - email:
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH libvirt v2 4/9] remote: Use domainClientEventCallbacks for remoteReplayConnectionClosedEvent

2018-04-12 Thread Marc Hartmayer
This allows us to get rid of another usage of the global variable
remoteProgram.

Signed-off-by: Marc Hartmayer 
Reviewed-by: Boris Fiuczynski 
---
 src/remote/remote_daemon_dispatch.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index b4c0e01b0832..cf2cd0add7d6 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1661,12 +1661,12 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr conn,
 static
 void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED, int 
reason, void *opaque)
 {
-virNetServerClientPtr client = opaque;
+daemonClientEventCallbackPtr callback = opaque;
 
 VIR_DEBUG("Relaying connection closed event, reason %d", reason);
 
 remote_connect_event_connection_closed_msg msg = { reason };
-remoteDispatchObjectEventSend(client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED,
   
(xdrproc_t)xdr_remote_connect_event_connection_closed_msg,
   );
@@ -3836,6 +3836,7 @@ 
remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server ATTRIBUTE_UNUS
virNetMessageErrorPtr rerr)
 {
 int rv = -1;
+daemonClientEventCallbackPtr callback = NULL;
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
@@ -3846,9 +3847,16 @@ 
remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server ATTRIBUTE_UNUS
 goto cleanup;
 }
 
+if (VIR_ALLOC(callback) < 0)
+goto cleanup;
+callback->client = virObjectRef(client);
+callback->program = virObjectRef(remoteProgram);
+/* eventID, callbackID, and legacy are not used */
+callback->eventID = -1;
+callback->callbackID = -1;
 if (virConnectRegisterCloseCallback(priv->conn,
 remoteRelayConnectionClosedEvent,
-client, NULL) < 0)
+callback, remoteEventCallbackFree) < 0)
 goto cleanup;
 
 priv->closeRegistered = true;
@@ -3856,8 +3864,10 @@ 
remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server ATTRIBUTE_UNUS
 
  cleanup:
 virMutexUnlock(>lock);
-if (rv < 0)
+if (rv < 0) {
+remoteEventCallbackFree(callback);
 virNetMessageSaveError(rerr);
+}
 return rv;
 }
 
-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH libvirt v2 5/9] rpc: Introduce virNetServerGetProgramLocked helper function

2018-04-12 Thread Marc Hartmayer
This patch introduces virNetServerGetProgramLocked. It's a function to
determine which program has to be used for a given @msg. This function
will be reused in the next patch.

Signed-off-by: Marc Hartmayer 
Reviewed-by: Boris Fiuczynski 
Reviewed-by: John Ferlan 
---
 src/rpc/virnetserver.c | 31 ---
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 3ce21a8f5345..ef214980b297 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -182,6 +182,29 @@ static void virNetServerHandleJob(void *jobOpaque, void 
*opaque)
 VIR_FREE(job);
 }
 
+
+/**
+ * virNetServerGetProgramLocked:
+ * @srv: server (must be locked by the caller)
+ * @msg: message
+ *
+ * Searches @srv for the right program for a given message @msg.
+ *
+ * Returns a pointer to the server program or NULL if not found.
+ */
+static virNetServerProgramPtr
+virNetServerGetProgramLocked(virNetServerPtr srv,
+ virNetMessagePtr msg)
+{
+size_t i;
+for (i = 0; i < srv->nprograms; i++) {
+if (virNetServerProgramMatches(srv->programs[i], msg))
+return srv->programs[i];
+}
+return NULL;
+}
+
+
 static void virNetServerDispatchNewMessage(virNetServerClientPtr client,
virNetMessagePtr msg,
void *opaque)
@@ -189,18 +212,12 @@ static void 
virNetServerDispatchNewMessage(virNetServerClientPtr client,
 virNetServerPtr srv = opaque;
 virNetServerProgramPtr prog = NULL;
 unsigned int priority = 0;
-size_t i;
 
 VIR_DEBUG("server=%p client=%p message=%p",
   srv, client, msg);
 
 virObjectLock(srv);
-for (i = 0; i < srv->nprograms; i++) {
-if (virNetServerProgramMatches(srv->programs[i], msg)) {
-prog = srv->programs[i];
-break;
-}
-}
+prog = virNetServerGetProgramLocked(srv, msg);
 
 if (srv->workers) {
 virNetServerJobPtr job;
-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH libvirt v2 9/9] remote: shrink the critical sections

2018-04-12 Thread Marc Hartmayer
No lock is required to access 'priv->conn' therefore we can shrink the
critical sections.

Signed-off-by: Marc Hartmayer 
Reviewed-by: Boris Fiuczynski 
---
 src/remote/remote_daemon_dispatch.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index 041e7c7440bf..d6699418392e 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -3841,8 +3841,6 @@ 
remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server,
 virNetServerClientGetPrivateData(client);
 virNetServerProgramPtr program;
 
-virMutexLock(>lock);
-
 if (!priv->conn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
@@ -3853,6 +3851,8 @@ 
remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server,
 goto cleanup;
 }
 
+virMutexLock(>lock);
+
 if (VIR_ALLOC(callback) < 0)
 goto cleanup;
 callback->client = virObjectRef(client);
@@ -3887,13 +3887,13 @@ 
remoteDispatchConnectUnregisterCloseCallback(virNetServerPtr server ATTRIBUTE_UN
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
-virMutexLock(>lock);
-
 if (!priv->conn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
 
+virMutexLock(>lock);
+
 if (virConnectUnregisterCloseCallback(priv->conn,
   remoteRelayConnectionClosedEvent) < 
0)
 goto cleanup;
-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH libvirt v2 8/9] remote: remove ATTRIBUTE_UNUSED when attribute is actually used

2018-04-12 Thread Marc Hartmayer
Signed-off-by: Marc Hartmayer 
Reviewed-by: Boris Fiuczynski 
---
 src/remote/remote_daemon_dispatch.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index 94b9cc3377d8..041e7c7440bf 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -3912,7 +3912,7 @@ static int
 remoteDispatchConnectDomainEventRegister(virNetServerPtr server,
  virNetServerClientPtr client,
  virNetMessagePtr msg,
- virNetMessageErrorPtr rerr 
ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
  
remote_connect_domain_event_register_ret *ret ATTRIBUTE_UNUSED)
 {
 int callbackID;
@@ -3984,7 +3984,7 @@ static int
 remoteDispatchConnectDomainEventDeregister(virNetServerPtr server 
ATTRIBUTE_UNUSED,
virNetServerClientPtr client,
virNetMessagePtr msg 
ATTRIBUTE_UNUSED,
-   virNetMessageErrorPtr rerr 
ATTRIBUTE_UNUSED,
+   virNetMessageErrorPtr rerr,

remote_connect_domain_event_deregister_ret *ret ATTRIBUTE_UNUSED)
 {
 int callbackID = -1;
@@ -4147,7 +4147,7 @@ static int
 remoteDispatchConnectDomainEventRegisterAny(virNetServerPtr server,
 virNetServerClientPtr client,
 virNetMessagePtr msg,
-virNetMessageErrorPtr rerr 
ATTRIBUTE_UNUSED,
+virNetMessageErrorPtr rerr,
 
remote_connect_domain_event_register_any_args *args)
 {
 int callbackID;
@@ -4228,7 +4228,7 @@ static int
 remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server,
 virNetServerClientPtr 
client,
 virNetMessagePtr msg,
-virNetMessageErrorPtr rerr 
ATTRIBUTE_UNUSED,
+virNetMessageErrorPtr rerr,
 
remote_connect_domain_event_callback_register_any_args *args,
 
remote_connect_domain_event_callback_register_any_ret *ret)
 {
@@ -4312,7 +4312,7 @@ static int
 remoteDispatchConnectDomainEventDeregisterAny(virNetServerPtr server 
ATTRIBUTE_UNUSED,
   virNetServerClientPtr client,
   virNetMessagePtr msg 
ATTRIBUTE_UNUSED,
-  virNetMessageErrorPtr rerr 
ATTRIBUTE_UNUSED,
+  virNetMessageErrorPtr rerr,
   
remote_connect_domain_event_deregister_any_args *args)
 {
 int callbackID = -1;
@@ -4370,7 +4370,7 @@ static int
 remoteDispatchConnectDomainEventCallbackDeregisterAny(virNetServerPtr server 
ATTRIBUTE_UNUSED,
   virNetServerClientPtr 
client,
   virNetMessagePtr msg 
ATTRIBUTE_UNUSED,
-  virNetMessageErrorPtr 
rerr ATTRIBUTE_UNUSED,
+  virNetMessageErrorPtr 
rerr,
   
remote_connect_domain_event_callback_deregister_any_args *args)
 {
 int rv = -1;
@@ -5764,7 +5764,7 @@ static int
 remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server,
  virNetServerClientPtr client,
  virNetMessagePtr msg,
- virNetMessageErrorPtr rerr 
ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
  
remote_connect_network_event_register_any_args *args,
  
remote_connect_network_event_register_any_ret *ret)
 {
@@ -5848,7 +5848,7 @@ static int
 remoteDispatchConnectNetworkEventDeregisterAny(virNetServerPtr server 
ATTRIBUTE_UNUSED,
virNetServerClientPtr client,
virNetMessagePtr msg 
ATTRIBUTE_UNUSED,
-   virNetMessageErrorPtr rerr 
ATTRIBUTE_UNUSED,
+

[libvirt] [PATCH libvirt v2 2/9] test: Convert testDriver to virObjectLockable

2018-04-12 Thread Marc Hartmayer
The test driver state (@testDriver) uses it's own reference counting
and locking implementation. Instead of doing that, convert @testDriver
into a virObjectLockable and use the provided functionalities.

Signed-off-by: Marc Hartmayer 
Reviewed-by: Boris Fiuczynski 
---
 src/test/test_driver.c | 200 ++---
 1 file changed, 90 insertions(+), 110 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 856869c9d3a9..1a219316e7c5 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -94,7 +94,7 @@ typedef struct _testAuth testAuth;
 typedef struct _testAuth *testAuthPtr;
 
 struct _testDriver {
-virMutex lock;
+virObjectLockable parent;
 
 virNodeInfo nodeInfo;
 virInterfaceObjListPtr ifaces;
@@ -126,9 +126,22 @@ typedef struct _testDriver testDriver;
 typedef testDriver *testDriverPtr;
 
 static testDriverPtr defaultPrivconn;
-static int defaultConnections;
 static virMutex defaultLock = VIR_MUTEX_INITIALIZER;
 
+static virClassPtr testDriverClass;
+static void testDriverDispose(void *obj);
+static int testDriverOnceInit(void)
+{
+if (!(testDriverClass = virClassNew(virClassForObjectLockable(),
+"testDriver",
+sizeof(testDriver),
+testDriverDispose)))
+return -1;
+
+return 0;
+}
+VIR_ONCE_GLOBAL_INIT(testDriver)
+
 #define TEST_MODEL "i686"
 #define TEST_EMULATOR "/usr/bin/test-hv"
 
@@ -144,10 +157,9 @@ static const virNodeInfo defaultNodeInfo = {
 };
 
 static void
-testDriverFree(testDriverPtr driver)
+testDriverDispose(void *obj)
 {
-if (!driver)
-return;
+testDriverPtr driver = obj;
 
 virObjectUnref(driver->caps);
 virObjectUnref(driver->xmlopt);
@@ -157,23 +169,9 @@ testDriverFree(testDriverPtr driver)
 virObjectUnref(driver->ifaces);
 virObjectUnref(driver->pools);
 virObjectUnref(driver->eventState);
-virMutexUnlock(>lock);
-virMutexDestroy(>lock);
-
-VIR_FREE(driver);
 }
 
 
-static void testDriverLock(testDriverPtr driver)
-{
-virMutexLock(>lock);
-}
-
-static void testDriverUnlock(testDriverPtr driver)
-{
-virMutexUnlock(>lock);
-}
-
 static void testObjectEventQueue(testDriverPtr driver,
  virObjectEventPtr event)
 {
@@ -405,14 +403,11 @@ testDriverNew(void)
 };
 testDriverPtr ret;
 
-if (VIR_ALLOC(ret) < 0)
+if (testDriverInitialize() < 0)
 return NULL;
 
-if (virMutexInit(>lock) < 0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   "%s", _("cannot initialize mutex"));
-goto error;
-}
+if (!(ret = virObjectLockableNew(testDriverClass)))
+return NULL;
 
 if (!(ret->xmlopt = virDomainXMLOptionNew(NULL, NULL, , NULL, NULL)) ||
 !(ret->eventState = virObjectEventStateNew()) ||
@@ -428,7 +423,7 @@ testDriverNew(void)
 return ret;
 
  error:
-testDriverFree(ret);
+virObjectUnref(ret);
 return NULL;
 }
 
@@ -1262,7 +1257,7 @@ testOpenFromFile(virConnectPtr conn, const char *file)
 if (!(privconn = testDriverNew()))
 return VIR_DRV_OPEN_ERROR;
 
-testDriverLock(privconn);
+virObjectLock(privconn);
 conn->privateData = privconn;
 
 if (!(privconn->caps = testBuildCapabilities(conn)))
@@ -1279,14 +1274,14 @@ testOpenFromFile(virConnectPtr conn, const char *file)
 
 xmlXPathFreeContext(ctxt);
 xmlFreeDoc(doc);
-testDriverUnlock(privconn);
+virObjectUnlock(privconn);
 
 return VIR_DRV_OPEN_SUCCESS;
 
  error:
 xmlXPathFreeContext(ctxt);
 xmlFreeDoc(doc);
-testDriverFree(privconn);
+virObjectUnref(privconn);
 conn->privateData = NULL;
 return VIR_DRV_OPEN_ERROR;
 }
@@ -1304,8 +1299,8 @@ testOpenDefault(virConnectPtr conn)
 size_t i;
 
 virMutexLock();
-if (defaultConnections++) {
-conn->privateData = defaultPrivconn;
+if (defaultPrivconn) {
+conn->privateData = virObjectRef(defaultPrivconn);
 virMutexUnlock();
 return VIR_DRV_OPEN_SUCCESS;
 }
@@ -1354,9 +1349,8 @@ testOpenDefault(virConnectPtr conn)
 return ret;
 
  error:
-testDriverFree(privconn);
+virObjectUnref(privconn);
 conn->privateData = NULL;
-defaultConnections--;
 goto cleanup;
 }
 
@@ -1369,9 +1363,9 @@ testConnectAuthenticate(virConnectPtr conn,
 ssize_t i;
 char *username = NULL, *password = NULL;
 
-testDriverLock(privconn);
+virObjectLock(privconn);
 if (privconn->numAuths == 0) {
-testDriverUnlock(privconn);
+virObjectUnlock(privconn);
 return 0;
 }
 
@@ -1413,7 +1407,7 @@ testConnectAuthenticate(virConnectPtr conn,
 
 ret = 0;
  cleanup:
-testDriverUnlock(privconn);
+virObjectUnlock(privconn);
 VIR_FREE(username);
 VIR_FREE(password);
 return ret;
@@ 

[libvirt] [PATCH libvirt v2 3/9] remote: Add the information which program has to be used to daemonClientEventCallback

2018-04-12 Thread Marc Hartmayer
As a result, you can later determine at the callback which program has
to be used. This makes it easier to refactor the code in the future
and is less prone to error.

Signed-off-by: Marc Hartmayer 
Reviewed-by: Boris Fiuczynski 
---
 src/remote/remote_daemon_dispatch.c | 108 
 1 file changed, 59 insertions(+), 49 deletions(-)

diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index 5b764bab48d5..b4c0e01b0832 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -78,6 +78,7 @@ VIR_LOG_INIT("daemon.remote");
 
 struct daemonClientEventCallback {
 virNetServerClientPtr client;
+virNetServerProgramPtr program;
 int eventID;
 int callbackID;
 bool legacy;
@@ -127,6 +128,7 @@ remoteEventCallbackFree(void *opaque)
 daemonClientEventCallbackPtr callback = opaque;
 if (!callback)
 return;
+virObjectUnref(callback->program);
 virObjectUnref(callback->client);
 VIR_FREE(callback);
 }
@@ -318,7 +320,7 @@ remoteRelayDomainEventLifecycle(virConnectPtr conn,
 data.detail = detail;
 
 if (callback->legacy) {
-remoteDispatchObjectEventSend(callback->client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE,
   
(xdrproc_t)xdr_remote_domain_event_lifecycle_msg,
   );
@@ -326,7 +328,7 @@ remoteRelayDomainEventLifecycle(virConnectPtr conn,
 remote_domain_event_callback_lifecycle_msg msg = { 
callback->callbackID,
data };
 
-remoteDispatchObjectEventSend(callback->client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE,
   
(xdrproc_t)xdr_remote_domain_event_callback_lifecycle_msg,
   );
@@ -355,14 +357,14 @@ remoteRelayDomainEventReboot(virConnectPtr conn,
 make_nonnull_domain(, dom);
 
 if (callback->legacy) {
-remoteDispatchObjectEventSend(callback->client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   REMOTE_PROC_DOMAIN_EVENT_REBOOT,
   
(xdrproc_t)xdr_remote_domain_event_reboot_msg, );
 } else {
 remote_domain_event_callback_reboot_msg msg = { callback->callbackID,
 data };
 
-remoteDispatchObjectEventSend(callback->client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT,
   
(xdrproc_t)xdr_remote_domain_event_callback_reboot_msg, );
 }
@@ -394,14 +396,14 @@ remoteRelayDomainEventRTCChange(virConnectPtr conn,
 data.offset = offset;
 
 if (callback->legacy) {
-remoteDispatchObjectEventSend(callback->client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE,
   
(xdrproc_t)xdr_remote_domain_event_rtc_change_msg, );
 } else {
 remote_domain_event_callback_rtc_change_msg msg = { 
callback->callbackID,
 data };
 
-remoteDispatchObjectEventSend(callback->client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE,
   
(xdrproc_t)xdr_remote_domain_event_callback_rtc_change_msg, );
 }
@@ -432,14 +434,14 @@ remoteRelayDomainEventWatchdog(virConnectPtr conn,
 data.action = action;
 
 if (callback->legacy) {
-remoteDispatchObjectEventSend(callback->client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   REMOTE_PROC_DOMAIN_EVENT_WATCHDOG,
   
(xdrproc_t)xdr_remote_domain_event_watchdog_msg, );
 } else {
 remote_domain_event_callback_watchdog_msg msg = { callback->callbackID,
   data };
 
-remoteDispatchObjectEventSend(callback->client, remoteProgram,
+remoteDispatchObjectEventSend(callback->client, callback->program,
   
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG,
   

[libvirt] [PATCH libvirt v2 1/9] virConnectRegisterCloseCallback: Cleanup 'opaque' if there is no connectRegisterCloseCallback

2018-04-12 Thread Marc Hartmayer
The commit 'close callback: move it to driver' (88f09b75eb99) moved
the responsibility for the close callback to the driver. But if the
driver doesn't support the connectRegisterCloseCallback API this
function does nothing, even no unsupported error report. This behavior
may lead to problems, for example memory leaks, as the caller cannot
differentiate whether the close callback was 'really' registered or
not.

Therefore, call directly @freecb if the connectRegisterCloseCallback
API is not supported by the driver used by the connection.

Signed-off-by: Marc Hartmayer 
Reviewed-by: Boris Fiuczynski 
---
 src/libvirt-host.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/libvirt-host.c b/src/libvirt-host.c
index 7ff7407a0874..cb2ace7d9778 100644
--- a/src/libvirt-host.c
+++ b/src/libvirt-host.c
@@ -1221,9 +1221,13 @@ virConnectRegisterCloseCallback(virConnectPtr conn,
 virCheckConnectReturn(conn, -1);
 virCheckNonNullArgGoto(cb, error);
 
-if (conn->driver->connectRegisterCloseCallback &&
-conn->driver->connectRegisterCloseCallback(conn, cb, opaque, freecb) < 
0)
-goto error;
+if (conn->driver->connectRegisterCloseCallback) {
+if (conn->driver->connectRegisterCloseCallback(conn, cb, opaque, 
freecb) < 0)
+goto error;
+} else {
+if (freecb)
+freecb(opaque);
+}
 
 return 0;
 
-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 08/10] qemu: Handle genid processing during startup/launch

2018-04-12 Thread Daniel P . Berrangé
On Thu, Apr 12, 2018 at 07:54:57AM -0400, John Ferlan wrote:
> 
> 
> On 04/12/2018 07:13 AM, Daniel P. Berrangé wrote:
> > On Wed, Apr 11, 2018 at 04:10:03PM -0400, John Ferlan wrote:
> >> Before we generate the command line for qemu, if the domain about to
> >> be launched desires to utilize the VM Generation ID functionality, then
> >> handle both the regenerating the GUID value for backup recovery (restore
> >> operation) and the startup after snapshot as well as checking that the
> >> genid value that's about to be placed on the command line doesn't
> >> duplicate some other already running domain.
> >>
> >> Signed-off-by: John Ferlan 
> >> ---
> >>  src/qemu/qemu_driver.c  |  22 +++---
> >>  src/qemu/qemu_process.c | 110 
> >> +++-
> >>  src/qemu/qemu_process.h |   1 +
> >>  3 files changed, 126 insertions(+), 7 deletions(-)
> > 
> > 
> >> +/* Now let's make sure the genid this domain has is not duplicitous
> >> + * with something else running. */
> >> +if (virDomainObjListForEach(driver->domains, qemuProcessCheckGenID, 
> >> vm) < 0)
> >> +return -1;
> > 
> > Is this really required  ?   AFAIK, the gen ID merely has to be unique 
> > within
> > the scope of the installed guest disk image, not amongst all VMs that exist.
> > If it was the latter, the check we're doing is pretty weak because it only
> > considers one host, not VMs on every other host.   IMHO this check is not
> > desirable because it adds mutex contention against every guest, into the
> > start up path and other code paths too.
> > 
> 
> Well it wasn't 100% clear from what I read whether it would be required.
> I may have misread something along the way too with how/why the value
> was being used with Active Directory and perhaps a cloned domain using
> (or needing) some mechanism to distinguish between the two.
> 
> Still, in rereading the MS GenID paper again uniqueness between two
> domains doesn't seem to be required (which is fine by me - I didn't like
> the code either) since the AD issues seem to be time based to rolling
> back using a snapshot.

In practice, unless someone uses tragically bad  UUID generator that
produces clashing strings, they're all going to be unique anyway. So
I think we're safe to drop the check and blame any mistakes on the mgmt
app using libvirt, if they occurr.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/9] Add Jansson support

2018-04-12 Thread Daniel P . Berrangé
On Thu, Apr 12, 2018 at 01:47:06PM +0200, Ján Tomko wrote:
> On Thu, Apr 12, 2018 at 12:35:21PM +0100, Daniel P. Berrangé wrote:
> > On Thu, Mar 29, 2018 at 01:09:49AM +0200, Ján Tomko wrote:
> > > Prefer Jansson, but allow fallback/choice of yajl.
> > > 
> > > Support for yajl can hopefully be dropped after we ditch CentOS 6
> > > which has no Jansson.
> > 
> > Seems like we can revisit this patch series given our discusions
> > about supported platforms.
> > 
> 
> Sadly, yes.
> 
> I don't see Jansson in the list of SLES 12 packages:
> https://www.suse.com/LinuxPackages/packageRouter.jsp?product=server=12_pack==x86_64_name=index_all
> 
> But json-c does seem to be everywhere.

json-c header files pollute the global namespace with this:

  #undef FALSE
  #define FALSE ((json_bool)0)

  #undef TRUE
  #define TRUE ((json_bool)1)

  #define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
  #define error_ptr(error) ((void*)error)
  #define error_description(error)  (json_tokener_errors[error])
  #define is_error(ptr) (ptr == NULL)

so I find json-c really unappealing to use.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/9] Add Jansson support

2018-04-12 Thread Ján Tomko

On Thu, Apr 12, 2018 at 12:35:21PM +0100, Daniel P. Berrangé wrote:

On Thu, Mar 29, 2018 at 01:09:49AM +0200, Ján Tomko wrote:

Prefer Jansson, but allow fallback/choice of yajl.

Support for yajl can hopefully be dropped after we ditch CentOS 6
which has no Jansson.


Seems like we can revisit this patch series given our discusions
about supported platforms.



Sadly, yes.

I don't see Jansson in the list of SLES 12 packages:
https://www.suse.com/LinuxPackages/packageRouter.jsp?product=server=12_pack==x86_64_name=index_all

But json-c does seem to be everywhere.

Jano


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] conf: Actually make virDomainChrSourceDef an object

2018-04-12 Thread Daniel P . Berrangé
On Thu, Apr 12, 2018 at 01:27:41PM +0200, Michal Privoznik wrote:
> On 04/12/2018 01:08 PM, John Ferlan wrote:
> > 
> > 
> > On 04/12/2018 04:44 AM, Erik Skultety wrote:
> >> On Thu, Apr 12, 2018 at 09:14:50AM +0200, Michal Privoznik wrote:
> >>> In 2ada9ef1465f we've tried to turn virDomainChrSourceDef into
> >>> virObject. Well, this requires 'virObject' member to be stored on
> >>> the first position of the struct. This adjustment is missing in
> >>> the original commit leading to all sorts of funny memleaks and
> >>> data corruptions.
> >>>
> >>> Signed-off-by: Michal Privoznik 
> >>> ---
> >>>  src/conf/domain_conf.h | 2 ++
> >>>  1 file changed, 2 insertions(+)
> >>>
> > 
> > Doh!  Thanks  I guess not only do we need a way to detect that we're
> > using VIR_ALLOC on an object (as Eric pointed out in my original
> > patches), but we really should detect when we use virObjectNew without
> > the virObject parent. For some reason, I have a recollection of altering
> > changes during my meanderings through virObject code in order to point
> > out more directly some misuses, but it was rejected. Although I cannot
> > recall if this particular instance of not having virObject parent was
> > addressed...
> 
> I don't think it was addressed there. And honestly, I don't know how to
> check for this in some automated way. Compiler is not going to help -
> sure we can have very primitive check like sizeof(virSomeStruct) >=
> sizeof(virObject), but that will fail only for very small structs (which
> is not the case here). Also, writing script that would check for this is
> going to end up in a lot of pain IMO. The only thing I can think of is
> review.

I think we could do a compile time check for it with a little cpp black
magic and some naming conventions.

First we declare that the class name variable must always match the
name of the object struct, but with Class suffix.

Second we declare that the object struct must have a field called "parent"
in it.

Then we rename virObjectNew to virObjectNewImpl and add a macro:

  #define virObjectNew(typ) \
  (typ *)(&((typ *)virObjectNewImpl(typ # Class)).parent)

IOW we're casting the void * return value to the object struct, then we're
referencing the parent field and casting it back to our object struct.

We would have to change all calls to pass the struct name instead of
class variable name.

This doesn't ensure that "parent" is the first field, but with a little
more thinking you can probably come up with a funkier macro to validate
that aspect too.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] conf: Actually make virDomainChrSourceDef an object

2018-04-12 Thread Michal Privoznik
On 04/12/2018 01:08 PM, John Ferlan wrote:
> 
> 
> On 04/12/2018 04:44 AM, Erik Skultety wrote:
>> On Thu, Apr 12, 2018 at 09:14:50AM +0200, Michal Privoznik wrote:
>>> In 2ada9ef1465f we've tried to turn virDomainChrSourceDef into
>>> virObject. Well, this requires 'virObject' member to be stored on
>>> the first position of the struct. This adjustment is missing in
>>> the original commit leading to all sorts of funny memleaks and
>>> data corruptions.
>>>
>>> Signed-off-by: Michal Privoznik 
>>> ---
>>>  src/conf/domain_conf.h | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
> 
> Doh!  Thanks  I guess not only do we need a way to detect that we're
> using VIR_ALLOC on an object (as Eric pointed out in my original
> patches), but we really should detect when we use virObjectNew without
> the virObject parent. For some reason, I have a recollection of altering
> changes during my meanderings through virObject code in order to point
> out more directly some misuses, but it was rejected. Although I cannot
> recall if this particular instance of not having virObject parent was
> addressed...

I don't think it was addressed there. And honestly, I don't know how to
check for this in some automated way. Compiler is not going to help -
sure we can have very primitive check like sizeof(virSomeStruct) >=
sizeof(virObject), but that will fail only for very small structs (which
is not the case here). Also, writing script that would check for this is
going to end up in a lot of pain IMO. The only thing I can think of is
review.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 06/10] conf: Add VM Generation ID parse/format support

2018-04-12 Thread Marc Hartmayer
On Thu, Apr 12, 2018 at 01:03 PM +0200, John Ferlan  wrote:
> [...]
>
>>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>>> index 385ba4ce8c..0fa9386270 100644
>>> --- a/src/conf/domain_conf.c
>>> +++ b/src/conf/domain_conf.c
>>> @@ -18791,6 +18791,34 @@ virDomainDefParseXML(xmlDocPtr xml,
>>>  VIR_FREE(tmp);
>>>  }
>>>
>>> +/* Extract domain genid - a genid can either be provided or generated 
>>> */
>>> +if ((n = virXPathNodeSet("./genid", ctxt, )) < 0)
>>> +goto error;
>>> +
>>> +if (n > 0) {
>>> +if (n != 1) {
>>> +virReportError(VIR_ERR_XML_ERROR, "%s",
>>> +  _("element 'genid' can only appear once"));
>>> +goto error;
>>> +}
>>> +def->genidRequested = true;
>>> +if (!(tmp = virXPathString("string(./genid[1])", ctxt))) {
>>> +if (virUUIDGenerate(def->genid) < 0) {
>>> +virReportError(VIR_ERR_INTERNAL_ERROR,
>>> +   "%s", _("Failed to generate genid"));
>>> +goto error;
>>> +}
>>> +def->genidGenerated = true;
>>> +} else {
>>> +if (virUUIDParse(tmp, def->genid) < 0) {
>>
>> You haven’t added these struct members to _virDomainDef (genid and
>> genidRequested) anywhere.
>>
>
> Patch 4 does that; however, there's been some list send/receive issues
> over the last 24 hours, so if that hasn't shown up in your inbox maybe
> it will today at some point...

Yay :D

>
> I split things up that way to reduce the amount of lines to review in
> one patch - in reality patches 4-6 could be one patch...
>
> John
>
>>> +virReportError(VIR_ERR_INTERNAL_ERROR,
>>> +   "%s", _("malformed genid element"));
>>> +goto error;
>>> +}
>>> +}
>>> +}
>>
>> […snip]
>>
>
--
Beste Grüße / Kind regards
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 08/10] qemu: Handle genid processing during startup/launch

2018-04-12 Thread Daniel P . Berrangé
On Wed, Apr 11, 2018 at 04:10:03PM -0400, John Ferlan wrote:
> Before we generate the command line for qemu, if the domain about to
> be launched desires to utilize the VM Generation ID functionality, then
> handle both the regenerating the GUID value for backup recovery (restore
> operation) and the startup after snapshot as well as checking that the
> genid value that's about to be placed on the command line doesn't
> duplicate some other already running domain.
> 
> Signed-off-by: John Ferlan 
> ---
>  src/qemu/qemu_driver.c  |  22 +++---
>  src/qemu/qemu_process.c | 110 
> +++-
>  src/qemu/qemu_process.h |   1 +
>  3 files changed, 126 insertions(+), 7 deletions(-)


> +/* Now let's make sure the genid this domain has is not duplicitous
> + * with something else running. */
> +if (virDomainObjListForEach(driver->domains, qemuProcessCheckGenID, vm) 
> < 0)
> +return -1;

Is this really required  ?   AFAIK, the gen ID merely has to be unique within
the scope of the installed guest disk image, not amongst all VMs that exist.
If it was the latter, the check we're doing is pretty weak because it only
considers one host, not VMs on every other host.   IMHO this check is not
desirable because it adds mutex contention against every guest, into the
start up path and other code paths too.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 06/10] conf: Add VM Generation ID parse/format support

2018-04-12 Thread John Ferlan
[...]

>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index 385ba4ce8c..0fa9386270 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -18791,6 +18791,34 @@ virDomainDefParseXML(xmlDocPtr xml,
>>  VIR_FREE(tmp);
>>  }
>>
>> +/* Extract domain genid - a genid can either be provided or generated */
>> +if ((n = virXPathNodeSet("./genid", ctxt, )) < 0)
>> +goto error;
>> +
>> +if (n > 0) {
>> +if (n != 1) {
>> +virReportError(VIR_ERR_XML_ERROR, "%s",
>> +  _("element 'genid' can only appear once"));
>> +goto error;
>> +}
>> +def->genidRequested = true;
>> +if (!(tmp = virXPathString("string(./genid[1])", ctxt))) {
>> +if (virUUIDGenerate(def->genid) < 0) {
>> +virReportError(VIR_ERR_INTERNAL_ERROR,
>> +   "%s", _("Failed to generate genid"));
>> +goto error;
>> +}
>> +def->genidGenerated = true;
>> +} else {
>> +if (virUUIDParse(tmp, def->genid) < 0) {
> 
> You haven’t added these struct members to _virDomainDef (genid and
> genidRequested) anywhere.
> 

Patch 4 does that; however, there's been some list send/receive issues
over the last 24 hours, so if that hasn't shown up in your inbox maybe
it will today at some point...

I split things up that way to reduce the amount of lines to review in
one patch - in reality patches 4-6 could be one patch...

John

>> +virReportError(VIR_ERR_INTERNAL_ERROR,
>> +   "%s", _("malformed genid element"));
>> +goto error;
>> +}
>> +}
>> +}
> 
> […snip]
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 06/10] conf: Add VM Generation ID parse/format support

2018-04-12 Thread Marc Hartmayer
On Wed, Apr 11, 2018 at 10:10 PM +0200, John Ferlan  wrote:
> The VM Generation ID is a mechanism to provide a unique 128-bit,
> cryptographically random, and integer value identifier known as
> the GUID (Globally Unique Identifier) to the guest OS. The value
> is used to help notify the guest operating system when the virtual
> machine is executed with a different configuration.
>
> This patch adds support for a new "genid" XML element similar to
> the "uuid" element. The "genid" element can have two forms ""
> or "$GUID". If the $GUID is not provided, libvirt
> will generate one.
>
> For the ABI checks add avoidance for the genid comparison if the
> appropriate flag is set.
>
> Since adding support for a generated GUID (or UUID like) value to
> be displayed only for an active guest, modifying the xml2xml test
> to include virrandommock.so is necessary since it will generate a
> "known" UUID value that can be compared against for the active test.
>
> Signed-off-by: John Ferlan 
> ---
>  docs/formatdomain.html.in| 29 
>  docs/schemas/domaincommon.rng|  8 
>  src/conf/domain_conf.c   | 59 
> 
>  src/conf/domain_conf.h   |  3 ++
>  tests/qemuxml2argvdata/genid-auto.xml| 32 +
>  tests/qemuxml2argvdata/genid.xml | 32 +
>  tests/qemuxml2xmloutdata/genid-active.xml| 32 +
>  tests/qemuxml2xmloutdata/genid-auto-active.xml   | 32 +
>  tests/qemuxml2xmloutdata/genid-auto-inactive.xml | 32 +
>  tests/qemuxml2xmloutdata/genid-inactive.xml  | 32 +
>  tests/qemuxml2xmltest.c  |  5 +-
>  11 files changed, 295 insertions(+), 1 deletion(-)
>  create mode 100644 tests/qemuxml2argvdata/genid-auto.xml
>  create mode 100644 tests/qemuxml2argvdata/genid.xml
>  create mode 100644 tests/qemuxml2xmloutdata/genid-active.xml
>  create mode 100644 tests/qemuxml2xmloutdata/genid-auto-active.xml
>  create mode 100644 tests/qemuxml2xmloutdata/genid-auto-inactive.xml
>  create mode 100644 tests/qemuxml2xmloutdata/genid-inactive.xml
>
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 5e99884dc5..fe9c3b19f0 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -34,6 +34,7 @@
>  domain type='kvm' id='1'
>nameMyGuest/name
>uuid4dea22b3-1d52-d8f3-2516-782e98ab3fa0/uuid
> +  genid43dc0cf8-809b-4adb-9bea-a9abb5f3d90e/genid
>titleA short description - title - of the domain/title
>descriptionSome human readable description/description
>metadata
> @@ -61,6 +62,34 @@
>  specification. Since 0.0.1, sysinfo
>  since 0.8.7
>
> +  genid
> +  Since 4.3.0, the genid
> +element can be used to add a Virtual Machine Generation ID which
> +exposes a 128-bit, cryptographically random, integer value 
> identifier,
> +referred to as a Globally Unique Identifier (GUID) using the same
> +format as the uuid. The value is used to help notify
> +the guest operating system when the virtual machine is executed
> +with a different configuration, such as:
> +
> +
> +  snapshot execution
> +  backup recovery
> +  failover in a disaster recovery environment
> +  creation from template (import, copy, clone)
> +
> +
> +The guest operating system notices the change and is then able to
> +react as appropriate by marking its copies of distributed databases
> +as dirty, re-initializing its random number generator, etc.
> +
> +
> +When a GUID value is not provided, e.g. using the XML syntax
> +genid/, then libvirt will automatically generate a GUID.
> +This is the recommended configuration since the hypervisor then
> +can handle changing the GUID value for specific state transitions.
> +Using a static GUID value may result in failures for starting from
> +snapshot, restoring from backup, starting a cloned domain, 
> etc.
> +
>title
>The optional element title provides space for a
>  short description of the domain. The title should not contain
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 4cab55f05d..1892a7c63c 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -502,6 +502,14 @@
>
>  
>
> +  
> +
> +  
> +
> +
> +  
> +
> +  
>  
>
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 385ba4ce8c..0fa9386270 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -18791,6 +18791,34 @@ virDomainDefParseXML(xmlDocPtr xml,
>  VIR_FREE(tmp);
>  }
>
> +/* 

Re: [libvirt] [dbus PATCH] APIs should appear in aplhabetical order in all files.

2018-04-12 Thread Katerina Koukiou
On Thu, 2018-04-12 at 11:42 +0200, Katerina Koukiou wrote:
> In C and XML files the order is:
> 1) properties
> 2) methods
> 3) signals
> All of them sorted in their category alphabetically.
> 
> Signed-off-by: Katerina Koukiou 
> ---
>  data/org.libvirt.Connect.xml |  12 +--
>  data/org.libvirt.Domain.xml  |  54 ++--
>  src/connect.c|   2 +-
>  src/domain.c | 200 +--
> 
>  4 files changed, 134 insertions(+), 134 deletions(-)
> 
> diff --git a/data/org.libvirt.Connect.xml
> b/data/org.libvirt.Connect.xml
> index 5b49ed9..55260cc 100644
> --- a/data/org.libvirt.Connect.xml
> +++ b/data/org.libvirt.Connect.xml
> @@ -25,12 +25,6 @@
>  value="See https://libvirt.org/html/libvirt-libvirt-host.htm
> l#virConnectGetVersion"/>;
>  
> -
> -   -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virConnectListAllDomains"/>;
> -  
> -  
> -
>  
>  value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainCreateXML"/>;
> @@ -73,6 +67,12 @@
>
>
>  
> +
> +   +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virConnectListAllDomains"/>;
> +  
> +  
> +
>  
>  value="See https://libvirt.org/html/libvirt-libvirt-network.
> html#virConnectListAllNetworks"/>;
> diff --git a/data/org.libvirt.Domain.xml
> b/data/org.libvirt.Domain.xml
> index 7679018..78378bb 100644
> --- a/data/org.libvirt.Domain.xml
> +++ b/data/org.libvirt.Domain.xml
> @@ -3,25 +3,25 @@
>  
>  
>
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetName"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainIsActive"/>;
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetUUIDString"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetAutostart"/>;
>  
>  
>  value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetID"/>;
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetOSType"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetName"/>;
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainIsActive"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetOSType"/>;
>  
>  
> @@ -31,21 +31,19 @@
>  value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetState"/>;
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetAutostart"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetUUIDString"/>;
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetVcpusFlags"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainCreateWithFlags"/>;
>
> -  
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetXMLDesc"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainDestroyFlags"/>;
>
> -  
>  
>  
> @@ -54,15 +52,17 @@
>
>
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainShutdownFlags"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetVcpusFlags"/>;
>
> +  
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainDestroyFlags"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainGetXMLDesc"/>;
>
> +  
>  
>  
> @@ -74,23 +74,23 @@
>  value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainReset"/>;
>
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainCreateWithFlags"/>;
> -  
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainResume"/>;
>  
> -
> +
> -value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainUndefineFlags"/>;
> +value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainShutdownFlags"/>;
>
>  
>  
>  value="See https://libvirt.org/html/libvirt-libvirt-domain.h
> tml#virDomainSuspend"/>;
>  
> 

[libvirt] [jenkins-ci PATCH v2] guests: Clean up packages after update

2018-04-12 Thread Andrea Bolognani
The package cache can grow to eat up a lot of disk space, and
not removing unused packages can lead to upgrade issues down
the line for fast moving distributions such as Fedora Rawhide.

Signed-off-by: Andrea Bolognani 
---
Changes from [v1]:

  * call 'yum autoremove' when possible.

[v1] https://www.redhat.com/archives/libvir-list/2018-April/msg00970.html

 guests/tasks/base.yml | 28 
 1 file changed, 28 insertions(+)

diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 53cbd65..616db0a 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -117,6 +117,34 @@
   when:
 - package_format == 'pkg'
 
+- name: Clean up packages after update
+  command: yum clean packages -y
+  args:
+warn: no
+  when:
+- package_format == 'rpm'
+
+- name: Clean up packages after update
+  command: yum autoremove -y
+  args:
+warn: no
+  when:
+- package_format == 'rpm'
+- not ( os_name == 'CentOS' and
+os_version == '6' )
+
+- name: Clean up packages after update
+  apt:
+autoclean: yes
+autoremove: yes
+  when:
+- package_format == 'deb'
+
+- name: Clean up packages after update
+  shell: pkg clean -y && pkg autoremove -y
+  when:
+- package_format == 'pkg'
+
 - name: Configure hostname
   hostname:
 name: '{{ inventory_hostname }}'
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [jenkins-ci PATCH] guests: Clean up packages after update

2018-04-12 Thread Andrea Bolognani
On Thu, 2018-04-12 at 11:00 +0100, Daniel P. Berrangé wrote:
> On Thu, Apr 12, 2018 at 11:54:16AM +0200, Andrea Bolognani wrote:
> > On Thu, 2018-04-12 at 10:29 +0200, Pavel Hrdina wrote:
> > > Would it be possible to add 'yum autoremove -y'? Only CentOS 6 doesn't
> > > have that command.
> > 
> > Good point, I must not have found out about it because I was
> > looking at CentOS 6 :) I'll post v2 in a bit.
> 
> "yum autoremove" is a command for reliably screwing up your system and
> should never be run without manual inspection of what it is going todo.

Is that so? The apt equivalent is usually pretty solid, and as
I mention in the commit message getting rid of obsolete packages can
really help when upgrading fast-moving targets.

I'm also not *that* worried about potentially breaking builders to
be honest, since with our current level of automation the worst case
scenario is spending around an hour rebuilding them from scratch :)

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt PATCH v2 13/44] Deprecate QEMU_CAPS_DRIVE_SERIAL

2018-04-12 Thread Andrea Bolognani
On Thu, 2018-04-12 at 11:54 +0200, Ján Tomko wrote:
> > I just realized that all of these should have a qemu: prefix in
> > the first line of the commit message. Before pushing, can you
> > please make sure they do?
> 
> I rarely use prefixes, they take up valuable space in the commit
> summary.
> 
> 'QEMU' is already contained in QEMU_CAPS if you're reading the single
> commit summary.
> 
> If you want to see changes just from qemu, you can filter by the
> src/qemu path
> 
> So what is the value they add?

They make the commit history look more consistent.

But feel free to disregard this comment if you feel stongly
otherwise, I really don't care that much at the end of the day.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [jenkins-ci PATCH] guests: Clean up packages after update

2018-04-12 Thread Daniel P . Berrangé
On Thu, Apr 12, 2018 at 11:54:16AM +0200, Andrea Bolognani wrote:
> On Thu, 2018-04-12 at 10:29 +0200, Pavel Hrdina wrote:
> > On Mon, Apr 09, 2018 at 03:56:05PM +0200, Andrea Bolognani wrote:
> > > +- name: Clean up packages after update
> > > +  command: yum clean packages -y
> > > +  args:
> > > +warn: no
> > > +  when:
> > > +- package_format == 'rpm'
> > 
> > Would it be possible to add 'yum autoremove -y'? Only CentOS 6 doesn't
> > have that command.
> 
> Good point, I must not have found out about it because I was
> looking at CentOS 6 :) I'll post v2 in a bit.

"yum autoremove" is a command for reliably screwing up your system and
should never be run without manual inspection of what it is going todo.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [jenkins-ci PATCH] guests: Clean up packages after update

2018-04-12 Thread Andrea Bolognani
On Thu, 2018-04-12 at 10:29 +0200, Pavel Hrdina wrote:
> On Mon, Apr 09, 2018 at 03:56:05PM +0200, Andrea Bolognani wrote:
> > +- name: Clean up packages after update
> > +  command: yum clean packages -y
> > +  args:
> > +warn: no
> > +  when:
> > +- package_format == 'rpm'
> 
> Would it be possible to add 'yum autoremove -y'? Only CentOS 6 doesn't
> have that command.

Good point, I must not have found out about it because I was
looking at CentOS 6 :) I'll post v2 in a bit.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [libvirt PATCH v2 14/44] Deprecate QEMU_CAPS_SDL

2018-04-12 Thread Andrea Bolognani
On Mon, 2018-04-09 at 17:20 +0200, Ján Tomko wrote:
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 009ae2d36c..18f7e6d2d7 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1141,8 +1141,8 @@ mymain(void)
>  VIR_FREE(driver.config->vncSASLdir);
>  VIR_FREE(driver.config->vncTLSx509certdir);
>  
> -DO_TEST("graphics-sdl", QEMU_CAPS_SDL, QEMU_CAPS_DEVICE_VGA);
> -DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_SDL,
> +DO_TEST("graphics-sdl", QEMU_CAPS_DEVICE_VGA);

The capability can go on a separate line now.


I think Dan's comments about having better detection of whether SDL
support is actually compiled into the QEMU binary will need to be
addressed separately anyway and thus shouldn't prevent this patch
from being merged. Assuming he doesn't object,

  Reviewed-by: Andrea Bolognani 

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [dbus PATCH 2/6] Implement SchedulerType property for Domain Interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  4 
 src/domain.c| 23 +++
 test/test_domain.py |  3 +++
 3 files changed, 30 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index b8ee5b8..dbeafce 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -28,6 +28,10 @@
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsPersistent"/>
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedulerType"/>
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState"/>
diff --git a/src/domain.c b/src/domain.c
index 82682ef..f775fd4 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -149,6 +149,28 @@ virtDBusDomainGetPersistent(const gchar *objectPath,
 *value = g_variant_new("b", !!persistent);
 }
 
+static void
+virtDBusDomainGetSchedulerType(const gchar *objectPath,
+   gpointer userData,
+   GVariant **value,
+   GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+g_autofree gchar *schedtype = NULL;
+gint nparams;
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+schedtype = virDomainGetSchedulerType(domain, );
+if (!schedtype)
+return virtDBusUtilSetLastVirtError(error);
+
+*value = g_variant_new("(si)", schedtype, nparams);
+}
+
 static void
 virtDBusDomainGetState(const gchar *objectPath,
gpointer userData,
@@ -517,6 +539,7 @@ static virtDBusGDBusPropertyTable 
virtDBusDomainPropertyTable[] = {
 { "Name", virtDBusDomainGetName, NULL },
 { "OSType", virtDBusDomainGetOsType, NULL },
 { "Persistent", virtDBusDomainGetPersistent, NULL },
+{ "SchedulerType", virtDBusDomainGetSchedulerType, NULL},
 { "State", virtDBusDomainGetState, NULL },
 { "UUID", virtDBusDomainGetUUID, NULL },
 { 0 }
diff --git a/test/test_domain.py b/test/test_domain.py
index 7fa9aad..a7cf962 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -16,6 +16,9 @@ class TestDomain(libvirttest.BaseTestClass):
 assert isinstance(props['Name'], dbus.String)
 assert isinstance(props['OSType'], dbus.String)
 assert isinstance(props['Persistent'], dbus.Boolean)
+assert any([isinstance(props['SchedulerType'], dbus.Struct),
+isinstance(props['SchedulerType'][0], dbus.String),
+isinstance(props['SchedulerType'][1], dbus.Int32)])
 assert isinstance(props['State'], dbus.String)
 assert isinstance(props['UUID'], dbus.String)
 
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH 6/6] Implement DetachDevice method for Domain Interface

2018-04-12 Thread Katerina Koukiou
This method is not tested for now since the test driver
doesn't suport this API.

Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 25 +
 2 files changed, 31 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index b620939..83e37bc 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -56,6 +56,12 @@
 value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags"/>
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDeviceFlags"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainListGetStats"/>
diff --git a/src/domain.c b/src/domain.c
index d246d45..ed50c68 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -367,6 +367,30 @@ virtDBusDomainDestroy(GVariant *inArgs,
 virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainDetachDevice(GVariant *inArgs,
+   GUnixFDList *inFDs G_GNUC_UNUSED,
+   const gchar *objectPath,
+   gpointer userData,
+   GVariant **outArgs G_GNUC_UNUSED,
+   GUnixFDList **outFDs G_GNUC_UNUSED,
+   GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+const gchar *xml;
+guint flags;
+
+g_variant_get(inArgs, "()", , );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainDetachDeviceFlags(domain, xml, flags) == -1)
+return virtDBusUtilSetLastVirtError(error);
+}
+
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, 
virDomainStatsRecordListFree);
 
 static void
@@ -643,6 +667,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "AttachDevice", virtDBusDomainAttachDevice },
 { "Create", virtDBusDomainCreate },
 { "Destroy", virtDBusDomainDestroy },
+{ "DetachDevice", virtDBusDomainDetachDevice },
 { "GetStats", virtDBusDomainGetStats },
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH 0/6] More methods for Domain Interface

2018-04-12 Thread Katerina Koukiou
Katerina Koukiou (6):
  Implement Setter for Autostart property for Domain interface
  Implement SchedulerType property for Domain Interface
  Introduce virtDBusDomainMemoryStatTypeToString helper function
  Implement MemoryStats for Domain Interface
  Implement AttachDevice method for Domain Interface
  Implement DetachDevice method for Domain Interface

 data/org.libvirt.Domain.xml |  28 +++-
 src/domain.c| 166 +++-
 test/test_domain.py |  10 +++
 3 files changed, 201 insertions(+), 3 deletions(-)

-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH 5/6] Implement AttachDevice method for Domain Interface

2018-04-12 Thread Katerina Koukiou
This method is not tested for now since the test driver
doesn't suport this API.

Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  6 ++
 src/domain.c| 25 +
 2 files changed, 31 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 6795d30..b620939 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -40,6 +40,12 @@
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/>
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAttachDeviceFlags"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags"/>
diff --git a/src/domain.c b/src/domain.c
index 0893f96..d246d45 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -297,6 +297,30 @@ virtDBusDomainSetAutostart(GVariant *value,
 return virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainAttachDevice(GVariant *inArgs,
+   GUnixFDList *inFDs G_GNUC_UNUSED,
+   const gchar *objectPath,
+   gpointer userData,
+   GVariant **outArgs G_GNUC_UNUSED,
+   GUnixFDList **outFDs G_GNUC_UNUSED,
+   GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+const gchar *xml;
+guint flags;
+
+g_variant_get(inArgs, "()", , );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+if (virDomainAttachDeviceFlags(domain, xml, flags) == -1)
+return virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainCreate(GVariant *inArgs,
  GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -616,6 +640,7 @@ static virtDBusGDBusPropertyTable 
virtDBusDomainPropertyTable[] = {
 };
 
 static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
+{ "AttachDevice", virtDBusDomainAttachDevice },
 { "Create", virtDBusDomainCreate },
 { "Destroy", virtDBusDomainDestroy },
 { "GetStats", virtDBusDomainGetStats },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH 4/6] Implement MemoryStats for Domain Interface

2018-04-12 Thread Katerina Koukiou
This method is not tested for now since the test driver
doesn't support this API.

Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  7 ++
 src/domain.c| 57 +
 2 files changed, 64 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index dbeafce..6795d30 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -69,6 +69,13 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats"/>
+  
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReboot"/>
diff --git a/src/domain.c b/src/domain.c
index 9b3de57..0893f96 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -17,6 +17,29 @@ VIRT_DBUS_ENUM_IMPL(virtDBusDomainMemoryStat,
 "usable",
 "last_update")
 
+static const gchar *
+virtDBusDomainMemoryStatToString(gint tag)
+{
+const gchar *str = virtDBusDomainMemoryStatTypeToString(tag);
+return str ? str : "unknown";
+}
+
+static GVariant *
+virtDBusDomainMemoryStatsToGVariant(virDomainMemoryStatPtr stats,
+gint nr_stats)
+{
+GVariantBuilder builder;
+
+g_variant_builder_init(, G_VARIANT_TYPE("a{st}"));
+
+for (gint i = 0; i < nr_stats; i++)
+g_variant_builder_add(, "{st}",
+  virtDBusDomainMemoryStatToString(stats[i].tag),
+  stats[i].val);
+
+return g_variant_builder_end();
+}
+
 static virDomainPtr
 virtDBusDomainGetVirDomain(virtDBusConnect *connect,
const gchar *objectPath,
@@ -412,6 +435,39 @@ virtDBusDomainGetXMLDesc(GVariant *inArgs,
 *outArgs = g_variant_new("(s)", xml);
 }
 
+static void
+virtDBusDomainMemoryStats(GVariant *inArgs,
+  GUnixFDList *inFDs G_GNUC_UNUSED,
+  const gchar *objectPath,
+  gpointer userData,
+  GVariant **outArgs,
+  GUnixFDList **outFDs G_GNUC_UNUSED,
+  GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virDomain) domain = NULL;
+g_autofree virDomainMemoryStatPtr stats = NULL;
+guint max_stats;
+gint nr_stats;
+guint flags;
+GVariant *gstats;
+
+g_variant_get(inArgs, "(uu)", _stats, );
+
+domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+if (!domain)
+return;
+
+stats = g_new0(virDomainMemoryStatStruct, max_stats);
+nr_stats = virDomainMemoryStats(domain, stats, max_stats, flags);
+if (nr_stats == -1)
+return virtDBusUtilSetLastVirtError(error);
+
+gstats = virtDBusDomainMemoryStatsToGVariant(stats, nr_stats);
+
+*outArgs = g_variant_new_tuple(, 1);
+}
+
 static void
 virtDBusDomainReboot(GVariant *inArgs,
  GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -565,6 +621,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] 
= {
 { "GetStats", virtDBusDomainGetStats },
 { "GetVcpus", virtDBusDomainGetVcpus },
 { "GetXMLDesc", virtDBusDomainGetXMLDesc },
+{ "MemoryStats", virtDBusDomainMemoryStats },
 { "Reboot", virtDBusDomainReboot },
 { "Reset", virtDBusDomainReset },
 { "Resume", virtDBusDomainResume },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH 3/6] Introduce virtDBusDomainMemoryStatTypeToString helper function

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 src/domain.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/domain.c b/src/domain.c
index f775fd4..9b3de57 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -3,6 +3,20 @@
 
 #include 
 
+VIRT_DBUS_ENUM_DECL(virtDBusDomainMemoryStat)
+VIRT_DBUS_ENUM_IMPL(virtDBusDomainMemoryStat,
+VIR_DOMAIN_MEMORY_STAT_LAST,
+"swap_in",
+"swap_out",
+"major_fault",
+"minor_fault",
+"unused",
+"available",
+"actual_baloon",
+"rss",
+"usable",
+"last_update")
+
 static virDomainPtr
 virtDBusDomainGetVirDomain(virtDBusConnect *connect,
const gchar *objectPath,
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH 1/6] Implement Setter for Autostart property for Domain interface

2018-04-12 Thread Katerina Koukiou
Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Domain.xml |  5 +++--
 src/domain.c| 22 +-
 test/test_domain.py |  7 +++
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 78378bb..b8ee5b8 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -7,9 +7,10 @@
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsActive"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart and
+   
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetAutostart"/>
 
 
   https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [dbus PATCH] APIs should appear in aplhabetical order in all files.

2018-04-12 Thread Katerina Koukiou
In C and XML files the order is:
1) properties
2) methods
3) signals
All of them sorted in their category alphabetically.

Signed-off-by: Katerina Koukiou 
---
 data/org.libvirt.Connect.xml |  12 +--
 data/org.libvirt.Domain.xml  |  54 ++--
 src/connect.c|   2 +-
 src/domain.c | 200 +--
 4 files changed, 134 insertions(+), 134 deletions(-)

diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 5b49ed9..55260cc 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -25,12 +25,6 @@
   https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetVersion"/>
 
-
-  https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListAllDomains"/>
-  
-  
-
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateXML"/>
@@ -73,6 +67,12 @@
   
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListAllDomains"/>
+  
+  
+
 
   https://libvirt.org/html/libvirt-libvirt-network.html#virConnectListAllNetworks"/>
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 7679018..78378bb 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -3,25 +3,25 @@
 
 
   
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetName"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsActive"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart"/>
 
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetID"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetOSType"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetName"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsActive"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetOSType"/>
 
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags"/>
   
-  
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetXMLDesc"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags"/>
   
-  
 
 
   
   
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainShutdownFlags"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags"/>
   
+  
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetXMLDesc"/>
   
+  
 
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReset"/>
   
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags"/>
-  
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlags"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainShutdownFlags"/>
   
 
 
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSuspend"/>
 
-
+
   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"/>
+value="See 
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlags"/>
+  
 
 
   https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] apparmor: add rules to use qemu_bridge_helper

2018-04-12 Thread Christian Ehrhardt
On Wed, Apr 11, 2018 at 11:03 AM, Michal Privoznik 
wrote:

> On 04/09/2018 08:34 AM, Christian Ehrhardt wrote:
> > Due to mediation of socket and signal activity currently qemu:///session
> > connections calling qemu_bridge_helper fail.
> >
> > We need the profile for libvirtd itself and the subprofile for
> > qemu-bridge-helper to be able to talk/notify to each other via unix
> socket and
> > signals.
> >
> > Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1754871
> >
> > Signed-off-by: Christian Ehrhardt 
> > ---
> >  examples/apparmor/usr.sbin.libvirtd | 8 
> >  1 file changed, 8 insertions(+)
> >
>
> ACK
>
> Michal
>

FYI - Without other feedback so far I pushed it as-is with your ack added.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] conf: Actually make virDomainChrSourceDef an object

2018-04-12 Thread Erik Skultety
On Thu, Apr 12, 2018 at 09:14:50AM +0200, Michal Privoznik wrote:
> In 2ada9ef1465f we've tried to turn virDomainChrSourceDef into
> virObject. Well, this requires 'virObject' member to be stored on
> the first position of the struct. This adjustment is missing in
> the original commit leading to all sorts of funny memleaks and
> data corruptions.
>
> Signed-off-by: Michal Privoznik 
> ---
>  src/conf/domain_conf.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 89a7131fdb..1426f115ed 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -57,6 +57,7 @@
>  # include "virtypedparam.h"
>  # include "virsavecookie.h"
>  # include "virresctrl.h"
> +# include "virobject.h"

syntax-check fails ^here because the header is already included on line 49

With that fixed:
Reviewed-by: Erik Skultety 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [jenkins-ci PATCH] guests: Fix intltool-update on FreeBSD

2018-04-12 Thread Pavel Hrdina
On Wed, Apr 11, 2018 at 03:14:49PM +0200, Andrea Bolognani wrote:
> The tool became completely unusable after the switch to Perl
> 5.26; workaround the issue while we wait for a proper solution.
> 
> Signed-off-by: Andrea Bolognani 
> ---
> Using regexes to match regexes: it's regexception.
> 
>  guests/tasks/kludges.yml | 13 +
>  1 file changed, 13 insertions(+)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt PATCH v2 13/44] Deprecate QEMU_CAPS_DRIVE_SERIAL

2018-04-12 Thread Andrea Bolognani
On Mon, 2018-04-09 at 17:20 +0200, Ján Tomko wrote:
> Implied by QEMU >= 1.2.0.
> 
> Signed-off-by: Ján Tomko 
> ---
>  src/qemu/qemu_capabilities.c |  1 -
>  src/qemu/qemu_capabilities.h |  2 +-
>  src/qemu/qemu_command.c  | 20 
> 
>  tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml|  1 -
>  tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml|  1 -
>  tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml|  1 -
>  tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml  |  1 -
>  tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml  |  1 -
>  tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml  |  1 -
>  tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml  |  1 -
>  tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml  |  1 -
>  tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml |  1 -
>  .../disk-drive-network-tlsx509-vxhs.args |  6 +++---
>  tests/qemuxml2argvdata/disk-drive-network-vxhs.args  |  2 +-
>  tests/qemuxml2argvdata/disk-scsi-disk-wwn.args   |  2 +-
>  tests/qemuxml2argvtest.c |  8 +++-
>  32 files changed, 17 insertions(+), 49 deletions(-)

I just realized that all of these should have a qemu: prefix in
the first line of the commit message. Before pushing, can you
please make sure they do?

Reviewed-by: Andrea Bolognani 

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt PATCH v2 10/44] Deprecate QEMU_CAPS_MONITOR_JSON

2018-04-12 Thread Ján Tomko

On Thu, Apr 12, 2018 at 09:45:48AM +0200, Andrea Bolognani wrote:

On Mon, 2018-04-09 at 17:20 +0200, Ján Tomko wrote:

We require QEMU >= 0.15.0, assume every QEMU supports it.


s/0.15.0/1.5.0/

Unless the usable monitor was introduced in 0.15.0, in which case
your version is more precise.


Sadly that does not let us trivially drop qemuMonitor's
priv->monJSON bool, because of qemuDomainQemuAttach.


I'm perfectly fine with dropping that being a follow-up patch,
just like the one taking care of qemuCaps->usedQMP. But just so
we're on the same page, you're planning on doing that, right?



Here, 'trivially' does not mean too many changes, but either
we still will need to track 'broken' domains created via QemuAttach
somehow, in case someone would try to use JSON monitor functions
with them, or drop QemuAttach completely since it's really out of date.

Jano


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [libvirt PATCH v2 12/44] Deprecate QEMU_CAPS_MEM_PATH

2018-04-12 Thread Andrea Bolognani
On Mon, 2018-04-09 at 17:20 +0200, Ján Tomko wrote:
> Implied by QEMU >= 1.2.0.
> 
> Signed-off-by: Ján Tomko 
> ---
>  src/qemu/qemu_capabilities.c   |  1 -
>  src/qemu/qemu_capabilities.h   |  2 +-
>  src/qemu/qemu_command.c| 12 ++
>  tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml  |  1 -
>  tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml |  1 -
>  tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml  |  1 -
>  tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml  |  1 -
>  tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml|  1 -
>  tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml|  1 -
>  tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml|  1 -
>  tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml   |  1 -
>  tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml|  1 -
>  tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml|  1 -
>  tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml   |  1 -
>  tests/qemuxml2argvtest.c   | 28 
> +++---
>  29 files changed, 17 insertions(+), 51 deletions(-)

Reviewed-by: Andrea Bolognani 

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH jenkins-ci] Run "make check" for osinfo-db

2018-04-12 Thread Pavel Hrdina
On Tue, Apr 10, 2018 at 05:29:39PM +0100, Daniel P. Berrangé wrote:
> Signed-off-by: Daniel P. Berrangé 
> ---
>  projects/osinfo-db.yaml | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/8] vfio-ccw passthrough support

2018-04-12 Thread Shalini Chellathurai Saroja



On 04/11/2018 05:49 PM, Shalini Chellathurai Saroja wrote:

Let us support the basic channel I/O passthrough infrastructure based on
vfio, which have been introduced in QEMU 2.10. The current focus is to
support dasd-eckd (cu_type/dev_type = 0x3990/0x3390) as the target
device.


There is a temporary delay with our mail reception. The answer to the 
question below is as follows.


Quick question: Does "current focus" mean "we have only tested it with
ECKD DASD", or "we only allow passthrough of 3990/3390 devices"?

yes, it means we have only tested it with ECKD DASD device. The libvirt 
implementation supports all the devices which are supported by QEMU.


Thanks.



Shalini Chellathurai Saroja (8):
   qemu: introduce capability for virtual-css-bridge
   qemu: introduce vfio-ccw capability
   util: virhostdev: add virHostdevIsMdevDevice()
   qemu: vfio-ccw device address generation
   qemu: command line generation for vfio-ccw device
   tests: tests for vfio-ccw passthrough
   docs: documentation for vfio-ccw passthrough
   news: documentation of new feature

  docs/drvnodedev.html.in|  21 -
  docs/formatdomain.html.in  |  20 +++-
  docs/news.xml  |   9 ++
  docs/schemas/domaincommon.rng  |   5 +-
  src/libvirt_private.syms   |   1 +
  src/qemu/qemu_capabilities.c   |  23 +
  src/qemu/qemu_capabilities.h   |   5 +
  src/qemu/qemu_command.c|  37 ++--
  src/qemu/qemu_domain.c |   2 +-
  src/qemu/qemu_domain_address.c |  32 +--
  src/qemu/qemu_hostdev.c|   3 +-
  src/qemu/qemu_hotplug.c|   4 +-
  src/util/virhostdev.c  |  26 --
  src/util/virhostdev.h  |   3 +
  src/util/virmdev.c |   3 +-
  src/util/virmdev.h |   1 +
  .../qemucapabilitiesdata/caps_2.10.0.s390x.replies |  28 --
  tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   |   3 +-
  .../qemucapabilitiesdata/caps_2.11.0.s390x.replies |  28 --
  tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml   |   3 +-
  .../qemucapabilitiesdata/caps_2.12.0.s390x.replies |  31 +--
  tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml   |   3 +
  .../qemucapabilitiesdata/caps_2.7.0.s390x.replies  |  24 +++--
  tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml|   3 +-
  .../qemucapabilitiesdata/caps_2.8.0.s390x.replies  |  28 --
  tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml|   3 +-
  .../qemucapabilitiesdata/caps_2.9.0.s390x.replies  |  28 --
  tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml|   3 +-
  tests/qemuhotplugtest.c|   2 +-
  ...tdev-subsys-mdev-vfio-ccw-duplicate-address.xml |  29 ++
  ...ostdev-subsys-mdev-vfio-ccw-invalid-address.xml |  23 +
  .../hostdev-subsys-mdev-vfio-ccw.args  |  23 +
  .../hostdev-subsys-mdev-vfio-ccw.xml   |  22 +
  tests/qemuxml2argvtest.c   | 102 -
  .../hostdev-subsys-mdev-vfio-ccw.xml   |  28 ++
  tests/qemuxml2xmltest.c|  31 ---
  36 files changed, 491 insertions(+), 149 deletions(-)
  create mode 100644 
tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-duplicate-address.xml
  create mode 100644 
tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-invalid-address.xml
  create mode 100644 tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw.args
  create mode 100644 tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw.xml
  create mode 100644 tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw.xml



--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] conf: Actually make virDomainChrSourceDef an object

2018-04-12 Thread Michal Privoznik
In 2ada9ef1465f we've tried to turn virDomainChrSourceDef into
virObject. Well, this requires 'virObject' member to be stored on
the first position of the struct. This adjustment is missing in
the original commit leading to all sorts of funny memleaks and
data corruptions.

Signed-off-by: Michal Privoznik 
---
 src/conf/domain_conf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 89a7131fdb..1426f115ed 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -57,6 +57,7 @@
 # include "virtypedparam.h"
 # include "virsavecookie.h"
 # include "virresctrl.h"
+# include "virobject.h"
 
 /* forward declarations of all device types, required by
  * virDomainDeviceDef
@@ -1180,6 +1181,7 @@ typedef virDomainChrSourceReconnectDef 
*virDomainChrSourceReconnectDefPtr;
 
 /* The host side information for a character device.  */
 struct _virDomainChrSourceDef {
+virObject parent;
 int type; /* virDomainChrType */
 virObjectPtr privateData;
 union {
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/2] tests: Create full host NUMA topology by default

2018-04-12 Thread Andrea Bolognani
vircapstest has code to add a full host NUMA topology, that
is, one that includes all information about nodes and CPUs
including IDs; the function used to create a mock virCapsPtr
by most of the test suite, however, just fakes it by setting
nnumaCell_max to some number.

While the latter approach has served us well so far, we're
going to need all the information to be filled in soon. In
order to do that, we can just move the existing code from
vircapstest to testutilsqemu and, with some renaming and
trivial tweaking, use it as-is.

Interestingly, the NUMA topology generated by the function
is rigged up so that the NUMA nodes aren't (necessarily)
numbered starting from 0, which is a nice way to spot
mistaken assumptions in our codebase.

Signed-off-by: Andrea Bolognani 
---
 tests/testutilsqemu.c | 57 +-
 tests/vircapstest.c   | 62 +--
 2 files changed, 57 insertions(+), 62 deletions(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index f8182033fc..ec32c4e106 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -375,6 +375,56 @@ static int testQemuAddAARCH64Guest(virCapsPtr caps)
 return -1;
 }
 
+#define MAX_CELLS 4
+#define MAX_CPUS_IN_CELL 2
+#define MAX_MEM_IN_CELL 2097152
+
+/*
+ * Build NUMA topology with cell id starting from (0 + seq)
+ * for testing
+ */
+static int
+testQemuBuildNUMATopology(virCapsPtr caps,
+  int seq)
+{
+virCapsHostNUMACellCPUPtr cell_cpus = NULL;
+int core_id, cell_id;
+int id;
+
+id = 0;
+for (cell_id = 0; cell_id < MAX_CELLS; cell_id++) {
+if (VIR_ALLOC_N(cell_cpus, MAX_CPUS_IN_CELL) < 0)
+goto error;
+
+for (core_id = 0; core_id < MAX_CPUS_IN_CELL; core_id++) {
+cell_cpus[core_id].id = id + core_id;
+cell_cpus[core_id].socket_id = cell_id + seq;
+cell_cpus[core_id].core_id = id + core_id;
+if (!(cell_cpus[core_id].siblings =
+  virBitmapNew(MAX_CPUS_IN_CELL)))
+goto error;
+ignore_value(virBitmapSetBit(cell_cpus[core_id].siblings, id));
+}
+id++;
+
+if (virCapabilitiesAddHostNUMACell(caps, cell_id + seq,
+   MAX_MEM_IN_CELL,
+   MAX_CPUS_IN_CELL, cell_cpus,
+   VIR_ARCH_NONE, NULL,
+   VIR_ARCH_NONE, NULL) < 0)
+   goto error;
+
+cell_cpus = NULL;
+}
+
+return 0;
+
+ error:
+virCapabilitiesClearHostNUMACellCPUTopology(cell_cpus, MAX_CPUS_IN_CELL);
+VIR_FREE(cell_cpus);
+return -1;
+}
+
 virCapsPtr testQemuCapsInit(void)
 {
 virCapsPtr caps;
@@ -400,7 +450,12 @@ virCapsPtr testQemuCapsInit(void)
 
 qemuTestSetHostCPU(caps, NULL);
 
-caps->host.nnumaCell_max = 4;
+/*
+ * Build a NUMA topology with cell_id (NUMA node id
+ * being 3(0 + 3),4(1 + 3), 5 and 6
+ */
+if (testQemuBuildNUMATopology(caps, 3) < 0)
+goto cleanup;
 
 if (testQemuAddI686Guest(caps) < 0)
 goto cleanup;
diff --git a/tests/vircapstest.c b/tests/vircapstest.c
index 664b7da143..e9d5e12158 100644
--- a/tests/vircapstest.c
+++ b/tests/vircapstest.c
@@ -29,62 +29,6 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
-#define MAX_CELLS 4
-#define MAX_CPUS_IN_CELL 2
-#define MAX_MEM_IN_CELL 2097152
-
-
-/*
- * Build  NUMA Toplogy with cell id starting from (0 + seq)
- * for testing
- */
-static virCapsPtr
-buildNUMATopology(int seq)
-{
-virCapsPtr caps;
-virCapsHostNUMACellCPUPtr cell_cpus = NULL;
-int core_id, cell_id;
-int id;
-
-if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64, false, false)) == NULL)
-goto error;
-
-id = 0;
-for (cell_id = 0; cell_id < MAX_CELLS; cell_id++) {
-if (VIR_ALLOC_N(cell_cpus, MAX_CPUS_IN_CELL) < 0)
-goto error;
-
-for (core_id = 0; core_id < MAX_CPUS_IN_CELL; core_id++) {
-cell_cpus[core_id].id = id + core_id;
-cell_cpus[core_id].socket_id = cell_id + seq;
-cell_cpus[core_id].core_id = id + core_id;
-if (!(cell_cpus[core_id].siblings =
-  virBitmapNew(MAX_CPUS_IN_CELL)))
-goto error;
-ignore_value(virBitmapSetBit(cell_cpus[core_id].siblings, id));
-}
-id++;
-
-if (virCapabilitiesAddHostNUMACell(caps, cell_id + seq,
-   MAX_MEM_IN_CELL,
-   MAX_CPUS_IN_CELL, cell_cpus,
-   VIR_ARCH_NONE, NULL,
-   VIR_ARCH_NONE, NULL) < 0)
-   goto error;
-
-cell_cpus = NULL;
-}
-
-return caps;
-
- error:
-virCapabilitiesClearHostNUMACellCPUTopology(cell_cpus, MAX_CPUS_IN_CELL);

[libvirt] [PATCH 2/2] qemu: Figure out nodeset bitmap size correctly

2018-04-12 Thread Andrea Bolognani
The current private XML parsing code relies on the assumption
that NUMA node IDs start from 0 and are densely allocated,
neither of which is necessarily the case.

Change it so that the bitmap size is dynamically calculated by
looking at NUMA node IDs instead, which ensures all nodes will
be able to fit and thus the bitmap will be parsed successfully.

Update one of the test cases so that it would fail with the
previous approach, but passes with the new one.

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

Signed-off-by: Andrea Bolognani 
---
 src/qemu/qemu_domain.c| 11 ++-
 tests/qemustatusxml2xmldata/modern-in.xml |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 100304fd05..b126c69490 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2248,6 +2248,8 @@ 
qemuDomainObjPrivateXMLParseAutomaticPlacement(xmlXPathContextPtr ctxt,
 virCapsPtr caps = NULL;
 char *nodeset;
 char *cpuset;
+int nodesetSize = 0;
+int i;
 int ret = -1;
 
 nodeset = virXPathString("string(./numad/@nodeset)", ctxt);
@@ -2259,8 +2261,15 @@ 
qemuDomainObjPrivateXMLParseAutomaticPlacement(xmlXPathContextPtr ctxt,
 if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
 goto cleanup;
 
+/* Figure out how big the nodeset bitmap needs to be.
+ * This is necessary because NUMA node IDs are not guaranteed to
+ * start from 0 or be densely allocated */
+for (i = 0; i < caps->host.nnumaCell; i++) {
+nodesetSize = MAX(nodesetSize, caps->host.numaCell[i]->num + 1);
+}
+
 if (nodeset &&
-virBitmapParse(nodeset, >autoNodeset, caps->host.nnumaCell_max) 
< 0)
+virBitmapParse(nodeset, >autoNodeset, nodesetSize) < 0)
 goto cleanup;
 
 if (cpuset) {
diff --git a/tests/qemustatusxml2xmldata/modern-in.xml 
b/tests/qemustatusxml2xmldata/modern-in.xml
index 2e166e6e67..c1e57618b6 100644
--- a/tests/qemustatusxml2xmldata/modern-in.xml
+++ b/tests/qemustatusxml2xmldata/modern-in.xml
@@ -252,7 +252,7 @@
 
 
   
-  
+  
   
   
   
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] vbox: Make vboxCommonDriver static

2018-04-12 Thread Michal Privoznik
This is a global variable, but it isn't accessible from outside
of the file its declared in.

Signed-off-by: Michal Privoznik 
---

Pushed as trivial.

 src/vbox/vbox_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 3bcca43d32..b5f8456f8d 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -7978,7 +7978,7 @@ vboxDomainSendKey(virDomainPtr dom,
  * Function Tables
  */
 
-virHypervisorDriver vboxCommonDriver = {
+static virHypervisorDriver vboxCommonDriver = {
 .name = "VBOX",
 .connectOpen = vboxConnectOpen, /* 0.6.3 */
 .connectClose = vboxConnectClose, /* 0.6.3 */
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list