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

Function get_device

systemvm/debian/opt/cloud/bin/cs/CsHelper.py:146–155  ·  view source on GitHub ↗

Returns the device which has a specific ip If the ip is not found returns an empty string

(ip)

Source from the content-addressed store, hash-verified

144
145
146def get_device(ip):
147 """ Returns the device which has a specific ip
148 If the ip is not found returns an empty string
149 """
150 for i in execute("ip addr show"):
151 vals = i.strip().lstrip().rstrip().split()
152 if vals[0] == "inet":
153 if vals[1].split('/')[0] == ip:
154 return vals[-1]
155 return ""
156
157
158def get_ip(device):

Callers 1

mainFunction · 0.85

Calls 1

executeFunction · 0.70

Tested by

no test coverage detected