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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux