All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com
Cc: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Subject: [PATCH RFC OSSTEST 3/9] Toolstack: use get_host_method_object() to manage toolstack selection
Date: Tue, 17 Jun 2014 16:26:21 +0100	[thread overview]
Message-ID: <1403018787-25442-3-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1403018758.25074.5.camel@kazak.uk.xensource.com>#>

This will allow us to more easily have per-toolstack methods etc.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm       | 37 ++++---------------------------------
 Osstest/Toolstack/libvirt.pm | 34 ++++++++++++++++++++++++++++++++++
 Osstest/Toolstack/xend.pm    | 35 +++++++++++++++++++++++++++++++++++
 Osstest/Toolstack/xl.pm      | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 108 insertions(+), 33 deletions(-)
 create mode 100644 Osstest/Toolstack/libvirt.pm
 create mode 100644 Osstest/Toolstack/xend.pm
 create mode 100644 Osstest/Toolstack/xl.pm

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 1377610..6129e9e 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1810,42 +1810,13 @@ sub guest_vncsnapshot_stash ($$$$) {
     target_getfile_root($ho,100, "$rfile", "$stash/$leaf");
 }
 
-our %toolstacks=
-    ('xend' => {
-        NewDaemons => [qw(xend)],
-        OldDaemonInitd => 'xend',
-        Command => 'xm',
-        CfgPathVar => 'cfgpath',
-        Dom0MemFixed => 1,
-        },
-     'xl' => {
-        NewDaemons => [],
-        Dom0MemFixed => 1,
-        Command => 'xl',
-        CfgPathVar => 'cfgpath',
-	RestoreNeedsConfig => 1,
-        },
-     'libvirt' => {
-        NewDaemons => [qw(libvirtd)],
-        Dom0MemFixed => 1,
-        Command => 'virsh',
-        ExtraPackages => [qw(libnl1 libavahi-client3)],
-        },
-     );
-
 sub toolstack ($) {
     my ($ho) = @_;
     return $ho->{Toolstack} if $ho->{Toolstack};
-    my $tsname= $r{toolstack};
-    $tsname= 'xend' if !defined $tsname;
-    my $ts= $toolstacks{$tsname};
-    die "$tsname ?" unless defined $ts;
-    if (!exists $ts->{Name}) {
-        logm("toolstack $tsname");
-        $ts->{Name}= $tsname;
-    }
-    $ho->{Toolstack} = $ts;
-    return $ts;
+
+    my $tsname= $r{toolstack} || 'xend';
+    $ho->{Toolstack}= get_host_method_object($ho, 'Toolstack', $tsname);
+    return $ho->{Toolstack};
 }
 
 sub authorized_keys () {
diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
new file mode 100644
index 0000000..90fe434
--- /dev/null
+++ b/Osstest/Toolstack/libvirt.pm
@@ -0,0 +1,34 @@
+# 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::Toolstack::libvirt;
+
+use strict;
+use warnings;
+
+sub new {
+    my ($class, $ho, $methname,$asset) = @_;
+    return bless { Name => "libvirt",
+		   Host => $ho,
+		   NewDaemons => [qw(libvirtd)],
+		   Dom0MemFixed => 1,
+		   Command => 'virsh',
+		   ExtraPackages => [qw(libnl1 libavahi-client3)],
+    }, $class;
+}
+
+1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
new file mode 100644
index 0000000..881417d
--- /dev/null
+++ b/Osstest/Toolstack/xend.pm
@@ -0,0 +1,35 @@
+# 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::Toolstack::xend;
+
+use strict;
+use warnings;
+
+sub new {
+    my ($class, $ho, $methname,$asset) = @_;
+    return bless { Name => "xend",
+		   Host => $ho,
+		   NewDaemons => [qw(xend)],
+		   OldDaemonInitd => 'xend',
+		   Command => 'xm',
+		   CfgPathVar => 'cfgpath',
+		   Dom0MemFixed => 1,
+    }, $class;
+}
+
+1;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
new file mode 100644
index 0000000..0b66201
--- /dev/null
+++ b/Osstest/Toolstack/xl.pm
@@ -0,0 +1,35 @@
+# 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::Toolstack::xl;
+
+use strict;
+use warnings;
+
+sub new {
+    my ($class, $ho, $methname,$asset) = @_;
+    return bless { Name => "xl",
+		   Host => $ho,
+		   NewDaemons => [],
+		   Dom0MemFixed => 1,
+		   Command => 'xl',
+		   CfgPathVar => 'cfgpath',
+		   RestoreNeedsConfig => 1,
+    }, $class;
+}
+
+1;
-- 
1.9.0

  parent reply	other threads:[~2014-06-17 15:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs Ian Campbell
2014-06-17 15:28   ` Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 2/9] Pass host to toolstack() Ian Campbell
2014-06-17 15:26 ` Ian Campbell [this message]
2014-06-17 15:26 ` [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 5/9] TestSupport: guest_create takes a $ho Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 8/9] Toolstack: Refactor consolecmd handling Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 9/9] Toolstack: refactor shutdown support Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 2/9] Pass host to toolstack() Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 3/9] Toolstack: use get_host_method_object() to manage toolstack selection Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 5/9] TestSupport: guest_create takes a $ho Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle Ian Campbell
2014-06-17 16:45   ` Dario Faggioli
2014-06-17 16:56     ` Ian Campbell
2014-06-23 21:01       ` Jim Fehlig
2014-06-17 15:26 ` [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check Ian Campbell
2014-06-17 15:33   ` Ian Campbell
2014-06-23 21:28     ` Jim Fehlig
2014-06-24 11:06       ` Ian Campbell
2014-06-25  3:18       ` Jim Fehlig
     [not found]       ` <53AA3F89.6050904@suse.com>
2014-06-25 12:38         ` Ian Campbell
2014-06-25 15:25           ` Jim Fehlig
2014-06-25 16:37             ` Ian Campbell
     [not found]             ` <1403714245.16595.1.camel@kazak.uk.xensource.com>
2014-06-25 18:18               ` Jim Fehlig
2014-06-17 15:26 ` [PATCH RFC OSSTEST 8/9] Toolstack: Refactor consolecmd handling Ian Campbell
2014-06-17 15:26 ` [PATCH RFC OSSTEST 9/9] Toolstack: refactor shutdown support Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403018787-25442-3-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.