Merge "xenapi: boot from volume without image_ref"

This commit is contained in:
Jenkins 2014-03-21 17:22:09 +00:00 committed by Gerrit Code Review
commit b548f31a12
2 changed files with 12 additions and 2 deletions

View File

@ -84,6 +84,7 @@ IMAGE_RAW = '4'
IMAGE_VHD = '5'
IMAGE_ISO = '6'
IMAGE_IPXE_ISO = '7'
IMAGE_FROM_VOLUME = '8'
IMAGE_FIXTURES = {
IMAGE_MACHINE: {
@ -122,6 +123,10 @@ IMAGE_FIXTURES = {
'container_format': 'bare',
'properties': {'ipxe_boot': 'true'}},
},
IMAGE_FROM_VOLUME: {
'image_meta': {'name': 'fake_ipxe_iso',
'properties': {'foo': 'bar'}},
},
}
@ -885,9 +890,14 @@ class XenAPIVMTestCase(stubs.XenAPITestBase):
self._test_spawn(None, None, None,
block_device_info=dev_info)
def test_spawn_boot_from_volume_no_glance_image_meta(self):
dev_info = get_fake_device_info()
self._test_spawn(IMAGE_FROM_VOLUME, None, None,
block_device_info=dev_info)
def test_spawn_boot_from_volume_with_image_meta(self):
dev_info = get_fake_device_info()
self._test_spawn(None, None, None,
self._test_spawn(IMAGE_VHD, None, None,
block_device_info=dev_info)
def test_spawn_netinject_file(self):

View File

@ -1641,7 +1641,7 @@ def determine_disk_image_type(image_meta):
2. If we're not using Glance, then we need to deduce this based on
whether a kernel_id is specified.
"""
if not image_meta:
if not image_meta or 'disk_format' not in image_meta:
return None
disk_format = image_meta['disk_format']