Merge "Move compute API is_volume_backed to BDM objects"
This commit is contained in:
@@ -32,6 +32,7 @@ from nova import block_device
|
||||
from nova import compute
|
||||
from nova.compute import flavors
|
||||
from nova import exception
|
||||
from nova.objects import block_device as block_device_obj
|
||||
from nova.openstack.common.gettextutils import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common.rpc import common as rpc_common
|
||||
@@ -1421,21 +1422,18 @@ class Controller(wsgi.Controller):
|
||||
|
||||
instance = self._get_server(context, req, id)
|
||||
|
||||
bdms = self.compute_api.get_instance_bdms(context, instance,
|
||||
legacy=False)
|
||||
bdms = block_device_obj.BlockDeviceMappingList.get_by_instance_uuid(
|
||||
context, instance.uuid)
|
||||
|
||||
try:
|
||||
if self.compute_api.is_volume_backed_instance(context, instance,
|
||||
bdms):
|
||||
img = instance['image_ref']
|
||||
if not img:
|
||||
# NOTE(Vincent Hou) The private method
|
||||
# _get_bdm_image_metadata only works, when boot
|
||||
# device is set to 'vda'. It needs to be fixed later,
|
||||
# but tentatively we use it here.
|
||||
image_meta = {'properties': self.compute_api.
|
||||
_get_bdm_image_metadata(context, bdms,
|
||||
legacy_bdm=False)}
|
||||
props = bdms.root_metadata(
|
||||
context, self.compute_api.image_service,
|
||||
self.compute_api.volume_api)
|
||||
image_meta = {'properties': props}
|
||||
else:
|
||||
src_image = self.compute_api.image_service.\
|
||||
show(context, img)
|
||||
|
||||
Reference in New Issue
Block a user