autotest/autotest — pull request #347 by ldoktor (2012-05-14 13:55:11+00:00)
Title: RFC: Qtree verification library

Hi guys,

this patch adds a mechanism for verification of Qtree and other KVM generated info.

Current release supports:
1) build representation of info qtree (QtreeContainer)
2) verification of disks from info block, guest OS and autotest params (QtreeDiskContainer)

ad1) QtreeContainer is a container class for storing qtree information. It does basic check of qtree and creates a tree. Using get_qtree you can get the qtree root (main-system-bus). Using get_nodes you can get all leafs (devices and bus')

ad2) QtreeDiskContainer is a container class for verifying disks. It was used because some tests needs to be performed on all disks. Usual check sequence is:

qtree = kvm_qtree.QtreeContainer()
qtree.parse_info_qtree(vm.monitor.info('qtree'))
disks = kvm_qtree.QtreeDisksContainer(qtree.get_nodes())
disks.parse_info_block(vm.monitor.info('block'))
disks.generate_params()
disks.check_disk_params(params, vm.root_dir)
disks.check_guests_proc_scsi(session.cmd_output('cat /proc/scsi/scsi'))

Please see modified multi_disk for usage.

I'm looking for systematic solution not only for disks qtree info parsing. Please take a look on those patches and let me know your thoughts.

Usages I have in mind:
* multi_disk tests (uses custom implementation)
* disk hotplug tests (my next target)
* other devices hotplug/stress tests (doesn't check qtree)

One other usage which pops in my mind is to use this method to check need_restart during preprocess. It would also verify correct cdrom images and other hidden stuff... (needs further investigation)

Tested on Fedora 16 (with custom kernels for virtio_scsi tests)