diff options
| author | Jason Koelker <jason@koelker.net> | 2011-09-15 13:31:15 -0500 |
|---|---|---|
| committer | Jason Koelker <jason@koelker.net> | 2011-09-15 13:31:15 -0500 |
| commit | af986ef55f01a702eb29b834be9fe237bf1981a2 (patch) | |
| tree | 58aae6ba3aa1ec20f1951f1ac9cca53f242aaa3d | |
| parent | f0f13454a68cdf5e33bb9c667f2e57d84b70ae11 (diff) | |
use uuids everywhere possible
| -rw-r--r-- | nova/network/api.py | 6 | ||||
| -rw-r--r-- | nova/network/manager.py | 11 |
2 files changed, 13 insertions, 4 deletions
diff --git a/nova/network/api.py b/nova/network/api.py index abc4e5a41..a1ed28496 100644 --- a/nova/network/api.py +++ b/nova/network/api.py @@ -212,11 +212,11 @@ class API(base.Base): {'method': 'validate_networks', 'args': args}) - def get_instance_ids_by_ip_filter(self, context, filters): + def get_instance_uuids_by_ip_filter(self, context, filters): """Returns a list of dicts in the form of - {'instance_id': id, 'ip': ip} that matched the ip_filter + {'instance_uuid': uuid, 'ip': ip} that matched the ip_filter """ args = {'filters': filters} return rpc.call(context, FLAGS.network_topic, - {'method': 'get_instance_ids_by_ip_filter', + {'method': 'get_instance_uuids_by_ip_filter', 'args': args}) diff --git a/nova/network/manager.py b/nova/network/manager.py index 4566151e8..94042f34f 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -402,7 +402,7 @@ class NetworkManager(manager.SchedulerDependentManager): instance_id) return vifs - def get_instance_ids_by_ip_filter(self, context, filters): + def get_instance_uuids_by_ip_filter(self, context, filters): fixed_ip_filter = filters.get('fixed_ip') ip_filter = re.compile(str(filters.get('ip'))) ipv6_filter = re.compile(str(filters.get('ip6'))) @@ -442,6 +442,15 @@ class NetworkManager(manager.SchedulerDependentManager): results.append({'instance_id': vif['instance_id'], 'ip': floating_ip['address']}) continue + + # NOTE(jkoelker) Until we switch over to instance_uuid ;) + ids = [res['instance_id'] for res in results] + uuids = self.db.instance_get_uuids_by_ids(context, ids) + for res in results: + uuid = [u['uuid'] for u in uuids if u['id'] == res['instance_id']] + # NOTE(jkoelker) UUID must exist, so no test here + res['instance_uuid'] = uuid[0] + return results def _get_networks_for_instance(self, context, instance_id, project_id, |
