Juju doesn't mount storage after lxd container restart
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
Simon Richardson | ||
3.0 |
Fix Released
|
High
|
Unassigned | ||
3.1 |
Fix Committed
|
High
|
Unassigned |
Bug Description
If we deploy an operator framework charm that has a storage defined on metadata.yaml, like the edge version of the PostgreSQL charm (https:/
But if the host machine (the one where lxd and the Juju agent are installed and running the lxd containers on top of it) is restarted or if restart one of the unit containers manually with lxc restart, sometimes the storage is not mounted again (sometimes it is mounted).
To reproduce this issue, you can do the following in a fresh Juju model:
juju deploy postgresql --channel edge
juju model-config update-
juju ssh postgresql/0
lsblk # check that /var/lib/
Then you restart the host machine or the unit container (you may need to do it multiple times, as the issue happened in a non predictable way):
lxc restart juju-machine-id
juju ssh postgresql/0
lsblk # and check that /var/lib/
Version used: Ubuntu 22.04, Juju 2.9.37 and lxd 5.9
Changed in juju: | |
importance: | Undecided → High |
status: | New → Triaged |
assignee: | nobody → Simon Richardson (simonrichardson) |
milestone: | none → 2.9.39 |
Changed in juju: | |
milestone: | 2.9.39 → 2.9.40 |
Changed in juju: | |
status: | Triaged → Fix Committed |
Changed in juju: | |
milestone: | 2.9.40 → 2.9.42 |
Changed in juju: | |
status: | Fix Committed → Fix Released |
One more detail that may be helpful:
I noticed that at the times the issue happens (the storage is not mounted after a restart) the ctx.filesystems map is empty (the filesystem of the storage is missing there) and then https:/ /github. com/juju/ juju/blob/ juju-2. 9.37/worker/ storageprovisio ner/storageprov isioner. go#L339 is called (which doesn't mount the storage as the filesystem is missing). The other times, ctx.filesystems is populated with the storage that is needed, so the storage is mounted.