libvirt-check-trim.py: Check machine type & handle diskless VMs

master
neingeist 9 years ago
parent bfa1c5faef
commit 4a7233f715

@ -19,6 +19,16 @@ for domain in conn.listAllDomains():
xml = domain.XMLDesc() xml = domain.XMLDesc()
tree = objectify.fromstring(xml) tree = objectify.fromstring(xml)
machine = tree.os.type.get('machine')
if machine < 'pc-i440fx-2.1':
print('machine should be at least pc-i440fx-2.1')
# Might want to check qemu-system-x86_64 -M help for supported
# machines.
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