|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 14/19] Toolstack: Refactor save/restore support
Use $gho->{CfgPath} rather than constructing it again.
Still stubbed out for libvirt.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
v3: Switch to CfgPath defered from incorrect home in earlier patch to
here.
RestoreNeedsConfig is an xl/xm ism, not relevant to libvirt, so
remove $cfg parameter from restore method.
---
Osstest/Toolstack/libvirt.pm | 10 ++++++++++
Osstest/Toolstack/xl.pm | 19 +++++++++++++++++++
ts-guest-saverestore | 12 ++----------
3 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 3f84be8..471b42e 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -73,4 +73,14 @@ sub migrate ($) {
die "Migration is not yet supported on libvirt.";
}
+sub save ($$$$) {
+ my ($self,$gho,$f,$timeout) = @_;
+ die "Save is not yet supported on libvirt.";
+}
+
+sub restore ($$$$) {
+ my ($self,$gho,$f,$timeout) = @_;
+ die "Restore is not yet supported on libvirt.";
+}
+
1;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index 4f710dd..b730783 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -77,4 +77,23 @@ sub migrate ($$$$) {
$timeout);
}
+sub save ($$$$) {
+ my ($self,$gho,$f,$timeout) = @_;
+ my $ho = $self->{Host};
+ my $gn = $gho->{Name};
+ target_cmd_root($ho,$self->{Command}." save $gn $f", $timeout);
+}
+
+sub restore ($$$$) {
+ my ($self,$gho,$f,$timeout) = @_;
+ my $ho = $self->{Host};
+ my $gn = $gho->{Name};
+ my $cfg = $self->{RestoreNeedsConfig} ? $gho->{CfgPath} : '';
+ target_cmd_root($ho,
+ $self->{Command}
+ ." restore "
+ .$cfg
+ ." $f", $timeout);
+}
+
1;
diff --git a/ts-guest-saverestore b/ts-guest-saverestore
index 9e04ae9..7e13d90 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} ?
- $r{ $gho->{Guest}.'_'. toolstack($ho)->{CfgPathVar} } :
'')
- ." image", 200);
+ toolstack($ho)->restore($gho,"image", 200);
target_ping_check_up($gho);
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |