diff options
author | jichenjc <jichenjc@cn.ibm.com> | 2017-09-26 19:57:31 +0800 |
---|---|---|
committer | jichenjc <jichenjc@cn.ibm.com> | 2017-12-01 00:02:38 +0800 |
commit | 2ea2f0d7058d55a01307a951770efd0df2ba2484 (patch) | |
tree | 6130165a434e0f0c1fddd729b0764ae420269978 /nova/image | |
parent | 9f46043f2f2463695385a6a14634664be4833e8e (diff) | |
download | nova-2ea2f0d7058d55a01307a951770efd0df2ba2484.tar.gz |
remove glance usage inside compute
refactor compute code to remove glance direct usage,
1) use image_api.get instead of get glance code then show the image
detail information
2) according to TODO, create a new api in image.api and use it
Change-Id: I0c8dee5d0d18adeaa83183da81c85f378ae5f8fd
Diffstat (limited to 'nova/image')
-rw-r--r-- | nova/image/api.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nova/image/api.py b/nova/image/api.py index e2d6192c59..43b9a2c20e 100644 --- a/nova/image/api.py +++ b/nova/image/api.py @@ -55,6 +55,16 @@ class API(object): # the context alive... return glance.get_default_image_service() + @staticmethod + def generate_image_url(image_ref, context): + """Generate an image URL from an image_ref. + + :param image_ref: The image ref to generate URL + :param context: The `nova.context.Context` object for the request + """ + return "%s/images/%s" % (next(glance.get_api_servers(context)), + image_ref) + def get_all(self, context, **kwargs): """Retrieves all information records about all disk images available to show to the requesting user. If the requesting user is an admin, |