diff options
| author | Naveed Massjouni <naveedm9@gmail.com> | 2011-03-24 01:08:17 -0400 |
|---|---|---|
| committer | Naveed Massjouni <naveedm9@gmail.com> | 2011-03-24 01:08:17 -0400 |
| commit | dcb5ddd117c713d60f06ce335d5484ef0242c02d (patch) | |
| tree | c0dc215485580eba69d19e2219f13cd9bb8b3f98 /nova/api | |
| parent | 0d677a9b63ed9b4612379494bf8a58af1c090331 (diff) | |
| parent | 6912b0e1efd6ba3814d3b29beef236bfe4da52ea (diff) | |
Merge from trunk
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/images.py | 6 | ||||
| -rw-r--r-- | nova/api/openstack/servers.py | 1 | ||||
| -rw-r--r-- | nova/api/openstack/views/servers.py | 18 |
3 files changed, 20 insertions, 5 deletions
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py index 98f0dd96b..99c14275a 100644 --- a/nova/api/openstack/images.py +++ b/nova/api/openstack/images.py @@ -143,6 +143,7 @@ class Controller(wsgi.Controller): image = self._service.show(req.environ['nova.context'], image_id) _convert_image_id_to_hash(image) + self._format_image_dates(image) return dict(image=image) def delete(self, req, id): @@ -164,3 +165,8 @@ class Controller(wsgi.Controller): # Users may not modify public images, and that's all that # we support for now. raise faults.Fault(exc.HTTPNotFound()) + + def _format_image_dates(self, image): + for attr in ['created_at', 'updated_at', 'deleted_at']: + if image.get(attr) is not None: + image[attr] = image[attr].strftime('%Y-%m-%dT%H:%M:%SZ') diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 73843f63e..443196146 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -22,6 +22,7 @@ from xml.dom import minidom from webob import exc from nova import compute +from nova import context from nova import exception from nova import flags from nova import log as logging diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py index fad361bd4..f93435198 100644 --- a/nova/api/openstack/views/servers.py +++ b/nova/api/openstack/views/servers.py @@ -16,7 +16,10 @@ # under the License. import hashlib + from nova.compute import power_state +import nova.compute +import nova.context from nova.api.openstack import common from nova.api.openstack.views import addresses as addresses_view from nova.api.openstack.views import flavors as flavors_view @@ -59,12 +62,17 @@ class ViewBuilder(object): power_state.SHUTOFF: 'active', power_state.CRASHED: 'error', power_state.FAILED: 'error'} - inst_dict = {} - inst_dict['id'] = int(inst['id']) - inst_dict['name'] = inst['display_name'] - inst_dict['status'] = power_mapping[inst.get('state')] - inst_dict['addresses'] = self.addresses_builder.build(inst) + inst_dict = { + 'id': int(inst['id']), + 'name': inst['display_name'], + 'addresses': self.addresses_builder.build(inst), + 'status': power_mapping[inst.get('state')]} + + ctxt = nova.context.get_admin_context() + compute_api = nova.compute.API() + if compute_api.has_finished_migration(ctxt, inst['id']): + inst_dict['status'] = 'resize-confirm' # Return the metadata as a dictionary metadata = {} |
