Skip to content

Commit c475606

Browse files
fix: incorrect reporting of Stopped, add better error reporting
1 parent dc370b5 commit c475606

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 24
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-5949b3d0dabd8e0b10afddb388b6f0ea66c44b0f383e28d49bcd81b22b021dee.yml
3-
openapi_spec_hash: 9e9e6964a4cafc48e3cff37d918d0889
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-79d2560d22cc9ee4e2bf34ad8de2e4f3ae8f4c653b1ed871ad532320ead489bc.yml
3+
openapi_spec_hash: 53af3f7cd0fe7951664479a9de444d56
44
config_hash: 510018ffa6ad6a17875954f66fe69598

instance.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)
229235
type InstanceState string
230236

231237
const (
@@ -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

Comments
 (0)