[libvirt] [PATCH v2 3/3] disk: Force clearing of the first 2048 bytes of device prior to mklabel

John Ferlan jferlan at redhat.com
Fri Apr 7 13:52:09 UTC 2017


https://bugzilla.redhat.com/show_bug.cgi?id=1439132

During 'matrix' testing of all possible combinations I found that if
device is formated with "gpt" first, then an attempt is made to format
using "mac", a startup will fail.  By adding a clearing of the first
2048 bytes of the device (similar to the logical pool code), the issue
is resolved.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---

 Difference to v1 - just split it out and sent separately with it's own
 commit message.

 src/storage/storage_backend_disk.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 39371f2..ce40ddd 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -496,6 +496,10 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
     }
 
     if (ok_to_mklabel) {
+        if (virStorageBackendZeroDeviceHeader(pool->def->source.devices[0].path,
+                                              4 * SECTOR_SIZE) < 0)
+            goto error;
+
         /* eg parted /dev/sda mklabel --script msdos */
         if (format == VIR_STORAGE_POOL_DISK_UNKNOWN)
             format = pool->def->source.format = VIR_STORAGE_POOL_DISK_DOS;
-- 
2.9.3




More information about the libvir-list mailing list