@@ -167,8 +167,10 @@ type Instance struct {
167167 // - Shutdown: VM shut down but VMM exists (Cloud Hypervisor native)
168168 // - Stopped: No VMM running, no snapshot exists
169169 // - Standby: No VMM running, snapshot exists (can be restored)
170+ // - Unknown: Failed to determine state (see state_error for details)
170171 //
171- // Any of "Created", "Running", "Paused", "Shutdown", "Stopped", "Standby".
172+ // Any of "Created", "Running", "Paused", "Shutdown", "Stopped", "Standby",
173+ // "Unknown".
172174 State InstanceState `json:"state,required"`
173175 // Environment variables
174176 Env map [string ]string `json:"env"`
@@ -184,6 +186,8 @@ type Instance struct {
184186 Size string `json:"size"`
185187 // Start timestamp (RFC3339)
186188 StartedAt time.Time `json:"started_at,nullable" format:"date-time"`
189+ // Error message if state couldn't be determined (only set when state is Unknown)
190+ StateError string `json:"state_error,nullable"`
187191 // Stop timestamp (RFC3339)
188192 StoppedAt time.Time `json:"stopped_at,nullable" format:"date-time"`
189193 // Number of virtual CPUs
@@ -204,6 +208,7 @@ type Instance struct {
204208 OverlaySize respjson.Field
205209 Size respjson.Field
206210 StartedAt respjson.Field
211+ StateError respjson.Field
207212 StoppedAt respjson.Field
208213 Vcpus respjson.Field
209214 Volumes respjson.Field
@@ -226,6 +231,7 @@ func (r *Instance) UnmarshalJSON(data []byte) error {
226231// - Shutdown: VM shut down but VMM exists (Cloud Hypervisor native)
227232// - Stopped: No VMM running, no snapshot exists
228233// - Standby: No VMM running, snapshot exists (can be restored)
234+ // - Unknown: Failed to determine state (see state_error for details)
229235type InstanceState string
230236
231237const (
@@ -235,6 +241,7 @@ const (
235241 InstanceStateShutdown InstanceState = "Shutdown"
236242 InstanceStateStopped InstanceState = "Stopped"
237243 InstanceStateStandby InstanceState = "Standby"
244+ InstanceStateUnknown InstanceState = "Unknown"
238245)
239246
240247// Network configuration of the instance
0 commit comments