Skip to content

Commit d708091

Browse files
feat: QEMU support
1 parent 9689c50 commit d708091

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
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: 30
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-28e78b73c796f9ee866671ed946402b5d569e683c3207d57c9143eb7d6f83fb6.yml
3-
openapi_spec_hash: fce0ac8713369a5f048bac684ed34fc8
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-cfdd18a303e2e6c87d671e6ae3ecdcd1d9642b053c2ef6bc507eee3f55cc6aa8.yml
3+
openapi_spec_hash: 0b038c955d95740ace74103a9c18d5a3
44
config_hash: f65a6a2bcef49a9f623212f9de6d6f6f

instance.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ type Instance struct {
197197
HasSnapshot bool `json:"has_snapshot"`
198198
// Hotplug memory size (human-readable)
199199
HotplugSize string `json:"hotplug_size"`
200+
// Hypervisor running this instance
201+
//
202+
// Any of "cloud-hypervisor", "qemu".
203+
Hypervisor InstanceHypervisor `json:"hypervisor"`
200204
// Network configuration of the instance
201205
Network InstanceNetwork `json:"network"`
202206
// Writable overlay disk size (human-readable)
@@ -223,6 +227,7 @@ type Instance struct {
223227
Env respjson.Field
224228
HasSnapshot respjson.Field
225229
HotplugSize respjson.Field
230+
Hypervisor respjson.Field
226231
Network respjson.Field
227232
OverlaySize respjson.Field
228233
Size respjson.Field
@@ -263,6 +268,14 @@ const (
263268
InstanceStateUnknown InstanceState = "Unknown"
264269
)
265270

271+
// Hypervisor running this instance
272+
type InstanceHypervisor string
273+
274+
const (
275+
InstanceHypervisorCloudHypervisor InstanceHypervisor = "cloud-hypervisor"
276+
InstanceHypervisorQemu InstanceHypervisor = "qemu"
277+
)
278+
266279
// Network configuration of the instance
267280
type InstanceNetwork struct {
268281
// Whether instance is attached to the default network
@@ -410,6 +423,10 @@ type InstanceNewParams struct {
410423
Devices []string `json:"devices,omitzero"`
411424
// Environment variables
412425
Env map[string]string `json:"env,omitzero"`
426+
// Hypervisor to use for this instance. Defaults to server configuration.
427+
//
428+
// Any of "cloud-hypervisor", "qemu".
429+
Hypervisor InstanceNewParamsHypervisor `json:"hypervisor,omitzero"`
413430
// Network configuration for the instance
414431
Network InstanceNewParamsNetwork `json:"network,omitzero"`
415432
// Volumes to attach to the instance at creation time
@@ -425,6 +442,14 @@ func (r *InstanceNewParams) UnmarshalJSON(data []byte) error {
425442
return apijson.UnmarshalRoot(data, r)
426443
}
427444

445+
// Hypervisor to use for this instance. Defaults to server configuration.
446+
type InstanceNewParamsHypervisor string
447+
448+
const (
449+
InstanceNewParamsHypervisorCloudHypervisor InstanceNewParamsHypervisor = "cloud-hypervisor"
450+
InstanceNewParamsHypervisorQemu InstanceNewParamsHypervisor = "qemu"
451+
)
452+
428453
// Network configuration for the instance
429454
type InstanceNewParamsNetwork struct {
430455
// Whether to attach instance to the default network

instance_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func TestInstanceNewWithOptionalParams(t *testing.T) {
3535
"NODE_ENV": "production",
3636
},
3737
HotplugSize: hypeman.String("2GB"),
38+
Hypervisor: hypeman.InstanceNewParamsHypervisorCloudHypervisor,
3839
Network: hypeman.InstanceNewParamsNetwork{
3940
Enabled: hypeman.Bool(true),
4041
},

0 commit comments

Comments
 (0)