xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [OSSTEST PATCH 1/4] PDU: ipmi: Use arrays rather than strings for cmd
@ 2018-07-11 14:54 Ian Jackson
  2018-07-11 14:54 ` [OSSTEST PATCH 2/4] PDU: pause: Honour OSSTEST_PDU_NOPAUSE Ian Jackson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ian Jackson @ 2018-07-11 14:54 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

This allows arguments with spaces, etc.

No functional change with the existing configurations I know about.
It would be good to fix this before any configurations are created
where this would make a difference...

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/PDU/ipmi.pm | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Osstest/PDU/ipmi.pm b/Osstest/PDU/ipmi.pm
index dbf211f..f3a50c9 100644
--- a/Osstest/PDU/ipmi.pm
+++ b/Osstest/PDU/ipmi.pm
@@ -49,11 +49,17 @@ sub pdu_power_state {
     my ($mo, $on) = @_;
     my $onoff= $on ? "on" : "off";
 
-    my $cmd = "ipmitool -H $mo->{Mgmt} -U $mo->{User} -P $mo->{Pass}";
+    my @cmd = (qw(ipmitool -H), $mo->{Mgmt},
+               '-U',$mo->{User}, '-P',$mo->{Pass});
 
     my $getstatus = sub {
-        my $status = `$cmd power status`
-            or die "Cannot retrieve current power status";
+        my @scmd = (@cmd, qw(power status));
+        logm("PDU IMPI: @scmd");
+        open IPMI, "-|", @scmd or die $!;
+        my $status = do { local $/=undef; <IPMI>; };
+        $?=0; $!=0;
+        close IPMI and $status or
+            die "Cannot retrieve current power status ($? $!)";
         chomp($status);
         logm("$status (want $onoff)");
         $status =~ s/^Chassis Power is (on|off)$/$1/
@@ -66,7 +72,7 @@ sub pdu_power_state {
 	return;
     }
 
-    system_checked("$cmd power $onoff");
+    system_checked((@cmd, qw(power), $onoff));
 
     my $count = 60;
     for (;;) {
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [OSSTEST PATCH 2/4] PDU: pause: Honour OSSTEST_PDU_NOPAUSE
  2018-07-11 14:54 [OSSTEST PATCH 1/4] PDU: ipmi: Use arrays rather than strings for cmd Ian Jackson
@ 2018-07-11 14:54 ` Ian Jackson
  2018-07-11 14:54 ` [OSSTEST PATCH 3/4] PDU: ipmi: Only log the first cmd run Ian Jackson
  2018-07-11 14:54 ` [OSSTEST PATCH 4/4] PDU: ipmi: Pass further options to ipmitool Ian Jackson
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2018-07-11 14:54 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

For debugging.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/PDU/pause.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Osstest/PDU/pause.pm b/Osstest/PDU/pause.pm
index 9e839c6..b5f0322 100644
--- a/Osstest/PDU/pause.pm
+++ b/Osstest/PDU/pause.pm
@@ -46,6 +46,7 @@ sub new {
 
 sub pdu_power_state {
     my ($mo, $on) = @_;
+    return if $ENV{OSSTEST_PDU_NOPAUSE};
     my $delay = $mo->[!!$on];
     logm("power: pdu operation pausing for ${delay}s");
     sleep $delay;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [OSSTEST PATCH 3/4] PDU: ipmi: Only log the first cmd run
  2018-07-11 14:54 [OSSTEST PATCH 1/4] PDU: ipmi: Use arrays rather than strings for cmd Ian Jackson
  2018-07-11 14:54 ` [OSSTEST PATCH 2/4] PDU: pause: Honour OSSTEST_PDU_NOPAUSE Ian Jackson
@ 2018-07-11 14:54 ` Ian Jackson
  2018-07-11 14:54 ` [OSSTEST PATCH 4/4] PDU: ipmi: Pass further options to ipmitool Ian Jackson
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2018-07-11 14:54 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

This quietens the output again.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/PDU/ipmi.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Osstest/PDU/ipmi.pm b/Osstest/PDU/ipmi.pm
index f3a50c9..b6621db 100644
--- a/Osstest/PDU/ipmi.pm
+++ b/Osstest/PDU/ipmi.pm
@@ -50,11 +50,12 @@ sub pdu_power_state {
     my $onoff= $on ? "on" : "off";
 
     my @cmd = (qw(ipmitool -H), $mo->{Mgmt},
-               '-U',$mo->{User}, '-P',$mo->{Pass});
+
+    my $cmd_logged;
 
     my $getstatus = sub {
         my @scmd = (@cmd, qw(power status));
-        logm("PDU IMPI: @scmd");
+        logm("PDU IMPI: @scmd") unless $cmd_logged++;
         open IPMI, "-|", @scmd or die $!;
         my $status = do { local $/=undef; <IPMI>; };
         $?=0; $!=0;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [OSSTEST PATCH 4/4] PDU: ipmi: Pass further options to ipmitool
  2018-07-11 14:54 [OSSTEST PATCH 1/4] PDU: ipmi: Use arrays rather than strings for cmd Ian Jackson
  2018-07-11 14:54 ` [OSSTEST PATCH 2/4] PDU: pause: Honour OSSTEST_PDU_NOPAUSE Ian Jackson
  2018-07-11 14:54 ` [OSSTEST PATCH 3/4] PDU: ipmi: Only log the first cmd run Ian Jackson
@ 2018-07-11 14:54 ` Ian Jackson
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2018-07-11 14:54 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

This is useful, for example, for passing `-I lanplus'.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/PDU/ipmi.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Osstest/PDU/ipmi.pm b/Osstest/PDU/ipmi.pm
index b6621db..d411d97 100644
--- a/Osstest/PDU/ipmi.pm
+++ b/Osstest/PDU/ipmi.pm
@@ -50,6 +50,8 @@ sub pdu_power_state {
     my $onoff= $on ? "on" : "off";
 
     my @cmd = (qw(ipmitool -H), $mo->{Mgmt},
+               '-U',$mo->{User}, '-P',$mo->{Pass},
+               @{ $mo->{Opts} });
 
     my $cmd_logged;
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-11 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-11 14:54 [OSSTEST PATCH 1/4] PDU: ipmi: Use arrays rather than strings for cmd Ian Jackson
2018-07-11 14:54 ` [OSSTEST PATCH 2/4] PDU: pause: Honour OSSTEST_PDU_NOPAUSE Ian Jackson
2018-07-11 14:54 ` [OSSTEST PATCH 3/4] PDU: ipmi: Only log the first cmd run Ian Jackson
2018-07-11 14:54 ` [OSSTEST PATCH 4/4] PDU: ipmi: Pass further options to ipmitool Ian Jackson

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).