From 8a7e0efd143bdd3a730b424c3de0dbbaf4be3f42 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Fri, 30 Sep 2022 10:40:40 -0700 Subject: [PATCH 01/10] versions: Upgrade to Cloud Hypervisor v27.0 This release has been tracked in our new [roadmap project ](https://github.com/orgs/cloud-hypervisor/projects/6) as iteration v27.0. **Community Engagement** A new mailing list has been created to support broader community discussions. Please consider [subscribing](https://lists.cloudhypervisor.org/g/dev/); an announcement of a regular meeting will be announced via this list shortly. **Prebuilt Packages** Prebuilt packages are now available. Please see this [document](https://github.com/cloud-hypervisor/obs-packaging/blob/main/README.md) on how to install. These packages also include packages for the different firmware options available. **Network Device MTU Exposed to Guest** The MTU for the TAP device associated with a virtio-net device is now exposed to the guest. If the user provides a MTU with --net mtu=.. then that MTU is applied to created TAP interfaces. This functionality is also exposed for vhost-user-net devices including those created with the reference backend. **Boot Tracing** Support for generating a trace report for the boot time has been added including a script for generating an SVG from that trace. **Simplified Build Feature Flags** The set of feature flags, for e.g. experimental features, have been simplified: * msvh and kvm features provide support for those specific hypervisors (with kvm enabled by default), * tdx provides support for Intel TDX; and although there is no MSHV support now it is now possible to compile with the mshv feature, * tracing adds support for boot tracing, * guest_debug now covers both support for gdbing a guest (formerly gdb feature) and dumping guest memory. The following feature flags were removed as the functionality was enabled by default: amx, fwdebug, cmos and common. **Asynchronous Kernel Loading** AArch64 has gained support for loading the guest kernel asynchronously like x86-64. **GDB Support for AArch64** GDB stub support (accessed through --gdb under guest_debug feature) is now available on AArch64 as well as as x86-64. **Notable Bug Fixes** * This version incorporates a version of virtio-queue that addresses an issue where a rogue guest can potentially DoS the VMM, * Improvements around PTY handling for virtio-console and serial devices, * Improved error handling in virtio devices. **Deprecations** Deprecated features will be removed in a subsequent release and users should plan to use alternatives. * Booting legacy firmware (compiled without a PVH header) has been deprecated. All the firmware options (Cloud Hypervisor OVMF and Rust Hypervisor Firmware) support booting with PVH so support for loading firmware in a legacy mode is no longer needed. This functionality will be removed in the next release. Details can be found: https://github.com/cloud-hypervisor/cloud-hypervisor/releases/tag/v27.0 Note: To have the new API of loading firmware for booting (e.g. boot from td-shim), a specific commit revision after the v27.0 release is used as the Cloud Hypervisor version from the 'versions.yaml'. Fixes: #5309 Signed-off-by: Bo Chen (cherry picked from commit fe610704268c77f4b5c9b237d35ebcc18baf311f) --- versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.yaml b/versions.yaml index 370f54561..2ae3988c5 100644 --- a/versions.yaml +++ b/versions.yaml @@ -75,7 +75,7 @@ assets: url: "https://github.com/cloud-hypervisor/cloud-hypervisor" uscan-url: >- https://github.com/cloud-hypervisor/cloud-hypervisor/tags.*/v?(\d\S+)\.tar\.gz - version: "v26.0" + version: "2115a4156891804e5fc7bbd0d1831d2e92a0c50e" firecracker: description: "Firecracker micro-VMM" From f3eac35b55fa7e6a2cd12562f8bacc7c5a2519ab Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Mon, 3 Oct 2022 10:30:42 -0700 Subject: [PATCH 02/10] runtime: clh: Re-generate the client code This patch re-generates the client code for Cloud Hypervisor v27.0. Note: The client code of cloud-hypervisor's (CLH) OpenAPI is automatically generated by openapi-generator [1-2]. [1] https://github.com/OpenAPITools/openapi-generator [2] https://github.com/kata-containers/kata-containers/blob/main/src/runtime/virtcontainers/pkg/cloud-hypervisor/README.md Fixes: #5309 Signed-off-by: Bo Chen (cherry picked from commit 5d63fcf344808495d3a67f1f718a7f0956bac87f) --- .../client/.openapi-generator/FILES | 2 - .../pkg/cloud-hypervisor/client/README.md | 1 - .../cloud-hypervisor/client/api/openapi.yaml | 236 +++++++++--------- .../cloud-hypervisor/client/docs/NetConfig.md | 52 ++++ .../client/docs/PayloadConfig.md | 26 ++ .../client/docs/PlatformConfig.md | 26 ++ .../cloud-hypervisor/client/docs/TdxConfig.md | 51 ---- .../cloud-hypervisor/client/docs/VmConfig.md | 26 -- .../client/model_net_config.go | 72 ++++++ .../client/model_payload_config.go | 36 +++ .../client/model_platform_config.go | 40 +++ .../client/model_tdx_config.go | 107 -------- .../client/model_vm_config.go | 36 --- .../cloud-hypervisor/cloud-hypervisor.yaml | 20 +- 14 files changed, 383 insertions(+), 348 deletions(-) delete mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TdxConfig.md delete mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tdx_config.go diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES index 7618fe3ab..60eb88720 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES @@ -32,7 +32,6 @@ docs/RestoreConfig.md docs/RngConfig.md docs/SendMigrationData.md docs/SgxEpcConfig.md -docs/TdxConfig.md docs/TokenBucket.md docs/VdpaConfig.md docs/VmAddDevice.md @@ -73,7 +72,6 @@ model_restore_config.go model_rng_config.go model_send_migration_data.go model_sgx_epc_config.go -model_tdx_config.go model_token_bucket.go model_vdpa_config.go model_vm_add_device.go diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md index 5839299b6..04b5c9f0c 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -134,7 +134,6 @@ Class | Method | HTTP request | Description - [RngConfig](docs/RngConfig.md) - [SendMigrationData](docs/SendMigrationData.md) - [SgxEpcConfig](docs/SgxEpcConfig.md) - - [TdxConfig](docs/TdxConfig.md) - [TokenBucket](docs/TokenBucket.md) - [VdpaConfig](docs/VdpaConfig.md) - [VmAddDevice](docs/VmAddDevice.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml index 96a0498a4..fbffa9053 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -425,7 +425,7 @@ components: VmInfo: description: Virtual Machine information example: - memory_actual_size: 3 + memory_actual_size: 7 state: Created config: console: @@ -433,7 +433,7 @@ components: file: file iommu: false balloon: - size: 6 + size: 1 deflate_on_oom: false free_page_reporting: false memory: @@ -530,83 +530,81 @@ components: - 3 - 3 devices: - - pci_segment: 6 + - pci_segment: 3 path: path iommu: false id: id - - pci_segment: 6 + - pci_segment: 3 path: path iommu: false id: id vdpa: - - pci_segment: 3 + - pci_segment: 7 path: path num_queues: 3 iommu: false id: id - - pci_segment: 3 + - pci_segment: 7 path: path num_queues: 3 iommu: false id: id numa: - distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 + guest_numa_id: 0 - distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 - tdx: - firmware: firmware + guest_numa_id: 0 rng: iommu: false src: /dev/urandom sgx_epc: - prefault: false - size: 7 + size: 6 id: id - prefault: false - size: 7 + size: 6 id: id fs: - pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id - pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id vsock: - pci_segment: 0 + pci_segment: 7 iommu: false socket: socket id: id @@ -615,22 +613,23 @@ components: iommu_segments: - 3 - 3 - num_pci_segments: 7 + num_pci_segments: 3 oem_strings: - oem_strings - oem_strings + tdx: false serial_number: serial_number uuid: uuid pmem: - - pci_segment: 5 + - pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false - - pci_segment: 5 + - pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false @@ -640,14 +639,16 @@ components: cmdline: cmdline kernel: kernel initramfs: initramfs + firmware: firmware serial: mode: "false" file: file iommu: false net: - tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -659,7 +660,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -667,8 +669,9 @@ components: id: id mask: 255.255.255.0 - tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -680,7 +683,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -769,7 +773,10 @@ components: cmdline: cmdline kernel: kernel initramfs: initramfs + firmware: firmware properties: + firmware: + type: string kernel: type: string cmdline: @@ -785,7 +792,7 @@ components: file: file iommu: false balloon: - size: 6 + size: 1 deflate_on_oom: false free_page_reporting: false memory: @@ -882,83 +889,81 @@ components: - 3 - 3 devices: - - pci_segment: 6 + - pci_segment: 3 path: path iommu: false id: id - - pci_segment: 6 + - pci_segment: 3 path: path iommu: false id: id vdpa: - - pci_segment: 3 + - pci_segment: 7 path: path num_queues: 3 iommu: false id: id - - pci_segment: 3 + - pci_segment: 7 path: path num_queues: 3 iommu: false id: id numa: - distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 + guest_numa_id: 0 - distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 - tdx: - firmware: firmware + guest_numa_id: 0 rng: iommu: false src: /dev/urandom sgx_epc: - prefault: false - size: 7 + size: 6 id: id - prefault: false - size: 7 + size: 6 id: id fs: - pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id - pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id vsock: - pci_segment: 0 + pci_segment: 7 iommu: false socket: socket id: id @@ -967,22 +972,23 @@ components: iommu_segments: - 3 - 3 - num_pci_segments: 7 + num_pci_segments: 3 oem_strings: - oem_strings - oem_strings + tdx: false serial_number: serial_number uuid: uuid pmem: - - pci_segment: 5 + - pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false - - pci_segment: 5 + - pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false @@ -992,14 +998,16 @@ components: cmdline: cmdline kernel: kernel initramfs: initramfs + firmware: firmware serial: mode: "false" file: file iommu: false net: - tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -1011,7 +1019,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -1019,8 +1028,9 @@ components: id: id mask: 255.255.255.0 - tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -1032,7 +1042,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -1084,8 +1095,6 @@ components: items: $ref: '#/components/schemas/SgxEpcConfig' type: array - tdx: - $ref: '#/components/schemas/TdxConfig' numa: items: $ref: '#/components/schemas/NumaConfig' @@ -1191,10 +1200,11 @@ components: iommu_segments: - 3 - 3 - num_pci_segments: 7 + num_pci_segments: 3 oem_strings: - oem_strings - oem_strings + tdx: false serial_number: serial_number uuid: uuid properties: @@ -1214,6 +1224,9 @@ components: items: type: string type: array + tdx: + default: false + type: boolean type: object MemoryZoneConfig: example: @@ -1442,8 +1455,9 @@ components: NetConfig: example: tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -1455,7 +1469,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -1473,6 +1488,10 @@ components: type: string mac: type: string + host_mac: + type: string + mtu: + type: integer iommu: default: false type: boolean @@ -1514,7 +1533,7 @@ components: type: object BalloonConfig: example: - size: 6 + size: 1 deflate_on_oom: false free_page_reporting: false properties: @@ -1535,8 +1554,8 @@ components: FsConfig: example: pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id @@ -1564,9 +1583,9 @@ components: type: object PmemConfig: example: - pci_segment: 5 + pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false @@ -1614,7 +1633,7 @@ components: type: object DeviceConfig: example: - pci_segment: 6 + pci_segment: 3 path: path iommu: false id: id @@ -1634,7 +1653,7 @@ components: type: object VdpaConfig: example: - pci_segment: 3 + pci_segment: 7 path: path num_queues: 3 iommu: false @@ -1659,7 +1678,7 @@ components: type: object VsockConfig: example: - pci_segment: 0 + pci_segment: 7 iommu: false socket: socket id: id @@ -1688,7 +1707,7 @@ components: SgxEpcConfig: example: prefault: false - size: 7 + size: 6 id: id properties: id: @@ -1703,21 +1722,10 @@ components: - id - size type: object - TdxConfig: - example: - firmware: firmware - properties: - firmware: - description: Path to the firmware that will be used to boot the TDx guest - up. - type: string - required: - - firmware - type: object NumaDistance: example: - distance: 8 - destination: 4 + distance: 7 + destination: 8 properties: destination: format: int32 @@ -1732,20 +1740,20 @@ components: NumaConfig: example: distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 + guest_numa_id: 0 properties: guest_numa_id: format: int32 diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md index 073401d19..f3af12647 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md @@ -8,6 +8,8 @@ Name | Type | Description | Notes **Ip** | Pointer to **string** | | [optional] [default to "192.168.249.1"] **Mask** | Pointer to **string** | | [optional] [default to "255.255.255.0"] **Mac** | Pointer to **string** | | [optional] +**HostMac** | Pointer to **string** | | [optional] +**Mtu** | Pointer to **int32** | | [optional] **Iommu** | Pointer to **bool** | | [optional] [default to false] **NumQueues** | Pointer to **int32** | | [optional] [default to 2] **QueueSize** | Pointer to **int32** | | [optional] [default to 256] @@ -137,6 +139,56 @@ SetMac sets Mac field to given value. HasMac returns a boolean if a field has been set. +### GetHostMac + +`func (o *NetConfig) GetHostMac() string` + +GetHostMac returns the HostMac field if non-nil, zero value otherwise. + +### GetHostMacOk + +`func (o *NetConfig) GetHostMacOk() (*string, bool)` + +GetHostMacOk returns a tuple with the HostMac field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHostMac + +`func (o *NetConfig) SetHostMac(v string)` + +SetHostMac sets HostMac field to given value. + +### HasHostMac + +`func (o *NetConfig) HasHostMac() bool` + +HasHostMac returns a boolean if a field has been set. + +### GetMtu + +`func (o *NetConfig) GetMtu() int32` + +GetMtu returns the Mtu field if non-nil, zero value otherwise. + +### GetMtuOk + +`func (o *NetConfig) GetMtuOk() (*int32, bool)` + +GetMtuOk returns a tuple with the Mtu field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMtu + +`func (o *NetConfig) SetMtu(v int32)` + +SetMtu sets Mtu field to given value. + +### HasMtu + +`func (o *NetConfig) HasMtu() bool` + +HasMtu returns a boolean if a field has been set. + ### GetIommu `func (o *NetConfig) GetIommu() bool` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PayloadConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PayloadConfig.md index 8985796ea..096584a8f 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PayloadConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PayloadConfig.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Firmware** | Pointer to **string** | | [optional] **Kernel** | Pointer to **string** | | [optional] **Cmdline** | Pointer to **string** | | [optional] **Initramfs** | Pointer to **string** | | [optional] @@ -27,6 +28,31 @@ NewPayloadConfigWithDefaults instantiates a new PayloadConfig object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set +### GetFirmware + +`func (o *PayloadConfig) GetFirmware() string` + +GetFirmware returns the Firmware field if non-nil, zero value otherwise. + +### GetFirmwareOk + +`func (o *PayloadConfig) GetFirmwareOk() (*string, bool)` + +GetFirmwareOk returns a tuple with the Firmware field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFirmware + +`func (o *PayloadConfig) SetFirmware(v string)` + +SetFirmware sets Firmware field to given value. + +### HasFirmware + +`func (o *PayloadConfig) HasFirmware() bool` + +HasFirmware returns a boolean if a field has been set. + ### GetKernel `func (o *PayloadConfig) GetKernel() string` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PlatformConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PlatformConfig.md index eacec0d02..d8772c5e0 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PlatformConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PlatformConfig.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **SerialNumber** | Pointer to **string** | | [optional] **Uuid** | Pointer to **string** | | [optional] **OemStrings** | Pointer to **[]string** | | [optional] +**Tdx** | Pointer to **bool** | | [optional] [default to false] ## Methods @@ -154,6 +155,31 @@ SetOemStrings sets OemStrings field to given value. HasOemStrings returns a boolean if a field has been set. +### GetTdx + +`func (o *PlatformConfig) GetTdx() bool` + +GetTdx returns the Tdx field if non-nil, zero value otherwise. + +### GetTdxOk + +`func (o *PlatformConfig) GetTdxOk() (*bool, bool)` + +GetTdxOk returns a tuple with the Tdx field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTdx + +`func (o *PlatformConfig) SetTdx(v bool)` + +SetTdx sets Tdx field to given value. + +### HasTdx + +`func (o *PlatformConfig) HasTdx() bool` + +HasTdx returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TdxConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TdxConfig.md deleted file mode 100644 index 8577bcf5b..000000000 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TdxConfig.md +++ /dev/null @@ -1,51 +0,0 @@ -# TdxConfig - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Firmware** | **string** | Path to the firmware that will be used to boot the TDx guest up. | - -## Methods - -### NewTdxConfig - -`func NewTdxConfig(firmware string, ) *TdxConfig` - -NewTdxConfig instantiates a new TdxConfig object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewTdxConfigWithDefaults - -`func NewTdxConfigWithDefaults() *TdxConfig` - -NewTdxConfigWithDefaults instantiates a new TdxConfig object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetFirmware - -`func (o *TdxConfig) GetFirmware() string` - -GetFirmware returns the Firmware field if non-nil, zero value otherwise. - -### GetFirmwareOk - -`func (o *TdxConfig) GetFirmwareOk() (*string, bool)` - -GetFirmwareOk returns a tuple with the Firmware field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetFirmware - -`func (o *TdxConfig) SetFirmware(v string)` - -SetFirmware sets Firmware field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md index 717749be6..9e0363df9 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md @@ -19,7 +19,6 @@ Name | Type | Description | Notes **Vdpa** | Pointer to [**[]VdpaConfig**](VdpaConfig.md) | | [optional] **Vsock** | Pointer to [**VsockConfig**](VsockConfig.md) | | [optional] **SgxEpc** | Pointer to [**[]SgxEpcConfig**](SgxEpcConfig.md) | | [optional] -**Tdx** | Pointer to [**TdxConfig**](TdxConfig.md) | | [optional] **Numa** | Pointer to [**[]NumaConfig**](NumaConfig.md) | | [optional] **Iommu** | Pointer to **bool** | | [optional] [default to false] **Watchdog** | Pointer to **bool** | | [optional] [default to false] @@ -414,31 +413,6 @@ SetSgxEpc sets SgxEpc field to given value. HasSgxEpc returns a boolean if a field has been set. -### GetTdx - -`func (o *VmConfig) GetTdx() TdxConfig` - -GetTdx returns the Tdx field if non-nil, zero value otherwise. - -### GetTdxOk - -`func (o *VmConfig) GetTdxOk() (*TdxConfig, bool)` - -GetTdxOk returns a tuple with the Tdx field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetTdx - -`func (o *VmConfig) SetTdx(v TdxConfig)` - -SetTdx sets Tdx field to given value. - -### HasTdx - -`func (o *VmConfig) HasTdx() bool` - -HasTdx returns a boolean if a field has been set. - ### GetNuma `func (o *VmConfig) GetNuma() []NumaConfig` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go index 976d8cd33..8f6d30ff3 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go @@ -20,6 +20,8 @@ type NetConfig struct { Ip *string `json:"ip,omitempty"` Mask *string `json:"mask,omitempty"` Mac *string `json:"mac,omitempty"` + HostMac *string `json:"host_mac,omitempty"` + Mtu *int32 `json:"mtu,omitempty"` Iommu *bool `json:"iommu,omitempty"` NumQueues *int32 `json:"num_queues,omitempty"` QueueSize *int32 `json:"queue_size,omitempty"` @@ -204,6 +206,70 @@ func (o *NetConfig) SetMac(v string) { o.Mac = &v } +// GetHostMac returns the HostMac field value if set, zero value otherwise. +func (o *NetConfig) GetHostMac() string { + if o == nil || o.HostMac == nil { + var ret string + return ret + } + return *o.HostMac +} + +// GetHostMacOk returns a tuple with the HostMac field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetConfig) GetHostMacOk() (*string, bool) { + if o == nil || o.HostMac == nil { + return nil, false + } + return o.HostMac, true +} + +// HasHostMac returns a boolean if a field has been set. +func (o *NetConfig) HasHostMac() bool { + if o != nil && o.HostMac != nil { + return true + } + + return false +} + +// SetHostMac gets a reference to the given string and assigns it to the HostMac field. +func (o *NetConfig) SetHostMac(v string) { + o.HostMac = &v +} + +// GetMtu returns the Mtu field value if set, zero value otherwise. +func (o *NetConfig) GetMtu() int32 { + if o == nil || o.Mtu == nil { + var ret int32 + return ret + } + return *o.Mtu +} + +// GetMtuOk returns a tuple with the Mtu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetConfig) GetMtuOk() (*int32, bool) { + if o == nil || o.Mtu == nil { + return nil, false + } + return o.Mtu, true +} + +// HasMtu returns a boolean if a field has been set. +func (o *NetConfig) HasMtu() bool { + if o != nil && o.Mtu != nil { + return true + } + + return false +} + +// SetMtu gets a reference to the given int32 and assigns it to the Mtu field. +func (o *NetConfig) SetMtu(v int32) { + o.Mtu = &v +} + // GetIommu returns the Iommu field value if set, zero value otherwise. func (o *NetConfig) GetIommu() bool { if o == nil || o.Iommu == nil { @@ -506,6 +572,12 @@ func (o NetConfig) MarshalJSON() ([]byte, error) { if o.Mac != nil { toSerialize["mac"] = o.Mac } + if o.HostMac != nil { + toSerialize["host_mac"] = o.HostMac + } + if o.Mtu != nil { + toSerialize["mtu"] = o.Mtu + } if o.Iommu != nil { toSerialize["iommu"] = o.Iommu } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_payload_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_payload_config.go index 04abb6a3e..5029c92d9 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_payload_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_payload_config.go @@ -16,6 +16,7 @@ import ( // PayloadConfig Payloads to boot in guest type PayloadConfig struct { + Firmware *string `json:"firmware,omitempty"` Kernel *string `json:"kernel,omitempty"` Cmdline *string `json:"cmdline,omitempty"` Initramfs *string `json:"initramfs,omitempty"` @@ -38,6 +39,38 @@ func NewPayloadConfigWithDefaults() *PayloadConfig { return &this } +// GetFirmware returns the Firmware field value if set, zero value otherwise. +func (o *PayloadConfig) GetFirmware() string { + if o == nil || o.Firmware == nil { + var ret string + return ret + } + return *o.Firmware +} + +// GetFirmwareOk returns a tuple with the Firmware field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PayloadConfig) GetFirmwareOk() (*string, bool) { + if o == nil || o.Firmware == nil { + return nil, false + } + return o.Firmware, true +} + +// HasFirmware returns a boolean if a field has been set. +func (o *PayloadConfig) HasFirmware() bool { + if o != nil && o.Firmware != nil { + return true + } + + return false +} + +// SetFirmware gets a reference to the given string and assigns it to the Firmware field. +func (o *PayloadConfig) SetFirmware(v string) { + o.Firmware = &v +} + // GetKernel returns the Kernel field value if set, zero value otherwise. func (o *PayloadConfig) GetKernel() string { if o == nil || o.Kernel == nil { @@ -136,6 +169,9 @@ func (o *PayloadConfig) SetInitramfs(v string) { func (o PayloadConfig) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} + if o.Firmware != nil { + toSerialize["firmware"] = o.Firmware + } if o.Kernel != nil { toSerialize["kernel"] = o.Kernel } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_platform_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_platform_config.go index 250493a6b..3072f0bd3 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_platform_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_platform_config.go @@ -21,6 +21,7 @@ type PlatformConfig struct { SerialNumber *string `json:"serial_number,omitempty"` Uuid *string `json:"uuid,omitempty"` OemStrings *[]string `json:"oem_strings,omitempty"` + Tdx *bool `json:"tdx,omitempty"` } // NewPlatformConfig instantiates a new PlatformConfig object @@ -29,6 +30,8 @@ type PlatformConfig struct { // will change when the set of required properties is changed func NewPlatformConfig() *PlatformConfig { this := PlatformConfig{} + var tdx bool = false + this.Tdx = &tdx return &this } @@ -37,6 +40,8 @@ func NewPlatformConfig() *PlatformConfig { // but it doesn't guarantee that properties required by API are set func NewPlatformConfigWithDefaults() *PlatformConfig { this := PlatformConfig{} + var tdx bool = false + this.Tdx = &tdx return &this } @@ -200,6 +205,38 @@ func (o *PlatformConfig) SetOemStrings(v []string) { o.OemStrings = &v } +// GetTdx returns the Tdx field value if set, zero value otherwise. +func (o *PlatformConfig) GetTdx() bool { + if o == nil || o.Tdx == nil { + var ret bool + return ret + } + return *o.Tdx +} + +// GetTdxOk returns a tuple with the Tdx field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlatformConfig) GetTdxOk() (*bool, bool) { + if o == nil || o.Tdx == nil { + return nil, false + } + return o.Tdx, true +} + +// HasTdx returns a boolean if a field has been set. +func (o *PlatformConfig) HasTdx() bool { + if o != nil && o.Tdx != nil { + return true + } + + return false +} + +// SetTdx gets a reference to the given bool and assigns it to the Tdx field. +func (o *PlatformConfig) SetTdx(v bool) { + o.Tdx = &v +} + func (o PlatformConfig) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.NumPciSegments != nil { @@ -217,6 +254,9 @@ func (o PlatformConfig) MarshalJSON() ([]byte, error) { if o.OemStrings != nil { toSerialize["oem_strings"] = o.OemStrings } + if o.Tdx != nil { + toSerialize["tdx"] = o.Tdx + } return json.Marshal(toSerialize) } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tdx_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tdx_config.go deleted file mode 100644 index 3fe9057da..000000000 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tdx_config.go +++ /dev/null @@ -1,107 +0,0 @@ -/* -Cloud Hypervisor API - -Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. - -API version: 0.3.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "encoding/json" -) - -// TdxConfig struct for TdxConfig -type TdxConfig struct { - // Path to the firmware that will be used to boot the TDx guest up. - Firmware string `json:"firmware"` -} - -// NewTdxConfig instantiates a new TdxConfig object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewTdxConfig(firmware string) *TdxConfig { - this := TdxConfig{} - this.Firmware = firmware - return &this -} - -// NewTdxConfigWithDefaults instantiates a new TdxConfig object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewTdxConfigWithDefaults() *TdxConfig { - this := TdxConfig{} - return &this -} - -// GetFirmware returns the Firmware field value -func (o *TdxConfig) GetFirmware() string { - if o == nil { - var ret string - return ret - } - - return o.Firmware -} - -// GetFirmwareOk returns a tuple with the Firmware field value -// and a boolean to check if the value has been set. -func (o *TdxConfig) GetFirmwareOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Firmware, true -} - -// SetFirmware sets field value -func (o *TdxConfig) SetFirmware(v string) { - o.Firmware = v -} - -func (o TdxConfig) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["firmware"] = o.Firmware - } - return json.Marshal(toSerialize) -} - -type NullableTdxConfig struct { - value *TdxConfig - isSet bool -} - -func (v NullableTdxConfig) Get() *TdxConfig { - return v.value -} - -func (v *NullableTdxConfig) Set(val *TdxConfig) { - v.value = val - v.isSet = true -} - -func (v NullableTdxConfig) IsSet() bool { - return v.isSet -} - -func (v *NullableTdxConfig) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTdxConfig(val *TdxConfig) *NullableTdxConfig { - return &NullableTdxConfig{value: val, isSet: true} -} - -func (v NullableTdxConfig) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTdxConfig) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go index f48f92b3c..c8fafc6a4 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go @@ -31,7 +31,6 @@ type VmConfig struct { Vdpa *[]VdpaConfig `json:"vdpa,omitempty"` Vsock *VsockConfig `json:"vsock,omitempty"` SgxEpc *[]SgxEpcConfig `json:"sgx_epc,omitempty"` - Tdx *TdxConfig `json:"tdx,omitempty"` Numa *[]NumaConfig `json:"numa,omitempty"` Iommu *bool `json:"iommu,omitempty"` Watchdog *bool `json:"watchdog,omitempty"` @@ -536,38 +535,6 @@ func (o *VmConfig) SetSgxEpc(v []SgxEpcConfig) { o.SgxEpc = &v } -// GetTdx returns the Tdx field value if set, zero value otherwise. -func (o *VmConfig) GetTdx() TdxConfig { - if o == nil || o.Tdx == nil { - var ret TdxConfig - return ret - } - return *o.Tdx -} - -// GetTdxOk returns a tuple with the Tdx field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *VmConfig) GetTdxOk() (*TdxConfig, bool) { - if o == nil || o.Tdx == nil { - return nil, false - } - return o.Tdx, true -} - -// HasTdx returns a boolean if a field has been set. -func (o *VmConfig) HasTdx() bool { - if o != nil && o.Tdx != nil { - return true - } - - return false -} - -// SetTdx gets a reference to the given TdxConfig and assigns it to the Tdx field. -func (o *VmConfig) SetTdx(v TdxConfig) { - o.Tdx = &v -} - // GetNuma returns the Numa field value if set, zero value otherwise. func (o *VmConfig) GetNuma() []NumaConfig { if o == nil || o.Numa == nil { @@ -743,9 +710,6 @@ func (o VmConfig) MarshalJSON() ([]byte, error) { if o.SgxEpc != nil { toSerialize["sgx_epc"] = o.SgxEpc } - if o.Tdx != nil { - toSerialize["tdx"] = o.Tdx - } if o.Numa != nil { toSerialize["numa"] = o.Numa } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index 029b4cf08..c793ce3ed 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -502,6 +502,8 @@ components: PayloadConfig: type: object properties: + firmware: + type: string kernel: type: string cmdline: @@ -559,8 +561,6 @@ components: type: array items: $ref: "#/components/schemas/SgxEpcConfig" - tdx: - $ref: "#/components/schemas/TdxConfig" numa: type: array items: @@ -650,6 +650,9 @@ components: type: array items: type: string + tdx: + type: boolean + default: false MemoryZoneConfig: required: @@ -818,6 +821,10 @@ components: default: "255.255.255.0" mac: type: string + host_mac: + type: string + mtu: + type: integer iommu: type: boolean default: false @@ -1006,15 +1013,6 @@ components: type: boolean default: false - TdxConfig: - required: - - firmware - type: object - properties: - firmware: - type: string - description: Path to the firmware that will be used to boot the TDx guest up. - NumaDistance: required: - destination From 9a0ab92f650805e467f600f389583378efab591c Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Fri, 30 Sep 2022 14:12:38 -0700 Subject: [PATCH 03/10] runtime: clh: Use the new API to boot with TDX firmware (td-shim) The new way to boot from TDX firmware (e.g. td-shim) is using the combination of '--platform tdx=on' with '--firmware tdshim'. Fixes: #5309 Signed-off-by: Bo Chen (cherry picked from commit 067e2b1e33b34b6bd0a55246f8f3db36dce3b3f2) --- src/runtime/virtcontainers/clh.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index d690ed350..56e04c9dd 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -415,7 +415,13 @@ func (clh *cloudHypervisor) enableProtection() error { return errors.New("Firmware path is not specified") } - clh.vmconfig.Tdx = chclient.NewTdxConfig(firmwarePath) + clh.vmconfig.Payload.SetFirmware(firmwarePath) + + if clh.vmconfig.Platform == nil { + clh.vmconfig.Platform = chclient.NewPlatformConfig() + } + clh.vmconfig.Platform.SetTdx(true) + return nil case sevProtection: From 9141acd94ce9ab29c56c6883b720cbb432638e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 21 Oct 2022 11:20:32 -0700 Subject: [PATCH 04/10] versions: Update Cloud Hypervisor to b4e39427080 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An API change, done a long time ago, has been exposed on Cloud Hypervisor and we should update it on the Kata Containers side to ensure it doesn't affect Cloud Hypervisor CI and because the change is needed for an upcoming work to get QAT working with Cloud Hypervisor. Fixes: #5492 Signed-off-by: Fabiano FidĂȘncio (cherry picked from commit 9d286af7b4543b0af9e6db53c6c84e0731f61c09) --- src/runtime/virtcontainers/clh.go | 9 +- src/runtime/virtcontainers/clh_test.go | 2 +- .../client/.openapi-generator/FILES | 2 - .../pkg/cloud-hypervisor/client/README.md | 1 - .../cloud-hypervisor/client/api/openapi.yaml | 16 +- .../cloud-hypervisor/client/api_default.go | 154 +++++++------- .../client/docs/DefaultApi.md | 8 +- .../client/docs/VmAddDevice.md | 108 ---------- .../client/model_vm_add_device.go | 189 ------------------ .../cloud-hypervisor/cloud-hypervisor.yaml | 13 +- versions.yaml | 2 +- 11 files changed, 84 insertions(+), 420 deletions(-) delete mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md delete mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index 56e04c9dd..e954104c5 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -100,7 +100,7 @@ type clhClient interface { // Add/remove CPUs to/from the VM VmResizePut(ctx context.Context, vmResize chclient.VmResize) (*http.Response, error) // Add VFIO PCI device to the VM - VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (chclient.PciDeviceInfo, *http.Response, error) + VmAddDevicePut(ctx context.Context, deviceConfig chclient.DeviceConfig) (chclient.PciDeviceInfo, *http.Response, error) // Add a new disk device to the VM VmAddDiskPut(ctx context.Context, diskConfig chclient.DiskConfig) (chclient.PciDeviceInfo, *http.Response, error) // Remove a device from the VM @@ -136,8 +136,8 @@ func (c *clhClientApi) VmResizePut(ctx context.Context, vmResize chclient.VmResi return c.ApiInternal.VmResizePut(ctx).VmResize(vmResize).Execute() } -func (c *clhClientApi) VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (chclient.PciDeviceInfo, *http.Response, error) { - return c.ApiInternal.VmAddDevicePut(ctx).VmAddDevice(vmAddDevice).Execute() +func (c *clhClientApi) VmAddDevicePut(ctx context.Context, deviceConfig chclient.DeviceConfig) (chclient.PciDeviceInfo, *http.Response, error) { + return c.ApiInternal.VmAddDevicePut(ctx).DeviceConfig(deviceConfig).Execute() } func (c *clhClientApi) VmAddDiskPut(ctx context.Context, diskConfig chclient.DiskConfig) (chclient.PciDeviceInfo, *http.Response, error) { @@ -804,8 +804,7 @@ func (clh *cloudHypervisor) hotPlugVFIODevice(device *config.VFIODev) error { defer cancel() // Create the clh device config via the constructor to ensure default values are properly assigned - clhDevice := *chclient.NewVmAddDevice() - clhDevice.Path = &device.SysfsDev + clhDevice := *chclient.NewDeviceConfig(device.SysfsDev) pciInfo, _, err := cl.VmAddDevicePut(ctx, clhDevice) if err != nil { return fmt.Errorf("Failed to hotplug device %+v %s", device, openAPIClientError(err)) diff --git a/src/runtime/virtcontainers/clh_test.go b/src/runtime/virtcontainers/clh_test.go index 1a30d515e..e8f02101e 100644 --- a/src/runtime/virtcontainers/clh_test.go +++ b/src/runtime/virtcontainers/clh_test.go @@ -103,7 +103,7 @@ func (c *clhClientMock) VmResizePut(ctx context.Context, vmResize chclient.VmRes } //nolint:golint -func (c *clhClientMock) VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (chclient.PciDeviceInfo, *http.Response, error) { +func (c *clhClientMock) VmAddDevicePut(ctx context.Context, deviceConfig chclient.DeviceConfig) (chclient.PciDeviceInfo, *http.Response, error) { return chclient.PciDeviceInfo{}, nil, nil } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES index 60eb88720..6369a3a41 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES @@ -34,7 +34,6 @@ docs/SendMigrationData.md docs/SgxEpcConfig.md docs/TokenBucket.md docs/VdpaConfig.md -docs/VmAddDevice.md docs/VmConfig.md docs/VmCoredumpData.md docs/VmInfo.md @@ -74,7 +73,6 @@ model_send_migration_data.go model_sgx_epc_config.go model_token_bucket.go model_vdpa_config.go -model_vm_add_device.go model_vm_config.go model_vm_coredump_data.go model_vm_info.go diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md index 04b5c9f0c..a33f74c7e 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -136,7 +136,6 @@ Class | Method | HTTP request | Description - [SgxEpcConfig](docs/SgxEpcConfig.md) - [TokenBucket](docs/TokenBucket.md) - [VdpaConfig](docs/VdpaConfig.md) - - [VmAddDevice](docs/VmAddDevice.md) - [VmConfig](docs/VmConfig.md) - [VmCoredumpData](docs/VmCoredumpData.md) - [VmInfo](docs/VmInfo.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml index fbffa9053..61e57e372 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -171,7 +171,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/VmAddDevice' + $ref: '#/components/schemas/DeviceConfig' description: The path of the new device required: true responses: @@ -1808,20 +1808,6 @@ components: format: int64 type: integer type: object - VmAddDevice: - example: - path: path - iommu: false - id: id - properties: - path: - type: string - iommu: - default: false - type: boolean - id: - type: string - type: object VmRemoveDevice: example: id: id diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go index cf97c19dd..cb9b99d66 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go @@ -38,8 +38,8 @@ func (r ApiBootVMRequest) Execute() (*_nethttp.Response, error) { /* BootVM Boot the previously created VM instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiBootVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiBootVMRequest */ func (a *DefaultApiService) BootVM(ctx _context.Context) ApiBootVMRequest { return ApiBootVMRequest{ @@ -133,8 +133,8 @@ func (r ApiCreateVMRequest) Execute() (*_nethttp.Response, error) { /* CreateVM Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreateVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateVMRequest */ func (a *DefaultApiService) CreateVM(ctx _context.Context) ApiCreateVMRequest { return ApiCreateVMRequest{ @@ -226,8 +226,8 @@ func (r ApiDeleteVMRequest) Execute() (*_nethttp.Response, error) { /* DeleteVM Delete the cloud-hypervisor Virtual Machine (VM) instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiDeleteVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDeleteVMRequest */ func (a *DefaultApiService) DeleteVM(ctx _context.Context) ApiDeleteVMRequest { return ApiDeleteVMRequest{ @@ -314,8 +314,8 @@ func (r ApiPauseVMRequest) Execute() (*_nethttp.Response, error) { /* PauseVM Pause a previously booted VM instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiPauseVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiPauseVMRequest */ func (a *DefaultApiService) PauseVM(ctx _context.Context) ApiPauseVMRequest { return ApiPauseVMRequest{ @@ -402,8 +402,8 @@ func (r ApiPowerButtonVMRequest) Execute() (*_nethttp.Response, error) { /* PowerButtonVM Trigger a power button in the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiPowerButtonVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiPowerButtonVMRequest */ func (a *DefaultApiService) PowerButtonVM(ctx _context.Context) ApiPowerButtonVMRequest { return ApiPowerButtonVMRequest{ @@ -490,8 +490,8 @@ func (r ApiRebootVMRequest) Execute() (*_nethttp.Response, error) { /* RebootVM Reboot the VM instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiRebootVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRebootVMRequest */ func (a *DefaultApiService) RebootVM(ctx _context.Context) ApiRebootVMRequest { return ApiRebootVMRequest{ @@ -578,8 +578,8 @@ func (r ApiResumeVMRequest) Execute() (*_nethttp.Response, error) { /* ResumeVM Resume a previously paused VM instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiResumeVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiResumeVMRequest */ func (a *DefaultApiService) ResumeVM(ctx _context.Context) ApiResumeVMRequest { return ApiResumeVMRequest{ @@ -666,8 +666,8 @@ func (r ApiShutdownVMRequest) Execute() (*_nethttp.Response, error) { /* ShutdownVM Shut the VM instance down. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiShutdownVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiShutdownVMRequest */ func (a *DefaultApiService) ShutdownVM(ctx _context.Context) ApiShutdownVMRequest { return ApiShutdownVMRequest{ @@ -754,8 +754,8 @@ func (r ApiShutdownVMMRequest) Execute() (*_nethttp.Response, error) { /* ShutdownVMM Shuts the cloud-hypervisor VMM. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiShutdownVMMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiShutdownVMMRequest */ func (a *DefaultApiService) ShutdownVMM(ctx _context.Context) ApiShutdownVMMRequest { return ApiShutdownVMMRequest{ @@ -831,14 +831,14 @@ func (a *DefaultApiService) ShutdownVMMExecute(r ApiShutdownVMMRequest) (*_netht } type ApiVmAddDevicePutRequest struct { - ctx _context.Context - ApiService *DefaultApiService - vmAddDevice *VmAddDevice + ctx _context.Context + ApiService *DefaultApiService + deviceConfig *DeviceConfig } // The path of the new device -func (r ApiVmAddDevicePutRequest) VmAddDevice(vmAddDevice VmAddDevice) ApiVmAddDevicePutRequest { - r.vmAddDevice = &vmAddDevice +func (r ApiVmAddDevicePutRequest) DeviceConfig(deviceConfig DeviceConfig) ApiVmAddDevicePutRequest { + r.deviceConfig = &deviceConfig return r } @@ -849,8 +849,8 @@ func (r ApiVmAddDevicePutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, /* VmAddDevicePut Add a new device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddDevicePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddDevicePutRequest */ func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context) ApiVmAddDevicePutRequest { return ApiVmAddDevicePutRequest{ @@ -860,8 +860,7 @@ func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context) ApiVmAddDeviceP } // Execute executes the request -// -// @return PciDeviceInfo +// @return PciDeviceInfo func (a *DefaultApiService) VmAddDevicePutExecute(r ApiVmAddDevicePutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -882,8 +881,8 @@ func (a *DefaultApiService) VmAddDevicePutExecute(r ApiVmAddDevicePutRequest) (P localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if r.vmAddDevice == nil { - return localVarReturnValue, nil, reportError("vmAddDevice is required and must be specified") + if r.deviceConfig == nil { + return localVarReturnValue, nil, reportError("deviceConfig is required and must be specified") } // to determine the Content-Type header @@ -904,7 +903,7 @@ func (a *DefaultApiService) VmAddDevicePutExecute(r ApiVmAddDevicePutRequest) (P localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.vmAddDevice + localVarPostBody = r.deviceConfig req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err @@ -961,8 +960,8 @@ func (r ApiVmAddDiskPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, er /* VmAddDiskPut Add a new disk to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddDiskPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddDiskPutRequest */ func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context) ApiVmAddDiskPutRequest { return ApiVmAddDiskPutRequest{ @@ -972,8 +971,7 @@ func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context) ApiVmAddDiskPutRe } // Execute executes the request -// -// @return PciDeviceInfo +// @return PciDeviceInfo func (a *DefaultApiService) VmAddDiskPutExecute(r ApiVmAddDiskPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1073,8 +1071,8 @@ func (r ApiVmAddFsPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, erro /* VmAddFsPut Add a new virtio-fs device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddFsPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddFsPutRequest */ func (a *DefaultApiService) VmAddFsPut(ctx _context.Context) ApiVmAddFsPutRequest { return ApiVmAddFsPutRequest{ @@ -1084,8 +1082,7 @@ func (a *DefaultApiService) VmAddFsPut(ctx _context.Context) ApiVmAddFsPutReques } // Execute executes the request -// -// @return PciDeviceInfo +// @return PciDeviceInfo func (a *DefaultApiService) VmAddFsPutExecute(r ApiVmAddFsPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1185,8 +1182,8 @@ func (r ApiVmAddNetPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, err /* VmAddNetPut Add a new network device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddNetPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddNetPutRequest */ func (a *DefaultApiService) VmAddNetPut(ctx _context.Context) ApiVmAddNetPutRequest { return ApiVmAddNetPutRequest{ @@ -1196,8 +1193,7 @@ func (a *DefaultApiService) VmAddNetPut(ctx _context.Context) ApiVmAddNetPutRequ } // Execute executes the request -// -// @return PciDeviceInfo +// @return PciDeviceInfo func (a *DefaultApiService) VmAddNetPutExecute(r ApiVmAddNetPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1297,8 +1293,8 @@ func (r ApiVmAddPmemPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, er /* VmAddPmemPut Add a new pmem device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddPmemPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddPmemPutRequest */ func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context) ApiVmAddPmemPutRequest { return ApiVmAddPmemPutRequest{ @@ -1308,8 +1304,7 @@ func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context) ApiVmAddPmemPutRe } // Execute executes the request -// -// @return PciDeviceInfo +// @return PciDeviceInfo func (a *DefaultApiService) VmAddPmemPutExecute(r ApiVmAddPmemPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1409,8 +1404,8 @@ func (r ApiVmAddVdpaPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, er /* VmAddVdpaPut Add a new vDPA device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddVdpaPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddVdpaPutRequest */ func (a *DefaultApiService) VmAddVdpaPut(ctx _context.Context) ApiVmAddVdpaPutRequest { return ApiVmAddVdpaPutRequest{ @@ -1420,8 +1415,7 @@ func (a *DefaultApiService) VmAddVdpaPut(ctx _context.Context) ApiVmAddVdpaPutRe } // Execute executes the request -// -// @return PciDeviceInfo +// @return PciDeviceInfo func (a *DefaultApiService) VmAddVdpaPutExecute(r ApiVmAddVdpaPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1521,8 +1515,8 @@ func (r ApiVmAddVsockPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, e /* VmAddVsockPut Add a new vsock device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddVsockPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddVsockPutRequest */ func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context) ApiVmAddVsockPutRequest { return ApiVmAddVsockPutRequest{ @@ -1532,8 +1526,7 @@ func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context) ApiVmAddVsockPut } // Execute executes the request -// -// @return PciDeviceInfo +// @return PciDeviceInfo func (a *DefaultApiService) VmAddVsockPutExecute(r ApiVmAddVsockPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1633,8 +1626,8 @@ func (r ApiVmCoredumpPutRequest) Execute() (*_nethttp.Response, error) { /* VmCoredumpPut Takes a VM coredump. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmCoredumpPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmCoredumpPutRequest */ func (a *DefaultApiService) VmCoredumpPut(ctx _context.Context) ApiVmCoredumpPutRequest { return ApiVmCoredumpPutRequest{ @@ -1726,8 +1719,8 @@ func (r ApiVmCountersGetRequest) Execute() (map[string]map[string]int64, *_netht /* VmCountersGet Get counters from the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmCountersGetRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmCountersGetRequest */ func (a *DefaultApiService) VmCountersGet(ctx _context.Context) ApiVmCountersGetRequest { return ApiVmCountersGetRequest{ @@ -1737,8 +1730,7 @@ func (a *DefaultApiService) VmCountersGet(ctx _context.Context) ApiVmCountersGet } // Execute executes the request -// -// @return map[string]map[string]int64 +// @return map[string]map[string]int64 func (a *DefaultApiService) VmCountersGetExecute(r ApiVmCountersGetRequest) (map[string]map[string]int64, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1826,8 +1818,8 @@ func (r ApiVmInfoGetRequest) Execute() (VmInfo, *_nethttp.Response, error) { /* VmInfoGet Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmInfoGetRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmInfoGetRequest */ func (a *DefaultApiService) VmInfoGet(ctx _context.Context) ApiVmInfoGetRequest { return ApiVmInfoGetRequest{ @@ -1837,8 +1829,7 @@ func (a *DefaultApiService) VmInfoGet(ctx _context.Context) ApiVmInfoGetRequest } // Execute executes the request -// -// @return VmInfo +// @return VmInfo func (a *DefaultApiService) VmInfoGetExecute(r ApiVmInfoGetRequest) (VmInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1933,8 +1924,8 @@ func (r ApiVmReceiveMigrationPutRequest) Execute() (*_nethttp.Response, error) { /* VmReceiveMigrationPut Receive a VM migration from URL - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmReceiveMigrationPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmReceiveMigrationPutRequest */ func (a *DefaultApiService) VmReceiveMigrationPut(ctx _context.Context) ApiVmReceiveMigrationPutRequest { return ApiVmReceiveMigrationPutRequest{ @@ -2033,8 +2024,8 @@ func (r ApiVmRemoveDevicePutRequest) Execute() (*_nethttp.Response, error) { /* VmRemoveDevicePut Remove a device from the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmRemoveDevicePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmRemoveDevicePutRequest */ func (a *DefaultApiService) VmRemoveDevicePut(ctx _context.Context) ApiVmRemoveDevicePutRequest { return ApiVmRemoveDevicePutRequest{ @@ -2133,8 +2124,8 @@ func (r ApiVmResizePutRequest) Execute() (*_nethttp.Response, error) { /* VmResizePut Resize the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmResizePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmResizePutRequest */ func (a *DefaultApiService) VmResizePut(ctx _context.Context) ApiVmResizePutRequest { return ApiVmResizePutRequest{ @@ -2233,8 +2224,8 @@ func (r ApiVmResizeZonePutRequest) Execute() (*_nethttp.Response, error) { /* VmResizeZonePut Resize a memory zone - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmResizeZonePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmResizeZonePutRequest */ func (a *DefaultApiService) VmResizeZonePut(ctx _context.Context) ApiVmResizeZonePutRequest { return ApiVmResizeZonePutRequest{ @@ -2333,8 +2324,8 @@ func (r ApiVmRestorePutRequest) Execute() (*_nethttp.Response, error) { /* VmRestorePut Restore a VM from a snapshot. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmRestorePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmRestorePutRequest */ func (a *DefaultApiService) VmRestorePut(ctx _context.Context) ApiVmRestorePutRequest { return ApiVmRestorePutRequest{ @@ -2433,8 +2424,8 @@ func (r ApiVmSendMigrationPutRequest) Execute() (*_nethttp.Response, error) { /* VmSendMigrationPut Send a VM migration to URL - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmSendMigrationPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmSendMigrationPutRequest */ func (a *DefaultApiService) VmSendMigrationPut(ctx _context.Context) ApiVmSendMigrationPutRequest { return ApiVmSendMigrationPutRequest{ @@ -2533,8 +2524,8 @@ func (r ApiVmSnapshotPutRequest) Execute() (*_nethttp.Response, error) { /* VmSnapshotPut Returns a VM snapshot. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmSnapshotPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmSnapshotPutRequest */ func (a *DefaultApiService) VmSnapshotPut(ctx _context.Context) ApiVmSnapshotPutRequest { return ApiVmSnapshotPutRequest{ @@ -2626,8 +2617,8 @@ func (r ApiVmmPingGetRequest) Execute() (VmmPingResponse, *_nethttp.Response, er /* VmmPingGet Ping the VMM to check for API server availability - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmmPingGetRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmmPingGetRequest */ func (a *DefaultApiService) VmmPingGet(ctx _context.Context) ApiVmmPingGetRequest { return ApiVmmPingGetRequest{ @@ -2637,8 +2628,7 @@ func (a *DefaultApiService) VmmPingGet(ctx _context.Context) ApiVmmPingGetReques } // Execute executes the request -// -// @return VmmPingResponse +// @return VmmPingResponse func (a *DefaultApiService) VmmPingGetExecute(r ApiVmmPingGetRequest) (VmmPingResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md index 1391a0b27..d61097719 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md @@ -554,7 +554,7 @@ No authorization required ## VmAddDevicePut -> PciDeviceInfo VmAddDevicePut(ctx).VmAddDevice(vmAddDevice).Execute() +> PciDeviceInfo VmAddDevicePut(ctx).DeviceConfig(deviceConfig).Execute() Add a new device to the VM @@ -571,11 +571,11 @@ import ( ) func main() { - vmAddDevice := *openapiclient.NewVmAddDevice() // VmAddDevice | The path of the new device + deviceConfig := *openapiclient.NewDeviceConfig("Path_example") // DeviceConfig | The path of the new device configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) - resp, r, err := api_client.DefaultApi.VmAddDevicePut(context.Background()).VmAddDevice(vmAddDevice).Execute() + resp, r, err := api_client.DefaultApi.VmAddDevicePut(context.Background()).DeviceConfig(deviceConfig).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.VmAddDevicePut``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -596,7 +596,7 @@ Other parameters are passed through a pointer to a apiVmAddDevicePutRequest stru Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **vmAddDevice** | [**VmAddDevice**](VmAddDevice.md) | The path of the new device | + **deviceConfig** | [**DeviceConfig**](DeviceConfig.md) | The path of the new device | ### Return type diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md deleted file mode 100644 index aaef7b32c..000000000 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md +++ /dev/null @@ -1,108 +0,0 @@ -# VmAddDevice - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Path** | Pointer to **string** | | [optional] -**Iommu** | Pointer to **bool** | | [optional] [default to false] -**Id** | Pointer to **string** | | [optional] - -## Methods - -### NewVmAddDevice - -`func NewVmAddDevice() *VmAddDevice` - -NewVmAddDevice instantiates a new VmAddDevice object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewVmAddDeviceWithDefaults - -`func NewVmAddDeviceWithDefaults() *VmAddDevice` - -NewVmAddDeviceWithDefaults instantiates a new VmAddDevice object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetPath - -`func (o *VmAddDevice) GetPath() string` - -GetPath returns the Path field if non-nil, zero value otherwise. - -### GetPathOk - -`func (o *VmAddDevice) GetPathOk() (*string, bool)` - -GetPathOk returns a tuple with the Path field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetPath - -`func (o *VmAddDevice) SetPath(v string)` - -SetPath sets Path field to given value. - -### HasPath - -`func (o *VmAddDevice) HasPath() bool` - -HasPath returns a boolean if a field has been set. - -### GetIommu - -`func (o *VmAddDevice) GetIommu() bool` - -GetIommu returns the Iommu field if non-nil, zero value otherwise. - -### GetIommuOk - -`func (o *VmAddDevice) GetIommuOk() (*bool, bool)` - -GetIommuOk returns a tuple with the Iommu field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetIommu - -`func (o *VmAddDevice) SetIommu(v bool)` - -SetIommu sets Iommu field to given value. - -### HasIommu - -`func (o *VmAddDevice) HasIommu() bool` - -HasIommu returns a boolean if a field has been set. - -### GetId - -`func (o *VmAddDevice) GetId() string` - -GetId returns the Id field if non-nil, zero value otherwise. - -### GetIdOk - -`func (o *VmAddDevice) GetIdOk() (*string, bool)` - -GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetId - -`func (o *VmAddDevice) SetId(v string)` - -SetId sets Id field to given value. - -### HasId - -`func (o *VmAddDevice) HasId() bool` - -HasId returns a boolean if a field has been set. - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go deleted file mode 100644 index acc3c177d..000000000 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go +++ /dev/null @@ -1,189 +0,0 @@ -/* -Cloud Hypervisor API - -Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. - -API version: 0.3.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "encoding/json" -) - -// VmAddDevice struct for VmAddDevice -type VmAddDevice struct { - Path *string `json:"path,omitempty"` - Iommu *bool `json:"iommu,omitempty"` - Id *string `json:"id,omitempty"` -} - -// NewVmAddDevice instantiates a new VmAddDevice object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewVmAddDevice() *VmAddDevice { - this := VmAddDevice{} - var iommu bool = false - this.Iommu = &iommu - return &this -} - -// NewVmAddDeviceWithDefaults instantiates a new VmAddDevice object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewVmAddDeviceWithDefaults() *VmAddDevice { - this := VmAddDevice{} - var iommu bool = false - this.Iommu = &iommu - return &this -} - -// GetPath returns the Path field value if set, zero value otherwise. -func (o *VmAddDevice) GetPath() string { - if o == nil || o.Path == nil { - var ret string - return ret - } - return *o.Path -} - -// GetPathOk returns a tuple with the Path field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *VmAddDevice) GetPathOk() (*string, bool) { - if o == nil || o.Path == nil { - return nil, false - } - return o.Path, true -} - -// HasPath returns a boolean if a field has been set. -func (o *VmAddDevice) HasPath() bool { - if o != nil && o.Path != nil { - return true - } - - return false -} - -// SetPath gets a reference to the given string and assigns it to the Path field. -func (o *VmAddDevice) SetPath(v string) { - o.Path = &v -} - -// GetIommu returns the Iommu field value if set, zero value otherwise. -func (o *VmAddDevice) GetIommu() bool { - if o == nil || o.Iommu == nil { - var ret bool - return ret - } - return *o.Iommu -} - -// GetIommuOk returns a tuple with the Iommu field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *VmAddDevice) GetIommuOk() (*bool, bool) { - if o == nil || o.Iommu == nil { - return nil, false - } - return o.Iommu, true -} - -// HasIommu returns a boolean if a field has been set. -func (o *VmAddDevice) HasIommu() bool { - if o != nil && o.Iommu != nil { - return true - } - - return false -} - -// SetIommu gets a reference to the given bool and assigns it to the Iommu field. -func (o *VmAddDevice) SetIommu(v bool) { - o.Iommu = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *VmAddDevice) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *VmAddDevice) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *VmAddDevice) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *VmAddDevice) SetId(v string) { - o.Id = &v -} - -func (o VmAddDevice) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Path != nil { - toSerialize["path"] = o.Path - } - if o.Iommu != nil { - toSerialize["iommu"] = o.Iommu - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - return json.Marshal(toSerialize) -} - -type NullableVmAddDevice struct { - value *VmAddDevice - isSet bool -} - -func (v NullableVmAddDevice) Get() *VmAddDevice { - return v.value -} - -func (v *NullableVmAddDevice) Set(val *VmAddDevice) { - v.value = val - v.isSet = true -} - -func (v NullableVmAddDevice) IsSet() bool { - return v.isSet -} - -func (v *NullableVmAddDevice) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableVmAddDevice(val *VmAddDevice) *NullableVmAddDevice { - return &NullableVmAddDevice{value: val, isSet: true} -} - -func (v NullableVmAddDevice) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableVmAddDevice) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index c793ce3ed..46d9aac83 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -185,7 +185,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/VmAddDevice" + $ref: "#/components/schemas/DeviceConfig" required: true responses: 200: @@ -1077,17 +1077,6 @@ components: type: integer format: int64 - VmAddDevice: - type: object - properties: - path: - type: string - iommu: - type: boolean - default: false - id: - type: string - VmRemoveDevice: type: object properties: diff --git a/versions.yaml b/versions.yaml index 2ae3988c5..3636267e8 100644 --- a/versions.yaml +++ b/versions.yaml @@ -75,7 +75,7 @@ assets: url: "https://github.com/cloud-hypervisor/cloud-hypervisor" uscan-url: >- https://github.com/cloud-hypervisor/cloud-hypervisor/tags.*/v?(\d\S+)\.tar\.gz - version: "2115a4156891804e5fc7bbd0d1831d2e92a0c50e" + version: "b4e39427080293c674b8db627ee6daf1f1b56806" firecracker: description: "Firecracker micro-VMM" From 8fbf862fa6b18646ee3ba8fee6e3a6aca9a575f4 Mon Sep 17 00:00:00 2001 From: Guanglu Guo Date: Thu, 3 Nov 2022 11:59:54 +0800 Subject: [PATCH 05/10] cloud-hypervisor: Fix GetThreadIDs function Get vcpu thread-ids by reading cloud-hypervisor process tasks information. Fixes: #5568 Signed-off-by: Guanglu Guo (cherry picked from commit daeee26a1e40afbd7065a62539d43a5684cf57f4) --- src/runtime/virtcontainers/clh.go | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index e954104c5..09f126790 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -21,6 +21,7 @@ import ( "os" "os/exec" "path/filepath" + "regexp" "strconv" "strings" "syscall" @@ -721,6 +722,55 @@ func (clh *cloudHypervisor) GetThreadIDs(ctx context.Context) (VcpuThreadIDs, er vcpuInfo.vcpus = make(map[int]int) + getVcpus := func(pid int) (map[int]int, error) { + vcpus := make(map[int]int) + + dir := fmt.Sprintf("/proc/%d/task", pid) + files, err := os.ReadDir(dir) + if err != nil { + return vcpus, err + } + + pattern, err := regexp.Compile(`^vcpu\d+$`) + if err != nil { + return vcpus, err + } + for _, file := range files { + comm, err := os.ReadFile(fmt.Sprintf("%s/%s/comm", dir, file.Name())) + if err != nil { + return vcpus, err + } + pName := strings.TrimSpace(string(comm)) + if !pattern.MatchString(pName) { + continue + } + + cpuID := strings.TrimPrefix(pName, "vcpu") + threadID := file.Name() + + k, err := strconv.Atoi(cpuID) + if err != nil { + return vcpus, err + } + v, err := strconv.Atoi(threadID) + if err != nil { + return vcpus, err + } + vcpus[k] = v + } + return vcpus, nil + } + + if clh.state.PID == 0 { + return vcpuInfo, nil + } + + vcpus, err := getVcpus(clh.state.PID) + if err != nil { + return vcpuInfo, err + } + vcpuInfo.vcpus = vcpus + return vcpuInfo, nil } From fa8a0ad49b1793ca57b8515e374351dc1bbcb3ae Mon Sep 17 00:00:00 2001 From: Alexandru Matei Date: Thu, 10 Nov 2022 14:06:13 +0200 Subject: [PATCH 06/10] clh: don't try to stop clh multiple times Avoid executing StopVM concurrently when virtiofs dies as a result of clh being stopped in StopVM. Fixes: #5622 Signed-off-by: Alexandru Matei (cherry picked from commit 2631b08ff109c433ea79bd8122e31cb0200ca483) --- src/runtime/virtcontainers/clh.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index 09f126790..9562cf5d8 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -24,6 +24,8 @@ import ( "regexp" "strconv" "strings" + "sync" + "sync/atomic" "syscall" "time" @@ -254,6 +256,8 @@ type cloudHypervisor struct { vmconfig chclient.VmConfig state CloudHypervisorState config HypervisorConfig + stopped int32 + mu sync.Mutex } var clhKernelParams = []Param{ @@ -1077,9 +1081,21 @@ func (clh *cloudHypervisor) ResumeVM(ctx context.Context) error { // StopVM will stop the Sandbox's VM. func (clh *cloudHypervisor) StopVM(ctx context.Context, waitOnly bool) (err error) { + clh.mu.Lock() + defer func() { + if err == nil { + atomic.StoreInt32(&clh.stopped, 1) + } + clh.mu.Unlock() + }() span, _ := katatrace.Trace(ctx, clh.Logger(), "StopVM", clhTracingTags, map[string]string{"sandbox_id": clh.id}) defer span.End() clh.Logger().WithField("function", "StopVM").Info("Stop Sandbox") + if atomic.LoadInt32(&clh.stopped) != 0 { + clh.Logger().Info("Already stopped") + return nil + } + return clh.terminate(ctx, waitOnly) } From 569ecdbe768bf7637aac96ef77dd7f2f88c57e6f Mon Sep 17 00:00:00 2001 From: Alexandru Matei Date: Thu, 10 Nov 2022 14:08:14 +0200 Subject: [PATCH 07/10] clh: fast exit from isClhRunning if the process was stopped Use atomic operations instead of acquiring a mutex in isClhRunning. This stops isClhRunning from generating a deadlock by trying to reacquire an already-acquired lock when called via StopVM->terminate. Signed-off-by: Alexandru Matei (cherry picked from commit 9ef68e0c7adc75e73e9a1b2827313c26c7551f51) --- src/runtime/virtcontainers/clh.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index 9562cf5d8..45217a4a9 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -1397,6 +1397,10 @@ func (clh *cloudHypervisor) isClhRunning(timeout uint) (bool, error) { pid := clh.state.PID + if atomic.LoadInt32(&clh.stopped) != 0 { + return false, nil + } + if err := syscall.Kill(pid, syscall.Signal(0)); err != nil { return false, nil } From 719017d6880948d4e507c0536b993ae1d8182d68 Mon Sep 17 00:00:00 2001 From: Alexandru Matei Date: Tue, 8 Nov 2022 21:05:22 +0200 Subject: [PATCH 08/10] clh: return faster with dead clh process from isClhRunning Through proactively checking if Cloud Hypervisor process is dead, this patch provides a faster path for isClhRunning Fixes: #5623 Signed-off-by: Alexandru Matei (cherry picked from commit 0e3ac66e761f8d41c91b5d07c985cedfa40790c0) --- src/runtime/virtcontainers/clh.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index 45217a4a9..69cfe7917 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -1401,16 +1401,16 @@ func (clh *cloudHypervisor) isClhRunning(timeout uint) (bool, error) { return false, nil } - if err := syscall.Kill(pid, syscall.Signal(0)); err != nil { - return false, nil - } - timeStart := time.Now() cl := clh.client() for { + err := syscall.Kill(pid, syscall.Signal(0)) + if err != nil { + return false, nil + } ctx, cancel := context.WithTimeout(context.Background(), clh.getClhAPITimeout()*time.Second) - defer cancel() - _, _, err := cl.VmmPingGet(ctx) + _, _, err = cl.VmmPingGet(ctx) + cancel() if err == nil { return true, nil } else { From 4d6ca7623a342f268c4b160d875ad1d39c8a1e75 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Thu, 17 Nov 2022 09:09:09 -0800 Subject: [PATCH 09/10] versions: Upgrade to Cloud Hypervisor v28.0 Details of this release can be found in our new roadmap project as iteration v28.0: https://github.com/orgs/cloud-hypervisor/projects/6. Fixes: #5683 Signed-off-by: Bo Chen (cherry picked from commit f4b02c224420f16122b30f76f1d6479a676a9a06) --- versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.yaml b/versions.yaml index 3636267e8..c0be81c37 100644 --- a/versions.yaml +++ b/versions.yaml @@ -75,7 +75,7 @@ assets: url: "https://github.com/cloud-hypervisor/cloud-hypervisor" uscan-url: >- https://github.com/cloud-hypervisor/cloud-hypervisor/tags.*/v?(\d\S+)\.tar\.gz - version: "b4e39427080293c674b8db627ee6daf1f1b56806" + version: "v28.0" firecracker: description: "Firecracker micro-VMM" From 9cf1af873bebb25d038b9814b2de9bec44bedd34 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Thu, 17 Nov 2022 09:21:40 -0800 Subject: [PATCH 10/10] runtime: clh: Re-generate the client code This patch re-generates the client code for Cloud Hypervisor v28.0. Note: The client code of cloud-hypervisor's OpenAPI is automatically generated by openapi-generator. Fixes: #5683 Signed-off-by: Bo Chen (cherry picked from commit 36545aa81ae988cef8824dcf2042d75dd1a86dbb) --- .../client/.openapi-generator/FILES | 2 + .../pkg/cloud-hypervisor/client/README.md | 1 + .../cloud-hypervisor/client/api/openapi.yaml | 21 +++ .../cloud-hypervisor/client/api_default.go | 138 ++++++++++-------- .../client/docs/MemoryConfig.md | 26 ++++ .../cloud-hypervisor/client/docs/TpmConfig.md | 51 +++++++ .../cloud-hypervisor/client/docs/VmConfig.md | 26 ++++ .../client/model_memory_config.go | 40 +++++ .../client/model_tpm_config.go | 106 ++++++++++++++ .../client/model_vm_config.go | 36 +++++ .../cloud-hypervisor/cloud-hypervisor.yaml | 13 ++ 11 files changed, 396 insertions(+), 64 deletions(-) create mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TpmConfig.md create mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tpm_config.go diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES index 6369a3a41..3cd6cf37e 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES @@ -33,6 +33,7 @@ docs/RngConfig.md docs/SendMigrationData.md docs/SgxEpcConfig.md docs/TokenBucket.md +docs/TpmConfig.md docs/VdpaConfig.md docs/VmConfig.md docs/VmCoredumpData.md @@ -72,6 +73,7 @@ model_rng_config.go model_send_migration_data.go model_sgx_epc_config.go model_token_bucket.go +model_tpm_config.go model_vdpa_config.go model_vm_config.go model_vm_coredump_data.go diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md index a33f74c7e..cb42aa49b 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -135,6 +135,7 @@ Class | Method | HTTP request | Description - [SendMigrationData](docs/SendMigrationData.md) - [SgxEpcConfig](docs/SgxEpcConfig.md) - [TokenBucket](docs/TokenBucket.md) + - [TpmConfig](docs/TpmConfig.md) - [VdpaConfig](docs/VdpaConfig.md) - [VmConfig](docs/VmConfig.md) - [VmCoredumpData](docs/VmCoredumpData.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml index 61e57e372..750c1e725 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -469,6 +469,7 @@ components: hotplug_size: 7 hotplug_size: 4 hotplug_method: Acpi + thp: true disks: - pci_segment: 8 path: path @@ -620,6 +621,8 @@ components: tdx: false serial_number: serial_number uuid: uuid + tpm: + socket: socket pmem: - pci_segment: 6 file: file @@ -828,6 +831,7 @@ components: hotplug_size: 7 hotplug_size: 4 hotplug_method: Acpi + thp: true disks: - pci_segment: 8 path: path @@ -979,6 +983,8 @@ components: tdx: false serial_number: serial_number uuid: uuid + tpm: + socket: socket pmem: - pci_segment: 6 file: file @@ -1107,6 +1113,8 @@ components: type: boolean platform: $ref: '#/components/schemas/PlatformConfig' + tpm: + $ref: '#/components/schemas/TpmConfig' required: - payload type: object @@ -1311,6 +1319,7 @@ components: hotplug_size: 7 hotplug_size: 4 hotplug_method: Acpi + thp: true properties: size: format: int64 @@ -1339,6 +1348,9 @@ components: prefault: default: false type: boolean + thp: + default: true + type: boolean zones: items: $ref: '#/components/schemas/MemoryZoneConfig' @@ -1651,6 +1663,15 @@ components: required: - path type: object + TpmConfig: + example: + socket: socket + properties: + socket: + type: string + required: + - socket + type: object VdpaConfig: example: pci_segment: 7 diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go index cb9b99d66..5c59d43d4 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go @@ -38,8 +38,8 @@ func (r ApiBootVMRequest) Execute() (*_nethttp.Response, error) { /* BootVM Boot the previously created VM instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiBootVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiBootVMRequest */ func (a *DefaultApiService) BootVM(ctx _context.Context) ApiBootVMRequest { return ApiBootVMRequest{ @@ -133,8 +133,8 @@ func (r ApiCreateVMRequest) Execute() (*_nethttp.Response, error) { /* CreateVM Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreateVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateVMRequest */ func (a *DefaultApiService) CreateVM(ctx _context.Context) ApiCreateVMRequest { return ApiCreateVMRequest{ @@ -226,8 +226,8 @@ func (r ApiDeleteVMRequest) Execute() (*_nethttp.Response, error) { /* DeleteVM Delete the cloud-hypervisor Virtual Machine (VM) instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiDeleteVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDeleteVMRequest */ func (a *DefaultApiService) DeleteVM(ctx _context.Context) ApiDeleteVMRequest { return ApiDeleteVMRequest{ @@ -314,8 +314,8 @@ func (r ApiPauseVMRequest) Execute() (*_nethttp.Response, error) { /* PauseVM Pause a previously booted VM instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiPauseVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiPauseVMRequest */ func (a *DefaultApiService) PauseVM(ctx _context.Context) ApiPauseVMRequest { return ApiPauseVMRequest{ @@ -402,8 +402,8 @@ func (r ApiPowerButtonVMRequest) Execute() (*_nethttp.Response, error) { /* PowerButtonVM Trigger a power button in the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiPowerButtonVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiPowerButtonVMRequest */ func (a *DefaultApiService) PowerButtonVM(ctx _context.Context) ApiPowerButtonVMRequest { return ApiPowerButtonVMRequest{ @@ -490,8 +490,8 @@ func (r ApiRebootVMRequest) Execute() (*_nethttp.Response, error) { /* RebootVM Reboot the VM instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiRebootVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRebootVMRequest */ func (a *DefaultApiService) RebootVM(ctx _context.Context) ApiRebootVMRequest { return ApiRebootVMRequest{ @@ -578,8 +578,8 @@ func (r ApiResumeVMRequest) Execute() (*_nethttp.Response, error) { /* ResumeVM Resume a previously paused VM instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiResumeVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiResumeVMRequest */ func (a *DefaultApiService) ResumeVM(ctx _context.Context) ApiResumeVMRequest { return ApiResumeVMRequest{ @@ -666,8 +666,8 @@ func (r ApiShutdownVMRequest) Execute() (*_nethttp.Response, error) { /* ShutdownVM Shut the VM instance down. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiShutdownVMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiShutdownVMRequest */ func (a *DefaultApiService) ShutdownVM(ctx _context.Context) ApiShutdownVMRequest { return ApiShutdownVMRequest{ @@ -754,8 +754,8 @@ func (r ApiShutdownVMMRequest) Execute() (*_nethttp.Response, error) { /* ShutdownVMM Shuts the cloud-hypervisor VMM. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiShutdownVMMRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiShutdownVMMRequest */ func (a *DefaultApiService) ShutdownVMM(ctx _context.Context) ApiShutdownVMMRequest { return ApiShutdownVMMRequest{ @@ -849,8 +849,8 @@ func (r ApiVmAddDevicePutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, /* VmAddDevicePut Add a new device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddDevicePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddDevicePutRequest */ func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context) ApiVmAddDevicePutRequest { return ApiVmAddDevicePutRequest{ @@ -860,7 +860,8 @@ func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context) ApiVmAddDeviceP } // Execute executes the request -// @return PciDeviceInfo +// +// @return PciDeviceInfo func (a *DefaultApiService) VmAddDevicePutExecute(r ApiVmAddDevicePutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -960,8 +961,8 @@ func (r ApiVmAddDiskPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, er /* VmAddDiskPut Add a new disk to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddDiskPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddDiskPutRequest */ func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context) ApiVmAddDiskPutRequest { return ApiVmAddDiskPutRequest{ @@ -971,7 +972,8 @@ func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context) ApiVmAddDiskPutRe } // Execute executes the request -// @return PciDeviceInfo +// +// @return PciDeviceInfo func (a *DefaultApiService) VmAddDiskPutExecute(r ApiVmAddDiskPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1071,8 +1073,8 @@ func (r ApiVmAddFsPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, erro /* VmAddFsPut Add a new virtio-fs device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddFsPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddFsPutRequest */ func (a *DefaultApiService) VmAddFsPut(ctx _context.Context) ApiVmAddFsPutRequest { return ApiVmAddFsPutRequest{ @@ -1082,7 +1084,8 @@ func (a *DefaultApiService) VmAddFsPut(ctx _context.Context) ApiVmAddFsPutReques } // Execute executes the request -// @return PciDeviceInfo +// +// @return PciDeviceInfo func (a *DefaultApiService) VmAddFsPutExecute(r ApiVmAddFsPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1182,8 +1185,8 @@ func (r ApiVmAddNetPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, err /* VmAddNetPut Add a new network device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddNetPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddNetPutRequest */ func (a *DefaultApiService) VmAddNetPut(ctx _context.Context) ApiVmAddNetPutRequest { return ApiVmAddNetPutRequest{ @@ -1193,7 +1196,8 @@ func (a *DefaultApiService) VmAddNetPut(ctx _context.Context) ApiVmAddNetPutRequ } // Execute executes the request -// @return PciDeviceInfo +// +// @return PciDeviceInfo func (a *DefaultApiService) VmAddNetPutExecute(r ApiVmAddNetPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1293,8 +1297,8 @@ func (r ApiVmAddPmemPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, er /* VmAddPmemPut Add a new pmem device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddPmemPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddPmemPutRequest */ func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context) ApiVmAddPmemPutRequest { return ApiVmAddPmemPutRequest{ @@ -1304,7 +1308,8 @@ func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context) ApiVmAddPmemPutRe } // Execute executes the request -// @return PciDeviceInfo +// +// @return PciDeviceInfo func (a *DefaultApiService) VmAddPmemPutExecute(r ApiVmAddPmemPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1404,8 +1409,8 @@ func (r ApiVmAddVdpaPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, er /* VmAddVdpaPut Add a new vDPA device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddVdpaPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddVdpaPutRequest */ func (a *DefaultApiService) VmAddVdpaPut(ctx _context.Context) ApiVmAddVdpaPutRequest { return ApiVmAddVdpaPutRequest{ @@ -1415,7 +1420,8 @@ func (a *DefaultApiService) VmAddVdpaPut(ctx _context.Context) ApiVmAddVdpaPutRe } // Execute executes the request -// @return PciDeviceInfo +// +// @return PciDeviceInfo func (a *DefaultApiService) VmAddVdpaPutExecute(r ApiVmAddVdpaPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1515,8 +1521,8 @@ func (r ApiVmAddVsockPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, e /* VmAddVsockPut Add a new vsock device to the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmAddVsockPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmAddVsockPutRequest */ func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context) ApiVmAddVsockPutRequest { return ApiVmAddVsockPutRequest{ @@ -1526,7 +1532,8 @@ func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context) ApiVmAddVsockPut } // Execute executes the request -// @return PciDeviceInfo +// +// @return PciDeviceInfo func (a *DefaultApiService) VmAddVsockPutExecute(r ApiVmAddVsockPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut @@ -1626,8 +1633,8 @@ func (r ApiVmCoredumpPutRequest) Execute() (*_nethttp.Response, error) { /* VmCoredumpPut Takes a VM coredump. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmCoredumpPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmCoredumpPutRequest */ func (a *DefaultApiService) VmCoredumpPut(ctx _context.Context) ApiVmCoredumpPutRequest { return ApiVmCoredumpPutRequest{ @@ -1719,8 +1726,8 @@ func (r ApiVmCountersGetRequest) Execute() (map[string]map[string]int64, *_netht /* VmCountersGet Get counters from the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmCountersGetRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmCountersGetRequest */ func (a *DefaultApiService) VmCountersGet(ctx _context.Context) ApiVmCountersGetRequest { return ApiVmCountersGetRequest{ @@ -1730,7 +1737,8 @@ func (a *DefaultApiService) VmCountersGet(ctx _context.Context) ApiVmCountersGet } // Execute executes the request -// @return map[string]map[string]int64 +// +// @return map[string]map[string]int64 func (a *DefaultApiService) VmCountersGetExecute(r ApiVmCountersGetRequest) (map[string]map[string]int64, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1818,8 +1826,8 @@ func (r ApiVmInfoGetRequest) Execute() (VmInfo, *_nethttp.Response, error) { /* VmInfoGet Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmInfoGetRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmInfoGetRequest */ func (a *DefaultApiService) VmInfoGet(ctx _context.Context) ApiVmInfoGetRequest { return ApiVmInfoGetRequest{ @@ -1829,7 +1837,8 @@ func (a *DefaultApiService) VmInfoGet(ctx _context.Context) ApiVmInfoGetRequest } // Execute executes the request -// @return VmInfo +// +// @return VmInfo func (a *DefaultApiService) VmInfoGetExecute(r ApiVmInfoGetRequest) (VmInfo, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1924,8 +1933,8 @@ func (r ApiVmReceiveMigrationPutRequest) Execute() (*_nethttp.Response, error) { /* VmReceiveMigrationPut Receive a VM migration from URL - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmReceiveMigrationPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmReceiveMigrationPutRequest */ func (a *DefaultApiService) VmReceiveMigrationPut(ctx _context.Context) ApiVmReceiveMigrationPutRequest { return ApiVmReceiveMigrationPutRequest{ @@ -2024,8 +2033,8 @@ func (r ApiVmRemoveDevicePutRequest) Execute() (*_nethttp.Response, error) { /* VmRemoveDevicePut Remove a device from the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmRemoveDevicePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmRemoveDevicePutRequest */ func (a *DefaultApiService) VmRemoveDevicePut(ctx _context.Context) ApiVmRemoveDevicePutRequest { return ApiVmRemoveDevicePutRequest{ @@ -2124,8 +2133,8 @@ func (r ApiVmResizePutRequest) Execute() (*_nethttp.Response, error) { /* VmResizePut Resize the VM - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmResizePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmResizePutRequest */ func (a *DefaultApiService) VmResizePut(ctx _context.Context) ApiVmResizePutRequest { return ApiVmResizePutRequest{ @@ -2224,8 +2233,8 @@ func (r ApiVmResizeZonePutRequest) Execute() (*_nethttp.Response, error) { /* VmResizeZonePut Resize a memory zone - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmResizeZonePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmResizeZonePutRequest */ func (a *DefaultApiService) VmResizeZonePut(ctx _context.Context) ApiVmResizeZonePutRequest { return ApiVmResizeZonePutRequest{ @@ -2324,8 +2333,8 @@ func (r ApiVmRestorePutRequest) Execute() (*_nethttp.Response, error) { /* VmRestorePut Restore a VM from a snapshot. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmRestorePutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmRestorePutRequest */ func (a *DefaultApiService) VmRestorePut(ctx _context.Context) ApiVmRestorePutRequest { return ApiVmRestorePutRequest{ @@ -2424,8 +2433,8 @@ func (r ApiVmSendMigrationPutRequest) Execute() (*_nethttp.Response, error) { /* VmSendMigrationPut Send a VM migration to URL - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmSendMigrationPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmSendMigrationPutRequest */ func (a *DefaultApiService) VmSendMigrationPut(ctx _context.Context) ApiVmSendMigrationPutRequest { return ApiVmSendMigrationPutRequest{ @@ -2524,8 +2533,8 @@ func (r ApiVmSnapshotPutRequest) Execute() (*_nethttp.Response, error) { /* VmSnapshotPut Returns a VM snapshot. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmSnapshotPutRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmSnapshotPutRequest */ func (a *DefaultApiService) VmSnapshotPut(ctx _context.Context) ApiVmSnapshotPutRequest { return ApiVmSnapshotPutRequest{ @@ -2617,8 +2626,8 @@ func (r ApiVmmPingGetRequest) Execute() (VmmPingResponse, *_nethttp.Response, er /* VmmPingGet Ping the VMM to check for API server availability - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiVmmPingGetRequest + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmmPingGetRequest */ func (a *DefaultApiService) VmmPingGet(ctx _context.Context) ApiVmmPingGetRequest { return ApiVmmPingGetRequest{ @@ -2628,7 +2637,8 @@ func (a *DefaultApiService) VmmPingGet(ctx _context.Context) ApiVmmPingGetReques } // Execute executes the request -// @return VmmPingResponse +// +// @return VmmPingResponse func (a *DefaultApiService) VmmPingGetExecute(r ApiVmmPingGetRequest) (VmmPingResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md index 669bcc518..e6127fc17 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **Hugepages** | Pointer to **bool** | | [optional] [default to false] **HugepageSize** | Pointer to **int64** | | [optional] **Prefault** | Pointer to **bool** | | [optional] [default to false] +**Thp** | Pointer to **bool** | | [optional] [default to true] **Zones** | Pointer to [**[]MemoryZoneConfig**](MemoryZoneConfig.md) | | [optional] ## Methods @@ -254,6 +255,31 @@ SetPrefault sets Prefault field to given value. HasPrefault returns a boolean if a field has been set. +### GetThp + +`func (o *MemoryConfig) GetThp() bool` + +GetThp returns the Thp field if non-nil, zero value otherwise. + +### GetThpOk + +`func (o *MemoryConfig) GetThpOk() (*bool, bool)` + +GetThpOk returns a tuple with the Thp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetThp + +`func (o *MemoryConfig) SetThp(v bool)` + +SetThp sets Thp field to given value. + +### HasThp + +`func (o *MemoryConfig) HasThp() bool` + +HasThp returns a boolean if a field has been set. + ### GetZones `func (o *MemoryConfig) GetZones() []MemoryZoneConfig` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TpmConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TpmConfig.md new file mode 100644 index 000000000..f659490e3 --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TpmConfig.md @@ -0,0 +1,51 @@ +# TpmConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Socket** | **string** | | + +## Methods + +### NewTpmConfig + +`func NewTpmConfig(socket string, ) *TpmConfig` + +NewTpmConfig instantiates a new TpmConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTpmConfigWithDefaults + +`func NewTpmConfigWithDefaults() *TpmConfig` + +NewTpmConfigWithDefaults instantiates a new TpmConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSocket + +`func (o *TpmConfig) GetSocket() string` + +GetSocket returns the Socket field if non-nil, zero value otherwise. + +### GetSocketOk + +`func (o *TpmConfig) GetSocketOk() (*string, bool)` + +GetSocketOk returns a tuple with the Socket field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSocket + +`func (o *TpmConfig) SetSocket(v string)` + +SetSocket sets Socket field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md index 9e0363df9..175df7ff3 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md @@ -23,6 +23,7 @@ Name | Type | Description | Notes **Iommu** | Pointer to **bool** | | [optional] [default to false] **Watchdog** | Pointer to **bool** | | [optional] [default to false] **Platform** | Pointer to [**PlatformConfig**](PlatformConfig.md) | | [optional] +**Tpm** | Pointer to [**TpmConfig**](TpmConfig.md) | | [optional] ## Methods @@ -513,6 +514,31 @@ SetPlatform sets Platform field to given value. HasPlatform returns a boolean if a field has been set. +### GetTpm + +`func (o *VmConfig) GetTpm() TpmConfig` + +GetTpm returns the Tpm field if non-nil, zero value otherwise. + +### GetTpmOk + +`func (o *VmConfig) GetTpmOk() (*TpmConfig, bool)` + +GetTpmOk returns a tuple with the Tpm field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTpm + +`func (o *VmConfig) SetTpm(v TpmConfig)` + +SetTpm sets Tpm field to given value. + +### HasTpm + +`func (o *VmConfig) HasTpm() bool` + +HasTpm returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go index f7b4bb09a..bc80adaba 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go @@ -25,6 +25,7 @@ type MemoryConfig struct { Hugepages *bool `json:"hugepages,omitempty"` HugepageSize *int64 `json:"hugepage_size,omitempty"` Prefault *bool `json:"prefault,omitempty"` + Thp *bool `json:"thp,omitempty"` Zones *[]MemoryZoneConfig `json:"zones,omitempty"` } @@ -45,6 +46,8 @@ func NewMemoryConfig(size int64) *MemoryConfig { this.Hugepages = &hugepages var prefault bool = false this.Prefault = &prefault + var thp bool = true + this.Thp = &thp return &this } @@ -63,6 +66,8 @@ func NewMemoryConfigWithDefaults() *MemoryConfig { this.Hugepages = &hugepages var prefault bool = false this.Prefault = &prefault + var thp bool = true + this.Thp = &thp return &this } @@ -346,6 +351,38 @@ func (o *MemoryConfig) SetPrefault(v bool) { o.Prefault = &v } +// GetThp returns the Thp field value if set, zero value otherwise. +func (o *MemoryConfig) GetThp() bool { + if o == nil || o.Thp == nil { + var ret bool + return ret + } + return *o.Thp +} + +// GetThpOk returns a tuple with the Thp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemoryConfig) GetThpOk() (*bool, bool) { + if o == nil || o.Thp == nil { + return nil, false + } + return o.Thp, true +} + +// HasThp returns a boolean if a field has been set. +func (o *MemoryConfig) HasThp() bool { + if o != nil && o.Thp != nil { + return true + } + + return false +} + +// SetThp gets a reference to the given bool and assigns it to the Thp field. +func (o *MemoryConfig) SetThp(v bool) { + o.Thp = &v +} + // GetZones returns the Zones field value if set, zero value otherwise. func (o *MemoryConfig) GetZones() []MemoryZoneConfig { if o == nil || o.Zones == nil { @@ -407,6 +444,9 @@ func (o MemoryConfig) MarshalJSON() ([]byte, error) { if o.Prefault != nil { toSerialize["prefault"] = o.Prefault } + if o.Thp != nil { + toSerialize["thp"] = o.Thp + } if o.Zones != nil { toSerialize["zones"] = o.Zones } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tpm_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tpm_config.go new file mode 100644 index 000000000..7dc4ad4be --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tpm_config.go @@ -0,0 +1,106 @@ +/* +Cloud Hypervisor API + +Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. + +API version: 0.3.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// TpmConfig struct for TpmConfig +type TpmConfig struct { + Socket string `json:"socket"` +} + +// NewTpmConfig instantiates a new TpmConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTpmConfig(socket string) *TpmConfig { + this := TpmConfig{} + this.Socket = socket + return &this +} + +// NewTpmConfigWithDefaults instantiates a new TpmConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTpmConfigWithDefaults() *TpmConfig { + this := TpmConfig{} + return &this +} + +// GetSocket returns the Socket field value +func (o *TpmConfig) GetSocket() string { + if o == nil { + var ret string + return ret + } + + return o.Socket +} + +// GetSocketOk returns a tuple with the Socket field value +// and a boolean to check if the value has been set. +func (o *TpmConfig) GetSocketOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Socket, true +} + +// SetSocket sets field value +func (o *TpmConfig) SetSocket(v string) { + o.Socket = v +} + +func (o TpmConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["socket"] = o.Socket + } + return json.Marshal(toSerialize) +} + +type NullableTpmConfig struct { + value *TpmConfig + isSet bool +} + +func (v NullableTpmConfig) Get() *TpmConfig { + return v.value +} + +func (v *NullableTpmConfig) Set(val *TpmConfig) { + v.value = val + v.isSet = true +} + +func (v NullableTpmConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableTpmConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTpmConfig(val *TpmConfig) *NullableTpmConfig { + return &NullableTpmConfig{value: val, isSet: true} +} + +func (v NullableTpmConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTpmConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go index c8fafc6a4..cd243bce9 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go @@ -35,6 +35,7 @@ type VmConfig struct { Iommu *bool `json:"iommu,omitempty"` Watchdog *bool `json:"watchdog,omitempty"` Platform *PlatformConfig `json:"platform,omitempty"` + Tpm *TpmConfig `json:"tpm,omitempty"` } // NewVmConfig instantiates a new VmConfig object @@ -663,6 +664,38 @@ func (o *VmConfig) SetPlatform(v PlatformConfig) { o.Platform = &v } +// GetTpm returns the Tpm field value if set, zero value otherwise. +func (o *VmConfig) GetTpm() TpmConfig { + if o == nil || o.Tpm == nil { + var ret TpmConfig + return ret + } + return *o.Tpm +} + +// GetTpmOk returns a tuple with the Tpm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VmConfig) GetTpmOk() (*TpmConfig, bool) { + if o == nil || o.Tpm == nil { + return nil, false + } + return o.Tpm, true +} + +// HasTpm returns a boolean if a field has been set. +func (o *VmConfig) HasTpm() bool { + if o != nil && o.Tpm != nil { + return true + } + + return false +} + +// SetTpm gets a reference to the given TpmConfig and assigns it to the Tpm field. +func (o *VmConfig) SetTpm(v TpmConfig) { + o.Tpm = &v +} + func (o VmConfig) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Cpus != nil { @@ -722,6 +755,9 @@ func (o VmConfig) MarshalJSON() ([]byte, error) { if o.Platform != nil { toSerialize["platform"] = o.Platform } + if o.Tpm != nil { + toSerialize["tpm"] = o.Tpm + } return json.Marshal(toSerialize) } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index 46d9aac83..dee8bdbf0 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -573,6 +573,8 @@ components: default: false platform: $ref: "#/components/schemas/PlatformConfig" + tpm: + $ref: "#/components/schemas/TpmConfig" description: Virtual machine configuration CpuAffinity: @@ -726,6 +728,9 @@ components: prefault: type: boolean default: false + thp: + type: boolean + default: true zones: type: array items: @@ -955,6 +960,14 @@ components: id: type: string + TpmConfig: + required: + - socket + type: object + properties: + socket: + type: string + VdpaConfig: required: - path