]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Fix check for partition type for disk backing volumes
authorJohn Ferlan <jferlan@redhat.com>
Thu, 22 Jan 2015 13:30:36 +0000 (08:30 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 28 Jan 2015 22:28:03 +0000 (17:28 -0500)
While checking the existing partitions in virStorageBackendDiskPartFormat,
the code would erroneously compare the volume target format type (eg, the
virStoragePartedFsType) rather than the source partition type (eg, the
virStorageVolTypeDisk) which is set during virStorageBackendDiskReadPartitions.

src/storage/storage_backend_disk.c

index 0c4126afc8390cbcc2453975409c77f9fc576ed3..31b6025d1e0390bb29397f0a4545382fe1d6eaca 100644 (file)
@@ -495,8 +495,8 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
         if (vol->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) {
             /* make sure we don't have a extended partition already */
             for (i = 0; i < pool->volumes.count; i++) {
-                if (pool->volumes.objs[i]->target.format ==
-                    VIR_STORAGE_VOL_DISK_EXTENDED) {
+                if (pool->volumes.objs[i]->source.partType ==
+                    VIR_STORAGE_VOL_DISK_TYPE_EXTENDED) {
                     virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                    _("extended partition already exists"));
                     return -1;
@@ -517,8 +517,8 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
             case VIR_STORAGE_VOL_DISK_TYPE_LOGICAL:
                 /* make sure we have a extended partition */
                 for (i = 0; i < pool->volumes.count; i++) {
-                    if (pool->volumes.objs[i]->target.format ==
-                        VIR_STORAGE_VOL_DISK_EXTENDED) {
+                    if (pool->volumes.objs[i]->source.partType ==
+                        VIR_STORAGE_VOL_DISK_TYPE_EXTENDED) {
                         if (virAsprintf(partFormat, "logical %s",
                                         partedFormat) < 0)
                             return -1;