[KVM-AUTOTEST PATCH 1/2] KVM test: make_qemu_command(): properly deal with get_mac_address() failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <mgoldish@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux