diff mbox

[Xen-devel,RFC,OSSTEST,9/9] Toolstack: refactor shutdown support

Message ID 1403018809-25509-9-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell June 17, 2014, 3:26 p.m. UTC
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Toolstack/libvirt.pm | 5 +++++
 Osstest/Toolstack/xend.pm    | 1 +
 Osstest/Toolstack/xl.pm      | 6 ++++++
 ts-guest-stop                | 5 +----
 4 files changed, 13 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 886e41b..0452df7 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -60,4 +60,9 @@  sub consolecmd ($$) {
     return "virsh console $gn";
 }
 
+sub shutdown_wait ($$) {
+    my ($self,$gn) = @_;
+    die "libvirt shutdown wait not implemented yet."
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index b77b4eb..f6841c9 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -37,6 +37,7 @@  sub new {
 sub destroy { return Osstest::Toolstack::xl::destroy(@_); }
 sub create { return Osstest::Toolstack::xl::create(@_); }
 sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); }
+sub shutdown_wait { return Osstest::Toolstack::xl::consolecmd(@_); }
 
 sub migrate_check ($) {
     my ($self) = @_;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index 9f4f8d1..ce38444 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -56,4 +56,10 @@  sub consolecmd ($$) {
     return $self->{_Command}." console $gho->{Name}";
 }
 
+sub shutdown_wait ($$) {
+    my ($self,$gn) = @_;
+    my $ho = $self->{Host};
+    target_cmd_root($ho,"$self->{_Command} shutdown -w $gn", 200);
+}
+
 1;
diff --git a/ts-guest-stop b/ts-guest-stop
index 0e3a863..bd9c946 100755
--- a/ts-guest-stop
+++ b/ts-guest-stop
@@ -26,10 +26,7 @@  our ($ho,$gho) = ts_get_host_guest(@ARGV);
 
 sub stop () {
     guest_checkrunning($ho, $gho) or die "$gho->{Name} not running";
-    target_cmd_root($ho,
-		    toolstack($ho)->{Command}
-		    ." shutdown -w "
-		    .$gho->{Name}, 200);
+    toolstack($ho)->shutdown_wait($gho->{Name});
     guest_checkrunning($ho, $gho) and die $gho->{Name};
 }