Skip to content

Commit

Permalink
Merge pull request #672 from mykaul/get_ips_per_net
Browse files Browse the repository at this point in the history
Add ips_in_net() function - retrieve all IPs in a net
  • Loading branch information
ovirt-infra authored Nov 28, 2017
2 parents 5bfa28d + e3ec935 commit 0ea069a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lago/plugins/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,21 @@ def all_ips(self):
for net in nets.values():
mapping = net.mapping()
for hostname, ip in mapping.items():
if hostname.startswith(self.name()):
# hostname is <hostname>-<ifacename>
if hostname.startswith(self.name() + "-"):
ips.append(str(ip))
return ips

def ips_in_net(self, net_name):
ips = []
net = self.virt_env.get_net(name=net_name)
mapping = net.mapping()
for hostname, ip in mapping.items():
# hostname is <hostname>-<ifacename>
if hostname.startswith(self.name() + "-"):
ips.append(str(ip))
return ips

def ssh(
self,
command,
Expand Down

0 comments on commit 0ea069a

Please sign in to comment.