From patchwork Mon Jun 16 08:59:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 31923 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 14D9B206A0 for ; Mon, 16 Jun 2014 09:00:42 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id t59sf25405895yho.10 for ; Mon, 16 Jun 2014 02:00:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:from:to:date:in-reply-to :references:organization:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=y5ZvbDbWnmF9zPPlGXqtfI3UubivVXxWabgpoSraJNk=; b=UVwxhofp4DvWyHp8+D4YnQFoJyy27PBLMqS9p9QDD5m1h8PU15SsSeyWdt5sNscC34 DklcLDwsV4W0WraStilKI27RhqDe+gt4a48uE9ecA068TUgN4YhDO6zldwtCAqsfZMu6 qf1QWN7vx0Lrgi6IUOhi6/T9mgYKrGaVlDp8wSw6yRH18/s0W5pFSmFTJnGqY/g6RL7H jRd8/zenW79Rd8E135Iwvh7b4UNZa0EF6S+k9YHFU4pLXz1ZIiyQ4UzWPCQypZoXT370 Y7GkC9IlEeHXWklKVC/SO69A6vXHfWxIEwRUgC7woHOt5Lf7WZ7FhgtRrLNmFM3jVPHp t5DA== X-Gm-Message-State: ALoCoQk1ClqfeSh2rrIC+qJorcFWEO/qXFlrz5bAzmE9u10nYvbRyceLcGMnoad+DwphFfCAQ4gK X-Received: by 10.236.2.162 with SMTP id 22mr1439944yhf.26.1402909241846; Mon, 16 Jun 2014 02:00:41 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.17.19 with SMTP id 19ls4262881qgc.69.gmail; Mon, 16 Jun 2014 02:00:41 -0700 (PDT) X-Received: by 10.52.189.161 with SMTP id gj1mr12835912vdc.2.1402909241737; Mon, 16 Jun 2014 02:00:41 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id c14si3864872vej.48.2014.06.16.02.00.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 02:00:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so4564240vcb.2 for ; Mon, 16 Jun 2014 02:00:41 -0700 (PDT) X-Received: by 10.221.29.137 with SMTP id ry9mr15408030vcb.6.1402909241616; Mon, 16 Jun 2014 02:00:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp119825vcb; Mon, 16 Jun 2014 02:00:41 -0700 (PDT) X-Received: by 10.229.234.67 with SMTP id kb3mr24404219qcb.6.1402909241002; Mon, 16 Jun 2014 02:00:41 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id hx1si11978518qcb.25.2014.06.16.02.00.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 02:00:40 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwSlF-0005P3-6s; Mon, 16 Jun 2014 08:59:29 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwSlD-0005Ox-LR for xen-devel@lists.xensource.com; Mon, 16 Jun 2014 08:59:27 +0000 Received: from [85.158.137.68:43665] by server-2.bemta-3.messagelabs.com id 3F/2D-23530-EE1BE935; Mon, 16 Jun 2014 08:59:26 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1402909164!10308174!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12799 invoked from network); 16 Jun 2014 08:59:25 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 16 Jun 2014 08:59:25 -0000 X-IronPort-AV: E=Sophos;i="5.01,485,1400025600"; d="scan'208";a="143662095" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 16 Jun 2014 08:59:24 +0000 Received: from kazak.uk.xensource.com (10.80.2.80) by FTLPEX01CL03.citrite.net (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Mon, 16 Jun 2014 04:59:23 -0400 Message-ID: <1402909162.9560.2.camel@kazak.uk.xensource.com> From: Ian Campbell To: xen.org Date: Mon, 16 Jun 2014 09:59:22 +0100 In-Reply-To: References: Organization: Citrix Systems, Inc. X-Mailer: Evolution 3.12.2-1 MIME-Version: 1.0 X-Originating-IP: [10.80.2.80] X-DLP: MIA1 Cc: xen-devel@lists.xensource.com Subject: [Xen-devel] [PATCH OSSTEST] Implement direct IPMI power control. (Was: Re: [xen-unstable test] 27133: regressions - trouble: broken/fail/pass) X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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 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 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 chassis bootdev pxe;ipmi marilith-n0-mgmt.uk.xensource.com Signed-off-by: Ian Campbell --- 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 . + +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;