MCPcopy Create free account
hub / github.com/apache/cloudstack / get_guest_if

Method get_guest_if

systemvm/debian/opt/cloud/bin/cs/CsAddress.py:61–75  ·  view source on GitHub ↗

Return CsInterface object for the lowest in use guest interface

(self)

Source from the content-addressed store, hash-verified

59 return guest_interface
60
61 def get_guest_if(self):
62 """
63 Return CsInterface object for the lowest in use guest interface
64 """
65 guest_interface = None
66 lowest_device = 1000
67 for interface in self.get_interfaces():
68 if interface.is_guest() and interface.is_added():
69 device = interface.get_device()
70 device_suffix = int(''.join([digit for digit in device if digit.isdigit()]))
71 if device_suffix < lowest_device:
72 lowest_device = device_suffix
73 guest_interface = interface
74 logging.debug("Guest interface will be set on device '%s' and IP '%s'" % (guest_interface.get_device(), guest_interface.get_ip()))
75 return guest_interface
76
77 def get_guest_ip(self):
78 """

Callers 4

get_guest_ipMethod · 0.95
get_guest_netmaskMethod · 0.95
_redundant_onMethod · 0.80
test_get_guest_ifMethod · 0.80

Calls 8

get_interfacesMethod · 0.95
intFunction · 0.85
is_guestMethod · 0.80
is_addedMethod · 0.80
get_deviceMethod · 0.80
debugMethod · 0.80
joinMethod · 0.45
get_ipMethod · 0.45

Tested by 1

test_get_guest_ifMethod · 0.64