From patchwork Tue May 11 09:03:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 98651 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4B8wvsS015489 for ; Tue, 11 May 2010 08:58:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932207Ab0EKI6x (ORCPT ); Tue, 11 May 2010 04:58:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25853 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932068Ab0EKI6w (ORCPT ); Tue, 11 May 2010 04:58:52 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4B8wpU6022695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 May 2010 04:58:51 -0400 Received: from localhost.localdomain ([10.66.91.25]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4B8wnRW018559; Tue, 11 May 2010 04:58:49 -0400 Subject: [PATCH v2 04/10] KVM test: Redirect the serial to the unix domain socket To: lmr@redhat.com, autotest@test.kernel.org From: Jason Wang Cc: kvm@vger.kernel.org Date: Tue, 11 May 2010 17:03:42 +0800 Message-ID: <20100511090342.19914.45561.stgit@localhost.localdomain> In-Reply-To: <20100511083338.19914.7719.stgit@localhost.localdomain> References: <20100511083338.19914.7719.stgit@localhost.localdomain> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 11 May 2010 08:58:58 +0000 (UTC) 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