From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH OSSTEST 1/3] Debian: erase-other-disks: add a log() helper
Date: Wed, 20 Jan 2016 15:06:19 +0000 [thread overview]
Message-ID: <1453302381-28692-1-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1453302359.26343.133.camel@citrix.com>
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@citrix.com>
---
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
next prev parent reply other threads:[~2016-01-20 15:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-20 15:05 [PATCH OSSTEST 0/3] fixes to erase-other-disks d-i hook Ian Campbell
2016-01-20 15:06 ` Ian Campbell [this message]
2016-01-20 16:10 ` [PATCH OSSTEST 1/3] Debian: erase-other-disks: add a log() helper Ian Jackson
2016-01-20 15:06 ` [PATCH OSSTEST 2/3] Debian: erase-other-disks: erase partitions first Ian Campbell
2016-01-20 16:11 ` Ian Jackson
2016-01-20 15:06 ` [PATCH OSSTEST 3/3] Debian: erase-other-disks: rescan partition tables after erasing whole disk Ian Campbell
2016-01-20 16:11 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453302381-28692-1-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).