[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 20/22] HVM guests: Use qemu "pipe:" for serial output logging



Modern qemu has the "pipe:/PATH" character driver.  This opens
/PATH.in for reading and /PATH.out for writing.  In my tests, I found
that:
  - contrary to the documentation, they do not need to be pipes
    (at least, /PATH.out can be a file)
  - but they must both already exist
  - qemu will follow symlinks, so /PATH.out can be a symlink to
    a file
  - if /PATH.in is a fifo, qemu will tolerate other processes opening
    it for writing, and writing things, only occasionally.  (Probably,
    qemu opens it O_RDWR; or perhaps it reopens it after EOF.)

Use this feature to achieve the following:
  - guest serial output ends up in /var/log/xen/osstest-serial-GUEST.log
    (which is already captured by ts-logs-capture) rather than
    interleaved with qemu's stderr output (in the libxl-created logfile)
  - guest serial input comes from a pipe in /root which we can open
    and write to if we want to talk to the guest

We are mostly interested in the final bullet point, because that will
allow us to send debug keys to the emulated serial port of an L1
nested HVM guest.

Looking at the source code of qemu in 4.2 and 4.6 I think the above
approach will work with all relevant qemu-xen's.

If the device model version is qemu-xen-traditional, `pipe:' is not
supported.  If device_model_version is not set, we will be using
whatever the xen.git we used defaults to.  For Xen 4.1 and earlier
that is qemu-xen-traditional, and I'm slightly loathe to break osstest
for those earlier versions.  There doesn't seem to be anything else in
the runvars that would clue us in.  So be cautious and do not use the
new feature unless device_model_version is explicitly set.

The nested tests are all -qemuu so set device_model_version.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
v16: New patch
---
 Osstest/TestSupport.pm |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 32f2956..0a47b52 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1884,8 +1884,18 @@ END
        # fd pointing to mini-os's console. IOW any such path used
        # here ends up in the host logs in /var/log/xen/qemu-dm-$guest.log
        $cfg .= "serial='file:/var/log/dm-serial.log'\n";
-    } else {
+    } elsif (!(defined $devmodel) || $devmodel =~ /traditional/) {
        $cfg .= "serial='file:/dev/stderr'\n";
+    } else {
+       my $logpath = "/var/log/xen/osstest-serial-$gho->{Name}.log";
+       my $basepath = "/root/$flight.$job.$gho->{Name}.serial";
+       target_cmd_root($ho, <<END);
+            set -ex
+            test -e $logpath      || touch $logpath
+            test -e $basepath.out || ln -s $logpath $basepath.out
+            test -e $basepath.in  || mkfifo -m700 $basepath.in
+END
+       $cfg .= "serial='pipe:$basepath'\n";
     }
 
     $xopts{VifType} ||= "ioemu";
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.