[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH OSSTEST v3 01/13] toolstack: save / restore check
Introduce check_for_command function and use it to check save / restore functionality. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- v3: remove $TOOLSTACK prefix. v2: introduce $TOOLSTACK_check_for_command function. --- Osstest/Toolstack/libvirt.pm | 14 ++++++++++++++ Osstest/Toolstack/xend.pm | 3 +++ Osstest/Toolstack/xl.pm | 16 +++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm index 51a10de..26a2fa3 100644 --- a/Osstest/Toolstack/libvirt.pm +++ b/Osstest/Toolstack/libvirt.pm @@ -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."; diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm index 972b3b1..fd54ae1 100644 --- a/Osstest/Toolstack/xend.pm +++ b/Osstest/Toolstack/xend.pm @@ -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; diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm index 3c3d348..1d014ca 100644 --- a/Osstest/Toolstack/xl.pm +++ b/Osstest/Toolstack/xl.pm @@ -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}; -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |