# HG changeset patch
# User Chip Vincent <cvincent(a)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(a)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);
if (ret == -1)
return XML_ERROR;