diff mbox

[KVM-AUTOTEST,14/18] KVM test: kvm_vm.py: redirect the serial console to a unix socket

Message ID 1276820075-31310-14-git-send-email-mgoldish@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Goldish June 18, 2010, 12:14 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index c82226d..5012d66 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -203,6 +203,9 @@  class VM:
         def add_qmp_monitor(help, filename):
             return " -qmp unix:'%s',server,nowait" % filename
 
+        def add_serial(help, filename):
+            return " -serial unix:'%s',server,nowait" % filename
+
         def add_mem(help, mem):
             return " -m %s" % mem
 
@@ -313,6 +316,9 @@  class VM:
             else:
                 qemu_cmd += add_human_monitor(help, monitor_filename)
 
+        # Add serial console redirection
+        qemu_cmd += add_serial(help, self.get_serial_console_filename())
+
         for image_name in kvm_utils.get_sub_dict_names(params, "images"):
             image_params = kvm_utils.get_sub_dict(params, image_name)
             if image_params.get("boot_drive") == "no":
@@ -772,6 +778,13 @@  class VM:
                 kvm_utils.get_sub_dict_names(self.params, "monitors")]
 
 
+    def get_serial_console_filename(self):
+        """
+        Return the serial console filename.
+        """
+        return "/tmp/serial-%s" % self.instance
+
+
     def get_testlog_filename(self):
         """
         Return the testlog filename.