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

[Xen-devel] [PATCH OSSTEST] Implement direct IPMI power control. (Was: Re: [xen-unstable test] 27133: regressions - trouble: broken/fail/pass)



On Mon, 2014-06-16 at 04:25 +0100, xen.org wrote:

>  test-armhf-armhf-xl           3 host-install(3)         broken REGR. vs. 
> 26701
>  test-armhf-armhf-libvirt      3 host-install(3)         broken REGR. vs. 
> 26701

xenuse is broken *again*:

        2014-06-15 03:34:56 Z power: setting 0 for marilith-n5
        2014-06-15 03:34:56 Z XenUse overriding $USER to osstest
        Traceback (most recent call last):
          File "/usr/groups/xenrt/production/share/control/xenrt", line 3454, 
in <module>
            rc = com.run(sys.argv[1], sys.argv[2:])
          File "/usr/groups/xenrt/production/share/control/xenrt", line 3401, 
in run
            return self.commands[command].dispatch(args, raw=self.raw)
          File "/usr/groups/xenrt/production/share/control/xenrt", line 101, in 
dispatch
            results = self.run(args)
          File "/usr/groups/xenrt/production/share/control/xenrt", line 3135, 
in run
            proxies=self.proxies)
          File "/usr/groups/xenrt/production/share/control/xenrt", line 52, in 
urlopen_with_retry
            raise e
        Exception: Invalid HTTP resonse code
        
-----8<-----------------------------

From c7bf53f3d1e1b32587df6a74b647d799054bfcdc Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Mon, 16 Jun 2014 09:51:21 +0100
Subject: [PATCH] Implement direct IPMI power control.

The xenuse module currently used to control some machines (specifically the ARM
marilith machines) is unreliable and subject to breakages on the xenrt server
side.

Since xenuse/xenrt is just wrapping IPMI for these machines implement direct
control via a new Osstest::PDI::impi module.

This is distinct from the existing impiextra (arbitrary ipmi commands on power
status change) because IPMI power control is not idempotent, therefore it is
necessary to query the current status before turning the machine on or off.

After this change the correct power method for a marilith node is:
    ipmiextra on marilith-n0-mgmt.uk.xensource.com <user> <pass> chassis 
bootdev pxe;ipmi marilith-n0-mgmt.uk.xensource.com <user> <pass>

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
Ian, when we discussed this on IRC you expressed a preference for using
freeipmitools, but since the existing ipmiextra module uses ipmitool I figured
it would be better to be consistent.
---
 Osstest/PDU/ipmi.pm | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Osstest/PDU/ipmi.pm

diff --git a/Osstest/PDU/ipmi.pm b/Osstest/PDU/ipmi.pm
new file mode 100644
index 0000000..45d2946
--- /dev/null
+++ b/Osstest/PDU/ipmi.pm
@@ -0,0 +1,67 @@
+# 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::ipmi;
+
+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, $mgmt, $user, $pass, @opts) = @_;
+    return bless { Host => $ho,
+                  Mgmt => $mgmt,
+                  User => $user,
+                  Pass => $pass,
+                  Opts => \@opts }, $class;
+}
+
+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 $status = `$cmd power status`
+       or die "Cannot retrieve current power status";
+    chop($status);
+    logm("$status (want $onoff)");
+    $status =~ s/^Chassis Power is (on|off)$/$1/
+       or die "Cannot parse current power status: $status";
+
+    if ( $status eq $onoff ) {
+       logm("Current power status is correct");
+       return;
+    }
+
+    system_checked("$cmd power $onoff")
+}
+
+1;
-- 
1.9.0




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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