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

[Xen-devel] [PATCH OSSTEST 1/3] Debian: erase-other-disks: add a log() helper



Writing it out each time is too verbose.

At the same time log the set of devices present before and after each
batch of erasing, with a udev settle before the second to ensure any
changes to /dev have happened.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 Osstest/Debian.pm | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 76171c0..cf3486b 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -1033,22 +1033,29 @@ if test -f \$stamp; then
     exit 0
 fi
 >\$stamp
-logger -t osstest-erase-other-disks-\$\$ "Running..."
+
+log () {
+    logger -t osstest-erase-other-disks-\$\$ "\$\@"
+}
+
+log "Running..."
+
 zero () {
     if test -b \$dev; then
-        logger -t osstest-erase-other-disks-\$\$ "Erasing \$dev"
+        log "Erasing \$dev"
         dd if=/dev/zero of=\$dev count=64 ||:
         if ! test -b \$dev; then
-            logger -t osstest-erase-other-disks-\$\$ "\$dev is no longer a 
block device!"
+            log "\$dev is no longer a block device!"
             exit 1
         fi
     else
-        logger -t osstest-erase-other-disks-\$\$ "\$dev does not exist or is 
not a block device."
+        log "\$dev does not exist or is not a block device."
     fi
 }
 
 udevadm settle
 for sd in sd hd; do
+    log "\${sd} devices present before: `echo /dev/\${sd}*`"
     for b in a b c d e f; do
         dev=/dev/\${sd}\${b}
         zero
@@ -1056,6 +1063,8 @@ for sd in sd hd; do
     for dev in /dev/\${sd}a[0-9]; do
         zero
     done
+    udevadm settle
+    log "\${sd} devices present after: `echo /dev/\${sd}*`"
 done
 for dev in ${disk}*; do
     zero
-- 
2.6.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.