diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2013-01-15 20:43:48 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2013-02-06 14:13:37 +0000 |
commit | 7be531fe9462f2b07d4a1abf6687f649d1dfbb89 (patch) | |
tree | 6b86c71eda449d9a1696ced7e1b38a86a4e862b1 /nova/utils.py | |
parent | cfec3e765816a3329f4477e71784cc4f36ff4cad (diff) | |
download | nova-7be531fe9462f2b07d4a1abf6687f649d1dfbb89.tar.gz nova-7be531fe9462f2b07d4a1abf6687f649d1dfbb89.tar.xz nova-7be531fe9462f2b07d4a1abf6687f649d1dfbb89.zip |
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>
Diffstat (limited to 'nova/utils.py')
0 files changed, 0 insertions, 0 deletions