libvirt-check-trim: fail more elegantly if listAllDomains() is not available

master
neingeist 9 years ago
parent ccd71f9bad
commit c0aebcbe91

@ -13,6 +13,10 @@ if not conn:
print('Failed to open connection to the hypervisor!') print('Failed to open connection to the hypervisor!')
sys.exit(1) sys.exit(1)
if not hasattr(conn, "listAllDomains"):
print('connection does not have listAllDomains(), is python-libvirt too old?')
sys.exit(1)
for domain in conn.listAllDomains(): for domain in conn.listAllDomains():
print('== {}'.format(domain.name())) print('== {}'.format(domain.name()))

Loading…
Cancel
Save