diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2013-02-18 16:06:35 -0800 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2013-02-18 16:06:35 -0800 |
| commit | a28d8e17d9a482b1c473e2deab6083a903cbf204 (patch) | |
| tree | 05ba15eb23b884649ee12f2717f3c4c12626160a /nova/api | |
| parent | b23c557cc8d03028caba95777f98adfe9b1031d9 (diff) | |
Fix network list and show with quantum.
The quantum driver was returning data in a format that was not
compatible with the extension. This munges the data and handles
fields that don't exist so the extensions still work.
Fixes bug 1076519
Change-Id: I5e00bfa72e8ce1d486f9aa4dddbe1080ff74cd6a
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/os_networks.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/os_tenant_networks.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/nova/api/openstack/compute/contrib/os_networks.py b/nova/api/openstack/compute/contrib/os_networks.py index d1d172686..bef2c3d1f 100644 --- a/nova/api/openstack/compute/contrib/os_networks.py +++ b/nova/api/openstack/compute/contrib/os_networks.py @@ -46,7 +46,7 @@ def network_dict(context, network): # are only visible if they are an admin. if context.is_admin: fields += admin_fields - result = dict((field, network[field]) for field in fields) + result = dict((field, network.get(field)) for field in fields) if 'uuid' in network: result['id'] = network['uuid'] return result diff --git a/nova/api/openstack/compute/contrib/os_tenant_networks.py b/nova/api/openstack/compute/contrib/os_tenant_networks.py index 03178ab65..5b4e7f5ea 100644 --- a/nova/api/openstack/compute/contrib/os_tenant_networks.py +++ b/nova/api/openstack/compute/contrib/os_tenant_networks.py @@ -64,9 +64,9 @@ authorize = extensions.extension_authorizer('compute', 'os-tenant-networks') def network_dict(network): - return {"id": network.get("uuid") or network["id"], - "cidr": network["cidr"], - "label": network["label"]} + return {"id": network.get("uuid") or network.get("id"), + "cidr": network.get("cidr"), + "label": network.get("label")} class NetworkController(object): @@ -108,7 +108,7 @@ class NetworkController(object): network = self.network_api.get(context, id) except exception.NetworkNotFound: raise exc.HTTPNotFound(_("Network not found")) - return network_dict(network) + return {'network': network_dict(network)} def delete(self, req, id): context = req.environ['nova.context'] |
