From patchwork Fri Jul 17 15:17:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yolkfull Chow X-Patchwork-Id: 36027 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6HFHmJ1009778 for ; Fri, 17 Jul 2009 15:17:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934690AbZGQPRq (ORCPT ); Fri, 17 Jul 2009 11:17:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934687AbZGQPRq (ORCPT ); Fri, 17 Jul 2009 11:17:46 -0400 Received: from mx2.redhat.com ([66.187.237.31]:50673 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934635AbZGQPRp (ORCPT ); Fri, 17 Jul 2009 11:17:45 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6HFHiTD025411; Fri, 17 Jul 2009 11:17:44 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6HFHgRX030221; Fri, 17 Jul 2009 11:17:43 -0400 Received: from localhost.localdomain (vpn-198-10.nrt.redhat.com [10.64.198.10]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6HFHbfu009742; Fri, 17 Jul 2009 11:17:39 -0400 From: Yolkfull Chow To: kvm@vger.kernel.org Cc: autotest@test.kernel.org, Yolkfull Chow Subject: [PATCH] Add UUID option into kvm command line Date: Fri, 17 Jul 2009 23:17:41 +0800 Message-Id: <1247843861-3976-1-git-send-email-yzhou@redhat.com> In-Reply-To: <1247740006-27416-1-git-send-email-yzhou@redhat.com> References: <1247740006-27416-1-git-send-email-yzhou@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Yolkfull Chow --- client/tests/kvm/kvm_vm.py | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index 503f636..48f2916 100644 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -107,6 +107,7 @@ class VM: @param iso_dir: The directory where ISOs reside """ self.pid = None + self.uuid = None self.name = name self.params = params @@ -287,6 +288,11 @@ class VM: elif params.get("display") == "nographic": qemu_cmd += " -nographic" + if params.get("uuid") == "random": + qemu_cmd += " -uuid %s" % self.uuid + elif params.get("uuid"): + qemu_cmd += " -uuid %s" % params.get("uuid") + return qemu_cmd @@ -371,6 +377,12 @@ class VM: if params.get("display") == "vnc": self.vnc_port = kvm_utils.find_free_port(5900, 6000) + # Find random UUID if specified 'uuid = random' in config file + if params.get("uuid") == "random": + f = open("/proc/sys/kernel/random/uuid") + self.uuid = f.read().strip() + f.close() + # Make qemu command qemu_command = self.make_qemu_command() @@ -732,3 +744,15 @@ class VM: self.send_key("shift-%s" % char.lower()) else: self.send_key(char) + + + def get_uuid(self): + """ + Catch UUID of the VM. + + @return: None,if not specified in config file + """ + if self.params.get("uuid") == "random": + return self.uuid + else: + return self.params.get("uuid", None)