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

[Xen-devel] [PATCH OSSTEST v2 04/13] 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>
---
v2: use bool instead of "local" "remote" string
---
 Osstest/Toolstack/libvirt.pm | 18 +++++++++++++++---
 Osstest/Toolstack/xend.pm    |  2 +-
 Osstest/Toolstack/xl.pm      |  4 ++--
 sg-run-job                   |  2 +-
 ts-migrate-support-check     |  6 +++++-
 5 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 592cfa2..ddf84df 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -72,9 +72,21 @@ 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, $local) = @_;
+    my $rc;
+
+    if ($local) {
+        # local migration is not supported
+        $rc = 1;
+    } else {
+       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 _libvirt_check_for_command($$) {
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index fd54ae1..b435938 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -36,7 +36,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 440d9d0..0c4aff8 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -70,8 +70,8 @@ sub _xl_check_for_command($$) {
     return $rc;
 }
 
-sub migrate_check ($) {
-    my ($self) = @_;
+sub migrate_check ($$) {
+    my ($self,$local) = @_;
     return _xl_check_for_command($self, "migrate");
 }
 
diff --git a/sg-run-job b/sg-run-job
index 61f88fb..16fcfc1 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -300,7 +300,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 1]
     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..f877c09 100755
--- a/ts-migrate-support-check
+++ b/ts-migrate-support-check
@@ -23,5 +23,9 @@ use Osstest::TestSupport;
 tsreadconfig();
 
 our $ho = selecthost($ARGV[0]);
+# $ARGV[1] is guest name, $ARG[2] indicates whether it is checking for
+# local migration or remote migration
+# Mode should be either 1 ("local") or 0 ("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®.