[KVM-AUTOTEST PATCH 4/7] KVM test: get_ifname(): use self.instance instead of self.vnc_port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux