QosPolicyInUse after notifying the removal to backends

Bug #1646370 reported by YAMAMOTO Takashi
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Miguel Angel Ajo

Bug Description

currently QosPolicyInUse check for delete_policy is in policy.delete().
it should be done before notifying the backends.

eg. test_delete_not_allowed_if_policy_in_use_by_network tempest test triggers the situation.
the following was seen on networking-midonet gate. while the first delete_qos_policy failed
from POV of neutron api, it deleted the policy in the backend. and the second delete_qos_policy
ends up with the following error.

http://logs.openstack.org/27/400627/12/check/gate-tempest-dsvm-networking-midonet-v2-ubuntu-xenial/c4dad99/logs/screen-q-svc.txt.gz

2016-12-01 05:44:49.116 23924 ERROR midonetclient.api_lib [req-91b72dde-2942-44c5-bb12-1bc479b9916c tempest-QosTestJSON-1358267085 -] Got http error(response={'status': '404', 'content-length': '92', 'access-control-expose-headers': 'Location', 'vary': 'Accept-Encoding', 'server': 'Jetty(9.3.z-SNAPSHOT)', '-content-encoding': 'gzip', 'date': 'Thu, 01 Dec 2016 05:44:49 GMT', 'access-control-allow-origin': '*', 'access-control-allow-methods': 'GET, POST, PUT, DELETE, OPTIONS', 'content-type': 'application/vnd.org.midonet.Error-v1+json'}, content='{"message":"There is no QosPolicy with ID 2474a2ca-9629-4c51-ae2f-18518a4aaaf0.","code":404}') for request(uri=u'http://10.12.148.148:8181/midonet-api/neutron/networks/114f5da9-9bae-4fd7-8095-44fad0d18da0', method='PUT', body={'status': u'ACTIVE', 'subnets': [], 'name': u'test network', 'admin_state_up': True, 'tenant_id': u'a030938a0e554f4fa31dec5651446fbf', 'description': u'', 'tags': [], 'updated_at': '2016-12-01T05:44:49Z', 'mtu': 1500, 'router:external': False, 'provider:network_type': 'midonet', 'revision_number': 4, 'port_security_enabled': True, 'shared': True, 'created_at': '2016-12-01T05:44:48Z', 'project_id': u'a030938a0e554f4fa31dec5651446fbf', 'id': u'114f5da9-9bae-4fd7-8095-44fad0d18da0', 'qos_policy_id': u'2474a2ca-9629-4c51-ae2f-18518a4aaaf0'}, query={},headers={'Content-Type': 'application/vnd.org.midonet.neutron.Network-v1+json', 'X-Auth-Token': 'gAAAAABYP7Y30jWsOPThAVKsDC8uc7JzrXDhiE5Qem4JMuz074sMgOLV7n6azX3LYdGKt0kB3-j4r74fExTuzo1oCQgRG1pv763rSgTD5nrpOnvphnr9ew1cJpsHjofVWOitV8Y3lwTFxaKAiK2ovKa3ifH5tLOJm7v_-uXaRaTd8vYb5n0QCf0'}). Raising exception=<HTTPNotFound at 0x7ff8dd456e60 404 Not Found>

tags: added: qos
Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

Yeah, it seems like the order of operations in delete_policy is wrong (we first notify, then delete in db, while we should do vice versa).

Changed in neutron:
status: New → Confirmed
importance: Undecided → Medium
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/405448

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

Reviewed: https://review.openstack.org/405448
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=8fcba9dec801a0fb57ff29f97838958f083c8131
Submitter: Jenkins
Branch: master

commit 8fcba9dec801a0fb57ff29f97838958f083c8131
Author: Miguel Angel Ajo <email address hidden>
Date: Thu Dec 1 16:18:36 2016 +0100

    QoS: update the database before notifying the backend on delete

    Previously, the QoS plugin was executing the DB delete operation
    after notifying the backend about the operation. This leads
    to situations where the backend is notified for deletion, and
    then the policy can't be deleted because it's in use.

    Correct order is, DB delete first, then notify the backend.

    Change-Id: I357543832b9359bf169d05d079bd153f0ee591c4
    Closes-Bug: #1646370

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 10.0.0.0b3

This issue was fixed in the openstack/neutron 10.0.0.0b3 development milestone.

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

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/484659

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

Reviewed: https://review.openstack.org/484659
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=364501f574c075ed97810e7dff4478d66bc0c9a9
Submitter: Jenkins
Branch: stable/newton

commit 364501f574c075ed97810e7dff4478d66bc0c9a9
Author: Miguel Angel Ajo <email address hidden>
Date: Thu Dec 1 16:18:36 2016 +0100

    QoS: update the database before notifying the backend on delete

    Previously, the QoS plugin was executing the DB delete operation
    after notifying the backend about the operation. This leads
    to situations where the backend is notified for deletion, and
    then the policy can't be deleted because it's in use.

    Correct order is, DB delete first, then notify the backend.

    Change-Id: I357543832b9359bf169d05d079bd153f0ee591c4
    Closes-Bug: #1646370
    (cherry picked from commit 8fcba9dec801a0fb57ff29f97838958f083c8131)

tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 9.4.1

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

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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