From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Meneghel Rodrigues Subject: [PATCH 5/5] KVM test: kvm_vm: Allow NIC MACs to be defined on config file Date: Mon, 20 Dec 2010 11:57:34 -0500 Message-ID: <1292864254-6782-5-git-send-email-lmr@redhat.com> References: <1292864254-6782-1-git-send-email-lmr@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: autotest@test.kernel.org Return-path: In-Reply-To: <1292864254-6782-1-git-send-email-lmr@redhat.com> 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 In order to allow the multi-host migration test to start VMs with the same MAC address, allow nic addresses to be defined on the config file, such as: nic_mac_nic1 = AA:BB:CC:DD:EE This way we can generate a MAC on the server control file and distribute this to the new VMs that are going to be created. Signed-off-by: Lucas Meneghel Rodrigues --- client/tests/kvm/kvm_vm.py | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index 416b827..b1aefb6 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -598,14 +598,22 @@ class VM: self.uuid = f.read().strip() f.close() + + # Generate or copy MAC addresses for all NICs num_nics = len(kvm_utils.get_sub_dict_names(params, "nics")) for vlan in range(num_nics): - mac = mac_source and mac_source.get_mac_address(vlan) - if mac: + nic_name = kvm_utils.get_sub_dict_names(params, "nics")[vlan] + nic_params = kvm_utils.get_sub_dict(params, nic_name) + if nic_params.get("nic_mac", None): + mac = nic_params.get("nic_mac") kvm_utils.set_mac_address(self.instance, vlan, mac) else: - kvm_utils.generate_mac_address(self.instance, vlan) + 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) # Assign a PCI assignable device self.pci_assignable = None -- 1.7.3.4