[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 3/5] PowerMethod: New "nest" psuedo-method



If specified as the first method, it means to reverse the order when
powering off.

There don't seem to be any docs for PowerMethod, so I have not
documented this right now.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 79737ea..ad877e2 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -920,7 +920,11 @@ sub power_cycle_host_setup ($) {
     my ($ho) = @_;
     my $methobjs = [ ];
     foreach my $meth (split /\;\s*/, ($ho->{Power} // 'unsupported')) {
-       push @$methobjs, get_host_method_object($ho,'PDU',$meth);
+        if ($meth eq 'nest') {
+            push @$methobjs, $meth;
+        } else {
+            push @$methobjs, get_host_method_object($ho,'PDU',$meth);
+        }
     }
     $ho->{PowerMethobjs} = $methobjs;
 }
@@ -946,7 +950,12 @@ sub power_cycle ($) {
 sub power_state ($$) {
     my ($ho, $on) = @_;
     logm("power: setting $on for $ho->{Name}");
-    foreach my $mo (@{ $ho->{PowerMethobjs} }) {
+    my @methobjs = @{ $ho->{PowerMethobjs} };
+    if ($methobjs[0] eq 'nest') {
+        shift @methobjs;
+        @methobjs = reverse @methobjs if !$on;
+    }
+    foreach my $mo (@methobjs) {
        $mo->pdu_power_state($on);
     }
 }
-- 
2.1.4


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.