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

[Xen-devel] [PATCH OSSTEST v2 13/18] Toolstack: Refactor save/restore support



Still stubbed out for libvirt.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 Osstest/Toolstack/libvirt.pm |  8 ++++++++
 Osstest/Toolstack/xend.pm    |  2 ++
 Osstest/Toolstack/xl.pm      | 18 ++++++++++++++++++
 ts-guest-saverestore         | 12 ++----------
 4 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 7740a89..8982cc1 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -73,4 +73,12 @@ sub migrate ($) {
     die "Migration is not yet supported on libvirt.";
 }
 
+sub save ($$$$) {
+    die "Save is not yet supported on libvirt.";
+}
+
+sub restore ($$$$$) {
+    die "Restore is not yet supported on libvirt.";
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index 4b5482f..6a5f9e6 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -39,6 +39,8 @@ sub create { return &Osstest::Toolstack::xl::create; }
 sub consolecmd { return &Osstest::Toolstack::xl::consolecmd; }
 sub shutdown_wait { return &Osstest::Toolstack::xl::shutdown_wait; }
 sub migrate { return &Osstest::Toolstack::xl::migrate; }
+sub save { return &Osstest::Toolstack::xl::save; }
+sub restore { return &Osstest::Toolstack::xl::restore; }
 
 # xend always supported migration
 sub migrate_check ($) { return 0; }
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index a6f04bc..adda0c7 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -76,4 +76,22 @@ sub migrate ($$$$) {
                    $to);
 }
 
+sub save ($$$$) {
+    my ($self,$gho,$f,$to) = @_;
+    my $ho = $self->{Host};
+    my $gn = $gho->{Name};
+    target_cmd_root($ho,$self->{Command}." save $gn $f", $to);
+}
+
+sub restore ($$$$$) {
+    my ($self,$gho,$f,$cfg,$to) = @_;
+    my $ho = $self->{Host};
+    my $gn = $gho->{Name};
+    target_cmd_root($ho,
+                   $self->{Command}
+                   ." restore "
+                   .($self->{RestoreNeedsConfig} ? $cfg : '')
+                   ." $f", $to);
+}
+
 1;
diff --git a/ts-guest-saverestore b/ts-guest-saverestore
index 8911aed..07baa93 100755
--- a/ts-guest-saverestore
+++ b/ts-guest-saverestore
@@ -27,19 +27,11 @@ our ($ho,$gho) = ts_get_host_guest(@ARGV);
 sub save () {
     guest_checkrunning($ho,$gho) or die $gho->{Name};
     my $err= guest_check_ip($gho);  die "$err $gho->{Name}" if defined $err;
-    target_cmd_root($ho,
-                   toolstack($ho)->{Command}
-                   ." save $gho->{Name} image",
-                   200);
+    toolstack($ho)->save($gho,"image",200);
     target_ping_check_down($gho);
 }
 sub restore () {
-    target_cmd_root($ho,
-                   toolstack($ho)->{Command}
-                   ." restore "
-                   .(toolstack($ho)->{RestoreNeedsConfig} ?
-                     $gho->{CfgPath} : '')
-                   ." image", 200);
+    toolstack($ho)->restore($gho,"image",$gho->{CfgPath},200);
     target_ping_check_up($gho);
 }
 
-- 
2.1.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®.