From: Michael Goldish <mgoldish@redhat.com>
To: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: [KVM-AUTOTEST PATCH 4/7] KVM test: get_ifname(): use self.instance instead of self.vnc_port
Date: Sun, 24 Oct 2010 13:01:07 +0200 [thread overview]
Message-ID: <1287918070-4579-4-git-send-email-mgoldish@redhat.com> (raw)
In-Reply-To: <1287918070-4579-3-git-send-email-mgoldish@redhat.com>
The vnc_port attribute is only unique among VMs that use a VNC display. Other
VMs don't bother to look for a free VNC port and don't occupy one, so vnc_port
can't be considered unique. The last 11 characters of self.instance make up a
fairly unique string which can be used instead. (The whole string can't be
used because it exceeds 15 characters.)
Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
client/tests/kvm/kvm_vm.py | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 2db916f..a5c110c 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -959,10 +959,7 @@ class VM:
def get_ifname(self, nic_index=0):
"""
- Return the ifname of tap device for the guest nic.
-
- The vnc_port is unique for each VM, nic_index is unique for each nic
- of one VM, it can avoid repeated ifname.
+ Return the ifname of a tap device associated with a NIC.
@param nic_index: Index of the NIC
"""
@@ -972,8 +969,7 @@ class VM:
if nic_params.get("nic_ifname"):
return nic_params.get("nic_ifname")
else:
- return "%s_%s_%s" % (nic_params.get("nic_model"),
- nic_index, self.vnc_port)
+ return "t%d-%s" % (nic_index, self.instance[-11:])
def get_mac_address(self, nic_index=0):
--
1.5.5.6
next prev parent reply other threads:[~2010-10-24 11:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-24 11:01 [KVM-AUTOTEST PATCH 1/7] KVM test: simplify MAC address management Michael Goldish
2010-10-24 11:01 ` [KVM-AUTOTEST PATCH 2/7] KVM test: VM.get_address(): fix handling of multiple NICs Michael Goldish
2010-10-24 11:01 ` [KVM-AUTOTEST PATCH 3/7] [RFC] KVM test: remove all code related to the old MAC address pool method Michael Goldish
2010-10-24 11:01 ` Michael Goldish [this message]
2010-10-24 11:01 ` [KVM-AUTOTEST PATCH 5/7] KVM test: kvm_monitor.py: replace MonitorSendError with MonitorSocketError Michael Goldish
2010-10-24 11:01 ` [KVM-AUTOTEST PATCH 6/7] KVM test: refactor migration code Michael Goldish
2010-10-24 11:01 ` [KVM-AUTOTEST PATCH 7/7] [RFC] KVM test: migrate_cancel: allow for alternative spellings of 'cancelled' Michael Goldish
2010-10-26 13:08 ` Lucas Meneghel Rodrigues
2010-10-26 12:56 ` [KVM-AUTOTEST PATCH 3/7] [RFC] KVM test: remove all code related to the old MAC address pool method Lucas Meneghel Rodrigues
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=1287918070-4579-4-git-send-email-mgoldish@redhat.com \
--to=mgoldish@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