]> xenbits.xensource.com Git - osstest.git/commitdiff
toolstack: distinguish local and remote migration support
authorWei Liu <wei.liu2@citrix.com>
Tue, 21 Jul 2015 14:38:17 +0000 (15:38 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 30 Jul 2015 14:22:13 +0000 (15:22 +0100)
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@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Osstest/Toolstack/libvirt.pm
Osstest/Toolstack/xend.pm
Osstest/Toolstack/xl.pm
sg-run-job
ts-migrate-support-check

index 5c6ca905cf05d81b2b9c07e9efcfe62fb26780e1..32dca8462fad6c63c7b4df5929d302a70dff37df 100644 (file)
@@ -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($$) {
index fd54ae12c57df16c4ec8bf188d5a5bad0b67e2e9..b43593842070a84180743f55bd979dd7e3f0c649 100644 (file)
@@ -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; }
index 62ecaa6b89967e365444458680c6530a4f3cd102..0f8abed52d3e44bc57d6ec1c04dcb5634840d4a4 100644 (file)
@@ -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");
 }
 
index d77744fa8ac7e4e45e93fb258e4ec51950385f2c..af035d32838f4d3a25fd1dd8f9760364833c2fb0 100755 (executable)
@@ -311,7 +311,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
 
index cd41f683415bbc78d2192cc2023a10dc9c762d78..a1440a22cde342b10659a1bd55c4fbe20be2a826 100755 (executable)
@@ -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));