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

[Xen-devel] [OSSTEST PATCH 4/5] PowerMethod: New pause functionality



And, an abbreviation for invoking it: just writing numbers (or
<on>/<off> pair of numbers).

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/PDU/pause.pm   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 Osstest/TestSupport.pm |  3 +++
 2 files changed, 52 insertions(+)
 create mode 100644 Osstest/PDU/pause.pm

diff --git a/Osstest/PDU/pause.pm b/Osstest/PDU/pause.pm
new file mode 100644
index 0000000..b1160c0
--- /dev/null
+++ b/Osstest/PDU/pause.pm
@@ -0,0 +1,49 @@
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2014 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+package Osstest::PDU::pause;
+
+use strict;
+use warnings;
+
+use Osstest;
+use Osstest::TestSupport;
+use IO::File;
+
+BEGIN {
+    use Exporter ();
+    our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+    $VERSION     = 1.00;
+    @ISA         = qw(Exporter);
+    @EXPORT      = qw();
+    %EXPORT_TAGS = ( );
+
+    @EXPORT_OK   = qw();
+}
+
+sub new {
+    my ($class, $ho, $methname, $on, $off) = @_;
+    return bless [ $off, $on ], $class;
+}
+
+sub pdu_power_state {
+    my ($mo, $on) = @_;
+    my $delay = $mo->[!!$on];
+    logm("power: pdu operation pausing for ${delay}s");
+    sleep $delay;
+}
+
+1;
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index ad877e2..004e644 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -922,6 +922,9 @@ sub power_cycle_host_setup ($) {
     foreach my $meth (split /\;\s*/, ($ho->{Power} // 'unsupported')) {
         if ($meth eq 'nest') {
             push @$methobjs, $meth;
+        } elsif ($meth =~ m{^(\d+)(?:/(\d+))$}) {
+            require Osstest::PDU::pause;
+            push @$methobjs, new Osstest::PDU::pause $ho, 'pause', $1, $2//$1;
         } else {
             push @$methobjs, get_host_method_object($ho,'PDU',$meth);
         }
-- 
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®.