summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-08-30 11:13:25 -0400
committerBrian Waldon <brian.waldon@rackspace.com>2011-08-30 11:13:25 -0400
commit1155b734164eb5856d68c926f7bf64a37ae4a3a4 (patch)
tree5b3787d3c568694b1adc6367bbef0aa3b746f374 /nova/api
parent2a2aa10316abe9135541198bddd4c189976eb2fd (diff)
supporting changes-since
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/servers.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index 27c67e79e..e0e40679a 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -107,6 +107,14 @@ class Controller(object):
LOG.error(reason)
raise exception.InvalidInput(reason=reason)
+ if 'changes-since' in search_opts:
+ try:
+ parsed = utils.parse_isotime(search_opts['changes-since'])
+ except ValueError:
+ msg = _('Invalid changes-since value')
+ raise exc.HTTPBadRequest(explanation=msg)
+ search_opts['changes-since'] = parsed
+
# By default, compute's get_all() will return deleted instances.
# If an admin hasn't specified a 'deleted' search option, we need
# to filter out deleted instances by setting the filter ourselves.
@@ -114,23 +122,17 @@ class Controller(object):
# should return recently deleted images according to the API spec.
if 'deleted' not in search_opts:
- # Admin hasn't specified deleted filter
if 'changes-since' not in search_opts:
- # No 'changes-since', so we need to find non-deleted servers
+ # No 'changes-since', so we only want non-deleted servers
search_opts['deleted'] = False
- else:
- # This is the default, but just in case..
- search_opts['deleted'] = True
-
- instance_list = self.compute_api.get_all(
- context, search_opts=search_opts)
- # FIXME(comstud): 'changes-since' is not fully implemented. Where
- # should this be filtered?
+ instance_list = self.compute_api.get_all(context,
+ search_opts=search_opts)
limited_list = self._limit_items(instance_list, req)
servers = [self._build_view(req, inst, is_detail)['server']
- for inst in limited_list]
+ for inst in limited_list]
+
return dict(servers=servers)
@scheduler_api.redirect_handler