[node-patches] Change in ovirt-node[node-3.0]: Also dd GPT labels

rbarry at redhat.com rbarry at redhat.com
Mon Nov 24 19:17:41 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Also dd GPT labels
......................................................................

Also dd GPT labels

wipefs may have problems with GPT labels on 4k disks. Get rid of
them. dd more of the disk as well

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1158044
Change-Id: Iced15d58939b8e7e4e86d274d1c46123500e3e6d
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirtnode/ovirtfunctions.py
1 file changed, 18 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/91/35491/1

diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index 0456153..f9e0959 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -1375,11 +1375,25 @@
     system_closefds("parted -s \""+ drive +"\" mklabel gpt &>>" + OVIRT_TMP_LOGFILE)
     system_closefds("parted -s \""+ drive +"\" mklabel loop &>>" + OVIRT_TMP_LOGFILE)
     system_closefds("wipefs -a \""+ drive +"\" &>>" + OVIRT_TMP_LOGFILE)
+    system_closefds("dd if=/dev/zero of=\""+ drive +"\" bs=1024K count=1 &>>" + OVIRT_TMP_LOGFILE)
     ## zero out the GPT secondary header
-    #logger.info("Wiping secondary gpt header")
-    #disk_kb = subprocess_closefds("sfdisk -s \""+ drive +"\" 2>/dev/null", shell=True, stdout=PIPE, stderr=STDOUT)
-    #disk_kb_count = disk_kb.stdout.read()
-    #system_closefds("dd if=/dev/zero of=\"" +drive +"\" bs=1024 seek=$(("+ disk_kb_count+" - 1)) count=1 &>>" + OVIRT_TMP_LOGFILE)
+    logger.info("Wiping secondary gpt header")
+    disk_kb = subprocess_closefds("sfdisk -s \""+ drive +"\" 2>/dev/null", shell=True, stdout=PIPE, stderr=STDOUT)
+    disk_kb_count = disk_kb.stdout.read()
+    system_closefds("dd if=/dev/zero of=\"" +drive +"\" bs=1024 seek=$(("+ disk_kb_count+" - 1)) count=1 &>>" + OVIRT_TMP_LOGFILE)
+
+    # Potentially wipe out new GPT header locations
+    logger.info("Wiping GPT header")
+    system_closefds("dd if=/dev/zero of=\"" + drive +
+                    "\" bs=4096 count=35 &>>" + OVIRT_TMP_LOGFILE)
+    logger.info("Wiping secondary gpt header")
+    disk_kb = subprocess_closefds("blockdev --getsz \"" + drive +
+                                  "\" 2>/dev/null", shell=True, stdout=PIPE,
+                                  stderr=STDOUT)
+    disk_kb_count = disk_kb.stdout.read()
+    system_closefds("dd if=/dev/zero of=\"" + drive +
+                    "\" bs=4096 seek=$((" + disk_kb_count +
+                    " * 512/4096 - 35)) count=35 &>>" + OVIRT_TMP_LOGFILE)
     system_closefds("sync")
 
 def test_ntp_configuration(self):


-- 
To view, visit http://gerrit.ovirt.org/35491
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iced15d58939b8e7e4e86d274d1c46123500e3e6d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: node-3.0
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list