From patchwork Mon Dec 20 16:57:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 422451 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 oBL0RA9T011307 for ; Tue, 21 Dec 2010 00:31:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933233Ab0LTU7M (ORCPT ); Mon, 20 Dec 2010 15:59:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7107 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933171Ab0LTU7L (ORCPT ); Mon, 20 Dec 2010 15:59:11 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBKKxAq9023540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Dec 2010 15:59:10 -0500 Received: from autotest.virt.bos.redhat.com (autotest.virt.bos.redhat.com [10.16.72.47]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBKKx7NV021469; Mon, 20 Dec 2010 15:59:09 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, 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> In-Reply-To: <1292864254-6782-1-git-send-email-lmr@redhat.com> References: <1292864254-6782-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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.3 (demeter1.kernel.org [140.211.167.41]); Tue, 21 Dec 2010 00:31:17 +0000 (UTC) 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