summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Lundy <mike@pistoncloud.com>2012-04-04 11:38:54 -0700
committerMike Lundy <mike@pistoncloud.com>2012-04-04 12:03:20 -0700
commitc7532c62ea6afb4bfcf3d00e42a58cc72b12405b (patch)
treed88faa9c0814c75827b5643ea7f9a4ab261ed10b
parent7ac5fbcc3054ec192ddc699f332a4006b3d8259f (diff)
fix bug where nova ignores glance host in imageref
This is related to bug 883328. Change-Id: Iadd1aec8d1bda3bd75bd0ab7f6797b643626db90
-rw-r--r--nova/image/glance.py8
-rw-r--r--nova/tests/image/test_glance.py3
2 files changed, 6 insertions, 5 deletions
diff --git a/nova/image/glance.py b/nova/image/glance.py
index a5f9e6865..97a60cb78 100644
--- a/nova/image/glance.py
+++ b/nova/image/glance.py
@@ -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)
diff --git a/nova/tests/image/test_glance.py b/nova/tests/image/test_glance.py
index bc5969a45..8fa136aad 100644
--- a/nova/tests/image/test_glance.py
+++ b/nova/tests/image/test_glance.py
@@ -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')