'Get image data from the request or raise appropriate
exceptions.
The field imageRef is mandatory when no block devices have been
defined and must be a proper uuid when present.'

def _image_from_req_data(self, server_dict, create_kwargs):

    image_href = server_dict.get('imageRef')
    if ((not image_href) and create_kwargs.get('block_device_mapping')):
        return ''
    elif image_href:
        return image_href
    else:
        msg = _('Missing    imageRef    attribute')
        raise exc.HTTPBadRequest(explanation=msg)
