diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-20 13:24:39 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-20 13:24:39 +0000 |
| commit | 5b7747e31a885d92c558022155e6dc75c19ab144 (patch) | |
| tree | 7340a99601dd4800df6d8868d9dcc4a61cd5b04e | |
| parent | 3f40de459cccb849ee892dad58ccba846a1149f2 (diff) | |
| parent | a28d8e17d9a482b1c473e2deab6083a903cbf204 (diff) | |
| download | nova-5b7747e31a885d92c558022155e6dc75c19ab144.tar.gz nova-5b7747e31a885d92c558022155e6dc75c19ab144.tar.xz nova-5b7747e31a885d92c558022155e6dc75c19ab144.zip | |
Merge "Fix network list and show with quantum."
| -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 | ||||
| -rw-r--r-- | nova/network/quantumv2/api.py | 9 |
3 files changed, 12 insertions, 7 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 9848d2320..c22e64b1f 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'] diff --git a/nova/network/quantumv2/api.py b/nova/network/quantumv2/api.py index e5caa5cdc..450445063 100644 --- a/nova/network/quantumv2/api.py +++ b/nova/network/quantumv2/api.py @@ -484,11 +484,16 @@ class API(base.Base): def get_all(self, context): client = quantumv2.get_client(context) - return client.list_networks() + networks = client.list_networks().get('networks') or {} + for network in networks: + network['label'] = network['name'] + return networks def get(self, context, network_uuid): client = quantumv2.get_client(context) - return client.show_network(network_uuid) + network = client.show_network(network_uuid).get('network') or {} + network['label'] = network['name'] + return network def delete(self, context, network_uuid): raise NotImplementedError() |
