yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #82447
[Bug 1844607] Re: log error when create neutron port with wrong subnet
** Changed in: neutron
Status: Fix Released => In Progress
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1844607
Title:
log error when create neutron port with wrong subnet
Status in neutron:
In Progress
Bug description:
With Neutron Newton version
There are two networks named share_net and test1 in my env, each with
one subnet. When I create port in share_net, but specify subnet_id of
the test1's subnet, not the subnet of share_net. Create port failed,
but log is "Failed to create port on network
8fd6c0d1-e499-4e29-9786-dadb377f9939, because fixed_ips included
invalid subnet d213e64e-045e-4941-a4bd-ffc049ad792c."
Here we can see network 8fd6c0d1-e499-4e29-9786-dadb377f9939 is test1,
subnet d213e64e-045e-4941-a4bd-ffc049ad792c is the subnet of test1.
The log is confused, actually it should log network
311a12a8-6824-4348-b5b5-80068a0c3785 with invalid subnet d213e64e-
045e-4941-a4bd-ffc049ad792c.
()[root@busybox-openstack-85c44df77f-xk2rx /]# neutron net-list
+--------------------------------------+----------------------------------------------------+-------------------------------------------------------+
| id | name | subnets |
+--------------------------------------+----------------------------------------------------+-------------------------------------------------------+
| 311a12a8-6824-4348-b5b5-80068a0c3785 | share_net | ef7e9220-d478-48f7-819e-80143621f233 192.168.20.0/24 |
| 8fd6c0d1-e499-4e29-9786-dadb377f9939 | test1 | d213e64e-045e-4941-a4bd-ffc049ad792c 192.168.20.0/24 |
+--------------------------------------+----------------------------------------------------+-------------------------------------------------------+
()[root@busybox-openstack-85c44df77f-xk2rx /]# neutron port-create
--name nic1 --fixed-ip subnet_id=d213e64e-045e-4941-a4bd-ffc049ad792c
311a12a8-6824-4348-b5b5-80068a0c3785
Invalid input for operation: Failed to create port on network 8fd6c0d1-e499-4e29-9786-dadb377f9939, because fixed_ips included invalid subnet d213e64e-045e-4941-a4bd-ffc049ad792c.
Neutron server returns request_ids: ['req-e32df57b-0756-4b88-b042-a0b67ccd7fe7']
after inspect code, I found the function code is:
def _get_subnet_for_fixed_ip(self, context, fixed, subnets):
# Subnets are all the subnets belonging to the same network.
if not subnets:
msg = _('IP allocation requires subnets for network')
raise exc.InvalidInput(error_message=msg)
if 'subnet_id' in fixed:
def get_matching_subnet():
for subnet in subnets:
if subnet['id'] == fixed['subnet_id']:
return subnet
subnet = get_matching_subnet()
if not subnet:
subnet = self._get_subnet(context, fixed['subnet_id'])
msg = (_("Failed to create port on network %(network_id)s"
", because fixed_ips included invalid subnet "
"%(subnet_id)s") %
{'network_id': subnet['network_id'],
'subnet_id': fixed['subnet_id']})
raise exc.InvalidInput(error_message=msg)
this function, it use “'network_id': subnet['network_id'] ”, actually it should use the network passed from api.
master branch also have this problem: https://github.com/openstack/neutron/blob/master/neutron/db/ipam_backend_mixin.py#382
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1844607/+subscriptions
References