[Libvirt-cim] [PATCH] Use CIM 'AllocationUnits' to populate libvirt XML 'capacity unit' AND 'allocation unit'

Sharad Mishra snmishra at us.ibm.com
Tue May 4 22:04:27 UTC 2010



libvirt-cim-bounces at redhat.com wrote on 05/04/2010 11:17:05 AM:

> Chip Vincent <cvincent at linux.vnet.ibm.com>
> Sent by: libvirt-cim-bounces at redhat.com
>
> 05/04/2010 11:17 AM
>
> Please respond to
> List for discussion and development of libvirt CIM
<libvirt-cim at redhat.com>
>
> To
>
> libvirt-cim at redhat.com
>
> cc
>
> Subject
>
> [Libvirt-cim] [PATCH] Use CIM 'AllocationUnits' to populate libvirt
> XML 'capacity unit' AND 'allocation unit'
>
> # HG changeset patch
> # User Chip Vincent <cvincent at us.ibm.com>
> # Date 1272996835 14400
> # Node ID 91c26f188476c9b56aaf5536d5f2abb051db9796
> # Parent  22a4721a2d978fe611cb75255a094a0cc23abe5c
> Use CIM 'AllocationUnits' to populate libvirt XML 'capacity unit'
> AND 'allocation unit'
>
> Today, AllocationUnits only maps to capacity unit, which will leave
> allocation unit as the default (Kb). With this patch, both will be
> set to the same units.
>
> Signed-off-by: Chip Vincent <cvincent at us.ibm.com>
>
> diff -r 22a4721a2d97 -r 91c26f188476 libxkutil/xmlgen.c
> --- a/libxkutil/xmlgen.c   Tue Mar 23 16:31:41 2010 -0700
> +++ b/libxkutil/xmlgen.c   Tue May 04 14:13:55 2010 -0400
> @@ -1138,7 +1138,14 @@
>                  goto out;
>
>          free(string);
> -        ret = asprintf(&string, "%" PRIu16, vol->cap);
> +        if (vol->cap_units != NULL) {
> +                xmlAttrPtr tmp = NULL;
> +                tmp = xmlNewProp(cap, BAD_CAST "unit", BAD_CAST
> vol->cap_units);
> +                if (tmp == NULL)
> +                        goto out;
> +        }
> +
> +   ret = asprintf(&string, "%" PRIu16, vol->cap);

Fix the indentation in the above line (no tabs, but spaces). Otherwise the
patch looks good. Haven't tested it.

-Sharad

>          if (ret == -1)
>                  return XML_ERROR;
>
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20100504/a285ca75/attachment.htm>


More information about the Libvirt-cim mailing list