diff --git a/versions.yaml b/versions.yaml index c35010808..69aacfa0f 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: "c1e6d0022b220ecba25a10f61d0025a408d90a94" + version: "a8ec8f3326628d34021ccae0f259a9509ff1e6da" firecracker: description: "Firecracker micro-VMM" diff --git a/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/VERSION b/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/VERSION index bfbf77eb7..b5d898602 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/VERSION +++ b/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.0-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/virtcontainers/pkg/cloud-hypervisor/client/README.md b/virtcontainers/pkg/cloud-hypervisor/client/README.md index c6b967cd2..3503d1baa 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -41,9 +41,14 @@ Class | Method | HTTP request | Description *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* | [**VmAddDiskPut**](docs/DefaultApi.md#vmadddiskput) | **Put** /vm.add-disk | Add a new disk 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* | [**VmInfoGet**](docs/DefaultApi.md#vminfoget) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. *DefaultApi* | [**VmRemoveDevicePut**](docs/DefaultApi.md#vmremovedeviceput) | **Put** /vm.remove-device | Remove a device from the VM *DefaultApi* | [**VmResizePut**](docs/DefaultApi.md#vmresizeput) | **Put** /vm.resize | Resize the VM +*DefaultApi* | [**VmRestorePut**](docs/DefaultApi.md#vmrestoreput) | **Put** /vm.restore | Restore a VM from a snapshot. +*DefaultApi* | [**VmSnapshotPut**](docs/DefaultApi.md#vmsnapshotput) | **Put** /vm.snapshot | Returns a VM snapshot. *DefaultApi* | [**VmmPingGet**](docs/DefaultApi.md#vmmpingget) | **Get** /vmm.ping | Ping the VMM to check for API server availability @@ -55,16 +60,19 @@ Class | Method | HTTP request | Description - [DeviceConfig](docs/DeviceConfig.md) - [DiskConfig](docs/DiskConfig.md) - [FsConfig](docs/FsConfig.md) + - [InitramfsConfig](docs/InitramfsConfig.md) - [KernelConfig](docs/KernelConfig.md) - [MemoryConfig](docs/MemoryConfig.md) - [NetConfig](docs/NetConfig.md) - [PmemConfig](docs/PmemConfig.md) + - [RestoreConfig](docs/RestoreConfig.md) - [RngConfig](docs/RngConfig.md) - [VmAddDevice](docs/VmAddDevice.md) - [VmConfig](docs/VmConfig.md) - [VmInfo](docs/VmInfo.md) - [VmRemoveDevice](docs/VmRemoveDevice.md) - [VmResize](docs/VmResize.md) + - [VmSnapshotConfig](docs/VmSnapshotConfig.md) - [VmmPingResponse](docs/VmmPingResponse.md) - [VsockConfig](docs/VsockConfig.md) diff --git a/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml b/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml index 5dcc8f25a..3d0eef035 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -158,6 +158,86 @@ paths: "404": description: The device could not be removed from the VM instance. summary: Remove a device from the VM + /vm.add-disk: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DiskConfig' + description: The details of the new disk + required: true + responses: + "204": + description: The new disk was successfully added to the VM instance. + "500": + description: The new disk could not be added to the VM instance. + summary: Add a new disk to the VM + /vm.add-pmem: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PmemConfig' + description: The details of the new pmem device + required: true + responses: + "204": + description: The new device was successfully added to the VM instance. + "500": + description: The new device could not be added to the VM instance. + summary: Add a new pmem device to the VM + /vm.add-net: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NetConfig' + description: The details of the new network device + required: true + responses: + "204": + description: The new device was successfully added to the VM instance. + "500": + description: The new device could not be added to the VM instance. + summary: Add a new network device to the VM + /vm.snapshot: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/VmSnapshotConfig' + description: The snapshot configuration + required: true + responses: + "204": + description: The VM instance was successfully snapshotted. + "404": + description: The VM instance could not be snapshotted because it is not + created. + "405": + description: The VM instance could not be snapshotted because it is not + booted. + summary: Returns a VM snapshot. + /vm.restore: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RestoreConfig' + description: The restore configuration + required: true + responses: + "204": + description: The VM instance was successfully restored. + "404": + description: The VM instance could not be restored because it is already + created. + summary: Restore a VM from a snapshot. components: schemas: VmmPingResponse: @@ -184,6 +264,7 @@ components: file: file size: 1 hotplug_size: 5 + hotplug_method: acpi disks: - path: path num_queues: 5 @@ -258,6 +339,8 @@ components: mode: "false" file: file iommu: false + initramfs: + path: path net: - tap: tap num_queues: 7 @@ -303,6 +386,7 @@ components: file: file size: 1 hotplug_size: 5 + hotplug_method: acpi disks: - path: path num_queues: 5 @@ -377,6 +461,8 @@ components: mode: "false" file: file iommu: false + initramfs: + path: path net: - tap: tap num_queues: 7 @@ -403,6 +489,8 @@ components: $ref: '#/components/schemas/MemoryConfig' kernel: $ref: '#/components/schemas/KernelConfig' + initramfs: + $ref: '#/components/schemas/InitramfsConfig' cmdline: $ref: '#/components/schemas/CmdLineConfig' disks: @@ -465,6 +553,7 @@ components: file: file size: 1 hotplug_size: 5 + hotplug_method: acpi properties: size: format: int64 @@ -477,6 +566,9 @@ components: mergeable: default: false type: boolean + hotplug_method: + default: acpi + type: string required: - size type: object @@ -489,6 +581,16 @@ components: required: - path type: object + InitramfsConfig: + example: + path: path + nullable: true + properties: + path: + type: string + required: + - path + type: object CmdLineConfig: example: args: args @@ -734,3 +836,22 @@ components: id: type: string type: object + VmSnapshotConfig: + example: + destination_url: destination_url + properties: + destination_url: + type: string + type: object + RestoreConfig: + example: + prefault: true + source_url: source_url + properties: + source_url: + type: string + prefault: + type: boolean + required: + - source_url + type: object diff --git a/virtcontainers/pkg/cloud-hypervisor/client/api_default.go b/virtcontainers/pkg/cloud-hypervisor/client/api_default.go index 87da4ded9..c68fda29a 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/api_default.go +++ b/virtcontainers/pkg/cloud-hypervisor/client/api_default.go @@ -597,6 +597,204 @@ func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context, vmAddDevice VmA return localVarHTTPResponse, nil } +/* +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(). + * @param diskConfig The details of the new disk +*/ +func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context, diskConfig DiskConfig) (*_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-disk" + 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 = &diskConfig + 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 +} + +/* +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(). + * @param netConfig The details of the new network device +*/ +func (a *DefaultApiService) VmAddNetPut(ctx _context.Context, netConfig NetConfig) (*_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-net" + 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 = &netConfig + 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 +} + +/* +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(). + * @param pmemConfig The details of the new pmem device +*/ +func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context, pmemConfig PmemConfig) (*_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-pmem" + 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 = &pmemConfig + 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(). @@ -656,15 +854,6 @@ func (a *DefaultApiService) VmInfoGet(ctx _context.Context) (VmInfo, *_nethttp.R body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 200 { - var v VmInfo - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -812,6 +1001,138 @@ func (a *DefaultApiService) VmResizePut(ctx _context.Context, vmResize VmResize) return localVarHTTPResponse, nil } +/* +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(). + * @param restoreConfig The restore configuration +*/ +func (a *DefaultApiService) VmRestorePut(ctx _context.Context, restoreConfig RestoreConfig) (*_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.restore" + 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 = &restoreConfig + 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 +} + +/* +VmSnapshotPut Returns a VM snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param vmSnapshotConfig The snapshot configuration +*/ +func (a *DefaultApiService) VmSnapshotPut(ctx _context.Context, vmSnapshotConfig VmSnapshotConfig) (*_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.snapshot" + 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 = &vmSnapshotConfig + 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 +} + /* 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(). @@ -871,15 +1192,6 @@ func (a *DefaultApiService) VmmPingGet(ctx _context.Context) (VmmPingResponse, * body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 200 { - var v VmmPingResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - } return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md index 3aafd1396..d414fadfd 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md @@ -13,9 +13,14 @@ Method | HTTP request | Description [**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 +[**VmAddDiskPut**](DefaultApi.md#VmAddDiskPut) | **Put** /vm.add-disk | Add a new disk 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 [**VmInfoGet**](DefaultApi.md#VmInfoGet) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. [**VmRemoveDevicePut**](DefaultApi.md#VmRemoveDevicePut) | **Put** /vm.remove-device | Remove a device from the VM [**VmResizePut**](DefaultApi.md#VmResizePut) | **Put** /vm.resize | Resize the VM +[**VmRestorePut**](DefaultApi.md#VmRestorePut) | **Put** /vm.restore | Restore a VM from a snapshot. +[**VmSnapshotPut**](DefaultApi.md#VmSnapshotPut) | **Put** /vm.snapshot | Returns a VM snapshot. [**VmmPingGet**](DefaultApi.md#VmmPingGet) | **Get** /vmm.ping | Ping the VMM to check for API server availability @@ -280,6 +285,102 @@ No authorization required [[Back to README]](../README.md) +## VmAddDiskPut + +> VmAddDiskPut(ctx, diskConfig) + +Add a new disk to the VM + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**diskConfig** | [**DiskConfig**](DiskConfig.md)| The details of the new disk | + +### 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) + + +## VmAddNetPut + +> VmAddNetPut(ctx, netConfig) + +Add a new network device to the VM + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**netConfig** | [**NetConfig**](NetConfig.md)| The details of the new network 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) + + +## VmAddPmemPut + +> VmAddPmemPut(ctx, pmemConfig) + +Add a new pmem device to the VM + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**pmemConfig** | [**PmemConfig**](PmemConfig.md)| The details of the new pmem 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, ) @@ -372,6 +473,70 @@ No authorization required [[Back to README]](../README.md) +## VmRestorePut + +> VmRestorePut(ctx, restoreConfig) + +Restore a VM from a snapshot. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**restoreConfig** | [**RestoreConfig**](RestoreConfig.md)| The restore configuration | + +### 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) + + +## VmSnapshotPut + +> VmSnapshotPut(ctx, vmSnapshotConfig) + +Returns a VM snapshot. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**vmSnapshotConfig** | [**VmSnapshotConfig**](VmSnapshotConfig.md)| The snapshot configuration | + +### 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) + + ## VmmPingGet > VmmPingResponse VmmPingGet(ctx, ) diff --git a/virtcontainers/pkg/cloud-hypervisor/client/docs/InitramfsConfig.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/InitramfsConfig.md new file mode 100644 index 000000000..726938f23 --- /dev/null +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/InitramfsConfig.md @@ -0,0 +1,11 @@ +# InitramfsConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Path** | **string** | | + +[[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/MemoryConfig.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md index 493419008..30ae9e018 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **HotplugSize** | **int64** | | [optional] **File** | **string** | | [optional] **Mergeable** | **bool** | | [optional] [default to false] +**HotplugMethod** | **string** | | [optional] [default to acpi] [[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/RestoreConfig.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/RestoreConfig.md new file mode 100644 index 000000000..c9d8f5ef0 --- /dev/null +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/RestoreConfig.md @@ -0,0 +1,12 @@ +# RestoreConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceUrl** | **string** | | +**Prefault** | **bool** | | [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 ef62495a7..08c142d47 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **Cpus** | [**CpusConfig**](CpusConfig.md) | | [optional] **Memory** | [**MemoryConfig**](MemoryConfig.md) | | [optional] **Kernel** | [**KernelConfig**](KernelConfig.md) | | +**Initramfs** | Pointer to [**InitramfsConfig**](InitramfsConfig.md) | | [optional] **Cmdline** | [**CmdLineConfig**](CmdLineConfig.md) | | **Disks** | [**[]DiskConfig**](DiskConfig.md) | | [optional] **Net** | [**[]NetConfig**](NetConfig.md) | | [optional] diff --git a/virtcontainers/pkg/cloud-hypervisor/client/docs/VmSnapshotConfig.md b/virtcontainers/pkg/cloud-hypervisor/client/docs/VmSnapshotConfig.md new file mode 100644 index 000000000..548261095 --- /dev/null +++ b/virtcontainers/pkg/cloud-hypervisor/client/docs/VmSnapshotConfig.md @@ -0,0 +1,11 @@ +# VmSnapshotConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DestinationUrl** | **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/model_initramfs_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_initramfs_config.go new file mode 100644 index 000000000..3b361c126 --- /dev/null +++ b/virtcontainers/pkg/cloud-hypervisor/client/model_initramfs_config.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 +// InitramfsConfig struct for InitramfsConfig +type InitramfsConfig struct { + Path string `json:"path"` +} diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go index e96e90320..3d4831c65 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go +++ b/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go @@ -14,4 +14,5 @@ type MemoryConfig struct { HotplugSize int64 `json:"hotplug_size,omitempty"` File string `json:"file,omitempty"` Mergeable bool `json:"mergeable,omitempty"` + HotplugMethod string `json:"hotplug_method,omitempty"` } diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_restore_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_restore_config.go new file mode 100644 index 000000000..713cf1b3c --- /dev/null +++ b/virtcontainers/pkg/cloud-hypervisor/client/model_restore_config.go @@ -0,0 +1,15 @@ +/* + * 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 +// RestoreConfig struct for RestoreConfig +type RestoreConfig struct { + SourceUrl string `json:"source_url"` + Prefault bool `json:"prefault,omitempty"` +} diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go index 0c4839253..aa95e3324 100644 --- a/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go +++ b/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go @@ -13,6 +13,7 @@ type VmConfig struct { Cpus CpusConfig `json:"cpus,omitempty"` Memory MemoryConfig `json:"memory,omitempty"` Kernel KernelConfig `json:"kernel"` + Initramfs *InitramfsConfig `json:"initramfs,omitempty"` Cmdline CmdLineConfig `json:"cmdline"` Disks []DiskConfig `json:"disks,omitempty"` Net []NetConfig `json:"net,omitempty"` diff --git a/virtcontainers/pkg/cloud-hypervisor/client/model_vm_snapshot_config.go b/virtcontainers/pkg/cloud-hypervisor/client/model_vm_snapshot_config.go new file mode 100644 index 000000000..b029fff39 --- /dev/null +++ b/virtcontainers/pkg/cloud-hypervisor/client/model_vm_snapshot_config.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 +// VmSnapshotConfig struct for VmSnapshotConfig +type VmSnapshotConfig struct { + DestinationUrl string `json:"destination_url,omitempty"` +} diff --git a/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index fb3ec6dc6..4a79b1406 100644 --- a/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -171,6 +171,88 @@ paths: 404: description: The device could not be removed from the VM instance. + /vm.add-disk: + put: + summary: Add a new disk to the VM + requestBody: + description: The details of the new disk + content: + application/json: + schema: + $ref: '#/components/schemas/DiskConfig' + required: true + responses: + 204: + description: The new disk was successfully added to the VM instance. + 500: + description: The new disk could not be added to the VM instance. + + /vm.add-pmem: + put: + summary: Add a new pmem device to the VM + requestBody: + description: The details of the new pmem device + content: + application/json: + schema: + $ref: '#/components/schemas/PmemConfig' + required: true + responses: + 204: + description: The new device was successfully added to the VM instance. + 500: + description: The new device could not be added to the VM instance. + + /vm.add-net: + put: + summary: Add a new network device to the VM + requestBody: + description: The details of the new network device + content: + application/json: + schema: + $ref: '#/components/schemas/NetConfig' + required: true + responses: + 204: + description: The new device was successfully added to the VM instance. + 500: + description: The new device could not be added to the VM instance. + + /vm.snapshot: + put: + summary: Returns a VM snapshot. + requestBody: + description: The snapshot configuration + content: + application/json: + schema: + $ref: '#/components/schemas/VmSnapshotConfig' + required: true + responses: + 204: + description: The VM instance was successfully snapshotted. + 404: + description: The VM instance could not be snapshotted because it is not created. + 405: + description: The VM instance could not be snapshotted because it is not booted. + + /vm.restore: + put: + summary: Restore a VM from a snapshot. + requestBody: + description: The restore configuration + content: + application/json: + schema: + $ref: '#/components/schemas/RestoreConfig' + required: true + responses: + 204: + description: The VM instance was successfully restored. + 404: + description: The VM instance could not be restored because it is already created. + components: schemas: @@ -208,6 +290,8 @@ components: $ref: '#/components/schemas/MemoryConfig' kernel: $ref: '#/components/schemas/KernelConfig' + initramfs: + $ref: '#/components/schemas/InitramfsConfig' cmdline: $ref: '#/components/schemas/CmdLineConfig' disks: @@ -277,6 +361,9 @@ components: mergeable: type: boolean default: false + hotplug_method: + type: string + default: "acpi" KernelConfig: required: @@ -286,6 +373,15 @@ components: path: type: string + InitramfsConfig: + nullable: true + required: + - path + type: object + properties: + path: + type: string + CmdLineConfig: required: - args @@ -481,3 +577,19 @@ components: properties: id: type: string + + VmSnapshotConfig: + type: object + properties: + destination_url: + type: string + + RestoreConfig: + required: + - source_url + type: object + properties: + source_url: + type: string + prefault: + type: boolean