From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Meneghel Rodrigues Subject: [KVM-AUTOTEST PATCH 7/8] Add new function, VM.clone() to clone an existing VM Date: Fri, 5 Jun 2009 17:46:33 -0300 Message-ID: <1244234794-7844-8-git-send-email-lmr@redhat.com> References: <1244234794-7844-1-git-send-email-lmr@redhat.com> <1244234794-7844-2-git-send-email-lmr@redhat.com> <1244234794-7844-3-git-send-email-lmr@redhat.com> <1244234794-7844-4-git-send-email-lmr@redhat.com> <1244234794-7844-5-git-send-email-lmr@redhat.com> <1244234794-7844-6-git-send-email-lmr@redhat.com> <1244234794-7844-7-git-send-email-lmr@redhat.com> Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues , Michael Goldish To: autotest@test.kernel.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:59803 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753024AbZFEUqu (ORCPT ); Fri, 5 Jun 2009 16:46:50 -0400 In-Reply-To: <1244234794-7844-7-git-send-email-lmr@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This method will be useful when writing functional tests. Risk: Low (new method of the kvm test API) Visibility: Low (kvm test developers will have an additional API to use) Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_vm.py | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index 3001648..b81c0df 100644 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -126,6 +126,25 @@ class VM: 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. If .pid -- 1.6.2.2