summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpengyuesheng <pengyuesheng@gohighsec.com>2019-04-08 14:57:33 +0800
committernorman shen <yshxxsjt715@gmail.com>2020-06-08 09:15:21 +0000
commit32129b3a61f49e9f38f268761a10dae1fc86e7b1 (patch)
tree3dbf721e8c642cfec754d2539284b6aa98bec0f9
parent607673e88235a01e45c5496c3e66f349de6ee009 (diff)
downloadhorizon-32129b3a61f49e9f38f268761a10dae1fc86e7b1.tar.gz
Incoming tenant id when creating a subnet on create network form
On admin panel, when creating a network and creating a subnet, the tenant to which the network belongs and the tenant to which the subnet belongs are inconsistent. This patch uniform network and subnet tenant ID Change-Id: I3744d8b7a0a37918962c9d9a2ac319002de93851 Closes-Bug: #1823627 (cherry picked from commit 8de1e272f08bcc294b10ce548616f181ee7bc800)
-rw-r--r--openstack_dashboard/dashboards/admin/networks/tests.py3
-rw-r--r--openstack_dashboard/dashboards/project/networks/tests.py4
-rw-r--r--openstack_dashboard/dashboards/project/networks/workflows.py3
3 files changed, 8 insertions, 2 deletions
diff --git a/openstack_dashboard/dashboards/admin/networks/tests.py b/openstack_dashboard/dashboards/admin/networks/tests.py
index 38b616a8e..f0223e965 100644
--- a/openstack_dashboard/dashboards/admin/networks/tests.py
+++ b/openstack_dashboard/dashboards/admin/networks/tests.py
@@ -588,7 +588,8 @@ class NetworkTests(test.BaseAdminViewTests):
'provider:network_type': 'local'}
self.mock_network_create.assert_called_once_with(test.IsHttpRequest(),
**params)
- subnet_params = {'name': subnet.name,
+ subnet_params = {'tenant_id': tenant_id,
+ 'name': subnet.name,
'network_id': subnet.network_id,
'cidr': subnet.cidr,
'enable_dhcp': subnet.enable_dhcp,
diff --git a/openstack_dashboard/dashboards/project/networks/tests.py b/openstack_dashboard/dashboards/project/networks/tests.py
index afc878af0..89b23470f 100644
--- a/openstack_dashboard/dashboards/project/networks/tests.py
+++ b/openstack_dashboard/dashboards/project/networks/tests.py
@@ -493,6 +493,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
'admin_state_up': network.admin_state_up,
'shared': False}
subnet_params = {'network_id': network.id,
+ 'tenant_id': network.tenant_id,
'name': subnet.name,
'cidr': subnet.cidr,
'ip_version': subnet.ip_version,
@@ -629,6 +630,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
self.mock_subnet_create.assert_called_once_with(
test.IsHttpRequest(),
network_id=network.id,
+ tenant_id=network.tenant_id,
name=subnet.name,
cidr=subnet.cidr,
ip_version=subnet.ip_version,
@@ -801,6 +803,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
'admin_state_up': network.admin_state_up,
'shared': False}
subnet_params = {'network_id': network.id,
+ 'tenant_id': network.tenant_id,
'name': subnet.name,
'cidr': cidr,
'ip_version': subnet.ip_version,
@@ -930,6 +933,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
'shared': False,
'with_subnet': True}
subnet_params = {'network_id': network.id,
+ 'tenant_id': network.tenant_id,
'name': subnet.name,
'cidr': subnet.cidr,
'ip_version': subnet.ip_version,
diff --git a/openstack_dashboard/dashboards/project/networks/workflows.py b/openstack_dashboard/dashboards/project/networks/workflows.py
index dcefe988e..b04c6239b 100644
--- a/openstack_dashboard/dashboards/project/networks/workflows.py
+++ b/openstack_dashboard/dashboards/project/networks/workflows.py
@@ -600,7 +600,8 @@ class CreateNetwork(workflows.Workflow):
# If we do not need to create a subnet, return here.
if not data['with_subnet']:
return True
- subnet = self._create_subnet(request, data, network, no_redirect=True)
+ subnet = self._create_subnet(request, data, network, no_redirect=True,
+ tenant_id=network.tenant_id)
if subnet:
return True
else: