get_mac_address() should first check if 'nic_mac' is defined and then check the address pool. This way, if 'nic_mac' is changed between tests, make_qemu_command(), which calls get_mac_address(), will reveal the change and trigger a VM restart. Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx> --- client/tests/kvm/kvm_vm.py | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index d852784..1ceef7a 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -850,15 +850,12 @@ class VM: for vlan in range(num_nics): nic_name = params.objects("nics")[vlan] nic_params = params.object_params(nic_name) - if nic_params.get("nic_mac", None): - mac = nic_params.get("nic_mac") + mac = (nic_params.get("nic_mac") or + mac_source and mac_source.get_mac_address(vlan)) + if mac: kvm_utils.set_mac_address(self.instance, vlan, mac) else: - mac = mac_source and mac_source.get_mac_address(vlan) - if mac: - kvm_utils.set_mac_address(self.instance, vlan, mac) - else: - kvm_utils.generate_mac_address(self.instance, vlan) + kvm_utils.generate_mac_address(self.instance, vlan) # Assign a PCI assignable device self.pci_assignable = None @@ -1233,7 +1230,10 @@ class VM: @raise VMMACAddressMissingError: If no MAC address is defined for the requested NIC """ - mac = kvm_utils.get_mac_address(self.instance, nic_index) + nic_name = self.params.objects("nics")[nic_index] + nic_params = self.params.object_params(nic_name) + mac = (nic_params.get("nic_mac") or + kvm_utils.get_mac_address(self.instance, nic_index)) if not mac: raise VMMACAddressMissingError(nic_index) return mac -- 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