All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC OSSTEST 0/9] implement for virsh
@ 2014-06-17 15:25 Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs Ian Campbell
                   ` (17 more replies)
  0 siblings, 18 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:25 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Jim Fehlig, xen-devel


The following series switches osstest to implement the toolstack via
get_host_method_object()->method rather than toolstack()->{Command}."
method" etc.

This is needed because virsh differs from xm/xl in a few commands.

It also implements partial virsh support (simple lifecycle stuff, but
not e.g. migration yet).

The intention is to eventually remove ->{Command} from view but I'm
sending this out now as an RFC before I complete this to get some
feedback on the approach. So a) ->{Command} is still there and used and b)
some of the libvirt.pm methods are just "die".

In particular I suspect there is a more Perl-ish way to implement the
fallback from xend to share the xl code, Ian?

Ian.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
@ 2014-06-17 15:26 ` 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
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 ts-logs-capture | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ts-logs-capture b/ts-logs-capture
index 3ccfc00..ae32883 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -117,6 +117,9 @@ sub fetch_logs_host_guests () {
                   /var/log/xen/osstest*
                   /var/log/xen/xenstored*
 
+                  /var/log/libvirt/libvirtd.log
+                  /var/log/libvirt/libxl/*
+
                   /var/run/xenstored*
                   /var/log/xenstored*
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 2/9] Pass host to toolstack()
  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:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 3/9] Toolstack: use get_host_method_object() to manage toolstack selection Ian Campbell
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

This will be needed in a future patch.

Everywhere already has a $ho in hand. Also cache the answer as
$ho->{Toolstack}.

I scanned the source with:
    find -name \*.pm -exec perl -c {} \;
    for i in ts-* ; do perl -c $i; done
which reported "Not enough arguments for Osstest::TestSupport::toolstack" for
each callsite which needed changing.

Also don't pass the toolstack command name directly to host_get_free_memory().
Look it up instead.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm   | 16 ++++++++++------
 ts-debian-fixup          |  2 +-
 ts-debian-hvm-install    |  4 ++--
 ts-guest-localmigrate    |  2 +-
 ts-guest-migrate         |  2 +-
 ts-guest-saverestore     |  8 ++++----
 ts-guest-start           |  4 ++--
 ts-guest-stop            |  2 +-
 ts-logs-capture          |  2 +-
 ts-migrate-support-check |  4 ++--
 ts-redhat-install        |  2 +-
 ts-windows-install       |  2 +-
 ts-xen-install           | 10 +++++-----
 13 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index bad0458..1377610 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -922,8 +922,9 @@ sub host_reboot ($) {
     });
 }
 
-sub host_get_free_memory($$) {
-    my ($ho,$toolstack) = @_;
+sub host_get_free_memory($) {
+    my ($ho) = @_;
+    my $toolstack = toolstack($ho)->{Command};
     # The line is as followed:
     # free_memory       :   XXXX
     my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1266,7 +1267,7 @@ sub guest_await_reboot ($$$) {
 
 sub guest_destroy ($$) {
     my ($ho,$gho) = @_;
-    target_cmd_root($ho, toolstack()->{Command}." destroy $gho->{Name}", 40);
+    target_cmd_root($ho, toolstack($ho)->{Command}." destroy $gho->{Name}", 40);
 }
 
 sub guest_create ($$) {
@@ -1557,7 +1558,7 @@ sub guest_check_up ($) {
 
 sub guest_get_state ($$) {
     my ($ho,$gho) = @_;
-    my $domains= target_cmd_output_root($ho, toolstack()->{Command}." list");
+    my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list");
     $domains =~ s/^Name.*\n//;
     foreach my $l (split /\n/, $domains) {
         $l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1762,7 +1763,7 @@ sub guest_find_domid ($$) {
     my ($ho,$gho) = @_;
     return if defined $gho->{Domid};
     my $list= target_cmd_output_root($ho,
-                toolstack()->{Command}." list $gho->{Name}");
+                toolstack($ho)->{Command}." list $gho->{Name}");
     $list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m
         or die "domain list: $list";
     $1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
@@ -1832,7 +1833,9 @@ our %toolstacks=
         },
      );
 
-sub toolstack () {
+sub toolstack ($) {
+    my ($ho) = @_;
+    return $ho->{Toolstack} if $ho->{Toolstack};
     my $tsname= $r{toolstack};
     $tsname= 'xend' if !defined $tsname;
     my $ts= $toolstacks{$tsname};
@@ -1841,6 +1844,7 @@ sub toolstack () {
         logm("toolstack $tsname");
         $ts->{Name}= $tsname;
     }
+    $ho->{Toolstack} = $ts;
     return $ts;
 }
 
diff --git a/ts-debian-fixup b/ts-debian-fixup
index f001418..11e956c 100755
--- a/ts-debian-fixup
+++ b/ts-debian-fixup
@@ -142,7 +142,7 @@ sub otherfixupcfg () {
     if (@pcipt) {
         logm("checking passthrough device(s) are assignable: @pcipt");
         my @assignables= split /\n/,
-            target_cmd_output_root($ho, toolstack()->{Command}.
+            target_cmd_output_root($ho, toolstack($ho)->{Command}.
                                    " pci-assignable-list");
         foreach my $pcipt (@pcipt) {
             die "not assignable: $pcipt (not in: @assignables)"
diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install
index 37eade2..0148eef 100755
--- a/ts-debian-hvm-install
+++ b/ts-debian-hvm-install
@@ -41,7 +41,7 @@ our $disk_mb= 10000;
 our $guesthost= "$gn.guest.osstest";
 our $gho;
 
-our $toolstack= toolstack()->{Command};
+our $toolstack= toolstack($ho)->{Command};
 
 
 sub preseed () {
@@ -171,7 +171,7 @@ sub prep () {
 
 # If host has >8G free memory, create a guest with 4G memory to catch
 # any error that triggers cross 4G boundary
-my $host_freemem_mb = host_get_free_memory($ho, $toolstack);
+my $host_freemem_mb = host_get_free_memory($ho);
 my $ram_minslop = 100;
 my $ram_lots = 5000;
 if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
diff --git a/ts-guest-localmigrate b/ts-guest-localmigrate
index e50e93a..f3381da 100755
--- a/ts-guest-localmigrate
+++ b/ts-guest-localmigrate
@@ -33,7 +33,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 sub migrate () {
     guest_checkrunning($ho,$gho) or die $gho->{Name};
     target_cmd_root($ho,
-		    toolstack()->{Command}
+		    toolstack($ho)->{Command}
 		    ." migrate $gho->{Name} localhost",
 		    $timeout{Migrate});
 }
diff --git a/ts-guest-migrate b/ts-guest-migrate
index 17ac8a0..65e7b42 100755
--- a/ts-guest-migrate
+++ b/ts-guest-migrate
@@ -32,7 +32,7 @@ sub migrate () {
     guest_checkrunning($sho,$gho) or die $gho->{Name};
     my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
     target_cmd_root($sho,
-		    toolstack()->{Command}
+		    toolstack($sho)->{Command}
 		    ." migrate $gho->{Name} $dho->{Name}",
 		    $timeout{Migrate});
 }
diff --git a/ts-guest-saverestore b/ts-guest-saverestore
index 81671c8..9e04ae9 100755
--- a/ts-guest-saverestore
+++ b/ts-guest-saverestore
@@ -28,17 +28,17 @@ sub save () {
     guest_checkrunning($ho,$gho) or die $gho->{Name};
     my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
     target_cmd_root($ho,
-		    toolstack()->{Command}
+		    toolstack($ho)->{Command}
 		    ." save $gho->{Name} image",
 		    200);
     target_ping_check_down($gho);
 }
 sub restore () {
     target_cmd_root($ho,
-		    toolstack()->{Command}
+		    toolstack($ho)->{Command}
 		    ." restore "
-		    .(toolstack()->{RestoreNeedsConfig} ?
-		      $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} } : '')
+		    .(toolstack($ho)->{RestoreNeedsConfig} ?
+		      $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} } : '')
 		    ." image", 200);
     target_ping_check_up($gho);
 }
diff --git a/ts-guest-start b/ts-guest-start
index 057afe6..bfbb734 100755
--- a/ts-guest-start
+++ b/ts-guest-start
@@ -26,8 +26,8 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 
 sub start () {
     guest_umount_lv($ho, $gho);
-    my $cmd= toolstack()->{Command}." create ".
-        $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} };
+    my $cmd= toolstack($ho)->{Command}." create ".
+        $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} };
     target_cmd_root($ho, $cmd, 30);
 }
 
diff --git a/ts-guest-stop b/ts-guest-stop
index cc7db4c..0e3a863 100755
--- a/ts-guest-stop
+++ b/ts-guest-stop
@@ -27,7 +27,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 sub stop () {
     guest_checkrunning($ho, $gho) or die "$gho->{Name} not running";
     target_cmd_root($ho,
-		    toolstack()->{Command}
+		    toolstack($ho)->{Command}
 		    ." shutdown -w "
 		    .$gho->{Name}, 200);
     guest_checkrunning($ho, $gho) and die $gho->{Name};
diff --git a/ts-logs-capture b/ts-logs-capture
index ae32883..9df5485 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -192,7 +192,7 @@ sub fetch_logs_guest ($) {
         logm("cannot find domid: $@");
         return;
     }
-    my $consolecmd= toolstack()->{Command}." console $gho->{Name}";
+    my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}";
     try_cmd_output_save("sleep 1 | $consolecmd | cat",
                         "guest-$gho->{Name}-console");
 
diff --git a/ts-migrate-support-check b/ts-migrate-support-check
index ffae1b3..c70b77a 100755
--- a/ts-migrate-support-check
+++ b/ts-migrate-support-check
@@ -25,9 +25,9 @@ tsreadconfig();
 our $ho = selecthost($ARGV[0]);
 
 # all xend/xm platforms support migration
-exit(0) if toolstack()->{Command} eq "xm";
+exit(0) if toolstack($ho)->{Command} eq "xm";
 
-my $help = target_cmd_output_root($ho, toolstack()->{Command}." help");
+my $help = target_cmd_output_root($ho, toolstack($ho)->{Command}." help");
 
 my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
 
diff --git a/ts-redhat-install b/ts-redhat-install
index 56d4129..a0b1fab 100755
--- a/ts-redhat-install
+++ b/ts-redhat-install
@@ -37,7 +37,7 @@ our $disk_mb= 50000;
 our $guesthost= "$gn.guest.osstest";
 our $gho;
 
-our $xl= toolstack()->{Command};
+our $xl= toolstack($ho)->{Command};
 
 
 sub kickstart () {
diff --git a/ts-windows-install b/ts-windows-install
index 0a69f8e..4b06310 100755
--- a/ts-windows-install
+++ b/ts-windows-install
@@ -50,7 +50,7 @@ END
 }
 
 sub start () {
-    target_cmd_root($ho, toolstack()->{Command}.
+    target_cmd_root($ho, toolstack($ho)->{Command}.
                     " create $gho->{CfgPath}", 100);
 }
 
diff --git a/ts-xen-install b/ts-xen-install
index 0b84b7b..31cd7c3 100755
--- a/ts-xen-install
+++ b/ts-xen-install
@@ -60,8 +60,8 @@ sub packages () {
     if ($r{arch} eq 'i386') {
 	target_install_packages($ho, 'libc6-xen');
     }
-    target_install_packages($ho, @{toolstack()->{ExtraPackages}})
-        if toolstack()->{ExtraPackages};
+    target_install_packages($ho, @{toolstack($ho)->{ExtraPackages}})
+        if toolstack($ho)->{ExtraPackages};
 }
 
 sub extract () {
@@ -101,7 +101,7 @@ sub adjustconfig () {
 	    }
 	}
 	print EO $extra or die $!;
-    }) if toolstack()->{Name} eq "xend";
+    }) if toolstack($ho)->{Name} eq "xend";
 
     my $trace_config_file;
     foreach my $try (qw(/etc/default/xencommons
@@ -147,7 +147,7 @@ sub setupboot () {
     } else {
 	mlog("No Xen console device defined for host");
     }
-    if (toolstack()->{Dom0MemFixed}) {
+    if (toolstack($ho)->{Dom0MemFixed}) {
         $xenhopt .= " dom0_mem=512M,max:512M";
     }
     my $append= $r{xen_boot_append};
@@ -179,7 +179,7 @@ sub setupboot () {
 our $initscripts_nobridge;
 
 sub setupinitd () {
-    my $ts= toolstack();
+    my $ts= toolstack($ho);
     my $xencommons= '/etc/init.d/xencommons';
     my $have_xencommons=
         !!target_cmd_output_root($ho, <<END);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 3/9] Toolstack: use get_host_method_object() to manage toolstack selection
  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:26 ` [PATCH RFC OSSTEST 2/9] Pass host to toolstack() Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations Ian Campbell
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

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

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations.
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (2 preceding siblings ...)
  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 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 5/9] TestSupport: guest_create takes a $ho Ian Campbell
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Unless the toolstack is xend (for compatibility with pre-xl Xen versions), when
we use xm.

For several operations in TestSupport.pm the actual toolstack isn't really
relevant, since we want info straight from Xen. For simplicity just use xl (or
xm) in these cases, to avoid needing to implement the following specially for
each toolstack:
  - host_get_free_memory
  - guest_get_state
  - guest_find_domid

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 6129e9e..11a036f 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -905,6 +905,13 @@ sub compress_stashed($) {
 
 #---------- other stuff ----------
 
+sub common_toolstack () {
+    my $tsname= $r{toolstack} || 'xend';
+    my $ts = 'xl';
+    $ts = 'xm' if $tsname eq 'xend';
+    return $ts;
+}
+
 sub host_reboot ($) {
     my ($ho) = @_;
     target_reboot($ho);
@@ -924,7 +931,7 @@ sub host_reboot ($) {
 
 sub host_get_free_memory($) {
     my ($ho) = @_;
-    my $toolstack = toolstack($ho)->{Command};
+    my $toolstack = common_toolstack();
     # The line is as followed:
     # free_memory       :   XXXX
     my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1558,7 +1565,7 @@ sub guest_check_up ($) {
 
 sub guest_get_state ($$) {
     my ($ho,$gho) = @_;
-    my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list");
+    my $domains= target_cmd_output_root($ho, common_toolstack()." list");
     $domains =~ s/^Name.*\n//;
     foreach my $l (split /\n/, $domains) {
         $l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1763,7 +1770,7 @@ sub guest_find_domid ($$) {
     my ($ho,$gho) = @_;
     return if defined $gho->{Domid};
     my $list= target_cmd_output_root($ho,
-                toolstack($ho)->{Command}." list $gho->{Name}");
+                common_toolstack()." list $gho->{Name}");
     $list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m
         or die "domain list: $list";
     $1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 5/9] TestSupport: guest_create takes a $ho.
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (3 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle Ian Campbell
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Add looks up the toolstack from it.

This is now consistent with guest_destroy.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm | 5 +++--
 ts-debian-hvm-install  | 7 ++-----
 ts-redhat-install      | 7 ++-----
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 11a036f..1444629 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1278,8 +1278,9 @@ sub guest_destroy ($$) {
 }
 
 sub guest_create ($$) {
-    my ($gho,$toolstack) = @_;
-    target_cmd_root($gho->{Host}, "$toolstack create $gho->{CfgPath}", 100);
+    my ($ho,$gho) = @_;
+    my $ts= toolstack($ho);
+    target_cmd_root($ho, $ts->{Command}." create $gho->{CfgPath}", 100);
 }
 
 
diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install
index 0148eef..f274630 100755
--- a/ts-debian-hvm-install
+++ b/ts-debian-hvm-install
@@ -41,9 +41,6 @@ our $disk_mb= 10000;
 our $guesthost= "$gn.guest.osstest";
 our $gho;
 
-our $toolstack= toolstack($ho)->{Command};
-
-
 sub preseed () {
 
     my $preseed_file = preseed_base('wheezy','',());
@@ -183,7 +180,7 @@ logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ra
 
 if (!$stage) {
     prep();
-    guest_create($gho,$toolstack);
+    guest_create($ho,$gho);
 } else {
     $gho= selectguest($gn,$gho);
 }
@@ -193,6 +190,6 @@ if ($stage<2) {
 }
 
 guest_editconfig_nocd($gho,$emptyiso);
-guest_create($gho,$toolstack);
+guest_create($ho,$gho);
 guest_await_dhcp_tcp($gho,300);
 guest_check_up($gho);
diff --git a/ts-redhat-install b/ts-redhat-install
index a0b1fab..0b4ee17 100755
--- a/ts-redhat-install
+++ b/ts-redhat-install
@@ -37,9 +37,6 @@ our $disk_mb= 50000;
 our $guesthost= "$gn.guest.osstest";
 our $gho;
 
-our $xl= toolstack($ho)->{Command};
-
-
 sub kickstart () {
     my $cryptpw= '$6$anjRJmBbJcrNJGWN$rqvGUhu8ITjvErdIA5C//w2R6b/6wAjHbaF7XF8u3lZg1XI3StthPIE6UII08scOFwASMOepCGpgtsYeCpjqb.';
     my $authkeys= authorized_keys();
@@ -152,7 +149,7 @@ sub prep () {
 
 if (!$stage) {
     prep();
-    guest_create($gho,$xl);
+    guest_create($ho,$gho);
 } else {
     $gho= selectguest($gn,$gho);
 }
@@ -162,6 +159,6 @@ if ($stage<2) {
 }
 
 guest_editconfig_nocd($gho,$emptyiso);
-guest_create($gho,$xl);
+guest_create($ho,$gho);
 guest_await_dhcp_tcp($gho,300);
 guest_check_up($gho);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle.
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (4 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 5/9] TestSupport: guest_create takes a $ho Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check Ian Campbell
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

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 <ian.campbell@citrix.com>
---
 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);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (5 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 8/9] Toolstack: Refactor consolecmd handling Ian Campbell
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Not implemented for libvirt (the check that is)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Toolstack/libvirt.pm |  5 +++++
 Osstest/Toolstack/xend.pm    |  5 +++++
 Osstest/Toolstack/xl.pm      |  9 +++++++++
 ts-migrate-support-check     | 10 +---------
 4 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index c1d2b09..2dffd09 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -50,4 +50,9 @@ sub create ($$) {
     target_cmd_root($ho, "virsh create --file $cfg.xml", 100);
 }
 
+sub migrate_check ($) {
+    my ($self) = @_;
+    die "libvirt migration not supported yet."
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index 4f093bc..934f1a5 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -36,4 +36,9 @@ sub new {
 sub destroy { return Osstest::Toolstack::xl::destroy(@_); }
 sub create { return Osstest::Toolstack::xl::create(@_); }
 
+sub migrate_check ($) {
+    my ($self) = @_;
+    return 0;
+}
+
 1;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index ca46094..1c97a9d 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -42,4 +42,13 @@ sub create ($$) {
     target_cmd_root($self->{Host}, $self->{_Command}." create $cfg", 100);
 }
 
+sub migrate_check ($) {
+    my $self = @_;
+    my $ho = $self->{Host};
+    my $help = target_cmd_output_root($ho, $self->{_Command}." help");
+    my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
+    logm("rc=$rc");
+    return $rc;
+}
+
 1;
diff --git a/ts-migrate-support-check b/ts-migrate-support-check
index c70b77a..cd41f68 100755
--- a/ts-migrate-support-check
+++ b/ts-migrate-support-check
@@ -24,12 +24,4 @@ tsreadconfig();
 
 our $ho = selecthost($ARGV[0]);
 
-# all xend/xm platforms support migration
-exit(0) if toolstack($ho)->{Command} eq "xm";
-
-my $help = target_cmd_output_root($ho, toolstack($ho)->{Command}." help");
-
-my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
-
-logm("rc=$rc");
-exit($rc);
+exit(toolstack($ho)->migrate_check());
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 8/9] Toolstack: Refactor consolecmd handling
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (6 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 9/9] Toolstack: refactor shutdown support Ian Campbell
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Toolstack/libvirt.pm | 5 +++++
 Osstest/Toolstack/xend.pm    | 2 ++
 Osstest/Toolstack/xl.pm      | 5 +++++
 ts-logs-capture              | 2 +-
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 2dffd09..886e41b 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -55,4 +55,9 @@ sub migrate_check ($) {
     die "libvirt migration not supported yet."
 }
 
+sub consolecmd ($$) {
+    my ($self,$gn) = @_;
+    return "virsh console $gn";
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index 934f1a5..b77b4eb 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -33,8 +33,10 @@ sub new {
     }, $class;
 }
 
+# Defer to xl driver for most things
 sub destroy { return Osstest::Toolstack::xl::destroy(@_); }
 sub create { return Osstest::Toolstack::xl::create(@_); }
+sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); }
 
 sub migrate_check ($) {
     my ($self) = @_;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index 1c97a9d..9f4f8d1 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -51,4 +51,9 @@ sub migrate_check ($) {
     return $rc;
 }
 
+sub consolecmd ($$) {
+    my ($self,$gn) = @_;
+    return $self->{_Command}." console $gho->{Name}";
+}
+
 1;
diff --git a/ts-logs-capture b/ts-logs-capture
index 9df5485..5a3b4c4 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -192,7 +192,7 @@ sub fetch_logs_guest ($) {
         logm("cannot find domid: $@");
         return;
     }
-    my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}";
+    my $consolecmd= toolstack($ho)->consolecmd($gho->{Name});
     try_cmd_output_save("sleep 1 | $consolecmd | cat",
                         "guest-$gho->{Name}-console");
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 9/9] Toolstack: refactor shutdown support
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (7 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 8/9] Toolstack: Refactor consolecmd handling Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs Ian Campbell
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Toolstack/libvirt.pm | 5 +++++
 Osstest/Toolstack/xend.pm    | 1 +
 Osstest/Toolstack/xl.pm      | 6 ++++++
 ts-guest-stop                | 5 +----
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 886e41b..0452df7 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -60,4 +60,9 @@ sub consolecmd ($$) {
     return "virsh console $gn";
 }
 
+sub shutdown_wait ($$) {
+    my ($self,$gn) = @_;
+    die "libvirt shutdown wait not implemented yet."
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index b77b4eb..f6841c9 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -37,6 +37,7 @@ sub new {
 sub destroy { return Osstest::Toolstack::xl::destroy(@_); }
 sub create { return Osstest::Toolstack::xl::create(@_); }
 sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); }
+sub shutdown_wait { return Osstest::Toolstack::xl::consolecmd(@_); }
 
 sub migrate_check ($) {
     my ($self) = @_;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index 9f4f8d1..ce38444 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -56,4 +56,10 @@ sub consolecmd ($$) {
     return $self->{_Command}." console $gho->{Name}";
 }
 
+sub shutdown_wait ($$) {
+    my ($self,$gn) = @_;
+    my $ho = $self->{Host};
+    target_cmd_root($ho,"$self->{_Command} shutdown -w $gn", 200);
+}
+
 1;
diff --git a/ts-guest-stop b/ts-guest-stop
index 0e3a863..bd9c946 100755
--- a/ts-guest-stop
+++ b/ts-guest-stop
@@ -26,10 +26,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 
 sub stop () {
     guest_checkrunning($ho, $gho) or die "$gho->{Name} not running";
-    target_cmd_root($ho,
-		    toolstack($ho)->{Command}
-		    ." shutdown -w "
-		    .$gho->{Name}, 200);
+    toolstack($ho)->shutdown_wait($gho->{Name});
     guest_checkrunning($ho, $gho) and die $gho->{Name};
 }
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (8 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 9/9] Toolstack: refactor shutdown support Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 2/9] Pass host to toolstack() Ian Campbell
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 ts-logs-capture | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ts-logs-capture b/ts-logs-capture
index 3ccfc00..ae32883 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -117,6 +117,9 @@ sub fetch_logs_host_guests () {
                   /var/log/xen/osstest*
                   /var/log/xen/xenstored*
 
+                  /var/log/libvirt/libvirtd.log
+                  /var/log/libvirt/libxl/*
+
                   /var/run/xenstored*
                   /var/log/xenstored*
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 2/9] Pass host to toolstack()
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (9 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 3/9] Toolstack: use get_host_method_object() to manage toolstack selection Ian Campbell
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

This will be needed in a future patch.

Everywhere already has a $ho in hand. Also cache the answer as
$ho->{Toolstack}.

I scanned the source with:
    find -name \*.pm -exec perl -c {} \;
    for i in ts-* ; do perl -c $i; done
which reported "Not enough arguments for Osstest::TestSupport::toolstack" for
each callsite which needed changing.

Also don't pass the toolstack command name directly to host_get_free_memory().
Look it up instead.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm   | 16 ++++++++++------
 ts-debian-fixup          |  2 +-
 ts-debian-hvm-install    |  4 ++--
 ts-guest-localmigrate    |  2 +-
 ts-guest-migrate         |  2 +-
 ts-guest-saverestore     |  8 ++++----
 ts-guest-start           |  4 ++--
 ts-guest-stop            |  2 +-
 ts-logs-capture          |  2 +-
 ts-migrate-support-check |  4 ++--
 ts-redhat-install        |  2 +-
 ts-windows-install       |  2 +-
 ts-xen-install           | 10 +++++-----
 13 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index bad0458..1377610 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -922,8 +922,9 @@ sub host_reboot ($) {
     });
 }
 
-sub host_get_free_memory($$) {
-    my ($ho,$toolstack) = @_;
+sub host_get_free_memory($) {
+    my ($ho) = @_;
+    my $toolstack = toolstack($ho)->{Command};
     # The line is as followed:
     # free_memory       :   XXXX
     my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1266,7 +1267,7 @@ sub guest_await_reboot ($$$) {
 
 sub guest_destroy ($$) {
     my ($ho,$gho) = @_;
-    target_cmd_root($ho, toolstack()->{Command}." destroy $gho->{Name}", 40);
+    target_cmd_root($ho, toolstack($ho)->{Command}." destroy $gho->{Name}", 40);
 }
 
 sub guest_create ($$) {
@@ -1557,7 +1558,7 @@ sub guest_check_up ($) {
 
 sub guest_get_state ($$) {
     my ($ho,$gho) = @_;
-    my $domains= target_cmd_output_root($ho, toolstack()->{Command}." list");
+    my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list");
     $domains =~ s/^Name.*\n//;
     foreach my $l (split /\n/, $domains) {
         $l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1762,7 +1763,7 @@ sub guest_find_domid ($$) {
     my ($ho,$gho) = @_;
     return if defined $gho->{Domid};
     my $list= target_cmd_output_root($ho,
-                toolstack()->{Command}." list $gho->{Name}");
+                toolstack($ho)->{Command}." list $gho->{Name}");
     $list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m
         or die "domain list: $list";
     $1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
@@ -1832,7 +1833,9 @@ our %toolstacks=
         },
      );
 
-sub toolstack () {
+sub toolstack ($) {
+    my ($ho) = @_;
+    return $ho->{Toolstack} if $ho->{Toolstack};
     my $tsname= $r{toolstack};
     $tsname= 'xend' if !defined $tsname;
     my $ts= $toolstacks{$tsname};
@@ -1841,6 +1844,7 @@ sub toolstack () {
         logm("toolstack $tsname");
         $ts->{Name}= $tsname;
     }
+    $ho->{Toolstack} = $ts;
     return $ts;
 }
 
diff --git a/ts-debian-fixup b/ts-debian-fixup
index f001418..11e956c 100755
--- a/ts-debian-fixup
+++ b/ts-debian-fixup
@@ -142,7 +142,7 @@ sub otherfixupcfg () {
     if (@pcipt) {
         logm("checking passthrough device(s) are assignable: @pcipt");
         my @assignables= split /\n/,
-            target_cmd_output_root($ho, toolstack()->{Command}.
+            target_cmd_output_root($ho, toolstack($ho)->{Command}.
                                    " pci-assignable-list");
         foreach my $pcipt (@pcipt) {
             die "not assignable: $pcipt (not in: @assignables)"
diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install
index 37eade2..0148eef 100755
--- a/ts-debian-hvm-install
+++ b/ts-debian-hvm-install
@@ -41,7 +41,7 @@ our $disk_mb= 10000;
 our $guesthost= "$gn.guest.osstest";
 our $gho;
 
-our $toolstack= toolstack()->{Command};
+our $toolstack= toolstack($ho)->{Command};
 
 
 sub preseed () {
@@ -171,7 +171,7 @@ sub prep () {
 
 # If host has >8G free memory, create a guest with 4G memory to catch
 # any error that triggers cross 4G boundary
-my $host_freemem_mb = host_get_free_memory($ho, $toolstack);
+my $host_freemem_mb = host_get_free_memory($ho);
 my $ram_minslop = 100;
 my $ram_lots = 5000;
 if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
diff --git a/ts-guest-localmigrate b/ts-guest-localmigrate
index e50e93a..f3381da 100755
--- a/ts-guest-localmigrate
+++ b/ts-guest-localmigrate
@@ -33,7 +33,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 sub migrate () {
     guest_checkrunning($ho,$gho) or die $gho->{Name};
     target_cmd_root($ho,
-		    toolstack()->{Command}
+		    toolstack($ho)->{Command}
 		    ." migrate $gho->{Name} localhost",
 		    $timeout{Migrate});
 }
diff --git a/ts-guest-migrate b/ts-guest-migrate
index 17ac8a0..65e7b42 100755
--- a/ts-guest-migrate
+++ b/ts-guest-migrate
@@ -32,7 +32,7 @@ sub migrate () {
     guest_checkrunning($sho,$gho) or die $gho->{Name};
     my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
     target_cmd_root($sho,
-		    toolstack()->{Command}
+		    toolstack($sho)->{Command}
 		    ." migrate $gho->{Name} $dho->{Name}",
 		    $timeout{Migrate});
 }
diff --git a/ts-guest-saverestore b/ts-guest-saverestore
index 81671c8..9e04ae9 100755
--- a/ts-guest-saverestore
+++ b/ts-guest-saverestore
@@ -28,17 +28,17 @@ sub save () {
     guest_checkrunning($ho,$gho) or die $gho->{Name};
     my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
     target_cmd_root($ho,
-		    toolstack()->{Command}
+		    toolstack($ho)->{Command}
 		    ." save $gho->{Name} image",
 		    200);
     target_ping_check_down($gho);
 }
 sub restore () {
     target_cmd_root($ho,
-		    toolstack()->{Command}
+		    toolstack($ho)->{Command}
 		    ." restore "
-		    .(toolstack()->{RestoreNeedsConfig} ?
-		      $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} } : '')
+		    .(toolstack($ho)->{RestoreNeedsConfig} ?
+		      $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} } : '')
 		    ." image", 200);
     target_ping_check_up($gho);
 }
diff --git a/ts-guest-start b/ts-guest-start
index 057afe6..bfbb734 100755
--- a/ts-guest-start
+++ b/ts-guest-start
@@ -26,8 +26,8 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 
 sub start () {
     guest_umount_lv($ho, $gho);
-    my $cmd= toolstack()->{Command}." create ".
-        $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} };
+    my $cmd= toolstack($ho)->{Command}." create ".
+        $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} };
     target_cmd_root($ho, $cmd, 30);
 }
 
diff --git a/ts-guest-stop b/ts-guest-stop
index cc7db4c..0e3a863 100755
--- a/ts-guest-stop
+++ b/ts-guest-stop
@@ -27,7 +27,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 sub stop () {
     guest_checkrunning($ho, $gho) or die "$gho->{Name} not running";
     target_cmd_root($ho,
-		    toolstack()->{Command}
+		    toolstack($ho)->{Command}
 		    ." shutdown -w "
 		    .$gho->{Name}, 200);
     guest_checkrunning($ho, $gho) and die $gho->{Name};
diff --git a/ts-logs-capture b/ts-logs-capture
index ae32883..9df5485 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -192,7 +192,7 @@ sub fetch_logs_guest ($) {
         logm("cannot find domid: $@");
         return;
     }
-    my $consolecmd= toolstack()->{Command}." console $gho->{Name}";
+    my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}";
     try_cmd_output_save("sleep 1 | $consolecmd | cat",
                         "guest-$gho->{Name}-console");
 
diff --git a/ts-migrate-support-check b/ts-migrate-support-check
index ffae1b3..c70b77a 100755
--- a/ts-migrate-support-check
+++ b/ts-migrate-support-check
@@ -25,9 +25,9 @@ tsreadconfig();
 our $ho = selecthost($ARGV[0]);
 
 # all xend/xm platforms support migration
-exit(0) if toolstack()->{Command} eq "xm";
+exit(0) if toolstack($ho)->{Command} eq "xm";
 
-my $help = target_cmd_output_root($ho, toolstack()->{Command}." help");
+my $help = target_cmd_output_root($ho, toolstack($ho)->{Command}." help");
 
 my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
 
diff --git a/ts-redhat-install b/ts-redhat-install
index 56d4129..a0b1fab 100755
--- a/ts-redhat-install
+++ b/ts-redhat-install
@@ -37,7 +37,7 @@ our $disk_mb= 50000;
 our $guesthost= "$gn.guest.osstest";
 our $gho;
 
-our $xl= toolstack()->{Command};
+our $xl= toolstack($ho)->{Command};
 
 
 sub kickstart () {
diff --git a/ts-windows-install b/ts-windows-install
index 0a69f8e..4b06310 100755
--- a/ts-windows-install
+++ b/ts-windows-install
@@ -50,7 +50,7 @@ END
 }
 
 sub start () {
-    target_cmd_root($ho, toolstack()->{Command}.
+    target_cmd_root($ho, toolstack($ho)->{Command}.
                     " create $gho->{CfgPath}", 100);
 }
 
diff --git a/ts-xen-install b/ts-xen-install
index 0b84b7b..31cd7c3 100755
--- a/ts-xen-install
+++ b/ts-xen-install
@@ -60,8 +60,8 @@ sub packages () {
     if ($r{arch} eq 'i386') {
 	target_install_packages($ho, 'libc6-xen');
     }
-    target_install_packages($ho, @{toolstack()->{ExtraPackages}})
-        if toolstack()->{ExtraPackages};
+    target_install_packages($ho, @{toolstack($ho)->{ExtraPackages}})
+        if toolstack($ho)->{ExtraPackages};
 }
 
 sub extract () {
@@ -101,7 +101,7 @@ sub adjustconfig () {
 	    }
 	}
 	print EO $extra or die $!;
-    }) if toolstack()->{Name} eq "xend";
+    }) if toolstack($ho)->{Name} eq "xend";
 
     my $trace_config_file;
     foreach my $try (qw(/etc/default/xencommons
@@ -147,7 +147,7 @@ sub setupboot () {
     } else {
 	mlog("No Xen console device defined for host");
     }
-    if (toolstack()->{Dom0MemFixed}) {
+    if (toolstack($ho)->{Dom0MemFixed}) {
         $xenhopt .= " dom0_mem=512M,max:512M";
     }
     my $append= $r{xen_boot_append};
@@ -179,7 +179,7 @@ sub setupboot () {
 our $initscripts_nobridge;
 
 sub setupinitd () {
-    my $ts= toolstack();
+    my $ts= toolstack($ho);
     my $xencommons= '/etc/init.d/xencommons';
     my $have_xencommons=
         !!target_cmd_output_root($ho, <<END);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 3/9] Toolstack: use get_host_method_object() to manage toolstack selection
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (10 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 2/9] Pass host to toolstack() Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations Ian Campbell
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

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

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations.
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (11 preceding siblings ...)
  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 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 5/9] TestSupport: guest_create takes a $ho Ian Campbell
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Unless the toolstack is xend (for compatibility with pre-xl Xen versions), when
we use xm.

For several operations in TestSupport.pm the actual toolstack isn't really
relevant, since we want info straight from Xen. For simplicity just use xl (or
xm) in these cases, to avoid needing to implement the following specially for
each toolstack:
  - host_get_free_memory
  - guest_get_state
  - guest_find_domid

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 6129e9e..11a036f 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -905,6 +905,13 @@ sub compress_stashed($) {
 
 #---------- other stuff ----------
 
+sub common_toolstack () {
+    my $tsname= $r{toolstack} || 'xend';
+    my $ts = 'xl';
+    $ts = 'xm' if $tsname eq 'xend';
+    return $ts;
+}
+
 sub host_reboot ($) {
     my ($ho) = @_;
     target_reboot($ho);
@@ -924,7 +931,7 @@ sub host_reboot ($) {
 
 sub host_get_free_memory($) {
     my ($ho) = @_;
-    my $toolstack = toolstack($ho)->{Command};
+    my $toolstack = common_toolstack();
     # The line is as followed:
     # free_memory       :   XXXX
     my $info = target_cmd_output_root($ho, "$toolstack info", 10);
@@ -1558,7 +1565,7 @@ sub guest_check_up ($) {
 
 sub guest_get_state ($$) {
     my ($ho,$gho) = @_;
-    my $domains= target_cmd_output_root($ho, toolstack($ho)->{Command}." list");
+    my $domains= target_cmd_output_root($ho, common_toolstack()." list");
     $domains =~ s/^Name.*\n//;
     foreach my $l (split /\n/, $domains) {
         $l =~ m/^(\S+) (?: \s+ \d+ ){3} \s+ ([-a-z]+) \s/x or die "$l ?";
@@ -1763,7 +1770,7 @@ sub guest_find_domid ($$) {
     my ($ho,$gho) = @_;
     return if defined $gho->{Domid};
     my $list= target_cmd_output_root($ho,
-                toolstack($ho)->{Command}." list $gho->{Name}");
+                common_toolstack()." list $gho->{Name}");
     $list =~ m/^(?!Name\s)(\S+)\s+(\d+)\s+(\d+)+(\d+)\s.*$/m
         or die "domain list: $list";
     $1 eq $gho->{Name} or die "domain list name $1 expected $gho->{Name}";
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 5/9] TestSupport: guest_create takes a $ho.
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (12 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 4/9] TestSupport: always use xl for generic operations Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle Ian Campbell
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Add looks up the toolstack from it.

This is now consistent with guest_destroy.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm | 5 +++--
 ts-debian-hvm-install  | 7 ++-----
 ts-redhat-install      | 7 ++-----
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 11a036f..1444629 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1278,8 +1278,9 @@ sub guest_destroy ($$) {
 }
 
 sub guest_create ($$) {
-    my ($gho,$toolstack) = @_;
-    target_cmd_root($gho->{Host}, "$toolstack create $gho->{CfgPath}", 100);
+    my ($ho,$gho) = @_;
+    my $ts= toolstack($ho);
+    target_cmd_root($ho, $ts->{Command}." create $gho->{CfgPath}", 100);
 }
 
 
diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install
index 0148eef..f274630 100755
--- a/ts-debian-hvm-install
+++ b/ts-debian-hvm-install
@@ -41,9 +41,6 @@ our $disk_mb= 10000;
 our $guesthost= "$gn.guest.osstest";
 our $gho;
 
-our $toolstack= toolstack($ho)->{Command};
-
-
 sub preseed () {
 
     my $preseed_file = preseed_base('wheezy','',());
@@ -183,7 +180,7 @@ logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ra
 
 if (!$stage) {
     prep();
-    guest_create($gho,$toolstack);
+    guest_create($ho,$gho);
 } else {
     $gho= selectguest($gn,$gho);
 }
@@ -193,6 +190,6 @@ if ($stage<2) {
 }
 
 guest_editconfig_nocd($gho,$emptyiso);
-guest_create($gho,$toolstack);
+guest_create($ho,$gho);
 guest_await_dhcp_tcp($gho,300);
 guest_check_up($gho);
diff --git a/ts-redhat-install b/ts-redhat-install
index a0b1fab..0b4ee17 100755
--- a/ts-redhat-install
+++ b/ts-redhat-install
@@ -37,9 +37,6 @@ our $disk_mb= 50000;
 our $guesthost= "$gn.guest.osstest";
 our $gho;
 
-our $xl= toolstack($ho)->{Command};
-
-
 sub kickstart () {
     my $cryptpw= '$6$anjRJmBbJcrNJGWN$rqvGUhu8ITjvErdIA5C//w2R6b/6wAjHbaF7XF8u3lZg1XI3StthPIE6UII08scOFwASMOepCGpgtsYeCpjqb.';
     my $authkeys= authorized_keys();
@@ -152,7 +149,7 @@ sub prep () {
 
 if (!$stage) {
     prep();
-    guest_create($gho,$xl);
+    guest_create($ho,$gho);
 } else {
     $gho= selectguest($gn,$gho);
 }
@@ -162,6 +159,6 @@ if ($stage<2) {
 }
 
 guest_editconfig_nocd($gho,$emptyiso);
-guest_create($gho,$xl);
+guest_create($ho,$gho);
 guest_await_dhcp_tcp($gho,300);
 guest_check_up($gho);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle.
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (13 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 5/9] TestSupport: guest_create takes a $ho Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 16:45   ` Dario Faggioli
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check Ian Campbell
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

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 <ian.campbell@citrix.com>
---
 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);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (14 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:33   ` 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
  17 siblings, 1 reply; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Not implemented for libvirt (the check that is)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Toolstack/libvirt.pm |  5 +++++
 Osstest/Toolstack/xend.pm    |  5 +++++
 Osstest/Toolstack/xl.pm      |  9 +++++++++
 ts-migrate-support-check     | 10 +---------
 4 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index c1d2b09..2dffd09 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -50,4 +50,9 @@ sub create ($$) {
     target_cmd_root($ho, "virsh create --file $cfg.xml", 100);
 }
 
+sub migrate_check ($) {
+    my ($self) = @_;
+    die "libvirt migration not supported yet."
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index 4f093bc..934f1a5 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -36,4 +36,9 @@ sub new {
 sub destroy { return Osstest::Toolstack::xl::destroy(@_); }
 sub create { return Osstest::Toolstack::xl::create(@_); }
 
+sub migrate_check ($) {
+    my ($self) = @_;
+    return 0;
+}
+
 1;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index ca46094..1c97a9d 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -42,4 +42,13 @@ sub create ($$) {
     target_cmd_root($self->{Host}, $self->{_Command}." create $cfg", 100);
 }
 
+sub migrate_check ($) {
+    my $self = @_;
+    my $ho = $self->{Host};
+    my $help = target_cmd_output_root($ho, $self->{_Command}." help");
+    my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
+    logm("rc=$rc");
+    return $rc;
+}
+
 1;
diff --git a/ts-migrate-support-check b/ts-migrate-support-check
index c70b77a..cd41f68 100755
--- a/ts-migrate-support-check
+++ b/ts-migrate-support-check
@@ -24,12 +24,4 @@ tsreadconfig();
 
 our $ho = selecthost($ARGV[0]);
 
-# all xend/xm platforms support migration
-exit(0) if toolstack($ho)->{Command} eq "xm";
-
-my $help = target_cmd_output_root($ho, toolstack($ho)->{Command}." help");
-
-my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
-
-logm("rc=$rc");
-exit($rc);
+exit(toolstack($ho)->migrate_check());
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 8/9] Toolstack: Refactor consolecmd handling
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (15 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 9/9] Toolstack: refactor shutdown support Ian Campbell
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Toolstack/libvirt.pm | 5 +++++
 Osstest/Toolstack/xend.pm    | 2 ++
 Osstest/Toolstack/xl.pm      | 5 +++++
 ts-logs-capture              | 2 +-
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 2dffd09..886e41b 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -55,4 +55,9 @@ sub migrate_check ($) {
     die "libvirt migration not supported yet."
 }
 
+sub consolecmd ($$) {
+    my ($self,$gn) = @_;
+    return "virsh console $gn";
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index 934f1a5..b77b4eb 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -33,8 +33,10 @@ sub new {
     }, $class;
 }
 
+# Defer to xl driver for most things
 sub destroy { return Osstest::Toolstack::xl::destroy(@_); }
 sub create { return Osstest::Toolstack::xl::create(@_); }
+sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); }
 
 sub migrate_check ($) {
     my ($self) = @_;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index 1c97a9d..9f4f8d1 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -51,4 +51,9 @@ sub migrate_check ($) {
     return $rc;
 }
 
+sub consolecmd ($$) {
+    my ($self,$gn) = @_;
+    return $self->{_Command}." console $gho->{Name}";
+}
+
 1;
diff --git a/ts-logs-capture b/ts-logs-capture
index 9df5485..5a3b4c4 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -192,7 +192,7 @@ sub fetch_logs_guest ($) {
         logm("cannot find domid: $@");
         return;
     }
-    my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}";
+    my $consolecmd= toolstack($ho)->consolecmd($gho->{Name});
     try_cmd_output_save("sleep 1 | $consolecmd | cat",
                         "guest-$gho->{Name}-console");
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC OSSTEST 9/9] Toolstack: refactor shutdown support
  2014-06-17 15:25 [PATCH RFC OSSTEST 0/9] implement for virsh Ian Campbell
                   ` (16 preceding siblings ...)
  2014-06-17 15:26 ` [PATCH RFC OSSTEST 8/9] Toolstack: Refactor consolecmd handling Ian Campbell
@ 2014-06-17 15:26 ` Ian Campbell
  17 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:26 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Toolstack/libvirt.pm | 5 +++++
 Osstest/Toolstack/xend.pm    | 1 +
 Osstest/Toolstack/xl.pm      | 6 ++++++
 ts-guest-stop                | 5 +----
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 886e41b..0452df7 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -60,4 +60,9 @@ sub consolecmd ($$) {
     return "virsh console $gn";
 }
 
+sub shutdown_wait ($$) {
+    my ($self,$gn) = @_;
+    die "libvirt shutdown wait not implemented yet."
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index b77b4eb..f6841c9 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -37,6 +37,7 @@ sub new {
 sub destroy { return Osstest::Toolstack::xl::destroy(@_); }
 sub create { return Osstest::Toolstack::xl::create(@_); }
 sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); }
+sub shutdown_wait { return Osstest::Toolstack::xl::consolecmd(@_); }
 
 sub migrate_check ($) {
     my ($self) = @_;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index 9f4f8d1..ce38444 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -56,4 +56,10 @@ sub consolecmd ($$) {
     return $self->{_Command}." console $gho->{Name}";
 }
 
+sub shutdown_wait ($$) {
+    my ($self,$gn) = @_;
+    my $ho = $self->{Host};
+    target_cmd_root($ho,"$self->{_Command} shutdown -w $gn", 200);
+}
+
 1;
diff --git a/ts-guest-stop b/ts-guest-stop
index 0e3a863..bd9c946 100755
--- a/ts-guest-stop
+++ b/ts-guest-stop
@@ -26,10 +26,7 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 
 sub stop () {
     guest_checkrunning($ho, $gho) or die "$gho->{Name} not running";
-    target_cmd_root($ho,
-		    toolstack($ho)->{Command}
-		    ." shutdown -w "
-		    .$gho->{Name}, 200);
+    toolstack($ho)->shutdown_wait($gho->{Name});
     guest_checkrunning($ho, $gho) and die $gho->{Name};
 }
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 1/9] ts-logs-capture: Collect some libvirt logs
  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
  0 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:28 UTC (permalink / raw)
  To: ian.jackson; +Cc: xen-devel

On Tue, 2014-06-17 at 16:26 +0100, Ian Campbell wrote:

Sorry for the two copies of this series, I fat fingered the
--in-reply-to (extra #) and thought I'd caught it in time -- obviously
not.

> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
>  ts-logs-capture | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/ts-logs-capture b/ts-logs-capture
> index 3ccfc00..ae32883 100755
> --- a/ts-logs-capture
> +++ b/ts-logs-capture
> @@ -117,6 +117,9 @@ sub fetch_logs_host_guests () {
>                    /var/log/xen/osstest*
>                    /var/log/xen/xenstored*
>  
> +                  /var/log/libvirt/libvirtd.log
> +                  /var/log/libvirt/libxl/*
> +
>                    /var/run/xenstored*
>                    /var/log/xenstored*
>  

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
  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
  0 siblings, 1 reply; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 15:33 UTC (permalink / raw)
  To: ian.jackson, Jim Fehlig; +Cc: xen-devel

On Tue, 2014-06-17 at 16:26 +0100, Ian Campbell wrote:
> Not implemented for libvirt (the check that is)

Jim,

What would be the right thing to do for this? The intention is for
osstest to skip migration tests when that feature is unimplemented by
the toolstack/xen/arch combination.

It looks like the output of "virsh capabilities" indicates migration:
    <migration_features>
      <live/>
      <uri_transports>
        <uri_transport>tcp</uri_transport>
      </uri_transports>
    </migration_features>
is that the right place to look?

Will this capability be automagically suppressed on ARM until we
implement it? FYI xl uses LIBXL_HAVE_NO_SUSPEND_RESUME to figure this
out...

For xl we parse the output of xl help.

Ian.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle.
  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
  0 siblings, 1 reply; 31+ messages in thread
From: Dario Faggioli @ 2014-06-17 16:45 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1370 bytes --]

On mar, 2014-06-17 at 16:26 +0100, Ian Campbell wrote:
> 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 <ian.campbell@citrix.com>
> ---

> +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);
> +}
> +
I agree that domxml-from-native would be the best thing to do here.

However, we need to double check how well it works, and probably commit
to improve that, as, last time I checked, it was doing a pretty poor
job. :-(

Jim, what's the status of that thing?

Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle.
  2014-06-17 16:45   ` Dario Faggioli
@ 2014-06-17 16:56     ` Ian Campbell
  2014-06-23 21:01       ` Jim Fehlig
  0 siblings, 1 reply; 31+ messages in thread
From: Ian Campbell @ 2014-06-17 16:56 UTC (permalink / raw)
  To: Dario Faggioli; +Cc: ian.jackson, xen-devel

On Tue, 2014-06-17 at 18:45 +0200, Dario Faggioli wrote:
> On mar, 2014-06-17 at 16:26 +0100, Ian Campbell wrote:
> > 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 <ian.campbell@citrix.com>
> > ---
> 
> > +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);
> > +}
> > +
> I agree that domxml-from-native would be the best thing to do here.
> 
> However, we need to double check how well it works, and probably commit
> to improve that, as, last time I checked, it was doing a pretty poor
> job. :-(
> 
> Jim, what's the status of that thing?

It worked well enough for osstest to start a guest with its usual
config, with the libvirt bugfix I sent out a few hours ago.

But the whole point of the tests is to find bugs, so I don't see the
fact that this may or may not be buggy as a reason for osstest not to
use it. If that shows that it is buggy then we should fix it.

Ian.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 6/9] Toolstack: Refactor guest lifecycle.
  2014-06-17 16:56     ` Ian Campbell
@ 2014-06-23 21:01       ` Jim Fehlig
  0 siblings, 0 replies; 31+ messages in thread
From: Jim Fehlig @ 2014-06-23 21:01 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Dario Faggioli, ian.jackson, xen-devel

Ian Campbell wrote:
> On Tue, 2014-06-17 at 18:45 +0200, Dario Faggioli wrote:
>   
>> On mar, 2014-06-17 at 16:26 +0100, Ian Campbell wrote:
>>     
>>> 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 <ian.campbell@citrix.com>
>>> ---
>>>       
>>> +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);
>>> +}
>>> +
>>>       
>> I agree that domxml-from-native would be the best thing to do here.
>>
>> However, we need to double check how well it works, and probably commit
>> to improve that, as, last time I checked, it was doing a pretty poor
>> job. :-(
>>
>> Jim, what's the status of that thing?
>>     
>
> It worked well enough for osstest to start a guest with its usual
> config, with the libvirt bugfix I sent out a few hours ago.
>   

I'm not aware of any issues with the xen-xm conversion, but then again
haven't tested all possible configs.  Ian found one such untested config
(root=) just last week.

Conversion of xl config is another matter.  Currently, libvirt doesn't
support 'virsh domxml-{from,to}-native xen-xl ...'.  David Kiarie is
going to look at this as part of his GSoC work on the libvirt libxl driver.

> But the whole point of the tests is to find bugs, so I don't see the
> fact that this may or may not be buggy as a reason for osstest not to
> use it. If that shows that it is buggy then we should fix it.
>   

Agreed.

Regards,
Jim

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
  2014-06-17 15:33   ` Ian Campbell
@ 2014-06-23 21:28     ` Jim Fehlig
  2014-06-24 11:06       ` Ian Campbell
                         ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Jim Fehlig @ 2014-06-23 21:28 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, xen-devel

Ian Campbell wrote:
> On Tue, 2014-06-17 at 16:26 +0100, Ian Campbell wrote:
>   
>> Not implemented for libvirt (the check that is)
>>     
>
> Jim,
>
> What would be the right thing to do for this? The intention is for
> osstest to skip migration tests when that feature is unimplemented by
> the toolstack/xen/arch combination.
>
> It looks like the output of "virsh capabilities" indicates migration:
>     <migration_features>
>       <live/>
>       <uri_transports>
>         <uri_transport>tcp</uri_transport>
>       </uri_transports>
>     </migration_features>
> is that the right place to look?
>   

Yes.

> Will this capability be automagically suppressed on ARM until we
> implement it?

Unfortunately, no :-/.  Currently, the libvirt libxl driver will include
<migration_features> and call save, restore, and migrate regardless of arch.

>  FYI xl uses LIBXL_HAVE_NO_SUSPEND_RESUME to figure this
> out...
>   

Ah, interesting.  Thanks for the tip.  I'll need to add similar logic in
the libxl driver.

Regards,
Jim

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
  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>
  2 siblings, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-24 11:06 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: ian.jackson, xen-devel

On Mon, 2014-06-23 at 15:28 -0600, Jim Fehlig wrote:
> Ian Campbell wrote:
> > On Tue, 2014-06-17 at 16:26 +0100, Ian Campbell wrote:
> >   
> >> Not implemented for libvirt (the check that is)
> >>     
> >
> > Jim,
> >
> > What would be the right thing to do for this? The intention is for
> > osstest to skip migration tests when that feature is unimplemented by
> > the toolstack/xen/arch combination.
> >
> > It looks like the output of "virsh capabilities" indicates migration:
> >     <migration_features>
> >       <live/>
> >       <uri_transports>
> >         <uri_transport>tcp</uri_transport>
> >       </uri_transports>
> >     </migration_features>
> > is that the right place to look?
> >   
> 
> Yes.
> 
> > Will this capability be automagically suppressed on ARM until we
> > implement it?
> 
> Unfortunately, no :-/.  Currently, the libvirt libxl driver will include
> <migration_features> and call save, restore, and migrate regardless of arch.
> 
> >  FYI xl uses LIBXL_HAVE_NO_SUSPEND_RESUME to figure this
> > out...
> >   
> 
> Ah, interesting.  Thanks for the tip.  I'll need to add similar logic in
> the libxl driver.

Great, thanks.

If my patches to enable osstest virsh support (they need a bit of work
anyway) were to go in before this then ts-migration-check test case will
turn from pass to fail which will look like a regression (even though
ts-migrate which it gates was failing). That's not the end of the world
and we could force osstest to ignore the old spurious passes.

Ian.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
  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>
  2 siblings, 0 replies; 31+ messages in thread
From: Jim Fehlig @ 2014-06-25  3:18 UTC (permalink / raw)
  To: Ian Campbell; +Cc: LibVir, ian.jackson, xen-devel

[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]

Jim Fehlig wrote:
> Ian Campbell wrote:
>   
>> Jim,
>>
>> What would be the right thing to do for this? The intention is for
>> osstest to skip migration tests when that feature is unimplemented by
>> the toolstack/xen/arch combination.
>>
>> It looks like the output of "virsh capabilities" indicates migration:
>>     <migration_features>
>>       <live/>
>>       <uri_transports>
>>         <uri_transport>tcp</uri_transport>
>>       </uri_transports>
>>     </migration_features>
>> is that the right place to look?
>>   
>>     
>
> Yes.
>
>   
>> Will this capability be automagically suppressed on ARM until we
>> implement it?
>>     
>
> Unfortunately, no :-/.  Currently, the libvirt libxl driver will include
> <migration_features> and call save, restore, and migrate regardless of arch.
>
>   
>>  FYI xl uses LIBXL_HAVE_NO_SUSPEND_RESUME to figure this
>> out...
>>   
>>     
>
> Ah, interesting.  Thanks for the tip.  I'll need to add similar logic in
> the libxl driver.
>   

Something like the attached patch (compile-tested only).  You'll need an
updated libvirt.git master to apply cleanly.

Regards,
Jim


[-- Attachment #2: libxl-detect-save-restore.patch --]
[-- Type: text/x-patch, Size: 3256 bytes --]

>From 5c805d24d7d78c4435b871ffaf938c3e302c7a6f Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@suse.com>
Date: Tue, 24 Jun 2014 11:10:49 -0600
Subject: [PATCH] libxl: detect support for save and restore

libxl does not support save, restore, or migrate on all architectures,
notably ARM.  Detect whether libxl supports these operations using
LIBXL_HAVE_NO_SUSPEND_RESUME.  If not supported, drop advertisement of
<migration_features>.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 src/libxl/libxl_conf.c   | 4 ++++
 src/libxl/libxl_driver.c | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 4b6b5c0..8eeaf82 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1340,7 +1340,11 @@ libxlMakeCapabilities(libxl_ctx *ctx)
 {
     virCapsPtr caps;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    if ((caps = virCapabilitiesNew(virArchFromHost(), 0, 0)) == NULL)
+#else
     if ((caps = virCapabilitiesNew(virArchFromHost(), 1, 1)) == NULL)
+#endif
         return NULL;
 
     if (libxlCapsInitHost(ctx, caps) < 0)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 1ea99e2..f90bf64 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1370,6 +1370,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
     return ret;
 }
 
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
 static int
 libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
                      unsigned int flags)
@@ -1488,6 +1489,7 @@ libxlDomainRestore(virConnectPtr conn, const char *from)
 {
     return libxlDomainRestoreFlags(conn, from, NULL, 0);
 }
+#endif /* ifndef LIBXL_HAVE_NO_SUSPEND_RESUME */
 
 static int
 libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
@@ -4594,10 +4596,12 @@ static virDriver libxlDriver = {
     .domainSetMemoryFlags = libxlDomainSetMemoryFlags, /* 0.9.0 */
     .domainGetInfo = libxlDomainGetInfo, /* 0.9.0 */
     .domainGetState = libxlDomainGetState, /* 0.9.2 */
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
     .domainSave = libxlDomainSave, /* 0.9.2 */
     .domainSaveFlags = libxlDomainSaveFlags, /* 0.9.4 */
     .domainRestore = libxlDomainRestore, /* 0.9.2 */
     .domainRestoreFlags = libxlDomainRestoreFlags, /* 0.9.4 */
+#endif
     .domainCoreDump = libxlDomainCoreDump, /* 0.9.2 */
     .domainSetVcpus = libxlDomainSetVcpus, /* 0.9.0 */
     .domainSetVcpusFlags = libxlDomainSetVcpusFlags, /* 0.9.0 */
@@ -4650,11 +4654,13 @@ static virDriver libxlDriver = {
     .nodeDeviceDetachFlags = libxlNodeDeviceDetachFlags, /* 1.2.3 */
     .nodeDeviceReAttach = libxlNodeDeviceReAttach, /* 1.2.3 */
     .nodeDeviceReset = libxlNodeDeviceReset, /* 1.2.3 */
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
     .domainMigrateBegin3Params = libxlDomainMigrateBegin3Params, /* 1.2.6 */
     .domainMigratePrepare3Params = libxlDomainMigratePrepare3Params, /* 1.2.6 */
     .domainMigratePerform3Params = libxlDomainMigratePerform3Params, /* 1.2.6 */
     .domainMigrateFinish3Params = libxlDomainMigrateFinish3Params, /* 1.2.6 */
     .domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */
+#endif
 };
 
 static virStateDriver libxlStateDriver = {
-- 
1.8.4.5


[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
       [not found]       ` <53AA3F89.6050904@suse.com>
@ 2014-06-25 12:38         ` Ian Campbell
  2014-06-25 15:25           ` Jim Fehlig
  0 siblings, 1 reply; 31+ messages in thread
From: Ian Campbell @ 2014-06-25 12:38 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: LibVir, ian.jackson, xen-devel


On Tue, 2014-06-24 at 21:18 -0600, Jim Fehlig wrote:

> Something like the attached patch (compile-tested only).  You'll need an
> updated libvirt.git master to apply cleanly.

Thanks. Building on ARM I get:

libxl/libxl_driver.c:4346:1: error: 'libxlDomainMigrateBegin3Params' defined but not used [-Werror=unused-function]
libxl/libxl_driver.c:4384:1: error: 'libxlDomainMigratePrepare3Params' defined but not used [-Werror=unused-function]
libxl/libxl_driver.c:4433:1: error: 'libxlDomainMigratePerform3Params' defined but not used [-Werror=unused-function]
libxl/libxl_driver.c:4488:1: error: 'libxlDomainMigrateFinish3Params' defined but not used [-Werror=unused-function]
libxl/libxl_driver.c:4539:1: error: 'libxlDomainMigrateConfirm3Params' defined but not used [-Werror=unused-function]

The fixup is obvious (I didn't bother with commit message etc since I
expect you'll want to fold it in):

commit 69606cdba69afdd5e2eea0096596ae3beaa34890
Author: Ian Campbell <ian.campbell@citrix.com>
Date:   Wed Jun 25 11:48:45 2014 +0100

    fixup

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index f90bf64..03d397e 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4342,6 +4342,7 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
     return ret;
 }
 
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
 static char *
 libxlDomainMigrateBegin3Params(virDomainPtr domain,
                                virTypedParameterPtr params,
@@ -4561,7 +4562,7 @@ libxlDomainMigrateConfirm3Params(virDomainPtr domain,
 
     return libxlDomainMigrationConfirm(driver, vm, flags, cancelled);
 }
-
+#endif /* ifndef LIBXL_HAVE_NO_SUSPEND_RESUME */
 
 static virDriver libxlDriver = {
     .no = VIR_DRV_LIBXL,

^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
  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>
  0 siblings, 2 replies; 31+ messages in thread
From: Jim Fehlig @ 2014-06-25 15:25 UTC (permalink / raw)
  To: Ian Campbell; +Cc: LibVir, ian.jackson, xen-devel

Ian Campbell wrote:
> On Tue, 2014-06-24 at 21:18 -0600, Jim Fehlig wrote:
>
>   
>> Something like the attached patch (compile-tested only).  You'll need an
>> updated libvirt.git master to apply cleanly.
>>     
>
> Thanks. Building on ARM I get:
>
> libxl/libxl_driver.c:4346:1: error: 'libxlDomainMigrateBegin3Params' defined but not used [-Werror=unused-function]
> libxl/libxl_driver.c:4384:1: error: 'libxlDomainMigratePrepare3Params' defined but not used [-Werror=unused-function]
> libxl/libxl_driver.c:4433:1: error: 'libxlDomainMigratePerform3Params' defined but not used [-Werror=unused-function]
> libxl/libxl_driver.c:4488:1: error: 'libxlDomainMigrateFinish3Params' defined but not used [-Werror=unused-function]
> libxl/libxl_driver.c:4539:1: error: 'libxlDomainMigrateConfirm3Params' defined but not used [-Werror=unused-function]
>   

Yeah, compile-tested on x86 only as it turned out.  I was building
packages in the build service, where I had the libxl driver disabled for
aarch64 :-/.

With the fixup, does this work for you?  Is <migration_features> omitted
from the capabilities?

Regards,
Jim

> The fixup is obvious (I didn't bother with commit message etc since I
> expect you'll want to fold it in):
>
> commit 69606cdba69afdd5e2eea0096596ae3beaa34890
> Author: Ian Campbell <ian.campbell@citrix.com>
> Date:   Wed Jun 25 11:48:45 2014 +0100
>
>     fixup
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index f90bf64..03d397e 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -4342,6 +4342,7 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
>      return ret;
>  }
>  
> +#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
>  static char *
>  libxlDomainMigrateBegin3Params(virDomainPtr domain,
>                                 virTypedParameterPtr params,
> @@ -4561,7 +4562,7 @@ libxlDomainMigrateConfirm3Params(virDomainPtr domain,
>  
>      return libxlDomainMigrationConfirm(driver, vm, flags, cancelled);
>  }
> -
> +#endif /* ifndef LIBXL_HAVE_NO_SUSPEND_RESUME */
>  
>  static virDriver libxlDriver = {
>      .no = VIR_DRV_LIBXL,
>
>
>
>
>   

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
  2014-06-25 15:25           ` Jim Fehlig
@ 2014-06-25 16:37             ` Ian Campbell
       [not found]             ` <1403714245.16595.1.camel@kazak.uk.xensource.com>
  1 sibling, 0 replies; 31+ messages in thread
From: Ian Campbell @ 2014-06-25 16:37 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: LibVir, ian.jackson, xen-devel

On Wed, 2014-06-25 at 09:25 -0600, Jim Fehlig wrote:
> Ian Campbell wrote:
> > On Tue, 2014-06-24 at 21:18 -0600, Jim Fehlig wrote:
> >
> >   
> >> Something like the attached patch (compile-tested only).  You'll need an
> >> updated libvirt.git master to apply cleanly.
> >>     
> >
> > Thanks. Building on ARM I get:
> >
> > libxl/libxl_driver.c:4346:1: error: 'libxlDomainMigrateBegin3Params' defined but not used [-Werror=unused-function]
> > libxl/libxl_driver.c:4384:1: error: 'libxlDomainMigratePrepare3Params' defined but not used [-Werror=unused-function]
> > libxl/libxl_driver.c:4433:1: error: 'libxlDomainMigratePerform3Params' defined but not used [-Werror=unused-function]
> > libxl/libxl_driver.c:4488:1: error: 'libxlDomainMigrateFinish3Params' defined but not used [-Werror=unused-function]
> > libxl/libxl_driver.c:4539:1: error: 'libxlDomainMigrateConfirm3Params' defined but not used [-Werror=unused-function]
> >   
> 
> Yeah, compile-tested on x86 only as it turned out.  I was building
> packages in the build service, where I had the libxl driver disabled for
> aarch64 :-/.

Whoops!

> With the fixup, does this work for you?  Is <migration_features> omitted
> from the capabilities?

Yes, it is omitted. On ARM:

        # virsh capabilities
        <capabilities>
        
          <host>
            <cpu>
              <arch>armv7l</arch>
            </cpu>
            <power_management/>
            <topology>
              <cells num='1'>
                <cell id='0'>
                  <memory unit='KiB'>4186112</memory>
                  <cpus num='4'>
                    <cpu id='0' socket_id='0' core_id='0' siblings='0-3'/>
                    <cpu id='1' socket_id='0' core_id='0' siblings='0-3'/>
                    <cpu id='2' socket_id='0' core_id='0' siblings='0-3'/>
                    <cpu id='3' socket_id='0' core_id='0' siblings='0-3'/>
                  </cpus>
                </cell>
              </cells>
            </topology>
          </host>
        
          <guest>
            <os_type>xen</os_type>
            <arch name='armv7l'>
              <wordsize>32</wordsize>
              <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
              <machine>xenpv</machine>
              <domain type='xen'>
              </domain>
            </arch>
          </guest>
        
        </capabilities>

Thanks,
Ian.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC OSSTEST 7/9] Toolstack: Abstract away migration support check.
       [not found]             ` <1403714245.16595.1.camel@kazak.uk.xensource.com>
@ 2014-06-25 18:18               ` Jim Fehlig
  0 siblings, 0 replies; 31+ messages in thread
From: Jim Fehlig @ 2014-06-25 18:18 UTC (permalink / raw)
  To: Ian Campbell; +Cc: LibVir, ian.jackson, xen-devel

Ian Campbell wrote:
> On Wed, 2014-06-25 at 09:25 -0600, Jim Fehlig wrote:
>   
>> With the fixup, does this work for you?  Is <migration_features> omitted
>> from the capabilities?
>>     
>
> Yes, it is omitted. On ARM:
>
>         # virsh capabilities
>         <capabilities>
>         
>           <host>
>             <cpu>
>               <arch>armv7l</arch>
>             </cpu>
>             <power_management/>
>             <topology>
>               <cells num='1'>
>                 <cell id='0'>
>                   <memory unit='KiB'>4186112</memory>
>                   <cpus num='4'>
>                     <cpu id='0' socket_id='0' core_id='0' siblings='0-3'/>
>                     <cpu id='1' socket_id='0' core_id='0' siblings='0-3'/>
>                     <cpu id='2' socket_id='0' core_id='0' siblings='0-3'/>
>                     <cpu id='3' socket_id='0' core_id='0' siblings='0-3'/>
>                   </cpus>
>                 </cell>
>               </cells>
>             </topology>
>           </host>
>         
>           <guest>
>             <os_type>xen</os_type>
>             <arch name='armv7l'>
>               <wordsize>32</wordsize>
>               <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
>               <machine>xenpv</machine>
>               <domain type='xen'>
>               </domain>
>             </arch>
>           </guest>
>         
>         </capabilities>
>   

Cool. I've squashed in your changes and sent a "v2" (forgot to note that
with --subject-prefix).

Regards,
Jim

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2014-06-25 18:18 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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 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

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.