Juju loses track of current controller when destroying model

Bug #1582021 reported by Mark Shuttleworth
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Unassigned
juju-ci-tools
Fix Released
High
Michael Skalka

Bug Description

I just saw this, not sure how to debug further. The TL;DR is that I was able to list models, but when I destroyed the model I was currently attached to, it seemed unable to fall back to a different model. Worse, it seemed to lose track of the admin and default models entirely until I switched to the admin model.

mark@mark-XPS-15-9550:~$ juju list-models
NAME OWNER STATUS LAST CONNECTION
admin admin@local available never connected
default admin@local available 22 hours ago
bigdata* admin@local available 21 hours ago

mark@mark-XPS-15-9550:~$ juju destroy-model bigdata
WARNING! This command will destroy the "bigdata" model.
This includes all machines, services, data and other resources.

Continue [y/N]? y
mark@mark-XPS-15-9550:~$ juju list-models
ERROR cannot list models: model not found (not found)
mark@mark-XPS-15-9550:~$ juju status
ERROR refreshing models: model not found (not found)
mark@mark-XPS-15-9550:~$ juju list-controllers
CONTROLLER MODEL USER SERVER
local.test* bigdata admin@local 192.168.253.164:17070

mark@mark-XPS-15-9550:~$ juju switch bigdata
local.test:bigdata (no change)
mark@mark-XPS-15-9550:~$ juju switch admin
local.test:bigdata -> local.test:admin
mark@mark-XPS-15-9550:~$ juju list-models
NAME OWNER STATUS LAST CONNECTION
admin* admin@local available never connected
default admin@local available 22 hours ago

mark@mark-XPS-15-9550:~$ juju status
[Services]
...

Related branches

Revision history for this message
Cheryl Jennings (cherylj) wrote :

I think there may be two issues here:

1 - We don't unset the "current model" if you destroy the model you're currently operating on. Bug #1505504 can track that fix.

2 - There's a timing hole in list-models where we first get all models, then query each one for more details. A model which has been removed during that timing hole would result in the error you saw. While we're iterating over the models, if we encounter one that no longer exists, we should not fail the whole operation. That model should just be removed from the results.

Changed in juju-core:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.0-beta8
tags: added: destroy-model juju-release-support usability
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta8 → 2.0-beta9
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta9 → 2.0-beta10
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta10 → 2.0-beta11
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta11 → 2.0-beta12
tags: added: 2.0 bitesize
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta12 → 2.0-beta13
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta13 → 2.0-beta14
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta14 → 2.0-beta15
Changed in juju-core:
milestone: 2.0-beta15 → 2.0-beta16
Changed in juju-core:
milestone: 2.0-beta16 → 2.0-beta17
affects: juju-core → juju
Changed in juju:
milestone: 2.0-beta17 → none
milestone: none → 2.0-beta17
Revision history for this message
Anastasia (anastasia-macmood) wrote :

We believe that this bug has been fixed by other fixes in related area.

@QA - could we please have a test for this?

Changed in juju:
status: Triaged → Fix Committed
tags: added: eda
Curtis Hovey (sinzui)
Changed in juju:
status: Fix Committed → Fix Released
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

@Anastasia, please add juju-ci-tools as affected to help us keep track when you have requests for new tests like this. I've added it to this bug. Thanks!

tags: added: needs-ci-test
Changed in juju-ci-tools:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Anastasia (anastasia-macmood) wrote :

@Nicholas, Thank you! I will \o/

Michael Skalka (mskalka)
Changed in juju-ci-tools:
assignee: nobody → Michael Skalka (mskalka)
status: Triaged → In Progress
Michael Skalka (mskalka)
Changed in juju-ci-tools:
status: In Progress → Confirmed
status: Confirmed → Fix Released
status: Fix Released → Fix Committed
Michael Skalka (mskalka)
Changed in juju-ci-tools:
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.