]> xenbits.xensource.com Git - osstest.git/commitdiff
toolstack: save / restore check
authorWei Liu <wei.liu2@citrix.com>
Sun, 8 Feb 2015 15:20:17 +0000 (15:20 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 30 Jul 2015 14:22:13 +0000 (15:22 +0100)
Introduce check_for_command function and use it to check save / restore
functionality.

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

index 51a10de49db49646cb41613ebed5356762d4158c..26a2fa35cda95d7f35e6c297939602c8bc5259af 100644 (file)
@@ -77,6 +77,20 @@ sub migrate_check ($) {
     die "Migration check is not yet supported on libvirt.";
 }
 
+sub check_for_command($$) {
+    my ($self,$cmd) = @_;
+    my $ho = $self->{Host};
+    my $help = target_cmd_output_root($ho, "virsh help");
+    my $rc = ($help =~ m/^\s*$cmd/m) ? 0 : 1;
+    logm("rc=$rc");
+    return $rc;
+}
+
+sub saverestore_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "save");
+}
+
 sub migrate ($) {
     my ($self,$gho,$dst,$timeout) = @_;
     die "Migration is not yet supported on libvirt.";
index 972b3b1d327e7f4aedec32b899f8020e532ab47a..fd54ae12c57df16c4ec8bf188d5a5bad0b67e2e9 100644 (file)
@@ -38,4 +38,7 @@ sub new {
 # xend always supported migration
 sub migrate_check ($) { return 0; }
 
+# xend always supported save / restore
+sub saverestore_check ($) { return 0; }
+
 1;
index becda7db9b31440e9e5cb96939eb6564c126aff4..62ecaa6b89967e365444458680c6530a4f3cd102 100644 (file)
@@ -61,15 +61,25 @@ sub shutdown_wait ($$$) {
     target_cmd_root($ho,"$self->{_Command} shutdown -w${acpi_fallback} $gn", $timeout);
 }
 
-sub migrate_check ($) {
-    my ($self) = @_;
+sub check_for_command($$) {
+    my ($self,$cmd) = @_;
     my $ho = $self->{Host};
     my $help = target_cmd_output_root($ho, $self->{_Command}." help");
-    my $rc = ($help =~ m/^\s*migrate/m) ? 0 : 1;
+    my $rc = ($help =~ m/^\s*$cmd/m) ? 0 : 1;
     logm("rc=$rc");
     return $rc;
 }
 
+sub migrate_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "migrate");
+}
+
+sub saverestore_check ($) {
+    my ($self) = @_;
+    return check_for_command($self, "save");
+}
+
 sub migrate ($$$$) {
     my ($self,$gho,$dho,$timeout) = @_;
     my $sho = $self->{Host};