[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH OSSTEST 04/12] toolstack: distinguish local and remote migration support



Libvirt supports migrating a guest to remote host but not local host.
Distinguish the concept of local migration support and remote migration
support.

Toolstack's migrate_check now takes an extra argument to indicate which
mode we're interested in.

In sg-run-job we still check for local migration support because that's
the implicit target in test-guest-migr. Libvirt will still be blocked.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/Toolstack/libvirt.pm | 19 ++++++++++++++++---
 Osstest/Toolstack/xend.pm    |  2 +-
 Osstest/Toolstack/xl.pm      |  4 ++--
 sg-run-job                   |  2 +-
 ts-migrate-support-check     |  5 ++++-
 5 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index acb801c..a804ed5 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -64,9 +64,22 @@ sub shutdown_wait ($$$) {
     guest_await_destroy($gho,$timeout);
 }
 
-sub migrate_check ($) {
-    my ($self) = @_;
-    die "Migration check is not yet supported on libvirt.";
+sub migrate_check ($$) {
+    my ($self, $mode) = @_;
+    my $rc;
+
+    if ($mode eq 'local') {
+        # local migration is not supported
+        $rc = 1;
+    } else {
+       # $mode eq 'remote'
+       my $ho = $self->{Host};
+       my $caps = target_cmd_output_root($ho, "virsh capabilities");
+       $rc = ($caps =~ m/<migration_features>/) ? 0 : 1
+    }
+
+    logm("rc=$rc");
+    return $rc;
 }
 
 sub saverestore_check ($) {
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index ad98e65..bb39b75 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -35,7 +35,7 @@ sub new {
 }
 
 # xend always supported migration
-sub migrate_check ($) { return 0; }
+sub migrate_check ($$) { return 0; }
 
 # xend always supported save / restore
 sub saverestore_check ($) { return 0; }
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index b124273..7c82770 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -58,8 +58,8 @@ sub shutdown_wait ($$$) {
     target_cmd_root($ho,"$self->{_Command} shutdown -w $gn", $timeout);
 }
 
-sub migrate_check ($) {
-    my ($self) = @_;
+sub migrate_check ($$) {
+    my ($self,$mode) = @_;
     my $ho = $self->{Host};
     my $help = target_cmd_output_root($ho, $self->{_Command}." help");
     my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
diff --git a/sg-run-job b/sg-run-job
index cc2ab3b..b3747a7 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -289,7 +289,7 @@ proc run-job/test-pair {} {
 }
 
 proc test-guest-migr {g} {
-    set to_reap [spawn-ts . = ts-migrate-support-check + host $g]
+    set to_reap [spawn-ts . = ts-migrate-support-check + host $g local]
     set can_migrate [reap-ts $to_reap]
     if {!$can_migrate} return
 
diff --git a/ts-migrate-support-check b/ts-migrate-support-check
index cd41f68..d237710 100755
--- a/ts-migrate-support-check
+++ b/ts-migrate-support-check
@@ -23,5 +23,8 @@ use Osstest::TestSupport;
 tsreadconfig();
 
 our $ho = selecthost($ARGV[0]);
+# $ARGV[1] is guest name, $ARG[2] is migration mode.
+# Mode should be either "local" or "remote"
+our $mode = $ARGV[2];
 
-exit(toolstack($ho)->migrate_check());
+exit(toolstack($ho)->migrate_check($mode));
-- 
1.9.1


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.