Service instance teardown makes non-optimal neutron port-list query

Bug #1879754 reported by Goutham Pacha Ravi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Fix Released
Low
George Melikov

Bug Description

Description
===========

Manila's Generic driver and Windows drivers use the service instance helper module to create and manage the lifecycle of share servers. While tearing down the service instance, we release the ports associated with the instance, and if the subnet is unused by any other service instance, we remove it from the router provisioned.

In order to identify if there are any ports being used on the subnet, we list *all* the ports:

https://opendev.org/openstack/manila/src/commit/198774292d8f53805c79fed05504a5d9f92eae26/manila/share/drivers/service_instance.py#L842-L858

This can be a very expensive call; and is absolutely unnecessary for us to get all ports and then filter them based on their subnet_id. Instead, we can rely on the subnet_id filtering in the neutron API: https://docs.openstack.org/api-ref/network/v2/?expanded=list-ports-detail#list-ports

Steps to reproduce
==================

* Deploy manila with the generic driver
* Create a share network, and a share on that share network
* Delete the share, and the associated share server (or set "[DEFAULT]/delete_share_server_with_last_share" to automatically delete the share server)
* Watch the neutron API calls in the neutron API log. The GET /ports call from manila retrieves *all* ports known to neutron

Expected result
===============
Manila only requests the ports relevant to its operation to act upon.

Actual result
=============
Manila requests a complete port list from neutron, and performs client side filtering to grab the relevant ones.

Environment
===========
1. OpenStack master
2. Which storage backend did you use? Generic
3. Which networking type did you use? Neutron with OpenVSwitch

Revision history for this message
Goutham Pacha Ravi (gouthamr) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/#/c/712972/

Changed in manila:
assignee: nobody → George Melikov (gmelikov)
importance: Undecided → Low
status: New → In Progress
milestone: none → victoria-1
tags: added: generic
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.opendev.org/712972
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=d5fc7d28023fb060a077e7913c38b2aa59deae4b
Submitter: Zuul
Branch: master

commit d5fc7d28023fb060a077e7913c38b2aa59deae4b
Author: George Melikov <email address hidden>
Date: Fri Mar 13 18:11:36 2020 +0300

    Get ports filtered by subnet id on share-server cleanup

    Neutron can filter ports by subnet-id by itself, so:
    - Don't send all ports in Neutron on every share-server removal
    - Don't send fixed-ips fields (which are nearly half of total data)

    Closes-Bug: #1879754
    Change-Id: If42c9a0a662a62bbe2a02b6baee6ae13eedd8c97
    Signed-off-by: George Melikov <email address hidden>

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

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/731286

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

Reviewed: https://review.opendev.org/731286
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=1c25df055cfcb4a99f6010dedd9698aeab582c9f
Submitter: Zuul
Branch: stable/ussuri

commit 1c25df055cfcb4a99f6010dedd9698aeab582c9f
Author: George Melikov <email address hidden>
Date: Fri Mar 13 18:11:36 2020 +0300

    Get ports filtered by subnet id on share-server cleanup

    Neutron can filter ports by subnet-id by itself, so:
    - Don't send all ports in Neutron on every share-server removal
    - Don't send fixed-ips fields (which are nearly half of total data)

    Closes-Bug: #1879754
    Change-Id: If42c9a0a662a62bbe2a02b6baee6ae13eedd8c97
    Signed-off-by: George Melikov <email address hidden>
    (cherry picked from commit d5fc7d28023fb060a077e7913c38b2aa59deae4b)

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/733692

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

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/738886

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

Reviewed: https://review.opendev.org/733692
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=6542f2f1c4a509c80531314a7e102ffbf62f02de
Submitter: Zuul
Branch: stable/train

commit 6542f2f1c4a509c80531314a7e102ffbf62f02de
Author: George Melikov <email address hidden>
Date: Fri Mar 13 18:11:36 2020 +0300

    Get ports filtered by subnet id on share-server cleanup

    Neutron can filter ports by subnet-id by itself, so:
    - Don't send all ports in Neutron on every share-server removal
    - Don't send fixed-ips fields (which are nearly half of total data)

    Closes-Bug: #1879754
    Change-Id: If42c9a0a662a62bbe2a02b6baee6ae13eedd8c97
    Signed-off-by: George Melikov <email address hidden>
    (cherry picked from commit d5fc7d28023fb060a077e7913c38b2aa59deae4b)
    (cherry picked from commit 1c25df055cfcb4a99f6010dedd9698aeab582c9f)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (stable/stein)

Reviewed: https://review.opendev.org/738886
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=908041c4569ead060c2c9c3a7ed054bcd7b6f6e9
Submitter: Zuul
Branch: stable/stein

commit 908041c4569ead060c2c9c3a7ed054bcd7b6f6e9
Author: George Melikov <email address hidden>
Date: Fri Mar 13 18:11:36 2020 +0300

    Get ports filtered by subnet id on share-server cleanup

    Neutron can filter ports by subnet-id by itself, so:
    - Don't send all ports in Neutron on every share-server removal
    - Don't send fixed-ips fields (which are nearly half of total data)

    Closes-Bug: #1879754
    Change-Id: If42c9a0a662a62bbe2a02b6baee6ae13eedd8c97
    Signed-off-by: George Melikov <email address hidden>
    (cherry picked from commit d5fc7d28023fb060a077e7913c38b2aa59deae4b)
    (cherry picked from commit 1c25df055cfcb4a99f6010dedd9698aeab582c9f)
    (cherry picked from commit 6542f2f1c4a509c80531314a7e102ffbf62f02de)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/738930

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

Fix proposed to branch: stable/queens
Review: https://review.opendev.org/743554

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

Reviewed: https://review.opendev.org/738930
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=ab799060277e5813f652e5176f78b9d912bbd012
Submitter: Zuul
Branch: stable/rocky

commit ab799060277e5813f652e5176f78b9d912bbd012
Author: George Melikov <email address hidden>
Date: Fri Mar 13 18:11:36 2020 +0300

    Get ports filtered by subnet id on share-server cleanup

    Neutron can filter ports by subnet-id by itself, so:
    - Don't send all ports in Neutron on every share-server removal
    - Don't send fixed-ips fields (which are nearly half of total data)

    Closes-Bug: #1879754
    Change-Id: If42c9a0a662a62bbe2a02b6baee6ae13eedd8c97
    Signed-off-by: George Melikov <email address hidden>
    (cherry picked from commit d5fc7d28023fb060a077e7913c38b2aa59deae4b)
    (cherry picked from commit 1c25df055cfcb4a99f6010dedd9698aeab582c9f)
    (cherry picked from commit 6542f2f1c4a509c80531314a7e102ffbf62f02de)
    (cherry picked from commit 908041c4569ead060c2c9c3a7ed054bcd7b6f6e9)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (stable/queens)

Reviewed: https://review.opendev.org/743554
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=f8103b5e588444705e0d82b27c2b0adf63c7381f
Submitter: Zuul
Branch: stable/queens

commit f8103b5e588444705e0d82b27c2b0adf63c7381f
Author: George Melikov <email address hidden>
Date: Fri Mar 13 18:11:36 2020 +0300

    Get ports filtered by subnet id on share-server cleanup

    Neutron can filter ports by subnet-id by itself, so:
    - Don't send all ports in Neutron on every share-server removal
    - Don't send fixed-ips fields (which are nearly half of total data)

    Closes-Bug: #1879754
    Change-Id: If42c9a0a662a62bbe2a02b6baee6ae13eedd8c97
    Signed-off-by: George Melikov <email address hidden>
    (cherry picked from commit d5fc7d28023fb060a077e7913c38b2aa59deae4b)
    (cherry picked from commit 1c25df055cfcb4a99f6010dedd9698aeab582c9f)
    (cherry picked from commit 6542f2f1c4a509c80531314a7e102ffbf62f02de)
    (cherry picked from commit 908041c4569ead060c2c9c3a7ed054bcd7b6f6e9)
    (cherry picked from commit ab799060277e5813f652e5176f78b9d912bbd012)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/manila queens-eol

This issue was fixed in the openstack/manila queens-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/manila rocky-eol

This issue was fixed in the openstack/manila rocky-eol release.

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.