From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [OSSTEST PATCH 14/26] Nested hosts: Provide PDU power method Date: Fri, 25 Sep 2015 20:15:10 +0100 Message-ID: <1443208522-24905-6-git-send-email-ian.jackson@eu.citrix.com> References: <1443181028-22705-1-git-send-email-ian.jackson@eu.citrix.com> <1443208522-24905-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZfYT2-0001Lc-UP for xen-devel@lists.xenproject.org; Fri, 25 Sep 2015 19:15:37 +0000 In-Reply-To: <1443208522-24905-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Robert Ho , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org From: Robert Ho This `guest' power method uses VM create/destroy. It is automatically used for nested hosts. It would not make much sense to configure it manually. For nested host/guest, its power on/off method shall be its host invoke $(toolstack)->create/destroy method. XXX Missing Signed-off-by from Robert Hu Signed-off-by: Ian Jackson --- v14: Mostly rewritten by iwj --- Osstest/PDU/guest.pm | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ Osstest/TestSupport.pm | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100755 Osstest/PDU/guest.pm diff --git a/Osstest/PDU/guest.pm b/Osstest/PDU/guest.pm new file mode 100755 index 0000000..b6bf9a1 --- /dev/null +++ b/Osstest/PDU/guest.pm @@ -0,0 +1,59 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2015 Intel. +# +# 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::guest; + +use strict; +use warnings; +use Switch; + +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) = @_; + return bless { Target => $ho }, $class; +} + +sub pdu_power_state { + my ($mo, $on) = @_; + + my $child = $mo->{Target}; + my $parent = $child->{Host}; + die "$child->{Name} ?" unless $parent; + + logm("power $child->{Name} nested on $parent->{Name} ".($on+0)); + if ($on) { + toolstack($parent)->create($child); + } else { + toolstack($parent)->destroy($child); + } +} + +1; diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 9b10602..3025c9f 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -855,7 +855,7 @@ sub selecthost ($) { $child->{Info} = [ "in", $parent->{Name}, @{ $parent->{Info} } ]; $child->{NestingLevel} = $parent->{NestingLevel}+1; - # $child->{Power} = 'guest'; todo + $child->{Power} = 'guest'; power_cycle_host_setup($child); $child->{Properties}{Serial} = 'noop'; # todo -- 1.7.10.4