Refactor code for setting up libvirt disk mappings

Currently the libvirt disk bus is fixed at the time the driver
is started. The get_guest_storage_config and _create_image
methods thus use some variables initialized in the libvirt
driver constructor to determine disk bus / dev name mappings.

It will shortly become possible to configure a different disk
bus per instance, which invalidates the current assumptions
in the code. A further complication is that the _create_image
and get_guest_storage_config methods needs to duplicate each
others logic for determining disk mapping.

To simplify the current code and make it more make flexible
introduce a new 'blockinfo.py' module in libvirt, and with
it a 'get_disk_mapping' method & associated helper APIs. This
method is responsible for examining the instance type and
block device info dicts and figuring out the complete list of
disks that will be attached to the guest & their optimal
disk bus + dev name values. This info is returned in a dict
and then passed to _create_image and get_guest_storage_config

Thus the logic for determining disk dev names is now isolated
in one single place, separate from the main driver code, so
it has no need to rely on state in the driver object.

Many, many test cases are added to try to thoroughly validate
the disk mapping code, since there are a huge set of possible
configurations the user may request, making it easy to break
the code accidentally.

Blueprint: libvirt-custom-hardware
Change-Id: I645e69fcc7088674f063f619b2acbbee94d7ba61
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Merge "Refactor code for setting up libvirt disk mappings"