Skip to content

Commit

Permalink
Change 'recurse_zones' to 'local_zone_only'.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
comstud committed Sep 28, 2011
1 parent ef22c00 commit bb410b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
10 changes: 5 additions & 5 deletions nova/api/openstack/servers.py
Expand Up @@ -140,9 +140,9 @@ def _get_servers(self, req, is_detail):
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.
Expand Down Expand Up @@ -1041,7 +1041,7 @@ def _get_server_admin_password(self, server):

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):
Expand Down Expand Up @@ -1272,7 +1272,7 @@ def _get_server_admin_password(self, server):

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')


Expand Down
18 changes: 8 additions & 10 deletions nova/compute/api.py
Expand Up @@ -959,7 +959,6 @@ def _remap_fixed_ip_filter(fixed_ip):
'name': 'display_name',
'instance_name': 'name',
'tenant_id': 'project_id',
'recurse_zones': None,
'flavor': _remap_flavor_filter,
'fixed_ip': _remap_fixed_ip_filter}

Expand All @@ -974,19 +973,18 @@ def _remap_fixed_ip_filter(fixed_ip):
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.
Expand Down

0 comments on commit bb410b3

Please sign in to comment.