diff options
| author | Chris Behrens <cbehrens@codestud.com> | 2011-10-21 00:29:54 -0700 |
|---|---|---|
| committer | Chris Behrens <cbehrens@codestud.com> | 2011-10-26 19:17:42 -0700 |
| commit | 61e5b8e7da3b36db9a09f80d62ebf2e276bbe88b (patch) | |
| tree | b9bc052b15c5e98464296bf5af66dfbf9e597aad /nova/compute | |
| parent | 5e9e3873e5ee3cf87b8aec801705ee24cedcd1aa (diff) | |
Revert how APIs get IP address info for instances
Fixes bug 862839
listing instances with IPs is extremely inefficient after changes were
made to query the network manager for IP information for each instance.
I tried adding a network manager call that said 'give me IP information
for 'x' instances', but that was also too slow.
We need a solution that caches IP info from the network manager before
we can fully untie things. So, this reverts APIs to use
instance['fixed_ips'] which hasn't been untied in the DB yet.
Change-Id: I37d21105d6306f0a812c5eb0f0717a5094cd17b9
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 57e0d9edd..8b5005e78 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -917,7 +917,11 @@ class API(base.Base): instance = self.db.instance_get_by_uuid(context, uuid) else: instance = self.db.instance_get(context, instance_id) - return dict(instance.iteritems()) + + inst = dict(instance.iteritems()) + # NOTE(comstud): Doesn't get returned with iteritems + inst['name'] = instance['name'] + return inst @scheduler_api.reroute_compute("get") def routing_get(self, context, instance_id): @@ -986,7 +990,15 @@ class API(base.Base): local_zone_only = search_opts.get('local_zone_only', False) - instances = self._get_instances_by_filters(context, filters) + inst_models = self._get_instances_by_filters(context, filters) + + # Convert the models to dictionaries + instances = [] + for inst_model in inst_models: + instance = dict(inst_model.iteritems()) + # NOTE(comstud): Doesn't get returned by iteritems + instance['name'] = inst_model['name'] + instances.append(instance) if local_zone_only: return instances |
