'Test that the create works if there is no image supplied but
os-volumes extension is enabled and bdms are supplied'

@mock.patch.object(compute_api.API, '_get_bdm_image_metadata')
def test_create_instance_with_volumes_enabled_and_bdms_no_image(self, mock_get_bdm_image_metadata):

    volume = {'id': uuids.volume_id, 'status': 'active', 'volume_image_metadata': {'test_key': 'test_value'}}
    mock_get_bdm_image_metadata.return_value = volume
    params = {'block_device_mapping': self.bdm}
    old_create = compute_api.API.create
    def create(*args, **kwargs):
        self.assertEqual(kwargs['block_device_mapping'], self.bdm)
        self.assertNotIn('imageRef', kwargs)
        return old_create(*args, **kwargs)
    self.stub_out('nova.compute.api.API.create', create)
    self._test_create(params, no_image=True)
    mock_get_bdm_image_metadata.assert_called_once_with(mock.ANY, self.bdm, True)
