Parted reports that the first block of the disk is free, even if it is occupied 
by the 
partition table.
--- libvirt-0.6.4.patches/src/storage_backend_disk.c	2009-06-23 18:17:19.039168000 +0200
+++ libvirt-0.6.4/src/storage_backend_disk.c	2009-06-23 18:17:10.324936000 +0200
@@ -36,6 +36,8 @@
 
 #define PARTHELPER BINDIR "/libvirt_parthelper"
 
+#define SECTOR_SIZE 512
+
 /* Map partition types to internal enum */
 static int 
 virStorageBackendDiskMapPartitionType(const char* partType)
@@ -214,6 +216,11 @@ virStorageBackendDiskMakeFreeExtent(virC
                          &dev->freeExtents[dev->nfreeExtent].end) < 0)
         return -1; /* Don't bother to re-alloc freeExtents - it'll be free'd shortly */
 
+    /* first block reported as free, even if it is not */
+    if (dev->freeExtents[dev->nfreeExtent].start == 0) {
+        dev->freeExtents[dev->nfreeExtent].start = SECTOR_SIZE;
+    }
+
     pool->def->available +=
         (dev->freeExtents[dev->nfreeExtent].end -
          dev->freeExtents[dev->nfreeExtent].start);
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to