Revising log with wrong network_id when create port failed
Log network_id passed from api rather than subnet['network_id'] Change-Id: I8151253be1ca42bbf4b49f904751565783723769 Closes-Bug: #1844607
This commit is contained in:
parent
4b02ed8225
commit
e07b6d8108
@ -383,7 +383,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
|
|||||||
if segment.is_dynamic:
|
if segment.is_dynamic:
|
||||||
raise segment_exc.SubnetCantAssociateToDynamicSegment()
|
raise segment_exc.SubnetCantAssociateToDynamicSegment()
|
||||||
|
|
||||||
def _get_subnet_for_fixed_ip(self, context, fixed, subnets):
|
def _get_subnet_for_fixed_ip(self, context, fixed, subnets, network_id):
|
||||||
# Subnets are all the subnets belonging to the same network.
|
# Subnets are all the subnets belonging to the same network.
|
||||||
if not subnets:
|
if not subnets:
|
||||||
msg = _('IP allocation requires subnets for network')
|
msg = _('IP allocation requires subnets for network')
|
||||||
@ -396,12 +396,13 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
|
|||||||
return subnet
|
return subnet
|
||||||
subnet = get_matching_subnet()
|
subnet = get_matching_subnet()
|
||||||
if not subnet:
|
if not subnet:
|
||||||
subnet_obj = self._get_subnet_object(context,
|
# Call this method to keep original status code
|
||||||
fixed['subnet_id'])
|
# in case subnet is not found
|
||||||
|
self._get_subnet_object(context, fixed['subnet_id'])
|
||||||
msg = (_("Failed to create port on network %(network_id)s"
|
msg = (_("Failed to create port on network %(network_id)s"
|
||||||
", because fixed_ips included invalid subnet "
|
", because fixed_ips included invalid subnet "
|
||||||
"%(subnet_id)s") %
|
"%(subnet_id)s") %
|
||||||
{'network_id': subnet_obj.network_id,
|
{'network_id': network_id,
|
||||||
'subnet_id': fixed['subnet_id']})
|
'subnet_id': fixed['subnet_id']})
|
||||||
raise exc.InvalidInput(error_message=msg)
|
raise exc.InvalidInput(error_message=msg)
|
||||||
# Ensure that the IP is valid on the subnet
|
# Ensure that the IP is valid on the subnet
|
||||||
|
@ -291,7 +291,8 @@ class IpamPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
|
|||||||
fixed_ip_list = []
|
fixed_ip_list = []
|
||||||
for fixed in fixed_ips:
|
for fixed in fixed_ips:
|
||||||
fixed['device_owner'] = device_owner
|
fixed['device_owner'] = device_owner
|
||||||
subnet = self._get_subnet_for_fixed_ip(context, fixed, subnets)
|
subnet = self._get_subnet_for_fixed_ip(context, fixed,
|
||||||
|
subnets, network_id)
|
||||||
|
|
||||||
is_auto_addr_subnet = ipv6_utils.is_auto_address_subnet(subnet)
|
is_auto_addr_subnet = ipv6_utils.is_auto_address_subnet(subnet)
|
||||||
if ('ip_address' in fixed and
|
if ('ip_address' in fixed and
|
||||||
|
Loading…
Reference in New Issue
Block a user