libvirt-check-trim.py: handle no disks

master
neingeist 9 years ago
parent 78e606f6d7
commit 80df644701

@ -18,6 +18,10 @@ for domain in conn.listAllDomains():
xml = domain.XMLDesc() xml = domain.XMLDesc()
tree = objectify.fromstring(xml) tree = objectify.fromstring(xml)
if not hasattr(tree.devices, 'disk'):
print('(has no disks)')
continue
# every disk should be scsi + discard=unmap # every disk should be scsi + discard=unmap
for disk in tree.devices.disk: for disk in tree.devices.disk:
if disk.get('device') != 'disk': if disk.get('device') != 'disk':

Loading…
Cancel
Save