neutron: do not create default route for service subnet if connect_share_server_to_tenant_network is on

Closes-Bug: #1983819
Change-Id: Ice29b02c1b10c734289ae80b11333b4d044de8f0
This commit is contained in:
Alexander Epaneshnikov 2022-08-09 16:15:05 +03:00
parent 85fb7d3625
commit b1bf086bb2
3 changed files with 9 additions and 2 deletions

View File

@ -241,13 +241,15 @@ class API(object):
raise exception.NetworkException(code=e.status_code,
message=e.message)
def subnet_create(self, tenant_id, net_id, name, cidr):
def subnet_create(self, tenant_id, net_id, name, cidr, no_gateway=False):
subnet_req_body = {'subnet': {}}
subnet_req_body['subnet']['tenant_id'] = tenant_id
subnet_req_body['subnet']['name'] = name
subnet_req_body['subnet']['network_id'] = net_id
subnet_req_body['subnet']['cidr'] = cidr
subnet_req_body['subnet']['ip_version'] = 4
if no_gateway:
subnet_req_body['subnet']['gateway_ip'] = None
try:
return self.client.create_subnet(
subnet_req_body).get('subnet', {})

View File

@ -893,7 +893,8 @@ class NeutronNetworkHelper(BaseNetworkhelper):
network_data['service_subnet'] = (
self.neutron_api.subnet_create(
self.admin_project_id, self.service_network_id,
subnet_name, self._get_cidr_for_subnet()))
subnet_name, self._get_cidr_for_subnet(),
self.connect_share_server_to_tenant_network))
network_data['ports'] = []

View File

@ -0,0 +1,4 @@
---
fixes:
- default route for service subnet wouldn't be created if
connect_share_server_to_tenant_network is on