From bb410b3f1bbdebdbdf540a22cd37fc9526897fe1 Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Wed, 28 Sep 2011 23:52:57 +0000 Subject: Change 'recurse_zones' to 'local_zone_only'. Fixes bug 861753 Zone recursion should be the default and now 'recurse_zones' as an optional search argument no longer makes sense. 'local_zone_only=True' can now be specified to override the new default of recursing zones. Change-Id: I5c3c849e9077117b2023f637b82831fa14b656b1 --- nova/api/openstack/servers.py | 10 +++++----- nova/compute/api.py | 18 ++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'nova') diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index de081343e..938ba8787 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -140,9 +140,9 @@ class Controller(object): remove_invalid_options(context, search_opts, self._get_server_search_options()) - # Convert recurse_zones into a boolean - search_opts['recurse_zones'] = utils.bool_from_str( - search_opts.get('recurse_zones', False)) + # Convert local_zone_only into a boolean + search_opts['local_zone_only'] = utils.bool_from_str( + search_opts.get('local_zone_only', False)) # If search by 'status', we need to convert it to 'vm_state' # to pass on to child zones. @@ -1041,7 +1041,7 @@ class ControllerV10(Controller): def _get_server_search_options(self): """Return server search options allowed by non-admin""" - return 'reservation_id', 'fixed_ip', 'name', 'recurse_zones' + return 'reservation_id', 'fixed_ip', 'name', 'local_zone_only' class ControllerV11(Controller): @@ -1272,7 +1272,7 @@ class ControllerV11(Controller): def _get_server_search_options(self): """Return server search options allowed by non-admin""" - return ('reservation_id', 'name', 'recurse_zones', + return ('reservation_id', 'name', 'local_zone_only', 'status', 'image', 'flavor', 'changes-since') diff --git a/nova/compute/api.py b/nova/compute/api.py index e40183a4b..7bf28d24e 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -959,7 +959,6 @@ class API(base.Base): 'name': 'display_name', 'instance_name': 'name', 'tenant_id': 'project_id', - 'recurse_zones': None, 'flavor': _remap_flavor_filter, 'fixed_ip': _remap_fixed_ip_filter} @@ -974,19 +973,18 @@ class API(base.Base): except KeyError: filters[opt] = value else: - if remap_object: - if isinstance(remap_object, basestring): - filters[remap_object] = value - else: - remap_object(value) + # Remaps are strings to translate to, or functions to call + # to do the translating as defined by the table above. + if isinstance(remap_object, basestring): + filters[remap_object] = value + else: + remap_object(value) - recurse_zones = search_opts.get('recurse_zones', False) - if 'reservation_id' in filters: - recurse_zones = True + local_zone_only = search_opts.get('local_zone_only', False) instances = self._get_instances_by_filters(context, filters) - if not recurse_zones: + if local_zone_only: return instances # Recurse zones. Send along the un-modified search options we received. -- cgit