Add DHCP leases to the facts return by the module (#19700)
On RHEL 6, where the feature is not present, this will be ignored and return nothing.
This commit is contained in:
parent
eeebd51f21
commit
6221327b13
1 changed files with 9 additions and 0 deletions
|
@ -369,6 +369,10 @@ class LibvirtConnection(object):
|
|||
state = self.find_entry(entryid).isPersistent()
|
||||
return ENTRY_STATE_PERSISTENT_MAP.get(state,"unknown")
|
||||
|
||||
def get_dhcp_leases(self, entryid):
|
||||
network = self.find_entry(entryid)
|
||||
return network.DHCPLeases()
|
||||
|
||||
def define_from_xml(self, entryid, xml):
|
||||
if not self.module.check_mode:
|
||||
return self.conn.networkDefineXML(xml)
|
||||
|
@ -454,6 +458,11 @@ class VirtNetwork(object):
|
|||
results[entry]["state"] = self.conn.get_status(entry)
|
||||
results[entry]["bridge"] = self.conn.get_bridge(entry)
|
||||
results[entry]["uuid"] = self.conn.get_uuid(entry)
|
||||
try:
|
||||
results[entry]["dhcp_leases"] = self.conn.get_dhcp_leases(entry)
|
||||
# not supported on RHEL 6
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
results[entry]["forward_mode"] = self.conn.get_forward(entry)
|
||||
|
|
Loading…
Reference in a new issue