1
From 155c7b2a8f05e75a9b08764bb4f9404c26036f99 Mon Sep 17 00:00:00 2001
2
From: Mike Lundy <mike@pistoncloud.com>
3
Date: Wed, 4 Apr 2012 11:38:54 -0700
4
Subject: [PATCH 1/5] fix bug where nova ignores glance host in imageref
6
This is related to bug 883328.
8
Change-Id: Iadd1aec8d1bda3bd75bd0ab7f6797b643626db90
10
nova/image/glance.py | 8 ++++----
11
nova/tests/image/test_glance.py | 3 ++-
12
2 files changed, 6 insertions(+), 5 deletions(-)
14
diff --git a/nova/image/glance.py b/nova/image/glance.py
15
index a5f9e68..97a60cb 100644
16
--- a/nova/image/glance.py
17
+++ b/nova/image/glance.py
18
@@ -111,13 +111,13 @@ def get_glance_client(context, image_href):
22
- (image_id, host, port) = _parse_image_ref(image_href)
23
+ (image_id, glance_host, glance_port) = _parse_image_ref(image_href)
24
+ glance_client = _create_glance_client(context,
28
raise exception.InvalidImageRef(image_href=image_href)
30
- glance_client = _create_glance_client(context,
33
return (glance_client, image_id)
36
diff --git a/nova/tests/image/test_glance.py b/nova/tests/image/test_glance.py
37
index bc5969a..8fa136a 100644
38
--- a/nova/tests/image/test_glance.py
39
+++ b/nova/tests/image/test_glance.py
40
@@ -578,6 +578,7 @@ class TestGlanceImageService(test.TestCase):
41
def test_glance_client_image_ref(self):
42
fixture = self._make_fixture(name='test image')
43
image_id = self.service.create(self.context, fixture)['id']
44
- image_url = 'http://foo/%s' % image_id
45
+ image_url = 'http://something-less-likely/%s' % image_id
46
client, same_id = glance.get_glance_client(self.context, image_url)
47
self.assertEquals(same_id, image_id)
48
+ self.assertEquals(client.host, 'something-less-likely')