kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: autotest@test.kernel.org, lmr@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH 4/9] KVM test: Redirect the serial to the unix domain socket
Date: Mon, 26 Apr 2010 18:03:54 +0800	[thread overview]
Message-ID: <20100426100354.26268.97488.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100426095656.26268.50549.stgit@localhost.localdomain>

This patch redirect the guest serial to the unix domain socket which
would be used by the following patches to dump its content or use it
as a session.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 client/tests/kvm/kvm_vm.py |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 6bc7987..8f4753f 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -116,17 +116,20 @@ class VM:
         self.address_cache = address_cache
         self.pci_assignable = None
 
-        # Find available monitor filename
+        # Find available filenames for monitor and guest serial redirection
         while True:
-            # The monitor filename should be unique
+            # The filenames should be unique
             self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
                              kvm_utils.generate_random_string(4))
-            self.monitor_file_name = os.path.join("/tmp",
-                                                  "monitor-" + self.instance)
-            if not os.path.exists(self.monitor_file_name):
-                break
-
 
+            names = [os.path.join("/tmp", type + self.instance) for type in
+                     "monitor-", "serial-"]
+            if True in [os.path.exists(file) for file in names]:
+                continue
+            else:
+                [self.monitor_file_name, self.serial_file_name] = names
+                break
+                                                         
     def clone(self, name=None, params=None, root_dir=None, address_cache=None):
         """
         Return a clone of the VM object with optionally modified parameters.
@@ -316,6 +319,8 @@ class VM:
             for pci_id in self.pa_pci_ids:
                 qemu_cmd += " -pcidevice host=%s" % pci_id
 
+        qemu_cmd += " -serial unix:%s,server,nowait" % self.serial_file_name
+
         return qemu_cmd

  parent reply	other threads:[~2010-04-26 10:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 10:03 [PATCH 0/9] Make use of the redirection of guest serial Jason Wang
2010-04-26 10:03 ` [PATCH 1/9] KVM test: Introduce the prompt assist Jason Wang
2010-04-28 11:28   ` Michael Goldish
2010-05-06  2:55     ` Jason Wang
2010-05-06 15:18       ` Lucas Meneghel Rodrigues
2010-04-26 10:03 ` [PATCH 2/9] KVM test: Add the ability to send the username in remote_login() Jason Wang
2010-04-28 11:32   ` Michael Goldish
2010-04-26 10:03 ` [PATCH 3/9] KVM test: Make the login re suitable for serial console Jason Wang
2010-04-28 11:18   ` Michael Goldish
2010-05-06  2:57     ` Jason Wang
2010-04-26 10:03 ` Jason Wang [this message]
2010-04-26 10:04 ` [PATCH 5/9] KVM test: Log the content from guest " Jason Wang
2010-04-28 13:26   ` Michael Goldish
2010-05-06  3:03     ` Jason Wang
2010-04-26 10:04 ` [PATCH 6/9] KVM test: Raise error when met unknown type in kvm_vm.remote_login() Jason Wang
2010-05-06 15:15   ` [Autotest] " Lucas Meneghel Rodrigues
2010-04-26 10:04 ` [PATCH 7/9] KVM test: Introduce the local_login() Jason Wang
2010-04-28 12:01   ` Michael Goldish
2010-04-28 23:44     ` Amos Kong
     [not found]     ` <20100428234409.GA2738@akong@redhat.com>
2010-05-05  9:37       ` [Autotest] " Michael Goldish
2010-05-06  3:07     ` Jason Wang
2010-04-26 10:04 ` [PATCH 8/9] KVM test: Create the background threads before calling process() Jason Wang
2010-04-28 11:55   ` Michael Goldish
2010-05-06 15:35     ` [Autotest] " Lucas Meneghel Rodrigues
2010-04-26 10:04 ` [PATCH 9/9] KVM test: Redirect the console to serial for all linux guests Jason Wang
2010-04-28 12:24   ` Michael Goldish
2010-05-06  3:08     ` Jason Wang
2010-05-06 15:43       ` Lucas Meneghel Rodrigues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100426100354.26268.97488.stgit@localhost.localdomain \
    --to=jasowang@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lmr@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).