From: John Ferlan Date: Thu, 22 Jan 2015 13:30:36 +0000 (-0500) Subject: storage: Fix check for partition type for disk backing volumes X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a0d88ed4e70a034dfcf7201bff8692af5b4effad;p=libvirt.git storage: Fix check for partition type for disk backing volumes 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. --- diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 0c4126afc8..31b6025d1e 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -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;