Re: [libvirt] [PATCH-RFC-V2] qemu: Add network bandwidth setting for ethernet interfaces

2014-10-07 Thread Anirban Chakraborty


On 10/6/14, 3:43 AM, "Michal Privoznik"  wrote:

>On 18.09.2014 01:33, Anirban Chakraborty wrote:
>> V2:
>> Consolidate calls to virNetDevBandwidthSet
>> Clear bandwidth settings when the interface is detached or domain
>>destroyed
>>
>> V1:
>> Ethernet interfaces in libvirt currently do not support bandwidth
>>setting.
>> For example, following xml file for an interface will not apply these
>> settings to corresponding qdiscs.
>>
>>  
>>
>>
>>
>>
>>
>>  
>>  
>>
>>  
>>
>> Signed-off-by: Anirban Chakraborty 
>> ---
>>   src/conf/domain_conf.h  |  7 +++
>>   src/lxc/lxc_process.c   | 27 ++-
>>   src/qemu/qemu_command.c |  9 -
>>   src/qemu/qemu_driver.c  | 21 +
>>   src/qemu/qemu_hotplug.c | 13 +
>>   src/util/virnetdevmacvlan.c | 10 --
>>   src/util/virnetdevmacvlan.h |  1 -
>>   7 files changed, 59 insertions(+), 29 deletions(-)
>>
>> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
>> index 640a4c5..3c950f1 100644
>> --- a/src/conf/domain_conf.h
>> +++ b/src/conf/domain_conf.h
>> @@ -829,6 +829,13 @@ typedef enum {
>>   VIR_DOMAIN_NET_TYPE_LAST
>>   } virDomainNetType;
>>
>> +/* check bandwidth configuration for a network interface */
>> +#define NETDEVIF_SUPPORT_BANDWIDTH(type) \
>> +   ((type == VIR_DOMAIN_NET_TYPE_ETHERNET || \
>> + type == VIR_DOMAIN_NET_TYPE_NETWORK  || \
>> + type == VIR_DOMAIN_NET_TYPE_BRIDGE   || \
>> + type == VIR_DOMAIN_NET_TYPE_DIRECT) ? true : false)
>> +
>
>I'd rather turn this into a function (possibly inline function).

Will do.

>
>>   /* the backend driver used for virtio interfaces */
>>   typedef enum {
>>   VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT, /* prefer kernel, fall back
>>to user */
>> diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
>> index ed30c37..5ef91e8 100644
>> --- a/src/lxc/lxc_process.c
>> +++ b/src/lxc/lxc_process.c
>> @@ -274,11 +274,6 @@ char
>>*virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
>>   if (virNetDevSetOnline(parentVeth, true) < 0)
>>   goto cleanup;
>>
>> -if (virNetDevBandwidthSet(net->ifname,
>> -  virDomainNetGetActualBandwidth(net),
>> -  false) < 0)
>> -goto cleanup;
>> -
>
>Well, the virLXCProcessSetupInterfaceBridged is used elsewhere in the
>code too. For instance after this patch the QoS is not applied on
>interfaces hotplugged into an LXC container.

Thanks for pointing it out. I am taking care of it in my next patch.

>
>>   if (net->filter &&
>>   virDomainConfNWFilterInstantiate(conn, vm->uuid, net) < 0)
>>   goto cleanup;
>> @@ -300,6 +295,7 @@ char
>>*virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
>>   virNetDevBandwidthPtr bw;
>>   virNetDevVPortProfilePtr prof;
>>   virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
>> +const char *linkdev = virDomainNetGetActualDirectDev(net);
>>
>>   /* XXX how todo bandwidth controls ?
>>* Since the 'net-ifname' is about to be moved to a different
>> @@ -329,16 +325,15 @@ char
>>*virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
>>
>>   if (virNetDevMacVLanCreateWithVPortProfile(
>>   net->ifname, &net->mac,
>> -virDomainNetGetActualDirectDev(net),
>> +linkdev,
>>   virDomainNetGetActualDirectMode(net),
>>   false, def->uuid,
>> -virDomainNetGetActualVirtPortProfile(net),
>> +prof,
>>   &res_ifname,
>>   VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
>>   cfg->stateDir,
>> -virDomainNetGetActualBandwidth(net), 0) < 0)
>> +0) < 0)
>>   goto cleanup;
>> -
>>   ret = res_ifname;
>>
>>cleanup:
>> @@ -368,6 +363,7 @@ static int
>>virLXCProcessSetupInterfaces(virConnectPtr conn,
>>   int ret = -1;
>>   size_t i;
>>   size_t niface = 0;
>> +int actualType;
>>
>>   for (i = 0; i < def->nnets; i++) {
>>   char *veth = NULL;
>> @@ -381,7 +377,8 @@ static int
>>virLXCProcessSetupInterfaces(virConnectPtr conn,
>>   if (VIR_EXPAND_N(*veths, *nveths, 1) < 0)
>>   goto cleanup;
>>
>> -switch (virDomainNetGetActualType(def->nets[i])) {
>> +actualType = virDomainNetGetActualType(def->nets[i]);
>> +switch (actualType) {
>>   case VIR_DOMAIN_NET_TYPE_NETWORK: {
>>   virNetworkPtr network;
>>   char *brname = NULL;
>> @@ -444,11 +441,15 @@ static int
>>virLXCProcessSetupInterfaces(virConnectPtr conn,
>>   case VIR_DOMAIN_NET_TYPE_LAST:
>>   virReportError(VIR_ERR_INTERNAL_ERROR,
>>  _("Unsupported network type %s"),
>> -   virDomainNetTypeToString(
>> -   virDomainNetGetActualType(def->nets[i])
>> -

Re: [libvirt] [PATCH v3 1/3] migration: add migration_host support for Ipv6 address without brackets

2014-10-07 Thread Chen, Fan
On Tue, 2014-10-07 at 11:08 +0200, Ján Tomko wrote: 
> On 10/07/2014 06:07 AM, Chen Fan wrote:
> > if specifying migration_host to an Ipv6 address without brackets,
> > it was resolved to an incorrect address, such as:
> > tcp:2001:0DB8::1428:,
> > but the correct address should be:
> > tcp:[2001:0DB8::1428]:
> > so we should add brackets when parsing it.
> > 
> > Signed-off-by: Chen Fan 
> > ---
> >  src/libvirt_private.syms  |  2 +-
> >  src/qemu/qemu_migration.c | 49 
> > +++
> >  src/util/virsocketaddr.c  | 19 +-
> >  src/util/virsocketaddr.h  |  2 +-
> >  tests/sockettest.c|  2 +-
> >  5 files changed, 36 insertions(+), 38 deletions(-)
> 
> ACK

Thanks.

> 
> Jan
> 


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

Re: [libvirt] Notes: Non-shared storage live migration w/ active blockcommit

2014-10-07 Thread Eric Blake
On 09/25/2014 08:26 AM, Kashyap Chamarthy wrote:
> This notes is based on an IRC conversation with Eric Blake, to have
> efficient non-shared storage live migration. Thought I'd post my notes
> here before I forget. Please review and spot if there are any
> inaccuracies.
> 
> Procedure
> -
> 
> (1) Starting from disk A, create a snapshot A <- A':
> 
> $ virsh snapshot-create-as \
> --domain f20vm snap1 snap1-desc \
> --diskspec hda,file=/export/vmimages/A'.qcow2 \
> --disk-only --atomic

If you are using this snapshot only for the side-effect of growing the
chain, you can add --no-metadata here instead of deleting the snapshot
later when it gets invalidated [1].  Of course, if you pass
--no-metadata, the snapshot name (snap1) and description (snap1-desc)
are no longer important.

> 
> (2) Background copy of A to B:
> 
> $ virsh blockcopy \
> --domain vm1 vda /export/vmimages/B.qcow2 \
> --wait --verbose --shallow \
> --finish

This step is not quite right.  You are asking for a shallow copy of the
current file for disk 'vda' (that is, A'.qcow2).  But that is NOT the
same as the base A image.  For this step, libvirt does not yet have an
easy way to access the contents of a backing chain of a live domain; you
CAN use 'virsh vol-*' commands to do a background copy from storage
pools, but it may be easier to just resort to normal file system tools:

cp /export/vmimages/A.qcow2 /export/vmimages/B.qcow2

or even rely on storage-array-specific commands to set up a trivial
clone with no real time overhead (for example, some iscsi storage arrays
allow efficient copy-on-write cloning of storage volumes by creating a
new name that shares the same original contents of A.qcow2 as its
starting point; and since we are about to delete A.qcow2 later on, we
never need any actual data copying).

> 
> (3) Create an empty B' with backing file B:
> 
> $ qemu-img create -f qcow2 -b B.qcow2 \
> -o backing_fmt=qcow2 B'.qcow2
> 
> [or]
> 
> $ virsh vol-create-as default B'.qcow2 1G \
> --format qcow2 \
> --backing-vol B.qcow2 --backing-vol-format qcow2 

[side note - we should really teach libvirt to not REQUIRE a size when
creating an empty wrapper around an existing image]

> 
> (4) Do a shallow blockcopy of A' to B':
> 
> $ virsh blockcopy \
> --domain vm1 vda /export/vmimages/B'.qcow2 \
> --wait --verbose --shallow \
> --finish

For this to work, you need to also use the --reuse-external flag to take
advantage of the backing chain already recorded in B'.qcow2 (without the
flag, the command will complain that B'.qcow2 already exists if it is a
regular file; if it is a block device, it will just silently ignore the
contents of the block device and treat B'.qcow2 as though an absolute
path to A.qcow2 were its backing file).

> 
> (5) Then live shallow commit of B:
> 
> $ virsh blockcommit \
> --domain f20vm vda \
> --wait --verbose --shallow \
> --pivot --active --finish
> Block Commit: [100 %]
> Successfully pivoted

With steps 2 and 4 corrected, this indeed shortens the chain back down
to just B.qcow2.  And once this happens, you no longer need the path to
A.qcow2 or A'.qcow2; you can also delete B'.qcow2.  But back to the
point I made earlier at [1]: if this is all you do, then 'virsh
snapshot-list' will still show 'snap1' as a snapshot that tries to refer
to A'.qcow2; since you just invalidated that with the copy, you'd need
to 'virsh snapshot-delete --metadata vm1 snap1' to get rid of the stale
snapshot (if you don't tweak step 1 to avoid creating that snapshot
metadata in the first place).

The NICE part about this whole sequence is that the backing file does
NOT have to be qcow2, and it is VERY efficient timewise, if you happen
to have an efficient way to do step 2.  That is, I can go from a
multi-gigabyte raw file A.img to raw file B.img in less than a second,
assuming the guest isn't doing much I/O in the meantime, when scripting
all these steps together, and without any guest downtime.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

Re: [libvirt] [PATCH v2] hotplug: Fix libvirtd crash on qemu-attached guest

2014-10-07 Thread John Ferlan
ping?

Eric/Dan - since you had comments on v1...

Tks,

John
On 09/25/2014 11:00 AM, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1141621
> 
> The crash in this case was because the qemu-attach code did not create
> aliases for qemu cli args. When the detach-interface code was called
> it assumed aliases were set resulting in a core when dereferencing the
> still NULL alias.
> 
> Adding a call to qemuAssignDeviceAliases() resolves the path for
> qemu-attach; however, to prevent future issues an additional check
> for a NULL value is made and an error provided in the deatch path.
> 
> Add some more verbiage to the virsh man page.
> 
> Signed-off-by: John Ferlan 
> ---
> 
> v1 is here:
> http://www.redhat.com/archives/libvir-list/2014-September/msg01331.html
> 
> Changes since v1:
>  - Add the call to qemuAssignDeviceAliases() in qemuDomainQemuAttach().
>  - Move the check for NULL alias inside the CAPS_DEVICE check and emit
>an error rather than trying to remove as an "else" condition.
> 
>  src/qemu/qemu_driver.c  | 3 +++
>  src/qemu/qemu_hotplug.c | 7 +++
>  tools/virsh.pod | 5 +++--
>  3 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 117138a..ef4ecd2 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -14746,6 +14746,9 @@ static virDomainPtr 
> qemuDomainQemuAttach(virConnectPtr conn,
>  if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
>  goto cleanup;
>  
> +if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
> +goto cleanup;
> +
>  if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0)
>  goto cleanup;
>  
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index d631887..daebe82 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -3521,6 +3521,13 @@ qemuDomainDetachNetDevice(virConnectPtr conn,
>  
>  qemuDomainObjEnterMonitor(driver, vm);
>  if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
> +if (!detach->info.alias) {
> +virReportError(VIR_ERR_OPERATION_FAILED, "%s",
> +   _("device alias not found: cannot delete the "
> + "net device"));
> +qemuDomainObjExitMonitor(driver, vm);
> +goto cleanup;
> +}
>  if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
>  qemuDomainObjExitMonitor(driver, vm);
>  virDomainAuditNet(vm, detach, NULL, "detach", false);
> diff --git a/tools/virsh.pod b/tools/virsh.pod
> index eae9195..bd17f68 100644
> --- a/tools/virsh.pod
> +++ b/tools/virsh.pod
> @@ -3698,8 +3698,9 @@ using the UNIX driver. Ideally the process will also 
> have had the
>  
>  Not all functions of libvirt are expected to work reliably after
>  attaching to an externally launched QEMU process. There may be
> -issues with the guest ABI changing upon migration, and hotunplug
> -may not work.
> +issues with the guest ABI changing upon migration and device hotplug
> +or hotunplug may not work. The attached environment should be considered
> +primarily read-only.
>  
>  =item B I { [I<--hmp>] | [I<--pretty>] }
>  I...
> 

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


Re: [libvirt] [PATCH] security_selinux: Don't relabel /dev/net/tun

2014-10-07 Thread Richard W.M. Jones
On Tue, Oct 07, 2014 at 04:53:24PM +0200, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1147057
> 
> The code for relabelling the TAP FD is there due to a race. When
> libvirt creates a /dev/tapN device it's labeled as
> 'system_u:object_r:device_t:s0' by default. Later, when
> udev/systemd reacts to this device, it's relabelled to the
> expected label 'system_u:object_r:tun_tap_device_t:s0'. Hence, we
> have a code that relabels the device, to cut the race down. For
> more info see ae368ebfcc4.
> 
> But the problem is, the relabel function is called on all TUN/TAP
> devices. Yes, on /dev/net/tun too. This is however a special kind
> of device - other processes uses it too. We shouldn't touch it's
> label then.
> 
> Ideally, there would an API in SELinux that would label just the
> passed FD and not the underlying path. That way, we wouldn't need
> to care as we would be not labeling /dev/net/tun but the FD
> passed to the domain. Unfortunately, there's no such API so we
> have to workaround until then.
> 
> Signed-off-by: Michal Privoznik 
> ---
>  src/security/security_selinux.c | 21 -
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
> index b7c1015..25e8320 100644
> --- a/src/security/security_selinux.c
> +++ b/src/security/security_selinux.c
> @@ -2352,7 +2352,7 @@ virSecuritySELinuxSetTapFDLabel(virSecurityManagerPtr 
> mgr,
>  struct stat buf;
>  security_context_t fcon = NULL;
>  virSecurityLabelDefPtr secdef;
> -char *str = NULL;
> +char *str = NULL, *proc = NULL, *fd_path = NULL;
>  int rc = -1;
>  
>  secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME);
> @@ -2370,6 +2370,23 @@ virSecuritySELinuxSetTapFDLabel(virSecurityManagerPtr 
> mgr,
>  goto cleanup;
>  }
>  
> +/* Label /dev/tap.* devices only. Leave /dev/net/tun alone! */
> +if (virAsprintf(&proc, "/proc/self/fd/%d", fd) == -1)
> +goto cleanup;
> +
> +if (virFileResolveLink(proc, &fd_path) < 0) {
> +virReportSystemError(errno,
> + _("Unable to resolve link: %s"), proc);
> +goto cleanup;
> +}
> +
> +if (!STRPREFIX(fd_path, "/dev/tap")) {
> +VIR_DEBUG("fd=%d points to %s not setting SELinux label",
> +  fd, fd_path);
> +rc = 0;
> +goto cleanup;
> +}
> +
>  if (getContext(mgr, "/dev/tap.*", buf.st_mode, &fcon) < 0) {
>  virReportError(VIR_ERR_INTERNAL_ERROR,
> _("cannot lookup default selinux label for tap fd 
> %d"), fd);
> @@ -2384,6 +2401,8 @@ virSecuritySELinuxSetTapFDLabel(virSecurityManagerPtr 
> mgr,
>  
>   cleanup:
>  freecon(fcon);
> +VIR_FREE(fd_path);
> +VIR_FREE(proc);
>  VIR_FREE(str);
>  return rc;
>  }

I applied this patch (without any of Eric's suggested changes) to
libvirt on Rawhide to see if it would fix the relabelling problems
that are stopping libguestfs networking from working.

It does indeed appear to fix them.  Hence you can add:

  Tested-by: Richard W.M. Jones 

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

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


Re: [libvirt] [PATCH 2/2] esx: Implement virDomainScreenshot using libcurl stream driver

2014-10-07 Thread Matthias Bolte
2014-03-31 15:46 GMT+02:00 Michal Privoznik :
> On 30.03.2014 21:03, Matthias Bolte wrote:
>>
>> This implementation uses the https://esx-server/screen?id= way to get
>> a screenshot of a running domain. Compared to the CreateScreenshot_Task
>> way this works since ESX 2.5 while CreateScreenshot_Task was added in
>> version 4.0.
>>
>> The newly added libcurl stream driver is used to directly provide the
>> downloaded data without saving it to a temporary file first.
>> ---
>>   src/esx/esx_driver.c  | 120
>> +-
>>   src/esx/esx_private.h |   1 +
>>   2 files changed, 120 insertions(+), 1 deletion(-)

>>
>> +static char *
>> +esxDomainScreenshot(virDomainPtr domain, virStreamPtr stream,
>> +unsigned int screen, unsigned int flags)
>> +{
>> +char *mimeType = NULL;
>> +esxPrivate *priv = domain->conn->privateData;
>> +esxVI_Boolean supportsScreenshot = esxVI_Boolean_Undefined;
>> +esxVI_String *propertyNameList = NULL;
>> +esxVI_ObjectContent *virtualMachine = NULL;
>> +esxVI_VirtualMachinePowerState powerState;
>> +virBuffer buffer = VIR_BUFFER_INITIALIZER;
>> +char *url = NULL;
>> +
>> +virCheckFlags(0, NULL);
>> +
>> +if (screen != 0) {
>> +virReportError(VIR_ERR_INVALID_ARG, "%s",
>> +   _("Screen cannot be selected"));
>> +return NULL;
>> +}
>> +
>> +supportsScreenshot = esxSupportsScreenshot(priv);
>> +
>> +if (supportsScreenshot == esxVI_Boolean_Undefined)
>> +return NULL;
>> +
>> +if (supportsScreenshot != esxVI_Boolean_True) {
>> +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
>> +   _("Screenshot feature is unsupported"));
>> +return NULL;
>> +}
>> +
>> +if (esxVI_EnsureSession(priv->primary) < 0)
>> +return NULL;
>> +
>> +if (esxVI_String_AppendValueToList(&propertyNameList,
>> +   "runtime.powerState") < 0 ||
>> +esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
>> + propertyNameList,
>> &virtualMachine,
>> + esxVI_Occurrence_RequiredItem) <
>> 0 ||
>> +esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) <
>> 0)
>> +goto cleanup;
>> +
>> +if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
>> +virReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> +   _("Domain is not powered on"));
>> +goto cleanup;
>> +}
>> +
>> +/* Build URL */
>> +virBufferAsprintf(&buffer, "%s://%s:%d/screen?id=",
>> priv->parsedUri->transport,
>> +  domain->conn->uri->server,
>> domain->conn->uri->port);
>> +virBufferURIEncodeString(&buffer, virtualMachine->obj->value);
>> +
>> +if (virBufferError(&buffer)) {
>> +virReportOOMError();
>> +goto cleanup;
>> +}
>> +
>> +url = virBufferContentAndReset(&buffer);
>> +
>> +if (VIR_STRDUP(mimeType, "image/png") < 0)
>> +goto cleanup;
>> +
>> +if (esxStreamOpenDownload(stream, priv, url, 0, 0) < 0) {
>> +VIR_FREE(mimeType);
>> +goto cleanup;
>> +}
>> +
>> + cleanup:
>> +if (!url)
>> +virBufferFreeAndReset(&buffer);
>
>
> The 'if' is redundant. Ether we get here with partially allocated buffer, or
> buffer is already reset.
>

True, I removed the if.

>
> ACK
>
> Michal

Thanks, pushed... finally :)

-- 
Matthias Bolte
http://photron.blogspot.com

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


Re: [libvirt] [PATCH 1/2] esx: Add libcurl based stream driver

2014-10-07 Thread Matthias Bolte
2014-03-31 15:46 GMT+02:00 Michal Privoznik :
>
> On 30.03.2014 21:03, Matthias Bolte wrote:
>>
>> This allows to implement libvirt functions that use streams, such as
>> virDoaminScreenshot, without the need to store the downloaded data in
>> a temporary file first. The stream driver directly interacts with
>> libcurl to send and receive data.
>>
>> The driver uses the libcurl multi interface that allows to do a transfer
>> in multiple curl_multi_perform() calls. The easy interface would do the
>> whole transfer in a single curl_easy_perform() call. This doesn't work
>> with the libvirt stream API that is driven by multiple calls to the
>> virStreamSend() and virStreamRecv() functions.
>>
>> The curl_multi_wait() function is used to do blocking operations. But it
>> was added in libcurl 7.28.0. For older versions it is emulated using the
>> socket callback of the multi interface.
>>
>> The current driver only supports blocking operations. There is already
>> some code in place for non-blocking mode but it's incomplete. As you can
>> tell from the copyright date I implemeted this in 2012, but never came
>> around to publish it then. I did some work in 2013 and now it's 2014 and
>> I don't want to hold it back any longer.
>> ---
>>   po/POTFILES.in   |   1 +
>>   src/Makefile.am  |   1 +
>>   src/esx/esx_stream.c | 478 
>> +++
>>   src/esx/esx_stream.h |  32 
>>   src/esx/esx_vi.c | 222 +++-
>>   src/esx/esx_vi.h |  19 +-
>>   6 files changed, 749 insertions(+), 4 deletions(-)
>>   create mode 100644 src/esx/esx_stream.c
>>   create mode 100644 src/esx/esx_stream.h
>>
>>
>
>> +static int
>> +esxStreamClose(virStreamPtr stream, bool finish)
>> +{
>> +int result = 0;
>> +esxStreamPrivate *priv = stream->privateData;
>> +
>> +if (!priv)
>> +return 0;
>> +
>> +virMutexLock(&priv->curl->lock);
>> +
>> +if (finish && priv->backlog_used > 0) {
>
>
> I think you want to unlock the curl lock here.
>

No, because there is no return statement in the if block, so the
unlock call after the if block is sufficient.

>>
>> +virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> +   _("Stream has untransferred data left"));
>> +result = -1;
>> +}
>> +
>> +stream->privateData = NULL;
>> +
>> +virMutexUnlock(&priv->curl->lock);
>> +
>> +esxFreeStreamPrivate(&priv);
>> +
>> +return result;
>> +}
>> +
>
>
>> diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
>> index 6188139..ba34bfd 100644
>> --- a/src/esx/esx_vi.c
>> +++ b/src/esx/esx_vi.c
>> @@ -2,7 +2,7 @@
>>* esx_vi.c: client for the VMware VI API 2.5 to manage ESX hosts
>>*
>>* Copyright (C) 2010-2012 Red Hat, Inc.
>> - * Copyright (C) 2009-2012 Matthias Bolte 
>> + * Copyright (C) 2009-2012, 2014 Matthias Bolte 
>> 
>>*
>>* This library is free software; you can redistribute it and/or
>>* modify it under the terms of the GNU Lesser General Public
>> @@ -22,6 +22,7 @@
>>
>>   #include 
>>
>> +#include 
>>   #include 
>>   #include 
>>
>> @@ -662,6 +663,68 @@ esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, 
>> esxVI_CURL *curl)
>>* MultiCURL
>>*/
>>
>> +#if ESX_EMULATE_CURL_MULTI_WAIT
>> +
>> +static int
>> +esxVI_MultiCURL_SocketCallback(CURL *handle ATTRIBUTE_UNUSED,
>> +   curl_socket_t fd, int action,
>> +   void *callback_opaque,
>> +   void *socket_opaque ATTRIBUTE_UNUSED)
>> +{
>> +esxVI_MultiCURL *multi = callback_opaque;
>> +size_t i;
>> +struct pollfd *pollfd = NULL;
>> +struct pollfd dummy;
>> +
>> +if (action & CURL_POLL_REMOVE) {
>> +for (i = 0; i < multi->npollfds; ++i) {
>> +if (multi->pollfds[i].fd == fd) {
>> +VIR_DELETE_ELEMENT(multi->pollfds, i, multi->npollfds);
>> +break;
>> +}
>> +}
>> +} else {
>> +for (i = 0; i < multi->npollfds; ++i) {
>> +if (multi->pollfds[i].fd == fd) {
>> +pollfd = &multi->pollfds[i];
>> +break;
>> +}
>> +}
>> +
>> +if (pollfd == NULL) {
>> +if (VIR_APPEND_ELEMENT(multi->pollfds, multi->npollfds, dummy) 
>> < 0) {
>> +return 0;
>
>
> Okay, this is strange. But I see why you can't return -1. From the 
> curl_multi_socket() documentation:
>
> "The callback MUST return 0."

I added a comment about this now.

>> +}
>> +
>> +pollfd = &multi->pollfds[multi->npollfds - 1];
>> +}
>> +
>> +pollfd->fd = fd;
>> +pollfd->events = 0;
>> +
>> +if (action & CURL_POLL_IN)
>> +pollfd->events |= POLLIN;
>> +
>> +if (action & CURL_POLL_OUT)
>> +pollfd->events |= POLLOUT;
>> +}
>> +
>> +return 0;
>> +}
>> +
>
>
> ACK with the nits fixed.
>
> Michal

Thanks, pushed... finally :)

Re: [libvirt] [PATCH] "pclmuldq" was introduced with Westmere, not Sandy Bridge. This feature is important to get proper performance for aes-128-gcm in openssl, an important cipher for https communica

2014-10-07 Thread Jan-Frode Myklebust
Just some documentation for the fact that this was introduced with
Westmere:


https://software.intel.com/sites/default/files/managed/72/cc/clmul-wp-rev-2.02-2014-04-20.pdf

"Intel® PCLMULQDQ instruction is a new instruction available
 beginning with the all new 2010 Intel® Core™ processor family based on
 the 32nm Intel® microarchitecture codename Westmere"

https://en.wikipedia.org/wiki/CLMUL_instruction_set

"Carry-less Multiplication (CLMUL) is an extension to the x86
 instruction set used by microprocessors from Intel and AMD which was
 proposed by Intel in March 2008[1] and made available in the Intel
 Westmere processors announced in early 2010."

https://en.wikipedia.org/wiki/Westmere_%28microarchitecture%29

"Delivers seven new instructions (AES instruction set or AES-NI)
that will be used by the AES algorithm. Also an instruction called
PCLMULQDQ (see CLMUL instruction set) that will perform carry-less
multiplication for use in cryptography."



  -jf

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

[libvirt] [PATCH] "pclmuldq" was introduced with Westmere, not Sandy Bridge. This feature is important to get proper performance for aes-128-gcm in openssl, an important cipher for https communication

2014-10-07 Thread Jan-Frode Myklebust

Signed-off-by: Jan-Frode Myklebust 
---
 src/cpu/cpu_map.xml |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 18c7b0d..94f1458 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -488,11 +488,11 @@
 
   
   
+  
 
 
 
   
-  
   
   
   
-- 
1.7.1

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


Re: [libvirt] increase number of libvirt threads by starting tansient guest doamin - is it a bug?

2014-10-07 Thread web2
 Hi,

i have found the time and tested Xen-4.4.1 with libvirt-1.2.6 and the problem 
with the threads are disappered. But now i see after every restore of an xen-vm 
(windows-xp hvm) an openfile-handle (via lsof -p `pgrep libvirtd`) to an file 
in /var/lib/xen with the name qemu-resume. and what me real make 
confusion is that the entry is marked as deleted.If i look in the directory, 
the file is really no more their, but libvirt have still have an handle to that 
none existing file!?!

I know that "Xen" create such a file before they startet the vm, and i also 
know that xen delete that file , but i don´t understand while it is listed 
under the openfiles of libvirtd after the vm is started/destroyed???

all the best
max
 
ursprüngliche Nachricht-
Von: "web2" usterman...@web.de 
An: "Jim Fehlig" jfeh...@suse.com , "web2" usterman...@web.de 
Kopie: "Michal Privoznik" mpriv...@redhat.com , "libvirt-users redhat.com" 
, "libvirt-list redhat.com" 
Datum: Thu, 2 Oct 2014 07:49:03 +
-
 
 
> 
> 
> ursprüngliche Nachricht-
> Von: "Jim Fehlig" jfeh...@suse.com 
> An: "web2" usterman...@web.de 
> Kopie: "Michal Privoznik" mpriv...@redhat.com , "libvirt-users redhat.com" 
> 
> , "libvirt-list redhat.com" 
> Datum: Wed, 01 Oct 2014 21:38:05 -0600
> -
> 
> 
>> web2 wrote:
>>> Hi
>>> 
>>> ursprüngliche Nachricht-
>>> Von: "Michal Privoznik" mpriv...@redhat.com 
>>> An: "web2" usterman...@web.de , "libvirt-users redhat.com" 
>>> , "libvirt-list redhat.com" 
>>> Datum: Wed, 01 Oct 2014 18:12:45 +0200
>>> -
>>> 
>>> 
>>> 
 On 01.10.2014 10:31, web2 wrote:
 
> Hello,
>
> sorry for my later answer.
>
> so, after i started libvirtd (no vm´s running) and attach gdb i get 
> the 
> following threads
>
> (gdb) info thread
> Id Target Id Frame
> 11 Thread 0x7f18fef4e700 (LWP 20695) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 10 Thread 0x7f18fe74d700 (LWP 20696) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 9 Thread 0x7f18fdf4c700 (LWP 20697) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 8 Thread 0x7f18fd74b700 (LWP 20698) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 7 Thread 0x7f18fcf4a700 (LWP 20699) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 6 Thread 0x7f18fc749700 (LWP 20700) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 5 Thread 0x7f18fbf48700 (LWP 20701) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 4 Thread 0x7f18fb747700 (LWP 20702) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 3 Thread 0x7f18faf46700 (LWP 20703) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 2 Thread 0x7f18fa745700 (LWP 20704) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> * 1 Thread 0x7f190892f840 (LWP 20694) "libvirtd" 
> 0x7f190677d7cd in 
> poll () at ../sysdeps/unix/syscall-template.S:81
>
> if i restore an persistent domain, i see the following in gdb:
>
> Detaching after fork from child process 20880.
> Detaching after fork from child process 20882.
> [New Thread 0x7f190893d700 (LWP 20883)]
> Detaching after fork from child process 20890.
> Detaching after fork from child process 20906.
>
> (gdb) info thread
> Id Target Id Frame
> 12 Thread 0x7f190893d700 (LWP 20883) "libvirtd" 
> 0x7f1906e6684d in 
> read () at ../sysdeps/unix/syscall-template.S:81
> 11 Thread 0x7f18fef4e700 (LWP 20695) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:1
> 85
> 
> 10 Thread 0x7f18fe74d700 (LWP 20696) "libvirtd" 
> pthread_cond_wait@@GLIBC_2.3.2 () at 
> 
> 
> ../nptl/sysdeps

Re: [libvirt] [RFC PATCH] include: make it easier to probe enum growth

2014-10-07 Thread Eric Blake
On 10/07/2014 03:16 AM, Daniel P. Berrange wrote:
> On Mon, Oct 06, 2014 at 02:06:56PM -0600, Eric Blake wrote:
>> https://bugzilla.redhat.com/show_bug.cgi?id=1147639 is an example
>> of a downstream distro's dilemma - when backporting a feature that
>> is implemented in an ABI-compatible manner (no .so bump was
>> required) but where the feature involves new bits to be defined
>> in a flags variable, how does one write code to reliably detect
>> that those bits have been backported?
> 
> My answer would be that distros shouldn't be cherry-picking bits
> of the public header file at all so they don't create these
> non-standard APIs.

That ship has already sailed.  Looking at just RHEL 7.0, I see the
following bits have been backported:

VIR_MIGRAGE_PARAM_LISTEN_ADDRESS (already a #define)
VIR_STORAGE_VOL_NETDIR
VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER
VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START

or looking at RHEL 6.5:

VIR_DOMAIN_RUNNING_CRASHED
VIR_DOMAIN_PAUSED_SNAPSHOT
VIR_DOMAIN_PAUSED_CRASHED
VIR_DOMAIN_CRASHED_PANICKED
VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN
VIR_MIGRATE_ABORT_ON_ERROR
VIR_DOMAIN_XML_MIGRATABLE
VIR_DOMAIN_EVENT_CRASHED
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR
VIR_DOMAIN_EVENT_PMSUSPENDED_DISK
VIR_DOMAIN_EVENT_CRASHED_PANICKED
VIR_DOMAIN_SNAPSHOT_CREATE_LIVE
VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE
VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY
VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL
VIR_DOMAIN_BLOCK_JOB_READY
VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK
VIR_DOMAIN_MEMORY_SHARED_MERGE_ACROSS_NODES (already a #define)

In other words, it's a VERY common action for downstreams to
conditionally backport new feature bits of existing APIs.  Downstream
language bindings needs to reflect these additional bits.  In the past,
when libvirt-python was part of libvirt.git, the python bindings got
this for free.  But the bugzilla I mentioned above is a case where RHEL
7.1 is considering the backport of a new VIR_DOMAIN_EVENT_ID_* bit where
gating on version alone is insufficient for writing correct libvirt
python bindings; since the python bindings live in a different
repository and need SOME witness of whether the event has been
backported, since it is easy to backport new events without breaking ABI.

Writing the upstream libvirt-python bindings to use witness variables
instead of version numbers as the gate for any use of a particular
feature (especially VIR_DOMAIN_EVENT_ID_*) makes it more robust to build
out-of-the-box with a downstream libvirt that has backported feature
bits.  On the other hand, the python bindings have already solved most
of the backport issue by scraping the XML document of all exported bits
as generated by the downstream libvirt, so new flags bits automatically
get exposed by the code generators.  I guess it may require auditing the
libvirt-python bindings to see all use of LIBVIR_CHECK_VERSION to see
which uses are NOT tied to an ABI change, and maybe special-case that
hand-written C code to instead play off of something that the generator
can produce automatically based off of what it scrapes from the XML.  If
THAT works, then I could patch just libvirt-python without worrying
about uglifying libvirt.h.

>> The solution presented here is a common idiom used in a number of
>> other header files (for example, glibc's /usr/include/langinfo.h
>> does it for ABDAY_1 and friends); by adding a self-referential
>> preprocessor macro,

>> +
>> +#define VIR_DOMAIN_PMSUSPENDED VIR_DOMAIN_PMSUSPENDED
>>  VIR_DOMAIN_PMSUSPENDED = 7, /* the domain is suspended by guest
>> power management */
> 
> This is pretty damn ugly IMHO.  I'd only support that if it was entirely
> automatically generated as part of the libvirt.h.in -> libvirt.h
> conversion.

That's a fair point.  If my experiments with trying to solve the issue
from the libvirt-python side don't pan out, then I'll look at what it
would take to automate things, so that it is not a maintainer burden.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

Re: [libvirt] [PATCH] security_selinux: Don't relabel /dev/net/tun

2014-10-07 Thread Eric Blake
On 10/07/2014 08:53 AM, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1147057
> 
> The code for relabelling the TAP FD is there due to a race. When
> libvirt creates a /dev/tapN device it's labeled as
> 'system_u:object_r:device_t:s0' by default. Later, when
> udev/systemd reacts to this device, it's relabelled to the
> expected label 'system_u:object_r:tun_tap_device_t:s0'. Hence, we
> have a code that relabels the device, to cut the race down. For
> more info see ae368ebfcc4.
> 
> But the problem is, the relabel function is called on all TUN/TAP
> devices. Yes, on /dev/net/tun too. This is however a special kind
> of device - other processes uses it too. We shouldn't touch it's
> label then.
> 
> Ideally, there would an API in SELinux that would label just the
> passed FD and not the underlying path. That way, we wouldn't need
> to care as we would be not labeling /dev/net/tun but the FD
> passed to the domain. Unfortunately, there's no such API so we
> have to workaround until then.
> 

> +
> +if (!STRPREFIX(fd_path, "/dev/tap")) {

Should this be "/dev/tap.", since...

> +VIR_DEBUG("fd=%d points to %s not setting SELinux label",
> +  fd, fd_path);
> +rc = 0;
> +goto cleanup;
> +}
> +
>  if (getContext(mgr, "/dev/tap.*", buf.st_mode, &fcon) < 0) {

...you require a '.' in the context lookup?  Without the '.' in the
filter, you would let the (unlikely) name '/dev/tapX' get through.

ACK with that tweaked.


-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

Re: [libvirt] [PATCH] Fix build-time pkg-config files in VPATH

2014-10-07 Thread Eric Blake
On 10/07/2014 07:26 AM, Jiri Denemark wrote:
> The pkg-config files in src/ make it pretty easy to build language
> bindings against an uninstalled libvirt, however, they don't work with
> VPATH builds. The reason is that all *-api.xml files are generated in
> source rather than build directory.
> 
> Signed-off-by: Jiri Denemark 
> ---
>  src/libvirt-lxc.pc.in  | 2 +-
>  src/libvirt-qemu.pc.in | 2 +-
>  src/libvirt.pc.in  | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 

Looks like datarootdir feeds datadir, infodir, localedir, mandir, and
docdir; I don't think any of our code requires documentation to be
installed to run correctly, so even though we have a mix of data that is
generated in srcdir vs. generated in builddir, I agree that the data
most useful to language bindings is the stuff we build into srcdir.

ACK.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



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

[libvirt] [PATCH] security_selinux: Don't relabel /dev/net/tun

2014-10-07 Thread Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1147057

The code for relabelling the TAP FD is there due to a race. When
libvirt creates a /dev/tapN device it's labeled as
'system_u:object_r:device_t:s0' by default. Later, when
udev/systemd reacts to this device, it's relabelled to the
expected label 'system_u:object_r:tun_tap_device_t:s0'. Hence, we
have a code that relabels the device, to cut the race down. For
more info see ae368ebfcc4.

But the problem is, the relabel function is called on all TUN/TAP
devices. Yes, on /dev/net/tun too. This is however a special kind
of device - other processes uses it too. We shouldn't touch it's
label then.

Ideally, there would an API in SELinux that would label just the
passed FD and not the underlying path. That way, we wouldn't need
to care as we would be not labeling /dev/net/tun but the FD
passed to the domain. Unfortunately, there's no such API so we
have to workaround until then.

Signed-off-by: Michal Privoznik 
---
 src/security/security_selinux.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index b7c1015..25e8320 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -2352,7 +2352,7 @@ virSecuritySELinuxSetTapFDLabel(virSecurityManagerPtr mgr,
 struct stat buf;
 security_context_t fcon = NULL;
 virSecurityLabelDefPtr secdef;
-char *str = NULL;
+char *str = NULL, *proc = NULL, *fd_path = NULL;
 int rc = -1;
 
 secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME);
@@ -2370,6 +2370,23 @@ virSecuritySELinuxSetTapFDLabel(virSecurityManagerPtr 
mgr,
 goto cleanup;
 }
 
+/* Label /dev/tap.* devices only. Leave /dev/net/tun alone! */
+if (virAsprintf(&proc, "/proc/self/fd/%d", fd) == -1)
+goto cleanup;
+
+if (virFileResolveLink(proc, &fd_path) < 0) {
+virReportSystemError(errno,
+ _("Unable to resolve link: %s"), proc);
+goto cleanup;
+}
+
+if (!STRPREFIX(fd_path, "/dev/tap")) {
+VIR_DEBUG("fd=%d points to %s not setting SELinux label",
+  fd, fd_path);
+rc = 0;
+goto cleanup;
+}
+
 if (getContext(mgr, "/dev/tap.*", buf.st_mode, &fcon) < 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot lookup default selinux label for tap fd %d"), 
fd);
@@ -2384,6 +2401,8 @@ virSecuritySELinuxSetTapFDLabel(virSecurityManagerPtr mgr,
 
  cleanup:
 freecon(fcon);
+VIR_FREE(fd_path);
+VIR_FREE(proc);
 VIR_FREE(str);
 return rc;
 }
-- 
2.0.4

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


Re: [libvirt] [PATCH v2 8/8] virsh: add postcopy-after option to migrate command

2014-10-07 Thread Jiri Denemark
On Tue, Sep 30, 2014 at 16:39:29 +0200, Cristian Klein wrote:
> Signed-off-by: Cristian Klein 
> ---
>  tools/virsh-domain.c | 72 
> ++--
>  tools/virsh.pod  |  5 
>  2 files changed, 75 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 36a6d52..395c73c 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -9251,6 +9251,10 @@ static const vshCmdOptDef opts_migrate[] = {
>   .type = VSH_OT_INT,
>   .help = N_("force guest to suspend if live migration exceeds timeout 
> (in seconds)")
>  },
> +{.name = "postcopy-after",
> + .type = VSH_OT_INT,
> + .help = N_("switch to post-copy migration if live migration exceeds 
> timeout (in seconds)")
> +},
>  {.name = "xml",
>   .type = VSH_OT_STRING,
>   .help = N_("filename containing updated XML for the target")

We also want to add --postcopy option to enable just
VIR_MIGRATE_POSTCOPY without an automatic switch to post-copy after a
timeout. The --postcopy-after option may turn it on automatically,
though, so that users don't have to use --postcopy --postcopy-after. And
we also want to add a new migrate-startpostcopy command as a direct
wrapper to virDomainMigrateStartPostCopy.

> @@ -9332,6 +9336,8 @@ doMigrate(void *opaque)
>  VIR_FREE(xml);
>  }
>  
> +if (vshCommandOptBool(cmd, "postcopy-after")) /* actually an int */
> +flags |= VIR_MIGRATE_POSTCOPY;
>  if (vshCommandOptBool(cmd, "live"))
>  flags |= VIR_MIGRATE_LIVE;
>  if (vshCommandOptBool(cmd, "p2p"))
> @@ -9423,6 +9429,50 @@ vshMigrationTimeout(vshControl *ctl,
>  virDomainSuspend(dom);
>  }
>  
> +static void
> +vshMigrationPostCopyAfter(vshControl *ctl,
> +virDomainPtr dom,
> +void *opaque ATTRIBUTE_UNUSED)
> +{
> +vshDebug(ctl, VSH_ERR_DEBUG, "starting post-copy\n");
> +int rv = virDomainMigrateStartPostCopy(dom, 0);
> +if (rv < 0) {
> +vshError(ctl, "%s", _("start post-copy command failed"));
> +} else {
> +vshDebug(ctl, VSH_ERR_INFO, "switched to post-copy\n");
> +}
> +}
> +
> +/* Parse the --postcopy-after parameter in seconds, but store its
> + * value in milliseconds. Return -1 on error, 0 if
> + * no timeout was requested, and 1 if timeout was set.
> + * Copy-paste-adapted from vshCommandOptTimeoutToMs.
> + */
> +static int
> +vshCommandOptPostCopyAfterToMs(vshControl *ctl, const vshCmd *cmd, int 
> *postCopyAfter)
> +{
> +int rv = vshCommandOptInt(cmd, "postcopy-after", postCopyAfter);
> +
> +if (rv < 0 || (rv > 0 && *postCopyAfter < 0)) {
> +vshError(ctl, "%s", _("invalid postcopy-after parameter"));
> +return -1;
> +}
> +if (rv > 0) {
> +/* Ensure that we can multiply by 1000 without overflowing. */
> +if (*postCopyAfter > INT_MAX / 1000) {
> +vshError(ctl, "%s", _("post-copy after parameter is too big"));
> +return -1;
> +}
> +*postCopyAfter *= 1000;
> +/* 0 is a special value inside virsh, which means no timeout, so
> + * use 1ms instead for "start post-copy immediately"
> + */
> +if (*postCopyAfter == 0)
> +*postCopyAfter = 1;
> +}
> +return rv;
> +}
> +
>  static bool
>  cmdMigrate(vshControl *ctl, const vshCmd *cmd)
>  {
> @@ -9432,6 +9482,7 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
>  bool verbose = false;
>  bool functionReturn = false;
>  int timeout = 0;
> +int postCopyAfter = 0;
>  bool live_flag = false;
>  vshCtrlData data = { .dconn = NULL };
>  
> @@ -9451,6 +9502,18 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
>  goto cleanup;
>  }
>  
> +if (vshCommandOptPostCopyAfterToMs(ctl, cmd, &postCopyAfter) < 0) {
> +goto cleanup;
> +} else if (postCopyAfter > 0 && !live_flag) {
> +vshError(ctl, "%s",
> + _("migrate: Unexpected postcopy-after for offline 
> migration"));

Offline migration is a migration of a domain which is not running at
all. We don't have a good name for migration of a paused domain, some
refer to it as coma migration. Anyway, this is checked for in the daemon
so checking here is redundant. Especially when this check seems to be
somewhat artificial. Sure, it doesn't make a lot of sense but post-copy
migration of a paused domain should be doable. Moreover, I believe you
can call virDomainSuspend during a post-copy migration, which is very
close to running migration without --live.

> +goto cleanup;
> +} else if (postCopyAfter > 0 && timeout > 0) {
> +vshError(ctl, "%s",
> + _("migrate: --postcopy-after is incompatible with 
> --timeout"));
> +goto cleanup;
> +}

Anyway, handling --postcopy-after seems quite complicated since we have
to repeat the logic around -1, 0, 1 return values in two places. Can't
we just directly f

Re: [libvirt] [PATCH v2 7/8] Implement virDomainMigrateStartPostCopy in qemu

2014-10-07 Thread Jiri Denemark
On Tue, Sep 30, 2014 at 16:39:28 +0200, Cristian Klein wrote:
> Signed-off-by: Cristian Klein 
> ---
>  src/qemu/qemu_driver.c | 50 
> ++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 3fe2216..1242b77 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -11950,6 +11950,55 @@ qemuDomainGetJobStats(virDomainPtr dom,
>  }
>  
>  
> +static int qemuDomainMigrateStartPostCopy(virDomainPtr dom,
> +  unsigned int flags)
> +{
> +virQEMUDriverPtr driver = dom->conn->privateData;
> +virDomainObjPtr vm;
> +int ret = -1;
> +qemuDomainObjPrivatePtr priv;
> +
> +virCheckFlags(0, -1);
> +
> +if (!(vm = qemuDomObjFromDomain(dom)))
> +goto cleanup;

return -1;

> +
> +if (virDomainMigrateStartPostCopyEnsureACL(dom->conn, vm->def) < 0)
> +return -1;

goto cleanup;

> +
> +if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
> +goto cleanup;
> +
> +if (!virDomainObjIsActive(vm)) {
> +virReportError(VIR_ERR_OPERATION_INVALID,
> +   "%s", _("domain is not running"));
> +goto endjob;
> +}
> +
> +priv = vm->privateData;
> +
> +if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT) {
> +virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> +   _("post-copy can only be started "
> + "while migration is in progress"));
> +goto cleanup;

goto endjob;

> +}

Do we need to explicitly check that post-copy was activated or is the
error we get from qemuMonitorMigrateStartPostCopy in such case good
enough?

> +
> +VIR_DEBUG("Starting post-copy");
> +qemuDomainObjEnterMonitor(driver, vm);
> +ret = qemuMonitorMigrateStartPostCopy(priv->mon);
> +qemuDomainObjExitMonitor(driver, vm);
> +
> + endjob:
> +if (!qemuDomainObjEndJob(driver, vm))
> +vm = NULL;
> +
> + cleanup:
> +if (vm)
> +virObjectUnlock(vm);
> +return ret;
> +}
> +
>  static int qemuDomainAbortJob(virDomainPtr dom)
>  {
>  virQEMUDriverPtr driver = dom->conn->privateData;
> @@ -18419,6 +18468,7 @@ static virDriver qemuDriver = {
>  .connectGetDomainCapabilities = qemuConnectGetDomainCapabilities, /* 
> 1.2.7 */
>  .connectGetAllDomainStats = qemuConnectGetAllDomainStats, /* 1.2.8 */
>  .nodeAllocPages = qemuNodeAllocPages, /* 1.2.9 */
> +.domainMigrateStartPostCopy = qemuDomainMigrateStartPostCopy, /* 1.2.10 
> */
>  };

Jirka

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


Re: [libvirt] [PATCH v2 6/8] Implemented post-copy migration logic in qemu

2014-10-07 Thread Jiri Denemark
On Tue, Sep 30, 2014 at 16:39:27 +0200, Cristian Klein wrote:
> Perform phase stops once migration switched to post-copy.
> Confirm phase waits for post-copy to finish before killing the VM.
> 
> Signed-off-by: Cristian Klein 
> ---
>  src/qemu/qemu_driver.c|  8 
>  src/qemu/qemu_migration.c | 25 ++---
>  2 files changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index e873d45..3fe2216 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -10942,6 +10942,14 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
>  
>  virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
>  
> +if (flags & VIR_MIGRATE_POSTCOPY) {
> +/* post-copy migration does not work with Sequence v2 */
> +virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +   _("Post-copy migration requested but not "
> + "supported by v2 protocol"));
> +goto cleanup;
> +}
> +

This code should be unreachable. If both source and destination daemons
support VIR_MIGRATE_POSTCOPY, they support v3 protocol as well. And a
client new enough to specify VIR_MIGRATE_POSTCOPY will also support v3
migration protocol. However, it doesn't hurt to check this to be safe.

>  if (flags & VIR_MIGRATE_TUNNELLED) {
>  /* this is a logical error; we never should have gotten here with
>   * VIR_MIGRATE_TUNNELLED set
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 4a36946..436b701 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2039,6 +2039,11 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
>  ret = 0;
>  break;
>  
> +case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_ACTIVE:
> +jobInfo->type = VIR_DOMAIN_JOB_PHASE1_COMPLETED;
> +ret = 0;
> +break;
> +

This will need to be dropped after 5/8 is removed. However, it reminds
me...

enum {
QEMU_MONITOR_MIGRATION_STATUS_INACTIVE,
QEMU_MONITOR_MIGRATION_STATUS_ACTIVE,
QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
QEMU_MONITOR_MIGRATION_STATUS_ERROR,
QEMU_MONITOR_MIGRATION_STATUS_CANCELLED,
QEMU_MONITOR_MIGRATION_STATUS_SETUP,
QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_ACTIVE,

QEMU_MONITOR_MIGRATION_STATUS_LAST
};

in qemu_monitor.h needs to be turned into a proper typedef so that

switch (status.status) {

line in qemuMigrationUpdateJobStatus may be changed to explicitly
mention the enum so that the compiler may report a warning whenever we
add new status but forgot to handle it in this switch. Which means the
new state will need to be handled in the same patch it was introduced,
i.e, in 3/8.

>  case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE:
>  jobInfo->type = VIR_DOMAIN_JOB_NONE;
>  virReportError(VIR_ERR_OPERATION_FAILED,
> @@ -2077,6 +2082,7 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
>  qemuDomainJobInfoPtr jobInfo = priv->job.current;
>  const char *job;
>  int pauseReason;
> +bool inPhase2 = (jobInfo->type == VIR_DOMAIN_JOB_PHASE1_COMPLETED);

I think it would be cleaner to pass this info in a new parameter for
qemuMigrationWaitForCompletion instead of doing a hidden black magic
here.

>  
>  switch (priv->job.asyncJob) {
>  case QEMU_ASYNC_JOB_MIGRATION_OUT:
> @@ -2092,9 +2098,11 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
>  job = _("job");
>  }
>  
> -jobInfo->type = VIR_DOMAIN_JOB_UNBOUNDED;
> +if (!inPhase2)
> +jobInfo->type = VIR_DOMAIN_JOB_UNBOUNDED;
>  
> -while (jobInfo->type == VIR_DOMAIN_JOB_UNBOUNDED) {
> +while (jobInfo->type == VIR_DOMAIN_JOB_UNBOUNDED ||
> +   (inPhase2 && jobInfo->type == VIR_DOMAIN_JOB_PHASE1_COMPLETED)) {

Just use jobInfo->status.status directly.

>  /* Poll every 50ms for progress & to allow cancellation */
>  struct timespec ts = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000ull };
>  
> @@ -2123,7 +2131,8 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
>  virObjectLock(vm);
>  }
>  
> -if (jobInfo->type == VIR_DOMAIN_JOB_COMPLETED) {
> +if (jobInfo->type == VIR_DOMAIN_JOB_COMPLETED ||
> +jobInfo->type == VIR_DOMAIN_JOB_PHASE1_COMPLETED) {

This shouldn't be needed when 5/8 is dropped.

>  qemuDomainJobInfoUpdateDowntime(jobInfo);
>  VIR_FREE(priv->job.completed);
>  if (VIR_ALLOC(priv->job.completed) == 0)
> @@ -3149,6 +3158,16 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
>  
>  virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
>  
> +/* Wait for post-copy to complete */
> +if (flags & VIR_MIGRATE_POSTCOPY) {
> +bool abort_on_error = !!(flags & VIR_MIGRATE_ABORT_ON_ERROR);
> +rv = qemuMigrationWaitForCompletion(driver, vm,
> +QEMU_ASYNC_JOB_MIGRATION_OUT,
> + 

[libvirt] [PATCH] Fix build-time pkg-config files in VPATH

2014-10-07 Thread Jiri Denemark
The pkg-config files in src/ make it pretty easy to build language
bindings against an uninstalled libvirt, however, they don't work with
VPATH builds. The reason is that all *-api.xml files are generated in
source rather than build directory.

Signed-off-by: Jiri Denemark 
---
 src/libvirt-lxc.pc.in  | 2 +-
 src/libvirt-qemu.pc.in | 2 +-
 src/libvirt.pc.in  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libvirt-lxc.pc.in b/src/libvirt-lxc.pc.in
index 88e431b..dd04950 100644
--- a/src/libvirt-lxc.pc.in
+++ b/src/libvirt-lxc.pc.in
@@ -6,7 +6,7 @@ prefix=@abs_top_builddir@
 exec_prefix=@abs_top_builddir@
 libdir=@abs_top_builddir@/src/.libs
 includedir=@abs_top_builddir@/include
-datarootdir=@abs_top_builddir@
+datarootdir=@abs_top_srcdir@
 
 libvirt_lxc_api=@datadir@/docs/libvirt-lxc-api.xml
 
diff --git a/src/libvirt-qemu.pc.in b/src/libvirt-qemu.pc.in
index ed1f68a..5483da9 100644
--- a/src/libvirt-qemu.pc.in
+++ b/src/libvirt-qemu.pc.in
@@ -6,7 +6,7 @@ prefix=@abs_top_builddir@
 exec_prefix=@abs_top_builddir@
 libdir=@abs_top_builddir@/src/.libs
 includedir=@abs_top_builddir@/include
-datarootdir=@abs_top_builddir@
+datarootdir=@abs_top_srcdir@
 
 libvirt_qemu_api=@datadir@/docs/libvirt-qemu-api.xml
 
diff --git a/src/libvirt.pc.in b/src/libvirt.pc.in
index c2bdbb2..548fa77 100644
--- a/src/libvirt.pc.in
+++ b/src/libvirt.pc.in
@@ -6,7 +6,7 @@ prefix=@abs_top_builddir@
 exec_prefix=@abs_top_builddir@
 libdir=@abs_top_builddir@/src/.libs
 includedir=@abs_top_builddir@/include
-datarootdir=@abs_top_builddir@
+datarootdir=@abs_top_srcdir@
 
 libvirt_api=@datadir@/docs/libvirt-api.xml
 
-- 
2.1.2

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


Re: [libvirt] [PATCH v2 5/8] Added job type VIR_DOMAIN_JOB_PHASE1_COMPLETED

2014-10-07 Thread Jiri Denemark
On Tue, Sep 30, 2014 at 16:39:26 +0200, Cristian Klein wrote:
> Some jobs feature several phases. For example, post-copy migration is
> composed of a first phase, from migration start to switching to
> post-copy, and a second phase, to migration completion. This
> job type allows to flag that the job has completed the first phase,
> but is not yet fully completed.
> 
> Signed-off-by: Cristian Klein 
> ---
>  include/libvirt/libvirt.h.in | 1 +
>  tools/virsh-domain.c | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 84cd5a4..81044f0 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -4307,6 +4307,7 @@ typedef enum {
>  VIR_DOMAIN_JOB_COMPLETED = 3, /* Job has finished, but isn't cleaned up 
> */
>  VIR_DOMAIN_JOB_FAILED= 4, /* Job hit error, but isn't cleaned up */
>  VIR_DOMAIN_JOB_CANCELLED = 5, /* Job was aborted, but isn't cleaned up */
> +VIR_DOMAIN_JOB_PHASE1_COMPLETED = 6, /* Job completed first phase, e.g., 
> post-copy activation */

This is not a job type. If we need to advertise this to libvirt clients,
we may introduce a new job statistics typed parameter but we should not
misuse job type. And I'm not entirely convinced we need to advertise
this. To me it seems the only interested thing is whether a domain is
still running on the source host or it was already resumed on the
destination host. And it's easy to get this kind of information via
existing ways, e.g., listening to domain life cycle events or by
checking domain's status.

Jirka

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


Re: [libvirt] [PATCH v2 4/8] Implemented VIR_MIGRATE_POSTCOPY in qemu driver

2014-10-07 Thread Jiri Denemark
On Tue, Sep 30, 2014 at 16:39:25 +0200, Cristian Klein wrote:
> Signed-off-by: Cristian Klein 
> ---
>  src/qemu/qemu_migration.c | 60 
> +++
>  src/qemu/qemu_migration.h |  3 ++-
>  2 files changed, 62 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 284cd5a..4a36946 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -1801,6 +1801,49 @@ qemuMigrationSetOffline(virQEMUDriverPtr driver,
>  
>  
>  static int
> +qemuMigrationSetPostCopy(virQEMUDriverPtr driver,
> + virDomainObjPtr vm,
> + qemuDomainAsyncJob job)
> +{
> +qemuDomainObjPrivatePtr priv = vm->privateData;
> +int ret;
> +
> +if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0)
> +return -1;
> +
> +ret = qemuMonitorGetMigrationCapability(
> +priv->mon,
> +QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY);
> +
> +if (ret < 0) {
> +goto cleanup;
> +} else if (ret == 0) {
> +if (job == QEMU_ASYNC_JOB_MIGRATION_IN) {
> +virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> +   _("Post-copy migration is not supported by "
> + "target QEMU binary"));
> +} else {
> +virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> +   _("Post-copy migration is not supported by "
> + "source QEMU binary"));
> +}
> +ret = -1;
> +goto cleanup;
> +}
> +
> +/* Post-copy only needs to be enabled on source qemu,
> + * for target, this function only acts as a capability check */
> +if (job == QEMU_ASYNC_JOB_MIGRATION_OUT) {
> +ret = qemuMonitorSetMigrationCapability(
> +priv->mon,
> +QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY);
> +}
> +
> + cleanup:
> +qemuDomainObjExitMonitor(driver, vm);
> +return ret;
> +}

Unless we need to try to set the capability to check whether it is
really available (which is not what the current code does), I think it
would make more sense to limit this function to source side only and let
destination call qemuMonitorGetMigrationCapability directly.

Empty lines missing between qemuMigrationSetPostCopy and
qemuMigrationSetCompression.

> +static int
>  qemuMigrationSetCompression(virQEMUDriverPtr driver,
>  virDomainObjPtr vm,
>  qemuDomainAsyncJob job)
> @@ -2741,6 +2784,11 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
>  dataFD[1] = -1; /* 'st' owns the FD now & will close it */
>  }
>  
> +if (flags & VIR_MIGRATE_POSTCOPY &&
> +qemuMigrationSetPostCopy(driver, vm,
> + QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
> +goto stop;
> +

Just call qemuMonitorGetMigrationCapability directly here.

>  if (flags & VIR_MIGRATE_COMPRESSED &&
>  qemuMigrationSetCompression(driver, vm,
>  QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
> @@ -3583,6 +3631,18 @@ qemuMigrationRun(virQEMUDriverPtr driver,
> QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
>  goto cleanup;
>  
> +if (flags & VIR_MIGRATE_POSTCOPY) {
> +if (!(flags & VIR_MIGRATE_LIVE)) {
> +virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +   _("Enabling post-copy only makes sense with "
> + "live migration"));
> +goto cleanup;
> +}
> +if (qemuMigrationSetPostCopy(driver, vm,
> + QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
> +goto cleanup;
> +}
> +
>  if (qemuDomainObjEnterMonitorAsync(driver, vm,
> QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
>  goto cleanup;
> diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
> index e7a90c3..349c9c4 100644
> --- a/src/qemu/qemu_migration.h
> +++ b/src/qemu/qemu_migration.h
> @@ -41,7 +41,8 @@
>   VIR_MIGRATE_COMPRESSED |   \
>   VIR_MIGRATE_ABORT_ON_ERROR |   \
>   VIR_MIGRATE_AUTO_CONVERGE |\
> - VIR_MIGRATE_RDMA_PIN_ALL)
> + VIR_MIGRATE_RDMA_PIN_ALL | \
> + VIR_MIGRATE_POSTCOPY)
>  
>  /* All supported migration parameters and their types. */
>  # define QEMU_MIGRATION_PARAMETERS  \

Jirka

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


Re: [libvirt] [libvirt-python PATCH] setup.py: fix rpm build to return 1 on error

2014-10-07 Thread Martin Kletzander

On Tue, Oct 07, 2014 at 11:56:54AM +0200, Pavel Hrdina wrote:

Signed-off-by: Pavel Hrdina 
---
setup.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index 0c34ae1..c6a9ce3 100755
--- a/setup.py
+++ b/setup.py
@@ -245,8 +245,8 @@ class my_rpm(Command):
"""

self.run_command('sdist')
-os.system('rpmbuild -ta --clean dist/libvirt-python-%s.tar.gz' %
-  self.distribution.get_version())
+self.spawn(["/usr/bin/rpmbuild", "-ta", "--clean",
+"dist/libvirt-python-%s.tar.gz" % self.distribution.get_version()])



ACK.

This actually raises a DistutilsExecError which is properly handled
"upstairs" in the Command class.

Martin


class my_test(Command):
user_options = [
--
2.0.4






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


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

Re: [libvirt] [libvirt-python PATCH] sanitytest: define long for python version >= 3

2014-10-07 Thread Ján Tomko
On 10/07/2014 11:49 AM, Pavel Hrdina wrote:
> On 10/07/2014 10:38 AM, Martin Kletzander wrote:
>> Commit c58c7f362aab37e4961407c2efc8a74925ed9c37 fixed 32-bit python
>> build but broke build with python3 due to the lack of 'long' in the
>> newer version of python.  This patch aims to fix it with a simple
>> string comparison of sys.version and '3'.
> 
> Actually the the int() type in python 3 is the same as long() type in
> python 2 and the int() from python 2 was removed.
> 
>>
>> Signed-off-by: Martin Kletzander 
>> ---
>>   sanitytest.py | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/sanitytest.py b/sanitytest.py
>> index 5bd85a5..b161696 100644
>> --- a/sanitytest.py
>> +++ b/sanitytest.py
>> @@ -9,6 +9,9 @@ import string
>>   sys.path.insert(0, sys.argv[1])
>>   import libvirt
>>
>> +if sys.version > '3':
>> +long = int
>> +
>>   # Path to the libvirt API XML file
>>   xml = sys.argv[2]
>>
> 
> ACK
> 

Thanks, pushed now.

Jan




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

Re: [libvirt] [PATCH v2 3/8] Added low-level API to qemu post-copy migration

2014-10-07 Thread Jiri Denemark
On Tue, Sep 30, 2014 at 16:39:24 +0200, Cristian Klein wrote:
> Signed-off-by: Cristian Klein 
> ---
>  src/qemu/qemu_monitor.c  | 24 ++--
>  src/qemu/qemu_monitor.h  |  4 
>  src/qemu/qemu_monitor_json.c | 23 ++-
>  src/qemu/qemu_monitor_json.h |  1 +
>  4 files changed, 49 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index 543384d..dbd854c 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -117,11 +117,11 @@ VIR_ONCE_GLOBAL_INIT(qemuMonitor)
>  
>  VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
>QEMU_MONITOR_MIGRATION_STATUS_LAST,
> -  "inactive", "active", "completed", "failed", "cancelled", 
> "setup")
> +  "inactive", "active", "completed", "failed", "cancelled", 
> "setup", "postcopy-active")
>  
>  VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
>QEMU_MONITOR_MIGRATION_CAPS_LAST,
> -  "xbzrle", "auto-converge", "rdma-pin-all")
> +  "xbzrle", "auto-converge", "rdma-pin-all", "x-postcopy-ram")

As already mentioned, we don't want to support unstable QEMU interfaces
so we will have to wait with this series until the "x-" prefix is
removed in QEMU. Otherwise this patch looks good.

Jirka

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


Re: [libvirt] [RFC PATCH] include: make it easier to probe enum growth

2014-10-07 Thread Daniel P. Berrange
On Mon, Oct 06, 2014 at 02:06:56PM -0600, Eric Blake wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1147639 is an example
> of a downstream distro's dilemma - when backporting a feature that
> is implemented in an ABI-compatible manner (no .so bump was
> required) but where the feature involves new bits to be defined
> in a flags variable, how does one write code to reliably detect
> that those bits have been backported?

My answer would be that distros shouldn't be cherry-picking bits
of the public header file at all so they don't create these
non-standard APIs.


> The solution presented here is a common idiom used in a number of
> other header files (for example, glibc's /usr/include/langinfo.h
> does it for ABDAY_1 and friends); by adding a self-referential
> preprocessor macro, client code can easily do:
> 
> | switch (state) {
> | #ifdef VIR_DOMAIN_PMSUSPENDED
> |   case VIR_DOMAIN_PMSUSPENDED:
> | 
> | #endif
> | }
> 
> rather than trying to figure out which version number introduced
> VIR_DOMAIN_PMSUSPENDED (v.9.11), and using that with
> LIBVIR_CHECK_VERSION.  Of course, since 1.2.10 would be the first
> release where this practice is reliable, we will still see clients
> that target earlier libvirt doing:
> 
> | switch (state) {
> | #if LIBVIR_CHECK_VERSION(0, 9, 11) || defined(VIR_DOMAIN_PMSUSPENDED)
> |   case VIR_DOMAIN_PMSUSPENDED:
> | 
> | #endif
> | }
> 
> but that is still more maintainable.
> 
> * include/libvirt/libvirt.h.in (virDomainState): Expose #defines
> matching each enum value.
> 
> Signed-off-by: Eric Blake 
> ---
> 
> This patch is an RFC because I want confirmation that it is worth
> doing.  Obviously, if it is desirable, there will be a LOT more
> addition of #define throughout the file, but as that is mostly
> busy-work, I want to get the idea approved first.
> 
>  include/libvirt/libvirt.h.in | 15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index c910b31..0baea53 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -116,13 +116,28 @@ typedef virDomain *virDomainPtr;
>   * A domain may be in different states at a given point in time
>   */
>  typedef enum {
> +#define VIR_DOMAIN_NOSTATE VIR_DOMAIN_NOSTATE
>  VIR_DOMAIN_NOSTATE = 0, /* no state */
> +
> +#define VIR_DOMAIN_RUNNING VIR_DOMAIN_RUNNING
>  VIR_DOMAIN_RUNNING = 1, /* the domain is running */
> +
> +#define VIR_DOMAIN_BLOCKED VIR_DOMAIN_BLOCKED
>  VIR_DOMAIN_BLOCKED = 2, /* the domain is blocked on resource */
> +
> +#define VIR_DOMAIN_PAUSED VIR_DOMAIN_PAUSED
>  VIR_DOMAIN_PAUSED  = 3, /* the domain is paused by user */
> +
> +#define VIR_DOMAIN_SHUTDOWN VIR_DOMAIN_SHUTDOWN
>  VIR_DOMAIN_SHUTDOWN= 4, /* the domain is being shut down */
> +
> +#define VIR_DOMAIN_SHUTOFF VIR_DOMAIN_SHUTOFF
>  VIR_DOMAIN_SHUTOFF = 5, /* the domain is shut off */
> +
> +#define VIR_DOMAIN_CRASHED VIR_DOMAIN_CRASHED
>  VIR_DOMAIN_CRASHED = 6, /* the domain is crashed */
> +
> +#define VIR_DOMAIN_PMSUSPENDED VIR_DOMAIN_PMSUSPENDED
>  VIR_DOMAIN_PMSUSPENDED = 7, /* the domain is suspended by guest
> power management */

This is pretty damn ugly IMHO.  I'd only support that if it was entirely
automatically generated as part of the libvirt.h.in -> libvirt.h
conversion.

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


[libvirt] [PATCH v5 0/7] qemu: Introduce support for new the block_set_io_throttle parameters add in the version 1.7 of qemu.

2014-10-07 Thread Matthias Gatto
This series of patches add support for bps_max, bps_rd_max, bps_wr_max, 
bps_max, bps_rd_max, bps_wr_max, and iops_size in the functions 
qemuDomainSetBlockIoTune and qemuDomainGetBlockIoTune.
The last patch add support for these parameters to the virsh blkdeviotune 
command.

v2: spellfix

v3: Merge patch 1/9,2/9,5/9 together.
Change the capability detection.(patch 2/7 and 3/7).
Try to make the usage of QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX more 
explicit(patch 3/7).

v4: Rebase on HEAD.
Update qemu_driver to comply with Pavel's patchs.(patch 3/6)
Remove the qemu_monitor_text modification.(remove old patch 5/7)

v5: Split patch 1/6 in two.
Add documentation for the new xml options (patch 2/7)
Change (void) to ATTRIBUTE_UNUSED (patch 4/7)
Capability detection of supportMaxOptions move before usage of 
supportMaxOptions

Matthias Gatto (7):
  qemu: Add define for the news throttle options
  qemu: Modify the structure _virDomainBlockIoTuneInfo.
  qemu: Add the capability to detect if the qemu binary have the
capability to use bps_max and friends
  qemu: Add bps_max and friends qemu driver
  qemu: Add bps_max and friends QMP suport
  qemu: add bps_max and friends to qemu command generation
  virsh: Add bps_max and friends to virsh

 docs/formatdomain.html.in|  25 
 docs/schemas/domaincommon.rng|  43 +++
 include/libvirt/libvirt.h.in | 110 
 src/conf/domain_conf.c   | 110 +++-
 src/conf/domain_conf.h   |   7 +
 src/qemu/qemu_capabilities.c |   2 +
 src/qemu/qemu_capabilities.h |   1 +
 src/qemu/qemu_command.c  |  57 +++-
 src/qemu/qemu_driver.c   | 186 ++-
 src/qemu/qemu_monitor.c  |  10 +-
 src/qemu/qemu_monitor.h  |   6 +-
 src/qemu/qemu_monitor_json.c |  64 +++--
 src/qemu/qemu_monitor_json.h |   6 +-
 tests/qemucapabilitiesdata/caps_2.1.1-1.caps |   1 +
 tests/qemumonitorjsontest.c  |   6 +-
 tools/virsh-domain.c | 119 +
 tools/virsh.pod  |  10 ++
 17 files changed, 730 insertions(+), 33 deletions(-)

-- 
1.8.3.1

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


[libvirt] [PATCH v5 5/7] qemu: Add bps_max and friends QMP suport

2014-10-07 Thread Matthias Gatto
Detect if the the qemu binary currently in use suport the bps_max option,
If yes add it to the command, if not, just ignore the options.

Signed-off-by: Matthias Gatto 
---
 src/qemu/qemu_monitor_json.c | 57 +++-
 1 file changed, 46 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index a118c1f..50f5888 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4148,6 +4148,12 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
 }
 
 
+#define GET_THROTTLE_STATS_OPTIONAL(FIELD, STORE) \
+if (virJSONValueObjectGetNumberUlong(inserted,\
+ FIELD,   \
+ &reply->STORE) < 0) {\
+reply->STORE = 0; \
+}
 #define GET_THROTTLE_STATS(FIELD, STORE)  \
 if (virJSONValueObjectGetNumberUlong(inserted,\
  FIELD,   \
@@ -4162,7 +4168,7 @@ static int
 qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result,
const char *device,
virDomainBlockIoTuneInfoPtr reply,
-   bool supportMaxOptions ATTRIBUTE_UNUSED)
+   bool supportMaxOptions)
 {
 virJSONValuePtr io_throttle;
 int ret = -1;
@@ -4214,6 +4220,15 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr 
result,
 GET_THROTTLE_STATS("iops", total_iops_sec);
 GET_THROTTLE_STATS("iops_rd", read_iops_sec);
 GET_THROTTLE_STATS("iops_wr", write_iops_sec);
+if (supportMaxOptions) {
+GET_THROTTLE_STATS_OPTIONAL("bps_max", total_bytes_sec_max);
+GET_THROTTLE_STATS_OPTIONAL("bps_rd_max", read_bytes_sec_max);
+GET_THROTTLE_STATS_OPTIONAL("bps_wr_max", write_bytes_sec_max);
+GET_THROTTLE_STATS_OPTIONAL("iops_max", total_iops_sec_max);
+GET_THROTTLE_STATS_OPTIONAL("iops_rd_max", read_iops_sec_max);
+GET_THROTTLE_STATS_OPTIONAL("iops_wr_max", write_iops_sec_max);
+GET_THROTTLE_STATS_OPTIONAL("iops_size", size_iops_sec);
+}
 
 break;
 }
@@ -4230,25 +4245,45 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr 
result,
 return ret;
 }
 #undef GET_THROTTLE_STATS
+#undef GET_THROTTLE_STATS_OPTIONAL
 
 int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
   const char *device,
   virDomainBlockIoTuneInfoPtr info,
-  bool supportMaxOptions ATTRIBUTE_UNUSED)
+  bool supportMaxOptions)
 {
 int ret = -1;
 virJSONValuePtr cmd = NULL;
 virJSONValuePtr result = NULL;
 
-cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
- "s:device", device,
- "U:bps", info->total_bytes_sec,
- "U:bps_rd", info->read_bytes_sec,
- "U:bps_wr", info->write_bytes_sec,
- "U:iops", info->total_iops_sec,
- "U:iops_rd", info->read_iops_sec,
- "U:iops_wr", info->write_iops_sec,
- NULL);
+if (supportMaxOptions) {
+cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
+ "s:device", device,
+ "U:bps", info->total_bytes_sec,
+ "U:bps_rd", info->read_bytes_sec,
+ "U:bps_wr", info->write_bytes_sec,
+ "U:iops", info->total_iops_sec,
+ "U:iops_rd", info->read_iops_sec,
+ "U:iops_wr", info->write_iops_sec,
+ "U:bps_max", 
info->total_bytes_sec_max,
+ "U:bps_rd_max", 
info->read_bytes_sec_max,
+ "U:bps_wr_max", 
info->write_bytes_sec_max,
+ "U:iops_max", 
info->total_iops_sec_max,
+ "U:iops_rd_max", 
info->read_iops_sec_max,
+ "U:iops_wr_max", 
info->write_iops_sec_max,
+ "U:iops_size", info->size_iops_sec,
+ NULL);
+} else {
+cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
+

[libvirt] [PATCH v5 1/7] qemu: Add define for the news throttle options

2014-10-07 Thread Matthias Gatto
Add defines for the news options total_bytes_sec_max, write_bytes_sec_max, 
read_bytes_sec_max, total_iops_sec_max, write_iops_sec_max, read_iops_sec_max, 
size_iops_sec.

Signed-off-by: Matthias Gatto 
---
 include/libvirt/libvirt.h.in | 54 
 1 file changed, 54 insertions(+)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index c910b31..459a292 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2800,6 +2800,60 @@ int virDomainBlockCommit(virDomainPtr dom, const char 
*disk, const char *base,
  */
 #define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC "write_iops_sec"
 
+/**
+ * VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX:
+ *
+ * Macro for the BlockIoTune tunable weight: it represents the maximum total
+ * bytes per second permitted through a block device, as a ullong.
+ */
+#define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX "total_bytes_sec_max"
+
+/**
+ * VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX:
+ *
+ * Macro for the BlockIoTune tunable weight: it represents the maximum read
+ * bytes per second permitted through a block device, as a ullong.
+ */
+#define VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX "read_bytes_sec_max"
+
+/**
+ * VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX:
+ *
+ * Macro for the BlockIoTune tunable weight: it represents the maximum write
+ * bytes per second permitted through a block device, as a ullong.
+ */
+#define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX "write_bytes_sec_max"
+
+/**
+ * VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX:
+ *
+ * Macro for the BlockIoTune tunable weight: it represents the maximum
+ * I/O operations per second permitted through a block device, as a ullong.
+ */
+#define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX "total_iops_sec_max"
+
+/**
+ * VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX:
+ *
+ * Macro for the BlockIoTune tunable weight: it represents the maximum read
+ * I/O operations per second permitted through a block device, as a ullong.
+ */
+#define VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX "read_iops_sec_max"
+
+/**
+ * VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX:
+ * Macro for the BlockIoTune tunable weight: it represents the maximum write
+ * I/O operations per second permitted through a block device, as a ullong.
+ */
+#define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX "write_iops_sec_max"
+
+/**
+ * VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC:
+ * Macro for the BlockIoTune tunable weight: it represents the size
+ * I/O operations per second permitted through a block device, as a ullong.
+ */
+#define VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC "size_iops_sec"
+
 int
 virDomainSetBlockIoTune(virDomainPtr dom,
 const char *disk,
-- 
1.8.3.1

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


[libvirt] [libvirt-python PATCH] setup.py: fix rpm build to return 1 on error

2014-10-07 Thread Pavel Hrdina
Signed-off-by: Pavel Hrdina 
---
 setup.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index 0c34ae1..c6a9ce3 100755
--- a/setup.py
+++ b/setup.py
@@ -245,8 +245,8 @@ class my_rpm(Command):
 """
 
 self.run_command('sdist')
-os.system('rpmbuild -ta --clean dist/libvirt-python-%s.tar.gz' %
-  self.distribution.get_version())
+self.spawn(["/usr/bin/rpmbuild", "-ta", "--clean",
+"dist/libvirt-python-%s.tar.gz" % self.distribution.get_version()])
 
 class my_test(Command):
 user_options = [
-- 
2.0.4

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


Re: [libvirt] [PATCH v2 2/8] Added public API to start post-copy migration

2014-10-07 Thread Jiri Denemark
On Tue, Sep 30, 2014 at 16:39:23 +0200, Cristian Klein wrote:
> Signed-off-by: Cristian Klein 
> ---
>  include/libvirt/libvirt.h.in |  3 +++
>  src/driver.h |  5 +
>  src/libvirt.c| 39 +++
>  src/libvirt_public.syms  |  5 +
>  src/remote/remote_driver.c   |  1 +
>  src/remote/remote_protocol.x | 13 -
>  src/remote_protocol-structs  |  5 +
>  7 files changed, 70 insertions(+), 1 deletion(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 82f3aeb..84cd5a4 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -1346,6 +1346,9 @@ int virDomainMigrateToURI3(virDomainPtr domain,
> unsigned int nparams,
> unsigned int flags);
>  
> +int virDomainMigrateStartPostCopy (virDomainPtr domain,
> +   unsigned int flags);
> +
>  int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
>  unsigned long long downtime,
>  unsigned int flags);
...

Looks good and I also checked the generator in libvirt-python creates
correct implementation of this API. No extra manual work is needed here.

Jirka

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


Re: [libvirt] [libvirt-python PATCH] sanitytest: define long for python version >= 3

2014-10-07 Thread Pavel Hrdina

On 10/07/2014 10:38 AM, Martin Kletzander wrote:

Commit c58c7f362aab37e4961407c2efc8a74925ed9c37 fixed 32-bit python
build but broke build with python3 due to the lack of 'long' in the
newer version of python.  This patch aims to fix it with a simple
string comparison of sys.version and '3'.


Actually the the int() type in python 3 is the same as long() type in
python 2 and the int() from python 2 was removed.



Signed-off-by: Martin Kletzander 
---
  sanitytest.py | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/sanitytest.py b/sanitytest.py
index 5bd85a5..b161696 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -9,6 +9,9 @@ import string
  sys.path.insert(0, sys.argv[1])
  import libvirt

+if sys.version > '3':
+long = int
+
  # Path to the libvirt API XML file
  xml = sys.argv[2]



ACK

Pavel

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


Re: [libvirt] access for wiki editing

2014-10-07 Thread Daniel P. Berrange
On Mon, Oct 06, 2014 at 01:07:42PM -0700, libvir.for.anomal...@xoxy.net wrote:
> username anomalyst
> found a typo in
> Fedora/RHEL Bridging
> s/briding/bridging/

I've created this. You should receive the password via email

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


[libvirt] [PATCH v5 6/7] qemu: add bps_max and friends to qemu command generation

2014-10-07 Thread Matthias Gatto
Check the arability of the options with the current qemu binary, add them in 
the varable opt if yes,
print a message if not.

Signed-off-by: Matthias Gatto 
---
 src/qemu/qemu_command.c | 57 -
 1 file changed, 56 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8cb0865..22c6a92 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3669,12 +3669,32 @@ qemuBuildDriveStr(virConnectPtr conn,
 goto error;
 }
 
+/* block I/O throttling 1.7 */
+if ((disk->blkdeviotune.total_bytes_sec_max ||
+ disk->blkdeviotune.read_bytes_sec_max ||
+ disk->blkdeviotune.write_bytes_sec_max ||
+ disk->blkdeviotune.total_iops_sec_max ||
+ disk->blkdeviotune.read_iops_sec_max ||
+ disk->blkdeviotune.write_iops_sec_max) &&
+!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+   _("there is some block I/O throttling paramater that 
are not supported with this "
+ "QEMU binary(need QEMU 1.7 or superior)"));
+goto error;
+}
+
 if (disk->blkdeviotune.total_bytes_sec > LLONG_MAX ||
 disk->blkdeviotune.read_bytes_sec > LLONG_MAX ||
 disk->blkdeviotune.write_bytes_sec > LLONG_MAX ||
 disk->blkdeviotune.total_iops_sec > LLONG_MAX ||
 disk->blkdeviotune.read_iops_sec > LLONG_MAX ||
-disk->blkdeviotune.write_iops_sec > LLONG_MAX) {
+disk->blkdeviotune.write_iops_sec > LLONG_MAX ||
+disk->blkdeviotune.total_bytes_sec_max > LLONG_MAX ||
+disk->blkdeviotune.read_bytes_sec_max > LLONG_MAX ||
+disk->blkdeviotune.write_bytes_sec_max > LLONG_MAX ||
+disk->blkdeviotune.total_iops_sec_max > LLONG_MAX ||
+disk->blkdeviotune.read_iops_sec_max > LLONG_MAX ||
+disk->blkdeviotune.write_iops_sec_max > LLONG_MAX) {
 virReportError(VIR_ERR_OVERFLOW,
   _("block I/O throttle limit must "
 "be less than %llu using QEMU"), LLONG_MAX);
@@ -3711,6 +3731,41 @@ qemuBuildDriveStr(virConnectPtr conn,
   disk->blkdeviotune.write_iops_sec);
 }
 
+if (disk->blkdeviotune.total_bytes_sec_max) {
+virBufferAsprintf(&opt, ",bps_max=%llu",
+  disk->blkdeviotune.total_bytes_sec_max);
+}
+
+if (disk->blkdeviotune.read_bytes_sec_max) {
+virBufferAsprintf(&opt, ",bps_rd_max=%llu",
+  disk->blkdeviotune.read_bytes_sec_max);
+}
+
+if (disk->blkdeviotune.write_bytes_sec_max) {
+virBufferAsprintf(&opt, ",bps_wr_max=%llu",
+  disk->blkdeviotune.write_bytes_sec_max);
+}
+
+if (disk->blkdeviotune.total_iops_sec_max) {
+virBufferAsprintf(&opt, ",iops_max=%llu",
+  disk->blkdeviotune.total_iops_sec_max);
+}
+
+if (disk->blkdeviotune.read_iops_sec_max) {
+virBufferAsprintf(&opt, ",iops_rd_max=%llu",
+  disk->blkdeviotune.read_iops_sec_max);
+}
+
+if (disk->blkdeviotune.write_iops_sec_max) {
+virBufferAsprintf(&opt, ",iops_wr_max=%llu",
+  disk->blkdeviotune.write_iops_sec_max);
+}
+
+if (disk->blkdeviotune.write_iops_sec_max) {
+virBufferAsprintf(&opt, ",iops_size=%llu",
+  disk->blkdeviotune.size_iops_sec);
+}
+
 if (virBufferCheckError(&opt) < 0)
 goto error;
 
-- 
1.8.3.1

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


[libvirt] [PATCH v5 2/7] qemu: Modify the structure _virDomainBlockIoTuneInfo.

2014-10-07 Thread Matthias Gatto
Modify the structure _virDomainBlockIoTuneInfo to support these the new
options.
Change the initialization of the variable expectedInfo in qemumonitorjsontest.c
to avoid compiling problem.
Add documentation about the new xml options

Signed-off-by: Matthias Gatto 
---
 docs/formatdomain.html.in |  25 ++
 docs/schemas/domaincommon.rng |  43 +
 src/conf/domain_conf.c| 110 +-
 src/conf/domain_conf.h|   7 +++
 tests/qemumonitorjsontest.c   |   2 +-
 5 files changed, 185 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 45b0f61..6ec7b6b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2103,6 +2103,31 @@
   write_iops_sec
   The optional write_iops_sec element is the
 write I/O operations per second.
+  total_bytes_sec_max
+  The optional total_bytes_sec_max element is the
+maximum total throughput limit in bytes per second.  This cannot
+appear with read_bytes_sec_max
+or write_bytes_sec_max.
+  read_bytes_sec_max
+  The optional read_bytes_sec_max element is the
+maximum read throughput limit in bytes per second.
+  write_bytes_sec_max
+  The optional write_bytes_sec_max element is the
+maximum write throughput limit in bytes per second.
+  total_iops_sec_max
+  The optional total_iops_sec_max element is the
+maximum total I/O operations per second.  This cannot
+appear with read_iops_sec_max
+or write_iops_sec_max.
+  read_iops_sec_max
+  The optional read_iops_sec_max element is the
+maximum read I/O operations per second.
+  write_iops_sec_max
+  The optional write_iops_sec_max element is the
+maximum write I/O operations per second.
+  size_iops_sec
+  The optional size_iops_sec element is the
+size of I/O operations per second.
 
   
   driver
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 6b69fd1..5ab796b 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4538,6 +4538,49 @@
 
   
 
+
+  
+
+  
+  
+
+  
+
+  
+
+  
+  
+
+  
+
+  
+
+  
+
+
+  
+
+  
+  
+
+  
+
+  
+
+  
+  
+
+  
+
+  
+
+  
+
+
+  
+
+  
+
   
 
   
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a9c6f05..5c22ddd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5815,6 +5815,49 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 def->blkdeviotune.write_iops_sec = 0;
 }
 
+if (virXPathULongLong("string(./iotune/total_bytes_sec_max)",
+  ctxt,
+  &def->blkdeviotune.total_bytes_sec_max) 
< 0) {
+def->blkdeviotune.total_bytes_sec_max = 0;
+}
+
+if (virXPathULongLong("string(./iotune/read_bytes_sec_max)",
+  ctxt,
+  &def->blkdeviotune.read_bytes_sec_max) < 
0) {
+def->blkdeviotune.read_bytes_sec_max = 0;
+}
+
+if (virXPathULongLong("string(./iotune/write_bytes_sec_max)",
+  ctxt,
+  &def->blkdeviotune.write_bytes_sec_max) 
< 0) {
+def->blkdeviotune.write_bytes_sec_max = 0;
+}
+
+if (virXPathULongLong("string(./iotune/total_iops_sec_max)",
+  ctxt,
+  &def->blkdeviotune.total_iops_sec_max) < 
0) {
+def->blkdeviotune.total_iops_sec_max = 0;
+}
+
+if (virXPathULongLong("string(./iotune/read_iops_sec_max)",
+  ctxt,
+  &def->blkdeviotune.read_iops_sec_max) < 
0) {
+def->blkdeviotune.read_iops_sec_max = 0;
+}
+
+if (virXPathULongLong("string(./iotune/write_iops_sec_max)",
+  ctxt,
+  &def->blkdeviotune.write_iops_sec_max) < 
0) {
+ 

[libvirt] [PATCH v5 4/7] qemu: Add bps_max and friends qemu driver

2014-10-07 Thread Matthias Gatto
Add support for bps_max and friends in the driver part.
In the part checking if a qemu is running, check if the running binary support 
bps_max,
if not print an error message, if yes add it to "info" variable

Signed-off-by: Matthias Gatto 
---
 include/libvirt/libvirt.h.in |  56 +
 src/qemu/qemu_driver.c   | 186 +--
 src/qemu/qemu_monitor.c  |  10 ++-
 src/qemu/qemu_monitor.h  |   6 +-
 src/qemu/qemu_monitor_json.c |  11 ++-
 src/qemu/qemu_monitor_json.h |   6 +-
 tests/qemumonitorjsontest.c  |   4 +-
 7 files changed, 258 insertions(+), 21 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 459a292..c1590d6 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -5379,6 +5379,62 @@ typedef void 
(*virConnectDomainEventDeviceRemovedCallback)(virConnectPtr conn,
 #define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC "blkdeviotune.write_iops_sec"
 
 /**
+ * VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX:
+ *
+ * Marco represents the total throughput limit in maximum bytes per second,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX 
"blkdeviotune.total_bytes_sec_max"
+
+/**
+ * VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX:
+ *
+ * Marco represents the read throughput limit in maximum bytes per second,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX 
"blkdeviotune.read_bytes_sec_max"
+
+/**
+ * VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX:
+ *
+ * Macro represents the write throughput limit in maximum bytes per second,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX 
"blkdeviotune.write_bytes_sec_max"
+
+/**
+ * VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX:
+ *
+ * Macro represents the total maximum I/O operations per second,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX 
"blkdeviotune.total_iops_sec_max"
+
+/**
+ * VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX:
+ *
+ * Macro represents the read maximum I/O operations per second,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX 
"blkdeviotune.read_iops_sec_max"
+
+/**
+ * VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX:
+ *
+ * Macro represents the write maximum I/O operations per second,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX 
"blkdeviotune.write_iops_sec_max"
+
+/**
+ * VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC:
+ *
+ * Macro represents the size maximum I/O operations per second,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC "blkdeviotune.size_iops_sec"
+
+/**
  * virConnectDomainEventTunableCallback:
  * @conn: connection object
  * @dom: domain on which the event occurred
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d111ccd..a913a7d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -105,6 +105,7 @@ VIR_LOG_INIT("qemu.qemu_driver");
 #define QEMU_NB_MEM_PARAM  3
 
 #define QEMU_NB_BLOCK_IO_TUNE_PARAM  6
+#define QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX  13
 
 #define QEMU_NB_NUMA_PARAM 2
 
@@ -16284,6 +16285,10 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
 int conf_idx = -1;
 bool set_bytes = false;
 bool set_iops = false;
+bool set_bytes_max = false;
+bool set_iops_max = false;
+bool set_size_iops = false;
+bool supportMaxOptions = true;
 virQEMUDriverConfigPtr cfg = NULL;
 virCapsPtr caps = NULL;
 virObjectEventPtr event = NULL;
@@ -16306,6 +16311,20 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
VIR_TYPED_PARAM_ULLONG,
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC,
VIR_TYPED_PARAM_ULLONG,
+   VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX,
+   VIR_TYPED_PARAM_ULLONG,
+   VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX,
+   VIR_TYPED_PARAM_ULLONG,
+   VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX,
+   VIR_TYPED_PARAM_ULLONG,
+   VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX,
+   VIR_TYPED_PARAM_ULLONG,
+   VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX,
+   VIR_TYPED_PARAM_ULLONG,
+   VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX,
+   VIR_TYPED_PARAM_ULLONG,
+   VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC,
+   VIR_TYPED_PARAM_ULLONG,
NULL) < 0)
 return -1;
 
@@ -16398,6 +16417,69 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
 
VIR_DOMAIN_TUNABLE_BLKD

[libvirt] [PATCH v5 7/7] virsh: Add bps_max and friends to virsh

2014-10-07 Thread Matthias Gatto
Add the new throttle options to virsh, and send them to libvirt.

Signed-off-by: Matthias Gatto 
---
 tools/virsh-domain.c | 119 +++
 tools/virsh.pod  |  10 +
 2 files changed, 129 insertions(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 12550ff..9eba253 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -,6 +,62 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
  .type = VSH_OT_INT,
  .help = N_("write I/O operations limit per second")
 },
+{.name = "total_bytes_sec_max",
+ .type = VSH_OT_ALIAS,
+ .help = "total-bytes-sec-max"
+},
+{.name = "total-bytes-sec-max",
+ .type = VSH_OT_INT,
+ .help = N_("total max in bytes")
+},
+{.name = "read_bytes_sec_max",
+ .type = VSH_OT_ALIAS,
+ .help = "read-bytes-sec-max"
+},
+{.name = "read-bytes-sec-max",
+ .type = VSH_OT_INT,
+ .help = N_("read max in bytes")
+},
+{.name = "write_bytes_sec_max",
+ .type = VSH_OT_ALIAS,
+ .help = "write-bytes-sec-max"
+},
+{.name = "write-bytes-sec-max",
+ .type = VSH_OT_INT,
+ .help = N_("write max in bytes")
+},
+{.name = "total_iops_sec_max",
+ .type = VSH_OT_ALIAS,
+ .help = "total-iops-sec-max"
+},
+{.name = "total-iops-sec-max",
+ .type = VSH_OT_INT,
+ .help = N_("total I/O operations max")
+},
+{.name = "read_iops_sec_max",
+ .type = VSH_OT_ALIAS,
+ .help = "read-iops-sec-max"
+},
+{.name = "read-iops-sec-max",
+ .type = VSH_OT_INT,
+ .help = N_("read I/O operations max")
+},
+{.name = "write_iops_sec_max",
+ .type = VSH_OT_ALIAS,
+ .help = "write-iops-sec-max"
+},
+{.name = "write-iops-sec-max",
+ .type = VSH_OT_INT,
+ .help = N_("write I/O operations max")
+},
+{.name = "size_iops_sec",
+ .type = VSH_OT_ALIAS,
+ .help = "size-iops-sec"
+},
+{.name = "size-iops-sec",
+ .type = VSH_OT_INT,
+ .help = N_("I/O size in bytes")
+},
 {.name = "config",
  .type = VSH_OT_BOOL,
  .help = N_("affect next boot")
@@ -1184,6 +1240,33 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
 goto save_error;
 }
 
+if ((rv = vshCommandOptULongLong(cmd, "total-bytes-sec-max", &value)) < 0) 
{
+goto interror;
+} else if (rv > 0) {
+if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX,
+value) < 0)
+goto save_error;
+}
+
+if ((rv = vshCommandOptULongLong(cmd, "read-bytes-sec-max", &value)) < 0) {
+goto interror;
+} else if (rv > 0) {
+if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX,
+value) < 0)
+goto save_error;
+}
+
+if ((rv = vshCommandOptULongLong(cmd, "write-bytes-sec-max", &value)) < 0) 
{
+goto interror;
+} else if (rv > 0) {
+if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX,
+value) < 0)
+goto save_error;
+}
+
 if ((rv = vshCommandOptULongLong(cmd, "total-iops-sec", &value)) < 0) {
 goto interror;
 } else if (rv > 0) {
@@ -1211,6 +1294,42 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
 goto save_error;
 }
 
+if ((rv = vshCommandOptULongLong(cmd, "write-iops-sec-max", &value)) < 0) {
+goto interror;
+} else if (rv > 0) {
+if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX,
+value) < 0)
+goto save_error;
+}
+
+if ((rv = vshCommandOptULongLong(cmd, "read-iops-sec-max", &value)) < 0) {
+goto interror;
+} else if (rv > 0) {
+if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX,
+value) < 0)
+goto save_error;
+}
+
+if ((rv = vshCommandOptULongLong(cmd, "total-iops-sec-max", &value)) < 0) {
+goto interror;
+} else if (rv > 0) {
+if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX,
+value) < 0)
+goto save_error;
+}
+
+if ((rv = vshCommandOptULongLong(cmd, "size-iops-sec", &value)) < 0) {
+goto interror;
+} else if (rv > 0) {
+if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC,
+  

[libvirt] [PATCH v5 3/7] qemu: Add the capability to detect if the qemu binary have the capability to use bps_max and friends

2014-10-07 Thread Matthias Gatto
Add a value in the enum virQEMUCapsFlags for the qemu capability.
Set it with virQEMUCapsSet if the binary suport bps_max and they friends.

Signed-off-by: Matthias Gatto 
---
 src/qemu/qemu_capabilities.c | 2 ++
 src/qemu/qemu_capabilities.h | 1 +
 tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6fcb5c7..73fd812 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -271,6 +271,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
   "iothread",
   "migrate-rdma",
   "ivshmem",
+  "drive-iotune-max",
 );
 
 
@@ -2450,6 +2451,7 @@ static struct virQEMUCapsCommandLineProps 
virQEMUCapsCommandLine[] = {
 { "spice", "disable-agent-file-xfer", QEMU_CAPS_SPICE_FILE_XFER_DISABLE },
 { "msg", "timestamp", QEMU_CAPS_MSG_TIMESTAMP },
 { "numa", NULL, QEMU_CAPS_NUMA },
+{ "drive", "throttling.bps-total-max", QEMU_CAPS_DRIVE_IOTUNE_MAX},
 };
 
 static int
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 0214f30..9161088 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -218,6 +218,7 @@ typedef enum {
 QEMU_CAPS_OBJECT_IOTHREAD= 176, /* -object iothread */
 QEMU_CAPS_MIGRATE_RDMA   = 177, /* have rdma migration */
 QEMU_CAPS_DEVICE_IVSHMEM = 178, /* -device ivshmem */
+QEMU_CAPS_DRIVE_IOTUNE_MAX   = 179, /* -drive bps_max= and friends */
 
 QEMU_CAPS_LAST,   /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps 
b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
index 7fc654d..7003ad8 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
@@ -160,4 +160,5 @@
 
 
 
+
   
-- 
1.8.3.1

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


Re: [libvirt] [PATCH v3 1/3] migration: add migration_host support for Ipv6 address without brackets

2014-10-07 Thread Ján Tomko
On 10/07/2014 06:07 AM, Chen Fan wrote:
> if specifying migration_host to an Ipv6 address without brackets,
> it was resolved to an incorrect address, such as:
> tcp:2001:0DB8::1428:,
> but the correct address should be:
> tcp:[2001:0DB8::1428]:
> so we should add brackets when parsing it.
> 
> Signed-off-by: Chen Fan 
> ---
>  src/libvirt_private.syms  |  2 +-
>  src/qemu/qemu_migration.c | 49 
> +++
>  src/util/virsocketaddr.c  | 19 +-
>  src/util/virsocketaddr.h  |  2 +-
>  tests/sockettest.c|  2 +-
>  5 files changed, 36 insertions(+), 38 deletions(-)

ACK

Jan



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

[libvirt] [libvirt-python PATCH] sanitytest: define long for python version >= 3

2014-10-07 Thread Martin Kletzander
Commit c58c7f362aab37e4961407c2efc8a74925ed9c37 fixed 32-bit python
build but broke build with python3 due to the lack of 'long' in the
newer version of python.  This patch aims to fix it with a simple
string comparison of sys.version and '3'.

Signed-off-by: Martin Kletzander 
---
 sanitytest.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sanitytest.py b/sanitytest.py
index 5bd85a5..b161696 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -9,6 +9,9 @@ import string
 sys.path.insert(0, sys.argv[1])
 import libvirt

+if sys.version > '3':
+long = int
+
 # Path to the libvirt API XML file
 xml = sys.argv[2]

-- 
2.1.2

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


[libvirt] [libvirt-python PATCH] sanitytest: count with the fact that large enums can be long

2014-10-07 Thread Martin Kletzander
On 32-bit systems, one new flag that has the value of 1 << 31, namely
VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, fails to fit into an
'int' on python and is therefore of type 'long'.  Fix sanitytest to
count with such fact in order to avoid build failures on 32-bit systems.

Signed-off-by: Martin Kletzander 
---

Notes:
Pushed as a build-breaker.

 sanitytest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sanitytest.py b/sanitytest.py
index 8cb0154..5bd85a5 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -84,7 +84,7 @@ for name in dir(libvirt):
 thing = getattr(libvirt, name)
 # Special-case libvirtError to deal with python 2.4 difference
 # in Exception class type reporting.
-if type(thing) == int:
+if type(thing) in (int, long):
 gotenums.append(name)
 elif type(thing) == type or name == "libvirtError":
 gottypes.append(name)
-- 
2.1.2

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