diff mbox

[Xen-devel,RFC,OSSTEST,8/9] Toolstack: Refactor consolecmd handling

Message ID 1403018787-25442-8-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    | 2 ++
 Osstest/Toolstack/xl.pm      | 5 +++++
 ts-logs-capture              | 2 +-
 4 files changed, 13 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/Osstest/Toolstack/libvirt.pm b/Osstest/Toolstack/libvirt.pm
index 2dffd09..886e41b 100644
--- a/Osstest/Toolstack/libvirt.pm
+++ b/Osstest/Toolstack/libvirt.pm
@@ -55,4 +55,9 @@  sub migrate_check ($) {
     die "libvirt migration not supported yet."
 }
 
+sub consolecmd ($$) {
+    my ($self,$gn) = @_;
+    return "virsh console $gn";
+}
+
 1;
diff --git a/Osstest/Toolstack/xend.pm b/Osstest/Toolstack/xend.pm
index 934f1a5..b77b4eb 100644
--- a/Osstest/Toolstack/xend.pm
+++ b/Osstest/Toolstack/xend.pm
@@ -33,8 +33,10 @@  sub new {
     }, $class;
 }
 
+# Defer to xl driver for most things
 sub destroy { return Osstest::Toolstack::xl::destroy(@_); }
 sub create { return Osstest::Toolstack::xl::create(@_); }
+sub consolecmd { return Osstest::Toolstack::xl::consolecmd(@_); }
 
 sub migrate_check ($) {
     my ($self) = @_;
diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm
index 1c97a9d..9f4f8d1 100644
--- a/Osstest/Toolstack/xl.pm
+++ b/Osstest/Toolstack/xl.pm
@@ -51,4 +51,9 @@  sub migrate_check ($) {
     return $rc;
 }
 
+sub consolecmd ($$) {
+    my ($self,$gn) = @_;
+    return $self->{_Command}." console $gho->{Name}";
+}
+
 1;
diff --git a/ts-logs-capture b/ts-logs-capture
index 9df5485..5a3b4c4 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -192,7 +192,7 @@  sub fetch_logs_guest ($) {
         logm("cannot find domid: $@");
         return;
     }
-    my $consolecmd= toolstack($ho)->{Command}." console $gho->{Name}";
+    my $consolecmd= toolstack($ho)->consolecmd($gho->{Name});
     try_cmd_output_save("sleep 1 | $consolecmd | cat",
                         "guest-$gho->{Name}-console");