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 ed5dc5764d..7eb679fb27 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/BalloonConfig.md docs/CmdLineConfig.md docs/ConsoleConfig.md docs/CpuAffinity.md +docs/CpuFeatures.md docs/CpuTopology.md docs/CpusConfig.md docs/DefaultApi.md @@ -35,6 +36,7 @@ docs/SendMigrationData.md docs/SgxEpcConfig.md docs/TdxConfig.md docs/TokenBucket.md +docs/VdpaConfig.md docs/VmAddDevice.md docs/VmConfig.md docs/VmInfo.md @@ -51,6 +53,7 @@ model_balloon_config.go model_cmd_line_config.go model_console_config.go model_cpu_affinity.go +model_cpu_features.go model_cpu_topology.go model_cpus_config.go model_device_config.go @@ -75,6 +78,7 @@ 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 model_vm_config.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 3b7967c4b0..2e12b424c5 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -92,6 +92,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**VmAddFsPut**](docs/DefaultApi.md#vmaddfsput) | **Put** /vm.add-fs | Add a new virtio-fs device to the VM *DefaultApi* | [**VmAddNetPut**](docs/DefaultApi.md#vmaddnetput) | **Put** /vm.add-net | Add a new network device to the VM *DefaultApi* | [**VmAddPmemPut**](docs/DefaultApi.md#vmaddpmemput) | **Put** /vm.add-pmem | Add a new pmem device to the VM +*DefaultApi* | [**VmAddVdpaPut**](docs/DefaultApi.md#vmaddvdpaput) | **Put** /vm.add-vdpa | Add a new vDPA device to the VM *DefaultApi* | [**VmAddVsockPut**](docs/DefaultApi.md#vmaddvsockput) | **Put** /vm.add-vsock | Add a new vsock device to the VM *DefaultApi* | [**VmCountersGet**](docs/DefaultApi.md#vmcountersget) | **Get** /vm.counters | Get counters from the VM *DefaultApi* | [**VmInfoGet**](docs/DefaultApi.md#vminfoget) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. @@ -111,6 +112,7 @@ Class | Method | HTTP request | Description - [CmdLineConfig](docs/CmdLineConfig.md) - [ConsoleConfig](docs/ConsoleConfig.md) - [CpuAffinity](docs/CpuAffinity.md) + - [CpuFeatures](docs/CpuFeatures.md) - [CpuTopology](docs/CpuTopology.md) - [CpusConfig](docs/CpusConfig.md) - [DeviceConfig](docs/DeviceConfig.md) @@ -135,6 +137,7 @@ Class | Method | HTTP request | Description - [SgxEpcConfig](docs/SgxEpcConfig.md) - [TdxConfig](docs/TdxConfig.md) - [TokenBucket](docs/TokenBucket.md) + - [VdpaConfig](docs/VdpaConfig.md) - [VmAddDevice](docs/VmAddDevice.md) - [VmConfig](docs/VmConfig.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 4a168e53e5..43b2e9737a 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -306,6 +306,28 @@ paths: "500": description: The new device could not be added to the VM instance. summary: Add a new vsock device to the VM + /vm.add-vdpa: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/VdpaConfig' + description: The details of the new vDPA device + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PciDeviceInfo' + description: The new vDPA device was successfully added to the VM instance. + "204": + description: The new vDPA device was successfully (cold) added to the VM + instance. + "500": + description: The new vDPA device could not be added to the VM instance. + summary: Add a new vDPA device to the VM /vm.snapshot: put: requestBody: @@ -386,7 +408,7 @@ components: VmInfo: description: Virtual Machine information example: - memory_actual_size: 3 + memory_actual_size: 7 state: Created config: console: @@ -472,6 +494,8 @@ components: refill_time: 0 id: id cpus: + features: + amx: true topology: dies_per_package: 5 threads_per_core: 1 @@ -500,37 +524,48 @@ components: id: id kernel: path: path + vdpa: + - pci_segment: 7 + path: path + num_queues: 3 + iommu: false + id: id + - pci_segment: 7 + path: path + num_queues: 3 + iommu: false + id: id numa: - distances: - - distance: 4 - destination: 0 - - distance: 4 - destination: 0 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 6 - - 6 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 7 + guest_numa_id: 0 - distances: - - distance: 4 - destination: 0 - - distance: 4 - destination: 0 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 6 - - 6 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 7 + guest_numa_id: 0 tdx: firmware: firmware rng: @@ -538,10 +573,10 @@ components: src: /dev/urandom sgx_epc: - prefault: false - size: 0 + size: 6 id: id - prefault: false - size: 0 + size: 6 id: id fs: - pci_segment: 6 @@ -568,9 +603,9 @@ components: cid: 3 platform: iommu_segments: - - 7 - - 7 - num_pci_segments: 8 + - 3 + - 3 + num_pci_segments: 3 pmem: - pci_segment: 6 mergeable: false @@ -801,6 +836,8 @@ components: refill_time: 0 id: id cpus: + features: + amx: true topology: dies_per_package: 5 threads_per_core: 1 @@ -829,37 +866,48 @@ components: id: id kernel: path: path + vdpa: + - pci_segment: 7 + path: path + num_queues: 3 + iommu: false + id: id + - pci_segment: 7 + path: path + num_queues: 3 + iommu: false + id: id numa: - distances: - - distance: 4 - destination: 0 - - distance: 4 - destination: 0 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 6 - - 6 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 7 + guest_numa_id: 0 - distances: - - distance: 4 - destination: 0 - - distance: 4 - destination: 0 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 6 - - 6 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 7 + guest_numa_id: 0 tdx: firmware: firmware rng: @@ -867,10 +915,10 @@ components: src: /dev/urandom sgx_epc: - prefault: false - size: 0 + size: 6 id: id - prefault: false - size: 0 + size: 6 id: id fs: - pci_segment: 6 @@ -897,9 +945,9 @@ components: cid: 3 platform: iommu_segments: - - 7 - - 7 - num_pci_segments: 8 + - 3 + - 3 + num_pci_segments: 3 pmem: - pci_segment: 6 mergeable: false @@ -1007,6 +1055,10 @@ components: items: $ref: '#/components/schemas/DeviceConfig' type: array + vdpa: + items: + $ref: '#/components/schemas/VdpaConfig' + type: array vsock: $ref: '#/components/schemas/VsockConfig' sgx_epc: @@ -1044,6 +1096,13 @@ components: type: integer type: array type: object + CpuFeatures: + example: + amx: true + properties: + amx: + type: boolean + type: object CpuTopology: example: dies_per_package: 5 @@ -1062,6 +1121,8 @@ components: type: object CpusConfig: example: + features: + amx: true topology: dies_per_package: 5 threads_per_core: 1 @@ -1096,6 +1157,8 @@ components: items: $ref: '#/components/schemas/CpuAffinity' type: array + features: + $ref: '#/components/schemas/CpuFeatures' required: - boot_vcpus - max_vcpus @@ -1103,9 +1166,9 @@ components: PlatformConfig: example: iommu_segments: - - 7 - - 7 - num_pci_segments: 8 + - 3 + - 3 + num_pci_segments: 3 properties: num_pci_segments: format: int16 @@ -1579,6 +1642,31 @@ components: required: - path type: object + VdpaConfig: + example: + pci_segment: 7 + path: path + num_queues: 3 + iommu: false + id: id + properties: + path: + type: string + num_queues: + default: 1 + type: integer + iommu: + default: false + type: boolean + pci_segment: + format: int16 + type: integer + id: + type: string + required: + - num_queues + - path + type: object VsockConfig: example: pci_segment: 7 @@ -1610,7 +1698,7 @@ components: SgxEpcConfig: example: prefault: false - size: 0 + size: 6 id: id properties: id: @@ -1638,8 +1726,8 @@ components: type: object NumaDistance: example: - distance: 4 - destination: 0 + distance: 7 + destination: 8 properties: destination: format: int32 @@ -1654,20 +1742,20 @@ components: NumaConfig: example: distances: - - distance: 4 - destination: 0 - - distance: 4 - destination: 0 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 6 - - 6 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 7 + guest_numa_id: 0 properties: guest_numa_id: format: int32 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 9c696060e3..183bac46b9 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go @@ -1385,6 +1385,117 @@ func (a *DefaultApiService) VmAddPmemPutExecute(r ApiVmAddPmemPutRequest) (PciDe return localVarReturnValue, localVarHTTPResponse, nil } +type ApiVmAddVdpaPutRequest struct { + ctx _context.Context + ApiService *DefaultApiService + vdpaConfig *VdpaConfig +} + +// The details of the new vDPA device +func (r ApiVmAddVdpaPutRequest) VdpaConfig(vdpaConfig VdpaConfig) ApiVmAddVdpaPutRequest { + r.vdpaConfig = &vdpaConfig + return r +} + +func (r ApiVmAddVdpaPutRequest) Execute() (PciDeviceInfo, *_nethttp.Response, error) { + return r.ApiService.VmAddVdpaPutExecute(r) +} + +/* +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 +*/ +func (a *DefaultApiService) VmAddVdpaPut(ctx _context.Context) ApiVmAddVdpaPutRequest { + return ApiVmAddVdpaPutRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return PciDeviceInfo +func (a *DefaultApiService) VmAddVdpaPutExecute(r ApiVmAddVdpaPutRequest) (PciDeviceInfo, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue PciDeviceInfo + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.VmAddVdpaPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vm.add-vdpa" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.vdpaConfig == nil { + return localVarReturnValue, nil, reportError("vdpaConfig is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.vdpaConfig + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiVmAddVsockPutRequest struct { ctx _context.Context ApiService *DefaultApiService diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpuFeatures.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpuFeatures.md new file mode 100644 index 0000000000..8510e4083d --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpuFeatures.md @@ -0,0 +1,56 @@ +# CpuFeatures + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Amx** | Pointer to **bool** | | [optional] + +## Methods + +### NewCpuFeatures + +`func NewCpuFeatures() *CpuFeatures` + +NewCpuFeatures instantiates a new CpuFeatures 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 + +### NewCpuFeaturesWithDefaults + +`func NewCpuFeaturesWithDefaults() *CpuFeatures` + +NewCpuFeaturesWithDefaults instantiates a new CpuFeatures 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 + +### GetAmx + +`func (o *CpuFeatures) GetAmx() bool` + +GetAmx returns the Amx field if non-nil, zero value otherwise. + +### GetAmxOk + +`func (o *CpuFeatures) GetAmxOk() (*bool, bool)` + +GetAmxOk returns a tuple with the Amx field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAmx + +`func (o *CpuFeatures) SetAmx(v bool)` + +SetAmx sets Amx field to given value. + +### HasAmx + +`func (o *CpuFeatures) HasAmx() bool` + +HasAmx 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/CpusConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpusConfig.md index 19b1a1795d..8514e696fc 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpusConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpusConfig.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **Topology** | Pointer to [**CpuTopology**](CpuTopology.md) | | [optional] **MaxPhysBits** | Pointer to **int32** | | [optional] **Affinity** | Pointer to [**[]CpuAffinity**](CpuAffinity.md) | | [optional] +**Features** | Pointer to [**CpuFeatures**](CpuFeatures.md) | | [optional] ## Methods @@ -144,6 +145,31 @@ SetAffinity sets Affinity field to given value. HasAffinity returns a boolean if a field has been set. +### GetFeatures + +`func (o *CpusConfig) GetFeatures() CpuFeatures` + +GetFeatures returns the Features field if non-nil, zero value otherwise. + +### GetFeaturesOk + +`func (o *CpusConfig) GetFeaturesOk() (*CpuFeatures, bool)` + +GetFeaturesOk returns a tuple with the Features field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFeatures + +`func (o *CpusConfig) SetFeatures(v CpuFeatures)` + +SetFeatures sets Features field to given value. + +### HasFeatures + +`func (o *CpusConfig) HasFeatures() bool` + +HasFeatures 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/DefaultApi.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md index c5ca050b60..b6e339559d 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md @@ -18,6 +18,7 @@ Method | HTTP request | Description [**VmAddFsPut**](DefaultApi.md#VmAddFsPut) | **Put** /vm.add-fs | Add a new virtio-fs device to the VM [**VmAddNetPut**](DefaultApi.md#VmAddNetPut) | **Put** /vm.add-net | Add a new network device to the VM [**VmAddPmemPut**](DefaultApi.md#VmAddPmemPut) | **Put** /vm.add-pmem | Add a new pmem device to the VM +[**VmAddVdpaPut**](DefaultApi.md#VmAddVdpaPut) | **Put** /vm.add-vdpa | Add a new vDPA device to the VM [**VmAddVsockPut**](DefaultApi.md#VmAddVsockPut) | **Put** /vm.add-vsock | Add a new vsock device to the VM [**VmCountersGet**](DefaultApi.md#VmCountersGet) | **Get** /vm.counters | Get counters from the VM [**VmInfoGet**](DefaultApi.md#VmInfoGet) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. @@ -870,6 +871,70 @@ No authorization required [[Back to README]](../README.md) +## VmAddVdpaPut + +> PciDeviceInfo VmAddVdpaPut(ctx).VdpaConfig(vdpaConfig).Execute() + +Add a new vDPA device to the VM + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + vdpaConfig := *openapiclient.NewVdpaConfig("Path_example", int32(123)) // VdpaConfig | The details of the new vDPA device + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.DefaultApi.VmAddVdpaPut(context.Background()).VdpaConfig(vdpaConfig).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.VmAddVdpaPut``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `VmAddVdpaPut`: PciDeviceInfo + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.VmAddVdpaPut`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiVmAddVdpaPutRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **vdpaConfig** | [**VdpaConfig**](VdpaConfig.md) | The details of the new vDPA device | + +### Return type + +[**PciDeviceInfo**](PciDeviceInfo.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## VmAddVsockPut > PciDeviceInfo VmAddVsockPut(ctx).VsockConfig(vsockConfig).Execute() diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VdpaConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VdpaConfig.md new file mode 100644 index 0000000000..bff8234026 --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VdpaConfig.md @@ -0,0 +1,150 @@ +# VdpaConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Path** | **string** | | +**NumQueues** | **int32** | | [default to 1] +**Iommu** | Pointer to **bool** | | [optional] [default to false] +**PciSegment** | Pointer to **int32** | | [optional] +**Id** | Pointer to **string** | | [optional] + +## Methods + +### NewVdpaConfig + +`func NewVdpaConfig(path string, numQueues int32, ) *VdpaConfig` + +NewVdpaConfig instantiates a new VdpaConfig 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 + +### NewVdpaConfigWithDefaults + +`func NewVdpaConfigWithDefaults() *VdpaConfig` + +NewVdpaConfigWithDefaults instantiates a new VdpaConfig 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 *VdpaConfig) GetPath() string` + +GetPath returns the Path field if non-nil, zero value otherwise. + +### GetPathOk + +`func (o *VdpaConfig) 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 *VdpaConfig) SetPath(v string)` + +SetPath sets Path field to given value. + + +### GetNumQueues + +`func (o *VdpaConfig) GetNumQueues() int32` + +GetNumQueues returns the NumQueues field if non-nil, zero value otherwise. + +### GetNumQueuesOk + +`func (o *VdpaConfig) GetNumQueuesOk() (*int32, bool)` + +GetNumQueuesOk returns a tuple with the NumQueues field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumQueues + +`func (o *VdpaConfig) SetNumQueues(v int32)` + +SetNumQueues sets NumQueues field to given value. + + +### GetIommu + +`func (o *VdpaConfig) GetIommu() bool` + +GetIommu returns the Iommu field if non-nil, zero value otherwise. + +### GetIommuOk + +`func (o *VdpaConfig) 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 *VdpaConfig) SetIommu(v bool)` + +SetIommu sets Iommu field to given value. + +### HasIommu + +`func (o *VdpaConfig) HasIommu() bool` + +HasIommu returns a boolean if a field has been set. + +### GetPciSegment + +`func (o *VdpaConfig) GetPciSegment() int32` + +GetPciSegment returns the PciSegment field if non-nil, zero value otherwise. + +### GetPciSegmentOk + +`func (o *VdpaConfig) GetPciSegmentOk() (*int32, bool)` + +GetPciSegmentOk returns a tuple with the PciSegment field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPciSegment + +`func (o *VdpaConfig) SetPciSegment(v int32)` + +SetPciSegment sets PciSegment field to given value. + +### HasPciSegment + +`func (o *VdpaConfig) HasPciSegment() bool` + +HasPciSegment returns a boolean if a field has been set. + +### GetId + +`func (o *VdpaConfig) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *VdpaConfig) 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 *VdpaConfig) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *VdpaConfig) 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/docs/VmConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md index b01b81db52..d6bbae4212 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md @@ -18,6 +18,7 @@ Name | Type | Description | Notes **Serial** | Pointer to [**ConsoleConfig**](ConsoleConfig.md) | | [optional] **Console** | Pointer to [**ConsoleConfig**](ConsoleConfig.md) | | [optional] **Devices** | Pointer to [**[]DeviceConfig**](DeviceConfig.md) | | [optional] +**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] @@ -400,6 +401,31 @@ SetDevices sets Devices field to given value. HasDevices returns a boolean if a field has been set. +### GetVdpa + +`func (o *VmConfig) GetVdpa() []VdpaConfig` + +GetVdpa returns the Vdpa field if non-nil, zero value otherwise. + +### GetVdpaOk + +`func (o *VmConfig) GetVdpaOk() (*[]VdpaConfig, bool)` + +GetVdpaOk returns a tuple with the Vdpa field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVdpa + +`func (o *VmConfig) SetVdpa(v []VdpaConfig)` + +SetVdpa sets Vdpa field to given value. + +### HasVdpa + +`func (o *VmConfig) HasVdpa() bool` + +HasVdpa returns a boolean if a field has been set. + ### GetVsock `func (o *VmConfig) GetVsock() VsockConfig` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpu_features.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpu_features.go new file mode 100644 index 0000000000..707b8251ae --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpu_features.go @@ -0,0 +1,113 @@ +/* +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" +) + +// CpuFeatures struct for CpuFeatures +type CpuFeatures struct { + Amx *bool `json:"amx,omitempty"` +} + +// NewCpuFeatures instantiates a new CpuFeatures 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 NewCpuFeatures() *CpuFeatures { + this := CpuFeatures{} + return &this +} + +// NewCpuFeaturesWithDefaults instantiates a new CpuFeatures 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 NewCpuFeaturesWithDefaults() *CpuFeatures { + this := CpuFeatures{} + return &this +} + +// GetAmx returns the Amx field value if set, zero value otherwise. +func (o *CpuFeatures) GetAmx() bool { + if o == nil || o.Amx == nil { + var ret bool + return ret + } + return *o.Amx +} + +// GetAmxOk returns a tuple with the Amx field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CpuFeatures) GetAmxOk() (*bool, bool) { + if o == nil || o.Amx == nil { + return nil, false + } + return o.Amx, true +} + +// HasAmx returns a boolean if a field has been set. +func (o *CpuFeatures) HasAmx() bool { + if o != nil && o.Amx != nil { + return true + } + + return false +} + +// SetAmx gets a reference to the given bool and assigns it to the Amx field. +func (o *CpuFeatures) SetAmx(v bool) { + o.Amx = &v +} + +func (o CpuFeatures) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Amx != nil { + toSerialize["amx"] = o.Amx + } + return json.Marshal(toSerialize) +} + +type NullableCpuFeatures struct { + value *CpuFeatures + isSet bool +} + +func (v NullableCpuFeatures) Get() *CpuFeatures { + return v.value +} + +func (v *NullableCpuFeatures) Set(val *CpuFeatures) { + v.value = val + v.isSet = true +} + +func (v NullableCpuFeatures) IsSet() bool { + return v.isSet +} + +func (v *NullableCpuFeatures) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCpuFeatures(val *CpuFeatures) *NullableCpuFeatures { + return &NullableCpuFeatures{value: val, isSet: true} +} + +func (v NullableCpuFeatures) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCpuFeatures) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpus_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpus_config.go index 52430cf004..cbcd4e034d 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpus_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpus_config.go @@ -21,6 +21,7 @@ type CpusConfig struct { Topology *CpuTopology `json:"topology,omitempty"` MaxPhysBits *int32 `json:"max_phys_bits,omitempty"` Affinity *[]CpuAffinity `json:"affinity,omitempty"` + Features *CpuFeatures `json:"features,omitempty"` } // NewCpusConfig instantiates a new CpusConfig object @@ -190,6 +191,38 @@ func (o *CpusConfig) SetAffinity(v []CpuAffinity) { o.Affinity = &v } +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *CpusConfig) GetFeatures() CpuFeatures { + if o == nil || o.Features == nil { + var ret CpuFeatures + return ret + } + return *o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CpusConfig) GetFeaturesOk() (*CpuFeatures, bool) { + if o == nil || o.Features == nil { + return nil, false + } + return o.Features, true +} + +// HasFeatures returns a boolean if a field has been set. +func (o *CpusConfig) HasFeatures() bool { + if o != nil && o.Features != nil { + return true + } + + return false +} + +// SetFeatures gets a reference to the given CpuFeatures and assigns it to the Features field. +func (o *CpusConfig) SetFeatures(v CpuFeatures) { + o.Features = &v +} + func (o CpusConfig) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { @@ -207,6 +240,9 @@ func (o CpusConfig) MarshalJSON() ([]byte, error) { if o.Affinity != nil { toSerialize["affinity"] = o.Affinity } + if o.Features != nil { + toSerialize["features"] = o.Features + } return json.Marshal(toSerialize) } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vdpa_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vdpa_config.go new file mode 100644 index 0000000000..886bb4bc81 --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vdpa_config.go @@ -0,0 +1,249 @@ +/* +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" +) + +// VdpaConfig struct for VdpaConfig +type VdpaConfig struct { + Path string `json:"path"` + NumQueues int32 `json:"num_queues"` + Iommu *bool `json:"iommu,omitempty"` + PciSegment *int32 `json:"pci_segment,omitempty"` + Id *string `json:"id,omitempty"` +} + +// NewVdpaConfig instantiates a new VdpaConfig 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 NewVdpaConfig(path string, numQueues int32) *VdpaConfig { + this := VdpaConfig{} + this.Path = path + this.NumQueues = numQueues + var iommu bool = false + this.Iommu = &iommu + return &this +} + +// NewVdpaConfigWithDefaults instantiates a new VdpaConfig 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 NewVdpaConfigWithDefaults() *VdpaConfig { + this := VdpaConfig{} + var numQueues int32 = 1 + this.NumQueues = numQueues + var iommu bool = false + this.Iommu = &iommu + return &this +} + +// GetPath returns the Path field value +func (o *VdpaConfig) GetPath() string { + if o == nil { + var ret string + return ret + } + + return o.Path +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *VdpaConfig) GetPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Path, true +} + +// SetPath sets field value +func (o *VdpaConfig) SetPath(v string) { + o.Path = v +} + +// GetNumQueues returns the NumQueues field value +func (o *VdpaConfig) GetNumQueues() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NumQueues +} + +// GetNumQueuesOk returns a tuple with the NumQueues field value +// and a boolean to check if the value has been set. +func (o *VdpaConfig) GetNumQueuesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NumQueues, true +} + +// SetNumQueues sets field value +func (o *VdpaConfig) SetNumQueues(v int32) { + o.NumQueues = v +} + +// GetIommu returns the Iommu field value if set, zero value otherwise. +func (o *VdpaConfig) 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 *VdpaConfig) 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 *VdpaConfig) 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 *VdpaConfig) SetIommu(v bool) { + o.Iommu = &v +} + +// GetPciSegment returns the PciSegment field value if set, zero value otherwise. +func (o *VdpaConfig) GetPciSegment() int32 { + if o == nil || o.PciSegment == nil { + var ret int32 + return ret + } + return *o.PciSegment +} + +// GetPciSegmentOk returns a tuple with the PciSegment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VdpaConfig) GetPciSegmentOk() (*int32, bool) { + if o == nil || o.PciSegment == nil { + return nil, false + } + return o.PciSegment, true +} + +// HasPciSegment returns a boolean if a field has been set. +func (o *VdpaConfig) HasPciSegment() bool { + if o != nil && o.PciSegment != nil { + return true + } + + return false +} + +// SetPciSegment gets a reference to the given int32 and assigns it to the PciSegment field. +func (o *VdpaConfig) SetPciSegment(v int32) { + o.PciSegment = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VdpaConfig) 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 *VdpaConfig) 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 *VdpaConfig) 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 *VdpaConfig) SetId(v string) { + o.Id = &v +} + +func (o VdpaConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["path"] = o.Path + } + if true { + toSerialize["num_queues"] = o.NumQueues + } + if o.Iommu != nil { + toSerialize["iommu"] = o.Iommu + } + if o.PciSegment != nil { + toSerialize["pci_segment"] = o.PciSegment + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + return json.Marshal(toSerialize) +} + +type NullableVdpaConfig struct { + value *VdpaConfig + isSet bool +} + +func (v NullableVdpaConfig) Get() *VdpaConfig { + return v.value +} + +func (v *NullableVdpaConfig) Set(val *VdpaConfig) { + v.value = val + v.isSet = true +} + +func (v NullableVdpaConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableVdpaConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVdpaConfig(val *VdpaConfig) *NullableVdpaConfig { + return &NullableVdpaConfig{value: val, isSet: true} +} + +func (v NullableVdpaConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVdpaConfig) 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 24c2e6289f..c4ad07fb06 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 @@ -30,6 +30,7 @@ type VmConfig struct { Serial *ConsoleConfig `json:"serial,omitempty"` Console *ConsoleConfig `json:"console,omitempty"` Devices *[]DeviceConfig `json:"devices,omitempty"` + Vdpa *[]VdpaConfig `json:"vdpa,omitempty"` Vsock *VsockConfig `json:"vsock,omitempty"` SgxEpc *[]SgxEpcConfig `json:"sgx_epc,omitempty"` Tdx *TdxConfig `json:"tdx,omitempty"` @@ -516,6 +517,38 @@ func (o *VmConfig) SetDevices(v []DeviceConfig) { o.Devices = &v } +// GetVdpa returns the Vdpa field value if set, zero value otherwise. +func (o *VmConfig) GetVdpa() []VdpaConfig { + if o == nil || o.Vdpa == nil { + var ret []VdpaConfig + return ret + } + return *o.Vdpa +} + +// GetVdpaOk returns a tuple with the Vdpa field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VmConfig) GetVdpaOk() (*[]VdpaConfig, bool) { + if o == nil || o.Vdpa == nil { + return nil, false + } + return o.Vdpa, true +} + +// HasVdpa returns a boolean if a field has been set. +func (o *VmConfig) HasVdpa() bool { + if o != nil && o.Vdpa != nil { + return true + } + + return false +} + +// SetVdpa gets a reference to the given []VdpaConfig and assigns it to the Vdpa field. +func (o *VmConfig) SetVdpa(v []VdpaConfig) { + o.Vdpa = &v +} + // GetVsock returns the Vsock field value if set, zero value otherwise. func (o *VmConfig) GetVsock() VsockConfig { if o == nil || o.Vsock == nil { @@ -784,6 +817,9 @@ func (o VmConfig) MarshalJSON() ([]byte, error) { if o.Devices != nil { toSerialize["devices"] = o.Devices } + if o.Vdpa != nil { + toSerialize["vdpa"] = o.Vdpa + } if o.Vsock != nil { toSerialize["vsock"] = o.Vsock } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index c9ecd399e6..8861f1e710 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -325,7 +325,28 @@ paths: description: The new device was successfully (cold) added to the VM instance. 500: description: The new device could not be added to the VM instance. - + + /vm.add-vdpa: + put: + summary: Add a new vDPA device to the VM + requestBody: + description: The details of the new vDPA device + content: + application/json: + schema: + $ref: '#/components/schemas/VdpaConfig' + required: true + responses: + 200: + description: The new vDPA device was successfully added to the VM instance. + content: + application/json: + schema: + $ref: '#/components/schemas/PciDeviceInfo' + 204: + description: The new vDPA device was successfully (cold) added to the VM instance. + 500: + description: The new vDPA device could not be added to the VM instance. /vm.snapshot: put: @@ -505,6 +526,10 @@ components: type: array items: $ref: '#/components/schemas/DeviceConfig' + vdpa: + type: array + items: + $ref: '#/components/schemas/VdpaConfig' vsock: $ref: '#/components/schemas/VsockConfig' sgx_epc: @@ -537,6 +562,12 @@ components: items: type: integer + CpuFeatures: + type: object + properties: + amx: + type: boolean + CpuTopology: type: object properties: @@ -571,6 +602,8 @@ components: type: array items: $ref: '#/components/schemas/CpuAffinity' + features: + $ref: '#/components/schemas/CpuFeatures' PlatformConfig: type: object @@ -921,6 +954,26 @@ components: id: type: string + VdpaConfig: + required: + - path + - num_queues + type: object + properties: + path: + type: string + num_queues: + type: integer + default: 1 + iommu: + type: boolean + default: false + pci_segment: + type: integer + format: int16 + id: + type: string + VsockConfig: required: - cid