diff --git a/versions.yaml b/versions.yaml index 671263a2d8..d5f02d608e 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: "stable/v0.5.x" + version: "df794993f8abe20f829275c77fb2a52ed485f70a" firecracker: description: "Firecracker micro-VMM" diff --git a/virtcontainers/pkg/cloud-hypervisor/client/README.md b/virtcontainers/pkg/cloud-hypervisor/client/README.md index b3affe8b71..8872c9ecdb 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -40,6 +40,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**ResumeVM**](docs/DefaultApi.md#resumevm) | **Put** /vm.resume | Resume a previously paused VM instance. *DefaultApi* | [**ShutdownVM**](docs/DefaultApi.md#shutdownvm) | **Put** /vm.shutdown | Shut the VM instance down. *DefaultApi* | [**ShutdownVMM**](docs/DefaultApi.md#shutdownvmm) | **Put** /vmm.shutdown | Shuts the cloud-hypervisor VMM. +*DefaultApi* | [**VmAddDevicePut**](docs/DefaultApi.md#vmadddeviceput) | **Put** /vm.add-device | Add a new device to the VM *DefaultApi* | [**VmInfoGet**](docs/DefaultApi.md#vminfoget) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. *DefaultApi* | [**VmResizePut**](docs/DefaultApi.md#vmresizeput) | **Put** /vm.resize | Resize the VM *DefaultApi* | [**VmmPingGet**](docs/DefaultApi.md#vmmpingget) | **Get** /vmm.ping | Ping the VMM to check for API server availability @@ -58,8 +59,7 @@ Class | Method | HTTP request | Description - [NetConfig](docs/NetConfig.md) - [PmemConfig](docs/PmemConfig.md) - [RngConfig](docs/RngConfig.md) - - [VhostUserBlkConfig](docs/VhostUserBlkConfig.md) - - [VhostUserNetConfig](docs/VhostUserNetConfig.md) + - [VmAddDevice](docs/VmAddDevice.md) - [VmConfig](docs/VmConfig.md) - [VmInfo](docs/VmInfo.md) - [VmResize](docs/VmResize.md) diff --git a/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml b/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml index edb23b1f3d..d9da94bc9c 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -128,6 +128,21 @@ paths: "404": description: The VM instance could not be resized because it is not created. summary: Resize the VM + /vm.add-device: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/VmAddDevice' + description: The path of the new device + required: true + responses: + "204": + description: The new device was successfully added to the VM instance. + "404": + description: The new device could not be added to the VM instance. + summary: Add a new device to the VM components: schemas: VmmPingResponse: @@ -161,7 +176,9 @@ components: queue_size: 5 vhost_socket: vhost_socket vhost_user: false + direct: false wce: true + poll_queue: true - path: path num_queues: 5 readonly: false @@ -169,7 +186,9 @@ components: queue_size: 5 vhost_socket: vhost_socket vhost_user: false + direct: false wce: true + poll_queue: true cpus: boot_vcpus: 1 max_vcpus: 1 @@ -180,15 +199,6 @@ components: iommu: false kernel: path: path - vhost_user_blk: - - sock: sock - num_queues: 1 - queue_size: 1 - wce: true - - sock: sock - num_queues: 1 - queue_size: 1 - wce: true rng: iommu: false src: /dev/urandom @@ -205,15 +215,6 @@ components: cache_size: 2 dax: true tag: tag - vhost_user_net: - - sock: sock - num_queues: 7 - queue_size: 1 - mac: mac - - sock: sock - num_queues: 7 - queue_size: 1 - mac: mac vsock: - sock: sock iommu: false @@ -262,8 +263,9 @@ components: state: enum: - Created - - Booted + - Running - Shutdown + - Paused type: string required: - config @@ -288,7 +290,9 @@ components: queue_size: 5 vhost_socket: vhost_socket vhost_user: false + direct: false wce: true + poll_queue: true - path: path num_queues: 5 readonly: false @@ -296,7 +300,9 @@ components: queue_size: 5 vhost_socket: vhost_socket vhost_user: false + direct: false wce: true + poll_queue: true cpus: boot_vcpus: 1 max_vcpus: 1 @@ -307,15 +313,6 @@ components: iommu: false kernel: path: path - vhost_user_blk: - - sock: sock - num_queues: 1 - queue_size: 1 - wce: true - - sock: sock - num_queues: 1 - queue_size: 1 - wce: true rng: iommu: false src: /dev/urandom @@ -332,15 +329,6 @@ components: cache_size: 2 dax: true tag: tag - vhost_user_net: - - sock: sock - num_queues: 7 - queue_size: 1 - mac: mac - - sock: sock - num_queues: 7 - queue_size: 1 - mac: mac vsock: - sock: sock iommu: false @@ -418,14 +406,6 @@ components: items: $ref: '#/components/schemas/DeviceConfig' type: array - vhost_user_net: - items: - $ref: '#/components/schemas/VhostUserNetConfig' - type: array - vhost_user_blk: - items: - $ref: '#/components/schemas/VhostUserBlkConfig' - type: array vsock: items: $ref: '#/components/schemas/VsockConfig' @@ -498,13 +478,18 @@ components: queue_size: 5 vhost_socket: vhost_socket vhost_user: false + direct: false wce: true + poll_queue: true properties: path: type: string readonly: default: false type: boolean + direct: + default: false + type: boolean iommu: default: false type: boolean @@ -522,6 +507,9 @@ components: wce: default: true type: boolean + poll_queue: + default: true + type: boolean required: - path type: object @@ -641,7 +629,7 @@ components: - "false" - Tty - File - - None + - null type: string iommu: default: false @@ -662,47 +650,6 @@ components: required: - path type: object - VhostUserNetConfig: - example: - sock: sock - num_queues: 7 - queue_size: 1 - mac: mac - properties: - sock: - type: string - num_queues: - default: 2 - type: integer - queue_size: - default: 256 - type: integer - mac: - type: string - required: - - sock - type: object - VhostUserBlkConfig: - example: - sock: sock - num_queues: 1 - queue_size: 1 - wce: true - properties: - sock: - type: string - num_queues: - default: 1 - type: integer - queue_size: - default: 128 - type: integer - wce: - default: true - type: boolean - required: - - sock - type: object VsockConfig: example: sock: sock @@ -735,3 +682,10 @@ components: desired_ram: type: integer type: object + VmAddDevice: + example: + path: path + properties: + path: + type: string + type: object diff --git a/virtcontainers/pkg/cloud-hypervisor/client/api_default.go b/virtcontainers/pkg/cloud-hypervisor/client/api_default.go index 53e0c516be..c73202bf7e 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/api_default.go +++ b/virtcontainers/pkg/cloud-hypervisor/client/api_default.go @@ -531,6 +531,72 @@ func (a *DefaultApiService) ShutdownVMM(ctx _context.Context) (*_nethttp.Respons return localVarHTTPResponse, nil } +/* +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(). + * @param vmAddDevice The path of the new device +*/ +func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context, vmAddDevice VmAddDevice) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/vm.add-device" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &vmAddDevice + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + /* 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(). diff --git a/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md index 535d9c69d2..74c9e3a3f1 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**ResumeVM**](DefaultApi.md#ResumeVM) | **Put** /vm.resume | Resume a previously paused VM instance. [**ShutdownVM**](DefaultApi.md#ShutdownVM) | **Put** /vm.shutdown | Shut the VM instance down. [**ShutdownVMM**](DefaultApi.md#ShutdownVMM) | **Put** /vmm.shutdown | Shuts the cloud-hypervisor VMM. +[**VmAddDevicePut**](DefaultApi.md#VmAddDevicePut) | **Put** /vm.add-device | Add a new device to the VM [**VmInfoGet**](DefaultApi.md#VmInfoGet) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. [**VmResizePut**](DefaultApi.md#VmResizePut) | **Put** /vm.resize | Resize the VM [**VmmPingGet**](DefaultApi.md#VmmPingGet) | **Get** /vmm.ping | Ping the VMM to check for API server availability @@ -246,6 +247,38 @@ No authorization required [[Back to README]](../README.md) +## VmAddDevicePut + +> VmAddDevicePut(ctx, vmAddDevice) + +Add a new device to the VM + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**vmAddDevice** | [**VmAddDevice**](VmAddDevice.md)| The path of the new device | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[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) + + ## VmInfoGet > VmInfo VmInfoGet(ctx, ) diff --git a/virtcontainers/pkg/cloud-hypervisor/client/docs/DiskConfig.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/DiskConfig.md index 9345f0bfc8..8df1b43153 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/docs/DiskConfig.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/DiskConfig.md @@ -6,12 +6,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Path** | **string** | | **Readonly** | **bool** | | [optional] [default to false] +**Direct** | **bool** | | [optional] [default to false] **Iommu** | **bool** | | [optional] [default to false] **NumQueues** | **int32** | | [optional] [default to 1] **QueueSize** | **int32** | | [optional] [default to 128] **VhostUser** | **bool** | | [optional] [default to false] **VhostSocket** | **string** | | [optional] **Wce** | **bool** | | [optional] [default to true] +**PollQueue** | **bool** | | [optional] [default to true] [[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/virtcontainers/pkg/cloud-hypervisor/client/docs/VhostUserBlkConfig.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/VhostUserBlkConfig.md deleted file mode 100644 index 6b36c78b90..0000000000 --- a/virtcontainers/pkg/cloud-hypervisor/client/docs/VhostUserBlkConfig.md +++ /dev/null @@ -1,14 +0,0 @@ -# VhostUserBlkConfig - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Sock** | **string** | | -**NumQueues** | **int32** | | [optional] [default to 1] -**QueueSize** | **int32** | | [optional] [default to 128] -**Wce** | **bool** | | [optional] [default to true] - -[[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/virtcontainers/pkg/cloud-hypervisor/client/docs/VhostUserNetConfig.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md similarity index 57% rename from virtcontainers/pkg/cloud-hypervisor/client/docs/VhostUserNetConfig.md rename to virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md index 0a11429d80..e281db1380 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/docs/VhostUserNetConfig.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md @@ -1,13 +1,10 @@ -# VhostUserNetConfig +# VmAddDevice ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Sock** | **string** | | -**NumQueues** | **int32** | | [optional] [default to 2] -**QueueSize** | **int32** | | [optional] [default to 256] -**Mac** | **string** | | [optional] +**Path** | **string** | | [optional] [[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/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md index 1c5eb6672d..ef62495a7b 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md @@ -16,8 +16,6 @@ Name | Type | Description | Notes **Serial** | [**ConsoleConfig**](ConsoleConfig.md) | | [optional] **Console** | [**ConsoleConfig**](ConsoleConfig.md) | | [optional] **Devices** | [**[]DeviceConfig**](DeviceConfig.md) | | [optional] -**VhostUserNet** | [**[]VhostUserNetConfig**](VhostUserNetConfig.md) | | [optional] -**VhostUserBlk** | [**[]VhostUserBlkConfig**](VhostUserBlkConfig.md) | | [optional] **Vsock** | [**[]VsockConfig**](VsockConfig.md) | | [optional] **Iommu** | **bool** | | [optional] [default to false] diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go index 79e56828a1..a88faba7b1 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go +++ b/virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go @@ -12,10 +12,12 @@ package openapi type DiskConfig struct { Path string `json:"path"` Readonly bool `json:"readonly,omitempty"` + Direct bool `json:"direct,omitempty"` Iommu bool `json:"iommu,omitempty"` NumQueues int32 `json:"num_queues,omitempty"` QueueSize int32 `json:"queue_size,omitempty"` VhostUser bool `json:"vhost_user,omitempty"` VhostSocket string `json:"vhost_socket,omitempty"` Wce bool `json:"wce,omitempty"` + PollQueue bool `json:"poll_queue,omitempty"` } diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_vhost_user_blk_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_vhost_user_blk_config.go deleted file mode 100644 index 62e3b309cf..0000000000 --- a/virtcontainers/pkg/cloud-hypervisor/client/model_vhost_user_blk_config.go +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Cloud Hypervisor API - * - * Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. - * - * API version: 0.3.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package openapi -// VhostUserBlkConfig struct for VhostUserBlkConfig -type VhostUserBlkConfig struct { - Sock string `json:"sock"` - NumQueues int32 `json:"num_queues,omitempty"` - QueueSize int32 `json:"queue_size,omitempty"` - Wce bool `json:"wce,omitempty"` -} diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_vhost_user_net_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_vhost_user_net_config.go deleted file mode 100644 index 3f1979c6fe..0000000000 --- a/virtcontainers/pkg/cloud-hypervisor/client/model_vhost_user_net_config.go +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Cloud Hypervisor API - * - * Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. - * - * API version: 0.3.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -package openapi -// VhostUserNetConfig struct for VhostUserNetConfig -type VhostUserNetConfig struct { - Sock string `json:"sock"` - NumQueues int32 `json:"num_queues,omitempty"` - QueueSize int32 `json:"queue_size,omitempty"` - Mac string `json:"mac,omitempty"` -} diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go b/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go new file mode 100644 index 0000000000..ee96b9b9cd --- /dev/null +++ b/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go @@ -0,0 +1,14 @@ +/* + * Cloud Hypervisor API + * + * Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. + * + * API version: 0.3.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi +// VmAddDevice struct for VmAddDevice +type VmAddDevice struct { + Path string `json:"path,omitempty"` +} diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go index 985ff73666..0c48392538 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go +++ b/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go @@ -22,8 +22,6 @@ type VmConfig struct { Serial ConsoleConfig `json:"serial,omitempty"` Console ConsoleConfig `json:"console,omitempty"` Devices []DeviceConfig `json:"devices,omitempty"` - VhostUserNet []VhostUserNetConfig `json:"vhost_user_net,omitempty"` - VhostUserBlk []VhostUserBlkConfig `json:"vhost_user_blk,omitempty"` Vsock []VsockConfig `json:"vsock,omitempty"` Iommu bool `json:"iommu,omitempty"` } diff --git a/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index 926e710a2c..fdbc088671 100644 --- a/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -139,6 +139,22 @@ paths: 404: description: The VM instance could not be resized because it is not created. + /vm.add-device: + put: + summary: Add a new device to the VM + requestBody: + description: The path of the new device + content: + application/json: + schema: + $ref: '#/components/schemas/VmAddDevice' + required: true + responses: + 204: + description: The new device was successfully added to the VM instance. + 404: + description: The new device could not be added to the VM instance. + components: schemas: @@ -161,7 +177,7 @@ components: $ref: '#/components/schemas/VmConfig' state: type: string - enum: [Created, Booted, Shutdown] + enum: [Created, Running, Shutdown, Paused] description: Virtual Machine information VmConfig: @@ -204,14 +220,6 @@ components: type: array items: $ref: '#/components/schemas/DeviceConfig' - vhost_user_net: - type: array - items: - $ref: '#/components/schemas/VhostUserNetConfig' - vhost_user_blk: - type: array - items: - $ref: '#/components/schemas/VhostUserBlkConfig' vsock: type: array items: @@ -277,6 +285,9 @@ components: readonly: type: boolean default: false + direct: + type: boolean + default: false iommu: type: boolean default: false @@ -294,6 +305,9 @@ components: wce: type: boolean default: true + poll_queue: + type: boolean + default: true NetConfig: type: object @@ -387,7 +401,7 @@ components: type: string mode: type: string - enum: [Off, Tty, File, None] + enum: [Off, Tty, File, Null] iommu: type: boolean default: false @@ -403,39 +417,6 @@ components: type: boolean default: false - VhostUserNetConfig: - required: - - sock - type: object - properties: - sock: - type: string - num_queues: - type: integer - default: 2 - queue_size: - type: integer - default: 256 - mac: - type: string - - VhostUserBlkConfig: - required: - - sock - type: object - properties: - sock: - type: string - num_queues: - type: integer - default: 1 - queue_size: - type: integer - default: 128 - wce: - type: boolean - default: true - VsockConfig: required: - cid @@ -462,3 +443,9 @@ components: type: integer desired_ram: type: integer + + VmAddDevice: + type: object + properties: + path: + type: string