[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 1/5] PDU::ipmi: Do not return until the power state has changed
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- Osstest/PDU/ipmi.pm | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Osstest/PDU/ipmi.pm b/Osstest/PDU/ipmi.pm index bff1143..0cbc5b9 100644 --- a/Osstest/PDU/ipmi.pm +++ b/Osstest/PDU/ipmi.pm @@ -49,19 +49,29 @@ sub pdu_power_state { my $cmd = "ipmitool -H $mo->{Mgmt} -U $mo->{User} -P $mo->{Pass}"; - my $status = `$cmd power status` - or die "Cannot retrieve current power status"; - chomp($status); - logm("$status (want $onoff)"); - $status =~ s/^Chassis Power is (on|off)$/$1/ - or die "Cannot parse current power status: $status"; + my $getstatus = sub { + my $status = `$cmd power status` + or die "Cannot retrieve current power status"; + chomp($status); + logm("$status (want $onoff)"); + $status =~ s/^Chassis Power is (on|off)$/$1/ + or die "Cannot parse current power status: $status"; + return $status; + }; - if ( $status eq $onoff ) { + if ( $getstatus->() eq $onoff ) { logm("Current power status is correct"); return; } - system_checked("$cmd power $onoff") + system_checked("$cmd power $onoff"); + + my $count = 60; + for (;;) { + last if $getstatus->() eq $onoff; + die "did not power $onoff" unless --$count > 0; + sleep(1); + } } 1; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |