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>
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($$) {
}
# xend always supported migration
-sub migrate_check ($) { return 0; }
+sub migrate_check ($$) { return 0; }
# xend always supported save / restore
sub saverestore_check ($) { return 0; }
return $rc;
}
-sub migrate_check ($) {
- my ($self) = @_;
+sub migrate_check ($$) {
+ my ($self,$local) = @_;
return check_for_command($self, "migrate");
}
}
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
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));