From: Michael Goldish Subject: [KVM-AUTOTEST PATCH 1/2] KVM test: make_qemu_command(): properly deal with get_mac_address() failure Date: Sat, 19 Feb 2011 01:11:27 +0200 Message-ID: <1298070688-12228-1-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org If VM params define a new NIC that didn't previously exist, then when make_qemu_command() is called in order to see if the VM should be restarted, it attempts to get the MAC address of the new (nonexistent) NIC, and an exception is raised. This exception is expected and should be caught. Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_vm.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index 969558b..d852784 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -638,7 +638,10 @@ class VM: except IndexError: netdev_id = None # Handle the '-net nic' part - mac = vm.get_mac_address(vlan) + try: + mac = vm.get_mac_address(vlan) + except VMAddressError: + mac = None qemu_cmd += add_nic(help, vlan, nic_params.get("nic_model"), mac, netdev_id, nic_params.get("nic_extra_params")) # Handle the '-net tap' or '-net user' part -- 1.7.3.4