Creating a security group rule with no protocol fails with KeyError

Bug #1566327 reported by Miguel Angel Ajo
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Ihar Hrachyshka

Bug Description

neutron security-group-rule-create --direction ingress default

results in:

2016-04-05 15:50:56.772 ERROR neutron.api.v2.resource [req-67736b7a-6a4c-442c-9536-890ccf5c8d19 admin 3dc1eb0373d34ba9b2edfb41ee98149c] create failed
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource Traceback (most recent call last):
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 84, in resource
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource result = method(request=request, **args)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 410, in create
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource return self._create(request, body, **kwargs)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 148, in wrapper
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource ectxt.value = e.inner_exc
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource self.force_reraise()
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 138, in wrapper
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource return f(*args, **kwargs)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 521, in _create
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource obj = do_create(body)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 503, in do_create
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource request.context, reservation.reservation_id)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource self.force_reraise()
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 496, in do_create
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource return obj_creator(request.context, **kwargs)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/securitygroups_rpc_base.py", line 74, in create_security_group_rule
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource security_group_rule)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/securitygroups_db.py", line 374, in create_security_group_rule
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource return self._create_security_group_rule(context, security_group_rule)
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/securitygroups_db.py", line 399, in _create_security_group_rule
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource protocol=rule_dict['protocol'],
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource KeyError: 'protocol'
2016-04-05 15:50:56.772 TRACE neutron.api.v2.resource

This is a regression, since it was working before.

Revision history for this message
Miguel Angel Ajo (mangelajo) wrote :

The culprit is here: https://github.com/openstack/neutron/commit/913a64cc1175b3bd7efc7abe34895c32bf39a696 I still don't understand why, but as soon as I reverted it, it works.

tags: added: mitaka-backport-potential
tags: added: mitaka-rc-potential
Changed in neutron:
importance: Medium → High
status: New → Confirmed
tags: added: liberty-backport-potential
removed: mitaka-backport-potential mitaka-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (stable/liberty)

Related fix proposed to branch: stable/liberty
Review: https://review.openstack.org/301703

Revision history for this message
Miguel Angel Ajo (mangelajo) wrote :

It did not land to mitaka [1], so removing the RC and mitaka backports , but we need to fix it in liberty [2] where it landed.

[1] https://review.openstack.org/#/c/298642/1
[2] https://review.openstack.org/#/c/298643/

Changed in neutron:
assignee: nobody → Ihar Hrachyshka (ihar-hrachyshka)
milestone: none → newton-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/301749

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/301749
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=5a41caa47a080fdbc1801e2771163734b9790c57
Submitter: Jenkins
Branch: master

commit 5a41caa47a080fdbc1801e2771163734b9790c57
Author: Ihar Hrachyshka <email address hidden>
Date: Tue Apr 5 16:56:16 2016 +0200

    Don't drop 'protocol' from client supplied security_group_rule dict

    If protocol was present in the dict, but was None, then it was never
    re-instantiated after being popped out of the dict. This later resulted
    in KeyError when trying to access the key on the dict.

    Change-Id: I4985e7b54117bee3241d7365cb438197a09b9b86
    Closes-Bug: #1566327

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/302126

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/liberty)

Change abandoned by Ihar Hrachyshka (<email address hidden>) on branch: stable/liberty
Review: https://review.openstack.org/301703
Reason: We are merging https://review.openstack.org/#/c/302126/ instead.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/liberty)

Reviewed: https://review.openstack.org/302126
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3a922a2dfec67d21756d14f3e7463aa8ef2b6148
Submitter: Jenkins
Branch: stable/liberty

commit 3a922a2dfec67d21756d14f3e7463aa8ef2b6148
Author: Ihar Hrachyshka <email address hidden>
Date: Tue Apr 5 16:56:16 2016 +0200

    Don't drop 'protocol' from client supplied security_group_rule dict

    If protocol was present in the dict, but was None, then it was never
    re-instantiated after being popped out of the dict. This later resulted
    in KeyError when trying to access the key on the dict.

    Change-Id: I4985e7b54117bee3241d7365cb438197a09b9b86
    Closes-Bug: #1566327
    (cherry picked from commit 5a41caa47a080fdbc1801e2771163734b9790c57)

tags: added: in-stable-liberty
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/mitaka)

Reviewed: https://review.openstack.org/298642
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=93d719a554d9b179636afccd25e1018b6e5d1cc3
Submitter: Jenkins
Branch: stable/mitaka

commit 93d719a554d9b179636afccd25e1018b6e5d1cc3
Author: Sreekumar S <email address hidden>
Date: Fri Jan 22 19:09:49 2016 +0530

    SG protocol validation to allow numbers or names

    SG rule protocol provided is validated against the DB rules'
    protocols for both number and name. The filter provided to DB
    is modified so that it is queried for records with both the
    protocol name and number, instead of exactly the type provided
    with the input. The returned DB rule record's protocol field is
    validated against the supplied SG protocol field for both name
    or number.
    This way, user is still allowed to enter protocol name or number
    to create a rule, and API compatibility is maintained.

    Closes-Bug: #1215181
    (cherry picked from commit 913a64cc1175b3bd7efc7abe34895c32bf39a696)

    Also squashed the following regression fix:

    ===

    Don't drop 'protocol' from client supplied security_group_rule dict

    If protocol was present in the dict, but was None, then it was never
    re-instantiated after being popped out of the dict. This later resulted
    in KeyError when trying to access the key on the dict.

    Change-Id: I4985e7b54117bee3241d7365cb438197a09b9b86
    Closes-Bug: #1566327
    (cherry picked from commit 5a41caa47a080fdbc1801e2771163734b9790c57)

    ===

    Change-Id: If4ad684e961433b8d9d3ec8fe2810585d3f6a093

tags: added: in-stable-mitaka
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 8.1.0

This issue was fixed in the openstack/neutron 8.1.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/314250

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)
Download full text (36.9 KiB)

Reviewed: https://review.openstack.org/314250
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3bf73801df169de40d365e6240e045266392ca63
Submitter: Jenkins
Branch: master

commit a323769143001d67fd1b3b4ba294e59accd09e0e
Author: Ryan Moats <email address hidden>
Date: Tue Oct 20 15:51:37 2015 +0000

    Revert "Improve performance of ensure_namespace"

    This reverts commit 81823e86328e62850a89aef9f0b609bfc0a6dacd.

    Unneeded optimization: this commit only improves execution
    time on the order of milliseconds, which is less than 1% of
    the total router update execution time at the network node.

    This also

    Closes-bug: #1574881

    Change-Id: Icbcdf4725ba7d2e743bb6761c9799ae436bd953b

commit 7fcf0253246832300f13b0aa4cea397215700572
Author: OpenStack Proposal Bot <email address hidden>
Date: Thu Apr 21 07:05:16 2016 +0000

    Imported Translations from Zanata

    For more information about this automatic import see:
    https://wiki.openstack.org/wiki/Translations/Infrastructure

    Change-Id: I9e930750dde85a9beb0b6f85eeea8a0962d3e020

commit 643b4431606421b09d05eb0ccde130adbf88df64
Author: OpenStack Proposal Bot <email address hidden>
Date: Tue Apr 19 06:52:48 2016 +0000

    Imported Translations from Zanata

    For more information about this automatic import see:
    https://wiki.openstack.org/wiki/Translations/Infrastructure

    Change-Id: I52d7460b3265b5460b9089e1cc58624640dc7230

commit 1ffea42ccdc14b7a6162c1895bd8f2aae48d5dae
Author: OpenStack Proposal Bot <email address hidden>
Date: Mon Apr 18 15:03:30 2016 +0000

    Updated from global requirements

    Change-Id: Icb27945b3f222af1d9ab2b62bf2169d82b6ae26c

commit b970ed5bdac60c0fa227f2fddaa9b842ba4f51a7
Author: Kevin Benton <email address hidden>
Date: Fri Apr 8 17:52:14 2016 -0700

    Clear DVR MAC on last agent deletion from host

    Once all agents are deleted from a host, the DVR MAC generated
    for that host should be deleted as well to prevent a buildup of
    pointless flows generated in the OVS agent for hosts that don't
    exist.

    Closes-Bug: #1568206
    Change-Id: I51e736aa0431980a595ecf810f148ca62d990d20
    (cherry picked from commit 92527c2de2afaf4862fddc101143e4d02858924d)

commit eee9e58ed258a48c69effef121f55fdaa5b68bd6
Author: Mike Bayer <email address hidden>
Date: Tue Feb 9 13:10:57 2016 -0500

    Add an option for WSGI pool size

    Neutron currently hardcodes the number of
    greenlets used to process requests in a process to 1000.
    As detailed in
    http://lists.openstack.org/pipermail/openstack-dev/2015-December/082717.html

    this can cause requests to wait within one process
    for available database connection while other processes
    remain available.

    By adding a wsgi_default_pool_size option functionally
    identical to that of Nova, we can lower the number of
    greenlets per process to be more in line with a typical
    max database connection pool size.

    DocImpact: a previously unused configuration value
               wsgi_default_pool_size is now used to a...

tags: added: neutron-proactive-backport-potential
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/neutron 7.1.0

This issue was fixed in the openstack/neutron 7.1.0 release.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 9.0.0.0b1

This issue was fixed in the openstack/neutron 9.0.0.0b1 development milestone.

tags: removed: neutron-proactive-backport-potential
tags: removed: liberty-backport-potential
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.