From 6487d3a2f6ed2e380cdb7d48efd8fdce5882e804 Mon Sep 17 00:00:00 2001 From: Masco Kaliyamoorthy Date: Thu, 30 Jul 2015 15:29:52 +0530 Subject: [PATCH] Exclude network which don't have subnet In create network form, the given network should have a subnet to create an instance. otherwise the create call will fail. We can filter the network list based on the subnet presence in the network to make the launch instance successful and avoid unnecessary server call. Change-Id: Ia37f32d5972ab84530a516dd488014081861c630 Closes-Bug: #1479722 --- openstack_dashboard/dashboards/project/instances/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack_dashboard/dashboards/project/instances/utils.py b/openstack_dashboard/dashboards/project/instances/utils.py index c15beb67e..557ff4e91 100644 --- a/openstack_dashboard/dashboards/project/instances/utils.py +++ b/openstack_dashboard/dashboards/project/instances/utils.py @@ -90,7 +90,7 @@ def network_field_data(request, include_empty_option=False): if api.base.is_service_enabled(request, 'network'): try: networks = api.neutron.network_list_for_tenant(request, tenant_id) - networks = [(n.id, n.name_or_id) for n in networks] + networks = [(n.id, n.name_or_id) for n in networks if n['subnets']] networks.sort(key=lambda obj: obj[1]) except Exception as e: msg = _('Failed to get network list {0}').format(six.text_type(e))