Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Inconsistent autostart behavior #2469
Comments
For 1), we may be able to differentiate between having boot.autostart set to false and not having it set at all. So if set to false, we could have LXD never restart the container, if unset we keep the current behavior (last state) and if set to true, we always start it. |
stgraber
added this to the lxd-2.5 milestone
Oct 7, 2016
stgraber
self-assigned this
Oct 7, 2016
stgraber
added
Bug
Easy
Documentation
labels
Oct 7, 2016
tych0
closed this
in
471eef7
Oct 11, 2016
added a commit
that referenced
this issue
Oct 26, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lathiat commentedOct 7, 2016
•
Edited 1 time
-
lathiat
Oct 7, 2016
Required information
Issue description
LXD autostart behavior is inconsistent and can be confusing.
A container is automatically restarted if it was last running, regardless of the autostart setting.
If you shutdown an LXD host with "poweroff", the container will store it's lastState of RUNNING and start again next boot. If you hard shutdown the host (e.g. echo b > /proc/sysrq-trigger), they will not restart - seems the state is never stored.
This behavior can lead you to make the wrong assumption about the autostart behavior, and it is likely to fail you at the worst time (when a host crashes or loses power). I believe this behavior contributed to the following juju bug not being discovered earlier:
https://bugs.launchpad.net/juju/+bug/1631254
I have two suggestions
(1) The autostart configuration option should allow you to set "NEVER", "LAST STATE" or "ALWAYS" - this kind of behavior is seen in the same option on physical servers. The current default (LAST STATE) is probably OK but would make this behavior more obvious
(2) The lastRunning state should be stored at runtime while the container is running, rather than at shutdown. So that an unclean or clean shutdown causes the same restart behavior.
These two items probably could be split, depending on feedback as to whether either option is considered a good idea.