diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-02-17 19:38:11 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-02-17 19:38:11 +0000 |
| commit | 38d0641f484d03c7a39b34830181abb1dc1dca1c (patch) | |
| tree | 8b3fd9783eca82f06e2419562026f3f614f39688 /nova/api | |
| parent | 7dd36690cecc51ecb0c35aafd13285b59adc1967 (diff) | |
| parent | e28ce7f82d1c89ab0c4e5ebfa98c12f502a33138 (diff) | |
| download | nova-38d0641f484d03c7a39b34830181abb1dc1dca1c.tar.gz nova-38d0641f484d03c7a39b34830181abb1dc1dca1c.tar.xz nova-38d0641f484d03c7a39b34830181abb1dc1dca1c.zip | |
Update the Openstack API so that it returns 'addresses'.
This branch should resolve nova bug #713144 (https://bugs.launchpad.net/nova/+bug/713144).
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/servers.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 33cc3bbde..c7f863764 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -64,6 +64,22 @@ def _translate_detail_keys(inst): inst_dict['status'] = power_mapping[inst_dict['status']] inst_dict['addresses'] = dict(public=[], private=[]) + + # grab single private fixed ip + try: + private_ip = inst['fixed_ip']['address'] + if private_ip: + inst_dict['addresses']['private'].append(private_ip) + except KeyError: + LOG.debug(_("Failed to read private ip")) + + # grab all public floating ips + try: + for floating in inst['fixed_ip']['floating_ips']: + inst_dict['addresses']['public'].append(floating['address']) + except KeyError: + LOG.debug(_("Failed to read public ip(s)")) + inst_dict['metadata'] = {} inst_dict['hostId'] = '' |
