Tracking through the twisty-turny stateenvirons code it looks like updating the model’s cloud-region value will fix it.
You can use the script from this post to get into the Juju database. This update needs to be run on the Mongo primary - if you’re in HA and the MongoDB prompt says SECONDARY try the other controller machines with juju-db 1
and juju-db 2
.
From the db prompt this query will show the models and their associated cloud-regions (the vSphere datacenter).
db.models.find({}, {"_id":1, "cloud-region":1})
To update the ones with the old datacenter, use updateMany
:
db.models.updateMany({"cloud-region": "old-datacenter-name"}, {$set: {"cloud-region": "new-datacenter-name"}})
Afterwards you’ll need to bounce the controller agent(s) to see the new value. (Repeat for each one with the 0s changed to 1, 2 if you’re in HA.)
juju ssh -m controller 0 sudo systemctl restart jujud-machine-0.service
That should sort it out, hopefully!