fix bug where nova ignores glance host in imageref

This is related to bug 883328.

Change-Id: Iadd1aec8d1bda3bd75bd0ab7f6797b643626db90
This commit is contained in:
Mike Lundy 2012-04-04 11:38:54 -07:00 committed by Vishvananda Ishaya
parent bbb021c842
commit 155c7b2a8f
2 changed files with 6 additions and 5 deletions

View File

@ -111,13 +111,13 @@ def get_glance_client(context, image_href):
else:
try:
(image_id, host, port) = _parse_image_ref(image_href)
(image_id, glance_host, glance_port) = _parse_image_ref(image_href)
glance_client = _create_glance_client(context,
glance_host,
glance_port)
except ValueError:
raise exception.InvalidImageRef(image_href=image_href)
glance_client = _create_glance_client(context,
glance_host,
glance_port)
return (glance_client, image_id)

View File

@ -578,6 +578,7 @@ class TestGlanceImageService(test.TestCase):
def test_glance_client_image_ref(self):
fixture = self._make_fixture(name='test image')
image_id = self.service.create(self.context, fixture)['id']
image_url = 'http://foo/%s' % image_id
image_url = 'http://something-less-likely/%s' % image_id
client, same_id = glance.get_glance_client(self.context, image_url)
self.assertEquals(same_id, image_id)
self.assertEquals(client.host, 'something-less-likely')