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
|
assert self.inventory
|
||||||
for uri in uri_list:
|
for uri in uri_list:
|
||||||
|
try:
|
||||||
if read_only:
|
if read_only:
|
||||||
conn = libvirt.openReadOnly(uri)
|
conn = libvirt.openReadOnly(uri)
|
||||||
else:
|
else:
|
||||||
conn = libvirt.open(uri)
|
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():
|
for dom in conn.listAllDomains():
|
||||||
host = Host(dom)
|
host = Host(dom)
|
||||||
state = host.get_state()[0]
|
state = host.get_state()[0]
|
||||||
|
|
Loading…
Reference in New Issue