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

[Xen-devel] [PATCH v3 13/19] Toolstack: Refactor migration support.



Note that since the previous patch arranges for
ts-migration-support-check to continue to fail for libvirt the libvirt
code is not actually called yet (and will die if it is). This patch is
mainly included to reduce the number of users of
toolstack()->{Command} closer to zero.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
v3: Pass a $ho object as the destination, rather than it's name.
---
 Osstest/Toolstack/libvirt.pm |  5 +++++
 Osstest/Toolstack/xl.pm      | 10 ++++++++++
 ts-guest-localmigrate        |  6 ++----
 ts-guest-migrate             |  5 +----
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index b74c8cb..3f84be8 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -68,4 +68,9 @@ sub migrate_check ($) {
     die "Migration check is not yet supported on libvirt.";
 }
 
+sub migrate ($) {
+    my ($self,$gho,$dst,$timeout) = @_;
+    die "Migration is not yet supported on libvirt.";
+}
+
 1;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index dcf3b08..4f710dd 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -67,4 +67,14 @@ sub migrate_check ($) {
     return $rc;
 }
 
+sub migrate ($$$$) {
+    my ($self,$gho,$dho,$timeout) = @_;
+    my $sho = $self->{Host};
+    my $dst = $dho->{Name};
+    my $gn = $gho->{Name};
+    target_cmd_root($sho,
+                   $self->{Command}." migrate $gn $dst",
+                   $timeout);
+}
+
 1;
diff --git a/ts-guest-localmigrate b/ts-guest-localmigrate
index f3381da..a831521 100755
--- a/ts-guest-localmigrate
+++ b/ts-guest-localmigrate
@@ -32,10 +32,8 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 
 sub migrate () {
     guest_checkrunning($ho,$gho) or die $gho->{Name};
-    target_cmd_root($ho,
-                   toolstack($ho)->{Command}
-                   ." migrate $gho->{Name} localhost",
-                   $timeout{Migrate});
+    # Migrate to same host, via localhost interface.
+    toolstack($ho)->migrate($gho, { %$ho, Name => "localhost" }, 
$timeout{Migrate});
 }
 
 guest_await_dhcp_tcp($gho, 5);
diff --git a/ts-guest-migrate b/ts-guest-migrate
index 65e7b42..b77d0de 100755
--- a/ts-guest-migrate
+++ b/ts-guest-migrate
@@ -31,10 +31,7 @@ our $gho = selectguest($ARGV[2],$sho);
 sub migrate () {
     guest_checkrunning($sho,$gho) or die $gho->{Name};
     my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
-    target_cmd_root($sho,
-                   toolstack($sho)->{Command}
-                   ." migrate $gho->{Name} $dho->{Name}",
-                   $timeout{Migrate});
+    toolstack($sho)->migrate($gho, $dho, $timeout{Migrate});
 }
 
 guest_await_dhcp_tcp($gho, 5);
-- 
2.1.4


_______________________________________________
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®.