inventory: Ignore errors connecting to libvirt
If one of the VM hosts is offline, we still want to be able to generate the inventory from the other host.unifi-restore
parent
53c0107651
commit
fad63d5973
|
@ -101,10 +101,14 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
|
||||
assert self.inventory
|
||||
for uri in uri_list:
|
||||
if read_only:
|
||||
conn = libvirt.openReadOnly(uri)
|
||||
else:
|
||||
conn = libvirt.open(uri)
|
||||
try:
|
||||
if read_only:
|
||||
conn = libvirt.openReadOnly(uri)
|
||||
else:
|
||||
conn = libvirt.open(uri)
|
||||
except libvirt.libvirtError as e:
|
||||
log.error('Unable to open to libvirt URI: %s', e)
|
||||
continue
|
||||
for dom in conn.listAllDomains():
|
||||
host = Host(dom)
|
||||
state = host.get_state()[0]
|
||||
|
|
Loading…
Reference in New Issue