"juju destroy-controller" can leak hosted models

Bug #1567228 reported by Andrew Wilkins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Andrew Wilkins

Bug Description

juju destroy-controller requires you to first destroy hosted models. So I ran this after a fresh bootstrap:

    juju add-machine
    (wait for machine to be provisioned)
    juju destroy-model -y default && juju destroy-controller -y ctrl

And the hosted model machine is still there.

The code in state that decrements hosted-model refcounts is broken. When you create a hosted model, a refcount is added to the controller. As long as this refcount is non-zero, you cannot destroy the controller. When you "juju destroy-model", it marks the model as dying, enqueues cleanups (destroy services, machines, etc.), and decrements the refcount. It's then possible to destroy the controller before all of the hosted model resources are cleaned up.

Revision history for this message
Andrew Wilkins (axwalk) wrote :

I'm tempted to target for 2.0, but I don't think it'll get fixed in time. This is complicated, due to how we keep models hanging around even after they're dead. Normally we would decrement refcounts when removing entities from state. I suspect we'll just have to do it when setting it to Dead, rather than Dying.

description: updated
Revision history for this message
Andrew Wilkins (axwalk) wrote :

Actually, that shouldn't be too hard. Working on it now.

Changed in juju-core:
milestone: 2.0.1 → 2.0-beta4
status: Triaged → In Progress
assignee: nobody → Andrew Wilkins (axwalk)
Revision history for this message
Andrew Wilkins (axwalk) wrote :
Andrew Wilkins (axwalk)
Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
affects: juju-core → juju
Changed in juju:
milestone: 2.0-beta4 → none
milestone: none → 2.0-beta4
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.