From patchwork Sun May 24 15:46:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 25598 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 n4OFif1a012433 for ; Sun, 24 May 2009 15:44:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754875AbZEXPod (ORCPT ); Sun, 24 May 2009 11:44:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754890AbZEXPod (ORCPT ); Sun, 24 May 2009 11:44:33 -0400 Received: from mx2.redhat.com ([66.187.237.31]:49717 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754875AbZEXPoc (ORCPT ); Sun, 24 May 2009 11:44:32 -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 n4OFiZmx029866 for ; Sun, 24 May 2009 11:44:35 -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 n4OFiYmn019941; Sun, 24 May 2009 11:44:34 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n4OFiMU2009023; Sun, 24 May 2009 11:44:33 -0400 From: Michael Goldish To: kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH] kvm_vm.py: add new function VM.clone() which returns a clone of the VM Date: Sun, 24 May 2009 18:46:44 +0300 Message-Id: In-Reply-To: <63bacaa214ccd95c18fb644056855acd72757ac4.1243179847.git.mgoldish@redhat.com> References: <8e37a36c044c20259dcd8a34d72a651e85b37d5f.1243179847.git.mgoldish@redhat.com> <838bcae1b49be011e2cde1294a391a296059464a.1243179847.git.mgoldish@redhat.com> <6a70cb56a775fdb688da0231073abb0ce4baa7b1.1243179847.git.mgoldish@redhat.com> <63bacaa214ccd95c18fb644056855acd72757ac4.1243179847.git.mgoldish@redhat.com> In-Reply-To: <8e37a36c044c20259dcd8a34d72a651e85b37d5f.1243179847.git.mgoldish@redhat.com> References: <8e37a36c044c20259dcd8a34d72a651e85b37d5f.1243179847.git.mgoldish@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: Michael Goldish --- client/tests/kvm_runtest_2/kvm_vm.py | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/client/tests/kvm_runtest_2/kvm_vm.py b/client/tests/kvm_runtest_2/kvm_vm.py index af06693..9571a3b 100644 --- a/client/tests/kvm_runtest_2/kvm_vm.py +++ b/client/tests/kvm_runtest_2/kvm_vm.py @@ -115,6 +115,24 @@ class VM: if not os.path.exists(self.monitor_file_name): break + def clone(self, name=None, params=None, qemu_path=None, image_dir=None, iso_dir=None): + """Return a clone of the VM object with optionally modified parameters. + + The clone is initially not alive and needs to be started using create(). + Any parameters not passed to this function are copied from the source VM. + """ + if name == None: + name = self.name + if params == None: + params = self.params.copy() + if qemu_path == None: + qemu_path = self.qemu_path + if image_dir == None: + image_dir = self.image_dir + if iso_dir == None: + iso_dir = self.iso_dir + return VM(name, params, qemu_path, image_dir, iso_dir) + def verify_process_identity(self): """Make sure .pid really points to the original qemu process.