Migrating a model back to controller fails: model XXXX has been removed
Bug #1641824 reported by
Menno Finlay-Smits
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
Christian Muirhead |
Bug Description
It's currently not possible to migrate a model from controller A to B and then back to A again. During the import phase an error like ""model XXXX has been removed" is reported causing the migration to abort.
The regression seems to be caused by recent fixes to the StatePool type, specifically this commit: e6d51734.
tags: | added: model-migration |
Changed in juju: | |
status: | In Progress → Fix Committed |
Changed in juju: | |
milestone: | 2.1.0 → 2.1-beta3 |
Changed in juju: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
This is because the state is still in the StatePool but marked as removed. It turns out there are a number of places that get states from the pool but never release them back. When the migration finishes it marks the state for the migrated pool to be removed but waits until any current users are finished with it - since the references never get to 0 it's not removed, and it just hangs around even though the underlying model is gone. Then when the reverse migration is started it fails because getting a removed state from the pool is forbidden.
This PR fixes all but one of the cases: https:/ /github. com/juju/ juju/pull/ 6566
The remaining place is here: https:/ /github. com/juju/ juju/blob/ staging/ apiserver/ apiserver. go#L470
Each Connect func needs to hang on to the context and release the state returned from the ctxt.stateForRe quest methods.