From patchwork Tue Jun 17 15:26:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 32071 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A05C02100C for ; Tue, 17 Jun 2014 15:28:18 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id a13sf16448076igq.8 for ; Tue, 17 Jun 2014 08:28:18 -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:from:to:date:message-id:in-reply-to :references: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=eRxjg2iLX2LlnW4Fy7LUsrbDFuXg0KICVOcag+TF0Yw=; b=eW6UPl2CpT4otSaSApl2CrsmuTAZ8cw16lZwcJLfvvk4jWlMA/X6BJXSZK4Tp+mAHZ XdItoARtqL+zbpttidhlChoIsSz9b1LQ2SDNzldv1I6F6ALI6JsSUoX3ahKizuu7KUfb Hqz5zVwlWBqM4fXcaHnzX9j6+9Mx14g5qGM8tVVQ/gNgTdEGc7OImqMfcEnFF5UG6qCp m4gBjPKu2t9yAr/CR6Ga3+iVZ5xpKBx9DKnhMplMyAt4G2zMTzyUQvKEukt6mQlbsz0R 8u0t/VUvwGM46e3J+Nv8Bl5u+G3J3Lu5MYO4SbOVsbxww93cznALCP2XtrRitgloRo7j 2X6A== X-Gm-Message-State: ALoCoQn/r6lOm/smRZavfYjFcRTyTFA20lbBImmfKg88y8w/1Fy+wanYpeK+0zamgIDuNo3LQM4U X-Received: by 10.43.68.76 with SMTP id xx12mr2061691icb.6.1403018898267; Tue, 17 Jun 2014 08:28:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.148 with SMTP id r20ls2066008qgd.12.gmail; Tue, 17 Jun 2014 08:28:18 -0700 (PDT) X-Received: by 10.52.29.236 with SMTP id n12mr6549511vdh.38.1403018898159; Tue, 17 Jun 2014 08:28:18 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id o6si1786297vek.62.2014.06.17.08.28.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Jun 2014 08:28:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id il7so6716719vcb.27 for ; Tue, 17 Jun 2014 08:28:18 -0700 (PDT) X-Received: by 10.58.68.129 with SMTP id w1mr1001148vet.49.1403018898075; Tue, 17 Jun 2014 08:28:18 -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 vs6csp218001vcb; Tue, 17 Jun 2014 08:28:17 -0700 (PDT) X-Received: by 10.52.241.98 with SMTP id wh2mr6789751vdc.37.1403018897493; Tue, 17 Jun 2014 08:28:17 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id fa1si5608699vcb.39.2014.06.17.08.28.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Jun 2014 08:28:17 -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 1WwvHo-0006OU-TI; Tue, 17 Jun 2014 15:27:00 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwvHl-0006Gn-Gq for xen-devel@lists.xen.org; Tue, 17 Jun 2014 15:26:57 +0000 Received: from [193.109.254.147:4376] by server-8.bemta-14.messagelabs.com id D7/8F-01877-F3E50A35; Tue, 17 Jun 2014 15:26:55 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1403018813!11894048!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10978 invoked from network); 17 Jun 2014 15:26:55 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-13.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 17 Jun 2014 15:26:55 -0000 X-IronPort-AV: E=Sophos;i="5.01,494,1400025600"; d="scan'208";a="144521866" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 17 Jun 2014 15:26:51 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Tue, 17 Jun 2014 11:26:50 -0400 Received: from kazak.uk.xensource.com ([10.80.2.80] helo=kazak.uk.xensource.com.) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WwvHe-00010t-7A; Tue, 17 Jun 2014 16:26:50 +0100 From: Ian Campbell To: Date: Tue, 17 Jun 2014 16:26:46 +0100 Message-ID: <1403018809-25509-6-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1403018758.25074.5.camel@kazak.uk.xensource.com> References: <1403018758.25074.5.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle. 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.182 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: Implement destory/create as per toolstack methods, including implementing the libvirt version which previously didn't work. To do this we use the virsh capability to convert an xl/xm style config file into the correct XML. xend basically calls into the xl helper since they are compatible. Signed-off-by: Ian Campbell --- Osstest/TestSupport.pm | 5 ++--- Osstest/Toolstack/libvirt.pm | 19 +++++++++++++++++++ Osstest/Toolstack/xend.pm | 4 ++++ Osstest/Toolstack/xl.pm | 10 ++++++++++ ts-guest-saverestore | 2 +- ts-guest-start | 4 +--- ts-windows-install | 7 +------ 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 1444629..e93687b 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -1274,13 +1274,12 @@ sub guest_await_reboot ($$$) { sub guest_destroy ($$) { my ($ho,$gho) = @_; - target_cmd_root($ho, toolstack($ho)->{Command}." destroy $gho->{Name}", 40); + toolstack($ho)->destroy($gho->{Name}); } sub guest_create ($$) { my ($ho,$gho) = @_; - my $ts= toolstack($ho); - target_cmd_root($ho, $ts->{Command}." create $gho->{CfgPath}", 100); + toolstack($ho)->create($gho->{CfgPath}); } diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm index 90fe434..c1d2b09 100644 --- a/Osstest/Toolstack/libvirt.pm +++ b/Osstest/Toolstack/libvirt.pm @@ -20,15 +20,34 @@ package Osstest::Toolstack::libvirt; use strict; use warnings; +use Osstest::TestSupport; + sub new { my ($class, $ho, $methname,$asset) = @_; return bless { Name => "libvirt", Host => $ho, NewDaemons => [qw(libvirtd)], Dom0MemFixed => 1, + CfgPathVar => 'cfgpath', Command => 'virsh', ExtraPackages => [qw(libnl1 libavahi-client3)], }, $class; } +sub destroy ($$) { + my ($self,$gn) = @_; + target_cmd_root($self->{Host}, "virsh destroy $gn", 40); +} + +sub create ($$) { + my ($self,$cfg) = @_; + my $ho = $self->{Host}; + my $lcfg = $cfg; + $lcfg =~ s,/,-,g; + $lcfg = "$ho->{Name}--$lcfg"; + target_cmd_root($ho, "virsh domxml-from-native xen-xm $cfg > $cfg.xml", 30); + target_getfile_root($ho,60,"$cfg.xml", "$stash/$lcfg"); + target_cmd_root($ho, "virsh create --file $cfg.xml", 100); +} + 1; diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm index 881417d..4f093bc 100644 --- a/Osstest/Toolstack/xend.pm +++ b/Osstest/Toolstack/xend.pm @@ -19,6 +19,7 @@ package Osstest::Toolstack::xend; use strict; use warnings; +use Osstest::Toolstack::xl; sub new { my ($class, $ho, $methname,$asset) = @_; @@ -32,4 +33,7 @@ sub new { }, $class; } +sub destroy { return Osstest::Toolstack::xl::destroy(@_); } +sub create { return Osstest::Toolstack::xl::create(@_); } + 1; diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm index 0b66201..ca46094 100644 --- a/Osstest/Toolstack/xl.pm +++ b/Osstest/Toolstack/xl.pm @@ -32,4 +32,14 @@ sub new { }, $class; } +sub destroy ($$) { + my ($self,$gn) = @_; + target_cmd_root($self->{Host}, $self->{_Command}." destroy $gn", 40); +} + +sub create ($$) { + my ($self,$cfg) = @_; + target_cmd_root($self->{Host}, $self->{_Command}." create $cfg", 100); +} + 1; diff --git a/ts-guest-saverestore b/ts-guest-saverestore index 9e04ae9..8911aed 100755 --- a/ts-guest-saverestore +++ b/ts-guest-saverestore @@ -38,7 +38,7 @@ sub restore () { toolstack($ho)->{Command} ." restore " .(toolstack($ho)->{RestoreNeedsConfig} ? - $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} } : '') + $gho->{CfgPath} : '') ." image", 200); target_ping_check_up($gho); } diff --git a/ts-guest-start b/ts-guest-start index bfbb734..fb6a174 100755 --- a/ts-guest-start +++ b/ts-guest-start @@ -26,9 +26,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV); sub start () { guest_umount_lv($ho, $gho); - my $cmd= toolstack($ho)->{Command}." create ". - $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} }; - target_cmd_root($ho, $cmd, 30); + toolstack($ho)->create($r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} }); } sub checkstart () { diff --git a/ts-windows-install b/ts-windows-install index 4b06310..f12a4f4 100755 --- a/ts-windows-install +++ b/ts-windows-install @@ -49,13 +49,8 @@ END store_runvar("$gho->{Guest}_pingbroken", 1); } -sub start () { - target_cmd_root($ho, toolstack($ho)->{Command}. - " create $gho->{CfgPath}", 100); -} - prep(); -start(); +guest_create($ho,$gho); guest_await_dhcp_tcp($gho,7000); guest_check_up($gho);