summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nova/api/openstack/compute/plugins/v3/servers.py19
-rw-r--r--nova/tests/api/openstack/compute/plugins/v3/test_servers.py4
2 files changed, 10 insertions, 13 deletions
diff --git a/nova/api/openstack/compute/plugins/v3/servers.py b/nova/api/openstack/compute/plugins/v3/servers.py
index 318cf19ebc..ce70cc8473 100644
--- a/nova/api/openstack/compute/plugins/v3/servers.py
+++ b/nova/api/openstack/compute/plugins/v3/servers.py
@@ -228,28 +228,25 @@ class ServersController(wsgi.Controller):
if 'default' not in task_state:
search_opts['task_state'] = task_state
- if 'changes_since' in search_opts:
+ if 'changes-since' in search_opts:
try:
- parsed = timeutils.parse_isotime(search_opts['changes_since'])
+ parsed = timeutils.parse_isotime(search_opts['changes-since'])
except ValueError:
- msg = _('Invalid changes_since value')
+ msg = _('Invalid changes-since value')
raise exc.HTTPBadRequest(explanation=msg)
- search_opts['changes_since'] = parsed
+ 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.
- # ... Unless 'changes_since' is specified, because 'changes_since'
+ # ... Unless 'changes-since' is specified, because 'changes-since'
# should return recently deleted images according to the API spec.
if 'deleted' not in search_opts:
- if 'changes_since' not in search_opts:
- # No 'changes_since', so we only want non-deleted servers
+ if 'changes-since' not in search_opts:
+ # No 'changes-since', so we only want non-deleted servers
search_opts['deleted'] = False
- if 'changes_since' in search_opts:
- search_opts['changes-since'] = search_opts.pop('changes_since')
-
if search_opts.get("vm_state") == ['deleted']:
if context.is_admin:
search_opts['deleted'] = True
@@ -1003,7 +1000,7 @@ class ServersController(wsgi.Controller):
def _get_server_search_options(self):
"""Return server search options allowed by non-admin."""
return ('reservation_id', 'name', 'status', 'image', 'flavor',
- 'ip', 'changes_since', 'all_tenants')
+ 'ip', 'changes-since', 'all_tenants')
def _get_instance(self, context, instance_uuid):
try:
diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_servers.py b/nova/tests/api/openstack/compute/plugins/v3/test_servers.py
index 846ec4fc5d..b4fe5793ab 100644
--- a/nova/tests/api/openstack/compute/plugins/v3/test_servers.py
+++ b/nova/tests/api/openstack/compute/plugins/v3/test_servers.py
@@ -1084,7 +1084,7 @@ class ServersControllerTest(ControllerTest):
self.stubs.Set(compute_api.API, 'get_all', fake_get_all)
- params = 'changes_since=2011-01-24T17:08:01Z'
+ params = 'changes-since=2011-01-24T17:08:01Z'
req = fakes.HTTPRequestV3.blank('/servers?%s' % params)
servers = self.controller.index(req)['servers']
@@ -1092,7 +1092,7 @@ class ServersControllerTest(ControllerTest):
self.assertEqual(servers[0]['id'], server_uuid)
def test_get_servers_allows_changes_since_bad_value(self):
- params = 'changes_since=asdf'
+ params = 'changes-since=asdf'
req = fakes.HTTPRequestV3.blank('/servers?%s' % params)
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.index, req)