'Test get_list_volumes_image_metadata in volume API.'

def test_volume_api_get_list_volumes_image_metadata(self):

    ctxt = context.get_admin_context()
    db.volume_create(ctxt, {'id': 'fake1', 'status': 'available', 'host': 'test', 'provider_location': '', 'size': 1})
    db.volume_glance_metadata_create(ctxt, 'fake1', 'key1', 'value1')
    db.volume_glance_metadata_create(ctxt, 'fake1', 'key2', 'value2')
    db.volume_create(ctxt, {'id': 'fake2', 'status': 'available', 'host': 'test', 'provider_location': '', 'size': 1})
    db.volume_glance_metadata_create(ctxt, 'fake2', 'key3', 'value3')
    db.volume_glance_metadata_create(ctxt, 'fake2', 'key4', 'value4')
    volume_api = cinder.volume.api.API()
    results = volume_api.get_list_volumes_image_metadata(ctxt, ['fake1', 'fake2'])
    expect_results = {'fake1': {'key1': 'value1', 'key2': 'value2'}, 'fake2': {'key3': 'value3', 'key4': 'value4'}}
    self.assertEqual(expect_results, results)
