vmm: openapi: Create enum types for enums

This makes it clearer that these are enums that can be reused and also
helps generation by providing names for those types.

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-03-11 07:28:02 -07:00
parent 19d0196291
commit f211170fa2

View File

@@ -520,6 +520,10 @@ components:
type: string type: string
description: Virtual Machine Monitor information description: Virtual Machine Monitor information
VmState:
type: string
enum: [Created, Running, Shutdown, Paused]
VmInfo: VmInfo:
required: required:
- config - config
@@ -529,8 +533,8 @@ components:
config: config:
$ref: "#/components/schemas/VmConfig" $ref: "#/components/schemas/VmConfig"
state: state:
type: string $ref: "#/components/schemas/VmState"
enum: [Created, Running, Shutdown, Paused]
memory_actual_size: memory_actual_size:
type: integer type: integer
format: int64 format: int64
@@ -710,6 +714,11 @@ components:
packages: packages:
type: integer type: integer
CoreSchedulingMode:
type: string
enum: ["Vm", "Vcpu", "Off"]
default: "Vm"
CpusConfig: CpusConfig:
required: required:
- boot_vcpus - boot_vcpus
@@ -739,9 +748,8 @@ components:
features: features:
$ref: "#/components/schemas/CpuFeatures" $ref: "#/components/schemas/CpuFeatures"
core_scheduling: core_scheduling:
type: string $ref: "#/components/schemas/CoreSchedulingMode"
enum: ["Vm", "Vcpu", "Off"]
default: "Vm"
PciSegmentConfig: PciSegmentConfig:
required: required:
@@ -931,6 +939,15 @@ components:
items: items:
type: integer type: integer
ImageType:
type: string
enum: ["FixedVhd", "Qcow2", "Raw", "Vhdx", "Unknown"]
LockGranularity:
type: string
enum: [byte-range, full]
default: byte-range
DiskConfig: DiskConfig:
type: object type: object
properties: properties:
@@ -978,12 +995,9 @@ components:
type: boolean type: boolean
default: true default: true
image_type: image_type:
type: string $ref: "#/components/schemas/ImageType"
enum: [FixedVhd, Qcow2, Raw, Vhdx, Unknown]
lock_granularity: lock_granularity:
type: string $ref: "#/components/schemas/LockGranularity"
enum: [byte-range, full]
default: byte-range
NetConfig: NetConfig:
type: object type: object
@@ -1132,6 +1146,10 @@ components:
id: id:
type: string type: string
ConsoleMode:
type: string
enum: ["Off", "Pty", "Tty", "File", "Socket", "Null"]
ConsoleConfig: ConsoleConfig:
required: required:
- mode - mode
@@ -1142,8 +1160,7 @@ components:
socket: socket:
type: string type: string
mode: mode:
type: string $ref: "#/components/schemas/ConsoleMode"
enum: ["Off", "Pty", "Tty", "File", "Socket", "Null"]
iommu: iommu:
type: boolean type: boolean
default: false default: false
@@ -1156,8 +1173,7 @@ components:
file: file:
type: string type: string
mode: mode:
type: string $ref: "#/components/schemas/ConsoleMode"
enum: ["Off", "Pty", "Tty", "File", "Null"]
iobase: iobase:
type: integer type: integer