[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 14/26] Nested hosts: Provide PDU power method
From: Robert Ho <robert.hu@xxxxxxxxx> 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 <Ian.Jackson@xxxxxxxxxxxxx> --- 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 <http://www.gnu.org/licenses/>. + + +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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |