Hello list,
Florian wrote about a .1 second sleep time - what a concept! I've never
thought to sleep for less than a second.
David wrote:
> ... Inserting a wait of a few (variable between 1 and 30 seconds,
> depending on load) seconds reduces, but does not eliminate, the
> failures. Introducing a 60-90 second wait produces a fairly
> reliable operation, but still not 100%. ...
These two ideas got me to thinking - could we get to an enableDevice()
function that is both reliable and fast until/if "chccwdev -e" gets fixed?
I reworked that test code and was able to get a few failures on one
system, but only needed a millisecond of sleep, if my assumptions are
correct (I forget that a millisecond is a long time for a computer).
Could someone copy and paste this script and test on a system that fails
more regularly? Thanks.
----------------
Here's the code:
----------------
# cat testudev # snip below here
#!/bin/bash
function enableDevice()
{
chccwdev -e $1 > /dev/null 2>&1
local rc=$?
if [ $rc != 0 ]; then # chccwdev failed => try again
for seconds in .001 .01 .04 .10 .14 .24 .38 .62 1 2 3 5 8 13 21 34; do
echo "chccwdev -e failed; sleeping $seconds seconds"
sleep $seconds
chccwdev -e $1 > /dev/null 2>&1
rc=$?
if [ "$rc" = 0 ]; then # success
break # out of for loop
fi
done
fi
$udevCmd
return $rc
}
udevCmd="udevadm settle"
# udevCmd="udevsettle"
vmcp define vfb-512 302 2000 > /dev/null
enableDevice 0.0.0302
rc=$?
if [ $rc != 0 ]; then
echo "return code from enableDevice 0.0.0302 = $rc"
fi
mkswap /dev/disk/by-path/ccw-0.0.0302-part1 > /dev/null 2>&1
rc=$?
if [ $rc != 0 ]; then
echo "mkswap failed"
else
echo "mkswap succeeded"
fi
chccwdev -d 0.0.0302 > /dev/null
rc=$?
if [ $rc != 0 ]; then
echo "return code from chccwdev -d 0.0.0302 = $rc"
fi
vmcp det 302 > /dev/null
# snip above here
--------------------
Here's the test run:
--------------------
# cat /etc/*release
SUSE Linux Enterprise Server 11 (s390x)
VERSION = 11
PATCHLEVEL = 1
LSB_VERSION="core-2.0-noarch:core-3.2-noarch:core-4.0-n
oarch:core-2.0-s390x:core-3.2-s390x:core-4.0-s390x"
# for i in {1..44}; do ./testudev | grep failed; done
chccwdev -e failed; sleeping .001 seconds
chccwdev -e failed; sleeping .001 seconds
chccwdev -e failed; sleeping .001 seconds
chccwdev -e failed; sleeping .001 seconds
chccwdev -e failed; sleeping .001 seconds
chccwdev -e failed; sleeping .001 seconds
chccwdev -e failed; sleeping .001 seconds
chccwdev -e failed; sleeping .001 seconds
chccwdev -e failed; sleeping .001 seconds
"Mike MacIsaac" <mikemac at-sign us.ibm.com>
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/