public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org
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	[thread overview]
Message-ID: <1292864254-6782-5-git-send-email-lmr@redhat.com> (raw)
In-Reply-To: <1292864254-6782-1-git-send-email-lmr@redhat.com>

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 <lmr@redhat.com>
---
 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

      parent reply	other threads:[~2010-12-20 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20 16:57 [PATCH 1/5] KVM test: Include the preprocessing param migration_mode Lucas Meneghel Rodrigues
2010-12-20 16:57 ` [PATCH 2/5] KVM test: Introduce migration_multi_host test Lucas Meneghel Rodrigues
2010-12-20 16:57 ` [PATCH 3/5] KVM test: Add migration server control file Lucas Meneghel Rodrigues
2010-12-20 16:57 ` [PATCH 4/5] KVM test: Modifications on the migrate utility function Lucas Meneghel Rodrigues
2010-12-20 16:57 ` Lucas Meneghel Rodrigues [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1292864254-6782-5-git-send-email-lmr@redhat.com \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox