Destroy bay should also destroy the related pods services and rcs

Bug #1440630 reported by Lan Qi song
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Magnum
Fix Released
Undecided
Lan Qi song

Bug Description

Currently, when we delete a bay, we will delete the stack firstly, then try to destroy the bay record in db, and at this time , if any of pods, services or replicationcontrollers are related to this bay, a BayNotEmpty exception will be raised.

But in the meanwhile, the stack should already be deleted which means the left records( bay, pod, service, rc) are unavailable.

I think we should destroy the bay related resources rather than raise an exception.

One concern here is HongBing's comment at these lines:
https://github.com/openstack/magnum/blob/master/magnum/db/sqlalchemy/api.py#L218-L221

  # TODO(hongbin): delete pods and services that attached to the bay.
  # We don't do it now because it could cause a long deletion
  # time which would block the conductor. It needs either threads
  # or coroutines.

But right now, the bay destroy method is called in poll_and_check method:
(https://github.com/openstack/magnum/blob/master/magnum/conductor/handlers/bay_k8s_heat.py#L256)
 which is a thread different from the main conductor thread, so the long deletion time won't block the conductor now.

Revision history for this message
Lan Qi song (lqslan) wrote :
Changed in magnum:
status: New → In Progress
assignee: nobody → Lan Qi song (lqslan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to magnum (master)

Reviewed: https://review.openstack.org/170764
Committed: https://git.openstack.org/cgit/openstack/magnum/commit/?id=dbb3769fa3792bf804d5d31197e3776eb4b7c9ff
Submitter: Jenkins
Branch: master

commit dbb3769fa3792bf804d5d31197e3776eb4b7c9ff
Author: lqslan <email address hidden>
Date: Mon Apr 6 10:33:59 2015 +0800

    Destroy the related resources when delete a bay

    Currently, when we delete a bay, we will delete the stack firstly,
    then try to detroy the bay record in db. And at this time, a
    BayNotEmpty exception may raised if some of pods, services or rc
    are related to this bay. In the meanwhile, the stack should be already
    deleted, actually, the left bay record is unavailable.

    This patch destroy the related resources when delete a bay.

    Change-Id: I56cd8813417bd4a6f6c340deb8afd88d5516f225
    Closes-bug: #1440630

Changed in magnum:
status: In Progress → Fix Committed
Adrian Otto (aotto)
Changed in magnum:
status: Fix Committed → Fix Released
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.