diff mbox

[OSSTEST,3/3] Debian: erase-other-disks: rescan partition tables after erasing whole disk

Message ID 1453302381-28692-3-git-send-email-ian.campbell@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Campbell Jan. 20, 2016, 3:06 p.m. UTC
This appears to happen anyway, but force it to be sure.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Debian.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Ian Jackson Jan. 20, 2016, 4:11 p.m. UTC | #1
Ian Campbell writes ("[PATCH OSSTEST 3/3] Debian: erase-other-disks: rescan partition tables after erasing whole disk"):
> This appears to happen anyway, but force it to be sure.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff mbox

Patch

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 20f3de7..e7b5538 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -1053,6 +1053,14 @@  zero () {
     fi
 }
 
+rescan () {
+    if ! test -b \${dev}; then
+	return
+    fi
+    log "Rescaning partition table on \${dev}"
+    echo 1 > /sys/block/\${dev#/dev/}/device/rescan
+}
+
 udevadm settle
 for sd in sd hd; do
     log "\${sd} devices present before: `echo /dev/\${sd}*`"
@@ -1063,6 +1071,7 @@  for sd in sd hd; do
 
         dev=/dev/\${sd}\${b}
         zero
+        rescan
     done
     udevadm settle
     log "\${sd} devices present after: `echo /dev/\${sd}*`"