]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Format disk pool part_separator attribute for running pool
authorJohn Ferlan <jferlan@redhat.com>
Thu, 17 Mar 2016 11:29:23 +0000 (07:29 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 18 Mar 2016 11:04:07 +0000 (07:04 -0400)
Commit id '4f846170' added printing of a new field 'part_separator';
however, neglected to do so when there was an "freeExtent" defined
for the device (as there would be when the disk pool was started).

This patch adjusts the logic to appropriately format the device path and
if there the part_separator attribute.

src/conf/storage_conf.c

index bfba52135bfa1e08b4fe40b8e90b134b9d311321..497c65f46015d9cdc801b3243c53f6197f09bb00 100644 (file)
@@ -1055,9 +1055,15 @@ virStoragePoolSourceFormat(virBufferPtr buf,
     if ((options->flags & VIR_STORAGE_POOL_SOURCE_DEVICE) &&
         src->ndevice) {
         for (i = 0; i < src->ndevice; i++) {
+            virBufferEscapeString(buf, "<device path='%s'",
+                                  src->devices[i].path);
+            if (src->devices[i].part_separator !=
+                VIR_TRISTATE_SWITCH_ABSENT) {
+                virBufferAsprintf(buf, " part_separator='%s'",
+                                  virTristateBoolTypeToString(src->devices[i].part_separator));
+            }
             if (src->devices[i].nfreeExtent) {
-                virBufferEscapeString(buf, "<device path='%s'>\n",
-                                      src->devices[i].path);
+                virBufferAddLit(buf, ">\n");
                 virBufferAdjustIndent(buf, 2);
                 for (j = 0; j < src->devices[i].nfreeExtent; j++) {
                     virBufferAsprintf(buf, "<freeExtent start='%llu' end='%llu'/>\n",
@@ -1067,13 +1073,6 @@ virStoragePoolSourceFormat(virBufferPtr buf,
                 virBufferAdjustIndent(buf, -2);
                 virBufferAddLit(buf, "</device>\n");
             } else {
-                virBufferEscapeString(buf, "<device path='%s'",
-                                      src->devices[i].path);
-                if (src->devices[i].part_separator !=
-                    VIR_TRISTATE_SWITCH_ABSENT) {
-                    virBufferAsprintf(buf, " part_separator='%s'",
-                                      virTristateBoolTypeToString(src->devices[i].part_separator));
-                }
                 virBufferAddLit(buf, "/>\n");
             }
         }