From patchwork Tue Jan 11 13:13:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 471651 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0BDEHTB008472 for ; Tue, 11 Jan 2011 13:14:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756044Ab1AKNNu (ORCPT ); Tue, 11 Jan 2011 08:13:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24543 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755799Ab1AKNNr (ORCPT ); Tue, 11 Jan 2011 08:13:47 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0BDDjFj015718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jan 2011 08:13:46 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0BDDjv5026163; Tue, 11 Jan 2011 08:13:45 -0500 Received: from qu0061.eng.lab.tlv.redhat.com ([10.35.16.61]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0BDD9nl025030; Tue, 11 Jan 2011 08:13:44 -0500 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 25/26] KVM test: VM.destroy(): allow keeping the MAC addresses Date: Tue, 11 Jan 2011 15:13:37 +0200 Message-Id: <1294751618-21631-25-git-send-email-mgoldish@redhat.com> In-Reply-To: <1294751618-21631-1-git-send-email-mgoldish@redhat.com> References: <1294751618-21631-1-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 11 Jan 2011 13:14:25 +0000 (UTC) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index 0c355da..0403569 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -690,7 +690,7 @@ class VM: @raise VMPAError: If no PCI assignable devices could be assigned """ error.context("creating '%s'" % self.name) - self.destroy() + self.destroy(free_mac_addresses=False) if name is not None: self.name = name @@ -903,7 +903,7 @@ class VM: lockfile.close() - def destroy(self, gracefully=True): + def destroy(self, gracefully=True, free_mac_addresses=True): """ Destroy the VM. @@ -911,9 +911,11 @@ class VM: command. Then, attempt to destroy the VM via the monitor with a 'quit' command. If that fails, send SIGKILL to the qemu process. - @param gracefully: Whether an attempt will be made to end the VM + @param gracefully: If True, an attempt will be made to end the VM using a shell command before trying to end the qemu process with a 'quit' or a kill signal. + @param free_mac_addresses: If True, the MAC addresses used by the VM + will be freed. """ try: # Is it already dead? @@ -985,9 +987,10 @@ class VM: os.unlink(self.migration_file) except OSError: pass - num_nics = len(self.params.objects("nics")) - for vlan in range(num_nics): - self.free_mac_address(vlan) + if free_mac_addresses: + num_nics = len(self.params.objects("nics")) + for vlan in range(num_nics): + self.free_mac_address(vlan) @property