summaryrefslogtreecommitdiffstats
path: root/nova/image
diff options
context:
space:
mode:
authorRick Harris <rick.harris@rackspace.com>2011-06-09 14:43:24 +0000
committerRick Harris <rick.harris@rackspace.com>2011-06-09 14:43:24 +0000
commiteda8a1aaa2cf7cc31c7fda4723849feee3bc6766 (patch)
treebb59f88abd0c4510f93d4ef308557b712f2f1e4d /nova/image
parent8096ee6c79c608fd84e016d5da7663549a95896f (diff)
downloadnova-eda8a1aaa2cf7cc31c7fda4723849feee3bc6766.tar.gz
nova-eda8a1aaa2cf7cc31c7fda4723849feee3bc6766.tar.xz
nova-eda8a1aaa2cf7cc31c7fda4723849feee3bc6766.zip
Fixing the tests
Diffstat (limited to 'nova/image')
-rw-r--r--nova/image/glance.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/nova/image/glance.py b/nova/image/glance.py
index b68415844..f82c0f4a3 100644
--- a/nova/image/glance.py
+++ b/nova/image/glance.py
@@ -60,14 +60,22 @@ class GlanceImageService(service.BaseImageService):
SERVICE_IMAGE_ATTRS = service.BaseImageService.BASE_IMAGE_ATTRS +\
GLANCE_ONLY_ATTRS
- @property
- def client(self):
+ _client = None
+
+ def _get_client(self):
# NOTE(sirp): we want to load balance each request across glance
# servers. Since GlanceImageService is a long-lived object, `client`
# is made to choose a new server each time via this property.
+ if self._client is not None:
+ return self._client
glance_host, glance_port = pick_glance_api_server()
return GlanceClient(glance_host, glance_port)
+ def _set_client(self, client):
+ self._client = client
+
+ client = property(_get_client, _set_client)
+
def index(self, context, filters=None, marker=None, limit=None):
"""Calls out to Glance for a list of images available."""
# NOTE(sirp): We need to use `get_images_detailed` and not