]> xenbits.xensource.com Git - osstest.git/commitdiff
power handling: Break out power_cycle_parse_method
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 22 Jan 2019 10:51:03 +0000 (10:51 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Thu, 24 Jan 2019 18:20:37 +0000 (18:20 +0000)
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/TestSupport.pm

index 29108423313e837fb70069d5c0083726c0aa1052..68b51728a46b232bc5a30a3a1e08f3d6966e65ac 100644 (file)
@@ -917,10 +917,10 @@ sub serial_fetch_logs ($) {
 
 #---------- power cycling ----------
 
-sub power_cycle_host_setup ($) {
-    my ($ho) = @_;
+sub power_cycle_parse_method ($$) {
+    my ($ho, $spec) = @_;
     my $methobjs = [ ];
-    foreach my $meth (split /\;\s*/, ($ho->{Power} // 'unsupported')) {
+    foreach my $meth (split /\;\s*/, $spec) {
         if ($meth eq 'nest') {
             push @$methobjs, $meth;
         } elsif ($meth =~ m{^(\d+)(?:/(\d+))$}) {
@@ -930,7 +930,13 @@ sub power_cycle_host_setup ($) {
             push @$methobjs, get_host_method_object($ho,'PDU',$meth);
         }
     }
-    $ho->{PowerMethobjs} = $methobjs;
+    return $methobjs;
+}
+
+sub power_cycle_host_setup ($) {
+    my ($ho) = @_;
+    $spec = ($ho->{Power} // 'unsupported');
+    $ho->{PowerMethobjs} = power_cycle_parse_method($ho,$spec);
 }
 
 sub power_cycle_sleep ($) {