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

[Xen-devel] [PATCH OSSTEST v3 05/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>
---
v3: use tuple to get all three arguments at once
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     |  7 +++++--
 5 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 5c6ca90..32dca84 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 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 1d014ca..67564b3 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -70,8 +70,8 @@ sub check_for_command($$) {
     return $rc;
 }
 
-sub migrate_check ($) {
-    my ($self) = @_;
+sub migrate_check ($$) {
+    my ($self,$local) = @_;
     return 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..a1440a2 100755
--- a/ts-migrate-support-check
+++ b/ts-migrate-support-check
@@ -22,6 +22,9 @@ use Osstest::TestSupport;
 
 tsreadconfig();
 
-our $ho = selecthost($ARGV[0]);
 
-exit(toolstack($ho)->migrate_check());
+# Mode should be either 1 ("local") or 0 ("remote")
+our ($whhost, $gn, $mode) = @ARGV;
+our $ho = selecthost($whhost);
+
+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®.