Local subnet left after central subnet deleted

Bug #1680757 reported by Zhiyuan Cai
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Tricircle
Fix Released
Undecided
Zhiyuan Cai

Bug Description

After issuing a subnet delete request to central Neutron, central subnet is deleted, but local subnet is left. Further delete central network, local network is deleted successfully along with local subnet deleted(this is why we didn't find out this bug before)

Digging into the log, I found that the local subnet was once deleted, but the following processes recreate the subnet.

1. local subnet is deleted
2. dhcp agent gets "subnet delete" notification
3. dhcp agent calls "get_network"
4. "get_network" calls "ensure_subnet"
5. "ensure_subnet" queries central Neutron to see if there are subnets associated with the network. At this point, central subnet is not deleted since we delete local subnet before deleting central subnet, so central subnet is returned and "ensure_subnet" recreates the local subnet.

Then why do we need to call "ensure_subnet" in "get_network"? The reason is that a user may first create a network and boot a VM, so local network is created. Then the user creates a subnet on this network and boots a VM again, in this case, if we don't ensure subnet in "get_network", the local subnet will not be created.

To fix this bug, we need a way to distinguish the call from dhcp agent and API.

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

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

Changed in tricircle:
assignee: nobody → Zhiyuan Cai (luckyvega-g)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tricircle (master)

Reviewed: https://review.openstack.org/456826
Committed: https://git.openstack.org/cgit/openstack/tricircle/commit/?id=af2cce93643db4d262d39fb2b2dc3017b9e9a66e
Submitter: Jenkins
Branch: master

commit af2cce93643db4d262d39fb2b2dc3017b9e9a66e
Author: zhiyuan_cai <email address hidden>
Date: Fri Apr 14 11:41:56 2017 +0800

    Mark subnet deletion state during subnet deletion

    1. What is the problem
    As reported in the bug page, local subnet will be recreated
    after central subnet is deleted

    2. What is the solution for the problem
    The reason for the recreation is that DhcpAgentNotifyAPI subscribe
    the subnet deletion event and will call get_network during subnet
    deletion, get_network will call _ensure_subnet to create the subnet.
    So we need a way to distinguish the call from API and callback.

    A dict on_subnet_delete is added to local plugin in this patch.
    In delete_subnet, before calling real core pluing's delete_subnet
    method, we first add a new item (request_id, True) to this dict.
    After the calling, this item is removed. So in get_network, we can
    check whether the dict contains the request_id, if so, we know
    that we are in the subnet deletion stage, then we don't call
    _ensure_subnet.

    3. What features need to be implemented to the Tricircle to
    realize the solution
    No new features

    Change-Id: Ie79460aa763918be7c522263d9865847fc0da828
    Closes-Bug: #1680757

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

This issue was fixed in the openstack/tricircle 3.3.0 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.