diff mbox series

[OSSTEST] PDU/IPMI: Be less aggressive with IPMI commands

Message ID 20230310170721.14493-1-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series [OSSTEST] PDU/IPMI: Be less aggressive with IPMI commands | expand

Commit Message

Anthony PERARD March 10, 2023, 5:07 p.m. UTC
The machine rimava0 doesn't power off or power on when we keep doing
"power status" then "power off" ipmi command without waiting.

Currently, osstest does:
    loop
	ipmitool power status
	ipmitool power off
	sleep 1

This loop goes on forever, the machine never change power state.
Adding some wait in between both command works.

While here, test for timeout just after a status check instead of
sending the `power off` command again which we would never check the
result of.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 Osstest/PDU/ipmi.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ian Jackson March 10, 2023, 6:22 p.m. UTC | #1
Anthony PERARD writes ("[OSSTEST PATCH] PDU/IPMI: Be less aggressive with IPMI commands"):
> The machine rimava0 doesn't power off or power on when we keep doing
> "power status" then "power off" ipmi command without waiting.
> 
> Currently, osstest does:
>     loop
> 	ipmitool power status
> 	ipmitool power off
> 	sleep 1
> 
> This loop goes on forever, the machine never change power state.
> Adding some wait in between both command works.

How sad.

> While here, test for timeout just after a status check instead of
> sending the `power off` command again which we would never check the
> result of.

Reviewed-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
diff mbox series

Patch

diff --git a/Osstest/PDU/ipmi.pm b/Osstest/PDU/ipmi.pm
index 21c94d98..ce498cb7 100644
--- a/Osstest/PDU/ipmi.pm
+++ b/Osstest/PDU/ipmi.pm
@@ -69,10 +69,10 @@  sub pdu_power_state {
     my $count = 60;
     for (;;) {
         last if $getstatus->() eq $onoff;
+        die "did not power $onoff" unless --$count > 0;
+        sleep(1);
 
 	system_checked((@cmd, qw(power), $onoff));
-
-        die "did not power $onoff" unless --$count > 0;
         sleep(1);
     }
 }