diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2011-01-06 23:38:01 -0600 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2011-01-06 23:38:01 -0600 |
| commit | 8de96296dfb22d0e6c491fcaf072210dfbaa67e8 (patch) | |
| tree | e83fb153ee36615966f6905c4eef99a9d2db7efc /nova | |
| parent | 3bf9bc6f6c0fbf90e3f4eab68a9bd99d85fcc422 (diff) | |
| download | nova-8de96296dfb22d0e6c491fcaf072210dfbaa67e8.tar.gz nova-8de96296dfb22d0e6c491fcaf072210dfbaa67e8.tar.xz nova-8de96296dfb22d0e6c491fcaf072210dfbaa67e8.zip | |
Removing some FIXMEs
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/api/openstack/images.py | 15 | ||||
| -rw-r--r-- | nova/compute/api.py | 2 | ||||
| -rw-r--r-- | nova/image/glance.py | 6 | ||||
| -rw-r--r-- | nova/utils.py | 3 |
4 files changed, 17 insertions, 9 deletions
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py index 4d1af77d9..a826b8435 100644 --- a/nova/api/openstack/images.py +++ b/nova/api/openstack/images.py @@ -76,7 +76,14 @@ def _translate_status(item): 'decrypting': 'preparing', 'untarring': 'saving', 'available': 'active'} - item['status'] = status_mapping[item['status']] + try: + item['status'] = status_mapping[item['status']] + except KeyError: + # TODO(sirp): Performing translation of status (if necessary) here for + # now. Perhaps this should really be done in EC2 API and + # S3ImageService + pass + return item @@ -115,8 +122,7 @@ class Controller(wsgi.Controller): items = self._service.index(req.environ['nova.context']) items = common.limited(items, req) items = [_translate_keys(item) for item in items] - #TODO(sirp): removing for glance - #items = [_translate_status(item) for item in items] + items = [_translate_status(item) for item in items] return dict(images=items) def show(self, req, id): @@ -132,11 +138,10 @@ class Controller(wsgi.Controller): env = self._deserialize(req.body, req) instance_id = env["image"]["serverId"] name = env["image"]["name"] - + image_meta = compute_api.ComputeAPI().snapshot( context, instance_id, name) - #TODO(sirp): need to map Glance attrs to OpenStackAPI attrs return dict(image=image_meta) def update(self, req, id): diff --git a/nova/compute/api.py b/nova/compute/api.py index 5bb6fac91..75759744d 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -263,7 +263,7 @@ class ComputeAPI(base.Base): """Snapshot the given instance.""" instance = self.db.instance_get_by_internal_id(context, instance_id) host = instance['host'] - + image_service = utils.import_object(FLAGS.image_service) data = {'name': name, 'is_public': True} diff --git a/nova/image/glance.py b/nova/image/glance.py index 9575574d1..be10f382b 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -26,17 +26,19 @@ import webob.exc from nova import flags from nova import exception +from nova import utils import nova.image.service FLAGS = flags.FLAGS +GlanceClient = utils.import_class('glance.client.Client') + class GlanceImageService(nova.image.service.BaseImageService): """Provides storage and retrieval of disk image objects within Glance.""" def __init__(self): - from glance.client import Client #TODO(sirp): lazy-import glance - self.client = Client(FLAGS.glance_host, FLAGS.glance_port) + self.client = GlanceClient(FLAGS.glance_host, FLAGS.glance_port) def index(self, context): """ diff --git a/nova/utils.py b/nova/utils.py index 8d3bf0a6b..cd53d31d5 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -306,7 +306,8 @@ class LazyPluggable(object): class LoopingCallDone(Exception): """The poll-function passed to LoopingCall can raise this exception to - break out of the loop normally. This is somewhat analogous to StopIteration. + break out of the loop normally. This is somewhat analogous to + StopIteration. An optional return-value can be included as the argument to the exception; this return-value will be returned by LoopingCall.wait() |
