Project | LXD |
Status | Approved |
Author(s) | @monstermunchkin |
Approver(s) | @stgraber @tomp |
Release | LXD 5.5 |
Internal ID | LX021 |
Abstract
Add new Ready
state to instances which indicates that an instance is ready to work with.
Rationale
Once an instance has been started successfully, it goes into Running
state. This state doesn’t indicate that the instance is ready, only that it’s running.
Introducing a Ready
state solves this problem. Once an instance is ready, it can (but doesn’t need to) notify LXD about this.
Specification
Design
Instances will use devlxd to notify LXD that they are ready. This will be done using a PATCH
to devlxd’s /1.0
endpoint, using {"state":"Ready"}
as the payload.
Once the instance has notified LXD about it being ready, the volatile.last_state.ready
config key will be set to true
. When requesting the status code, and the instance is running and ready, it will return the new Ready
status.
When an instance is shut down, the aforementioned config key will be set to false
. During daemon initialization, the config key is unset for all instances. That is because LXD doesn’t truly know whether or not an instance is ready when starting; it’s possible that instances have been left running while the server has been shut down.
It is possible for an instance to return to Running
state by calling PATCH /1.0
with {"state":"Started"}
as the payload.
API changes
The devlxd server will gain the following new endpoint:
PATCH /1.0
This endpoint accepts the following payload:
type devlxdPut struct {
State string `json:"state" yaml:"state"`
}
CLI changes
No CLI changes.
Database changes
No database changes.
Upgrade handling
No upgrade handling.
Further information
No further information.