From 2d799cbfa3f1b13281bb57311d724d25f65ee890 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Thu, 20 Jan 2022 17:48:10 -0800 Subject: [PATCH] virtcontainers: clh: Re-generate the client code This patch re-generates the client code for Cloud Hypervisor v21.0. Note: The client code of cloud-hypervisor's (CLH) OpenAPI is automatically generated by openapi-generator [1-2]. [1] https://github.com/OpenAPITools/openapi-generator [2] https://github.com/kata-containers/kata-containers/blob/main/src/runtime/virtcontainers/pkg/cloud-hypervisor/README.md Signed-off-by: Bo Chen --- .../client/.openapi-generator/FILES | 4 + .../pkg/cloud-hypervisor/client/README.md | 4 + .../cloud-hypervisor/client/api/openapi.yaml | 80 +++++-- .../cloud-hypervisor/client/api_default.go | 200 ++++++++++++++++++ .../client/docs/DefaultApi.md | 126 +++++++++++ .../cloud-hypervisor/client/docs/NetConfig.md | 28 +-- .../client/docs/ReceiveMigrationData.md | 56 +++++ .../client/docs/SendMigrationData.md | 82 +++++++ .../client/model_net_config.go | 38 ++-- .../client/model_receive_migration_data.go | 113 ++++++++++ .../client/model_send_migration_data.go | 149 +++++++++++++ .../cloud-hypervisor/cloud-hypervisor.yaml | 49 ++++- 12 files changed, 875 insertions(+), 54 deletions(-) create mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/ReceiveMigrationData.md create mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/SendMigrationData.md create mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_receive_migration_data.go create mode 100644 src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_send_migration_data.go diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES index 44ecb19dfb..22dad792f0 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES @@ -27,8 +27,10 @@ docs/NumaDistance.md docs/PciDeviceInfo.md docs/PmemConfig.md docs/RateLimiterConfig.md +docs/ReceiveMigrationData.md docs/RestoreConfig.md docs/RngConfig.md +docs/SendMigrationData.md docs/SgxEpcConfig.md docs/TokenBucket.md docs/VmAddDevice.md @@ -63,8 +65,10 @@ model_numa_distance.go model_pci_device_info.go model_pmem_config.go model_rate_limiter_config.go +model_receive_migration_data.go model_restore_config.go model_rng_config.go +model_send_migration_data.go model_sgx_epc_config.go model_token_bucket.go model_vm_add_device.go diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md index f29bcf958a..b9829e33ea 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -95,10 +95,12 @@ Class | Method | HTTP request | Description *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. +*DefaultApi* | [**VmReceiveMigrationPut**](docs/DefaultApi.md#vmreceivemigrationput) | **Put** /vm.receive-migration | Receive a VM migration from URL *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* | [**VmResizeZonePut**](docs/DefaultApi.md#vmresizezoneput) | **Put** /vm.resize-zone | Resize a memory zone *DefaultApi* | [**VmRestorePut**](docs/DefaultApi.md#vmrestoreput) | **Put** /vm.restore | Restore a VM from a snapshot. +*DefaultApi* | [**VmSendMigrationPut**](docs/DefaultApi.md#vmsendmigrationput) | **Put** /vm.send-migration | Send a VM migration to URL *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 @@ -125,8 +127,10 @@ Class | Method | HTTP request | Description - [PciDeviceInfo](docs/PciDeviceInfo.md) - [PmemConfig](docs/PmemConfig.md) - [RateLimiterConfig](docs/RateLimiterConfig.md) + - [ReceiveMigrationData](docs/ReceiveMigrationData.md) - [RestoreConfig](docs/RestoreConfig.md) - [RngConfig](docs/RngConfig.md) + - [SendMigrationData](docs/SendMigrationData.md) - [SgxEpcConfig](docs/SgxEpcConfig.md) - [TokenBucket](docs/TokenBucket.md) - [VmAddDevice](docs/VmAddDevice.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml index fd963b0f4c..a00924ac5e 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -329,6 +329,36 @@ paths: description: The VM instance could not be restored because it is already created. summary: Restore a VM from a snapshot. + /vm.receive-migration: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ReceiveMigrationData' + description: The URL for the reception of migration state + required: true + responses: + "204": + description: The VM migration was successfully received. + "500": + description: The VM migration could not be received. + summary: Receive a VM migration from URL + /vm.send-migration: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SendMigrationData' + description: The URL for sending the migration state + required: true + responses: + "204": + description: The VM migration was successfully sent. + "500": + description: The VM migration could not be sent. + summary: Send a VM migration to URL components: schemas: VmmPingResponse: @@ -564,12 +594,12 @@ components: pci_segment: 6 vhost_mode: Client iommu: false + fds: + - 3 + - 3 vhost_socket: vhost_socket vhost_user: false id: id - fd: - - 3 - - 3 mask: 255.255.255.0 - tap: tap num_queues: 9 @@ -588,12 +618,12 @@ components: pci_segment: 6 vhost_mode: Client iommu: false + fds: + - 3 + - 3 vhost_socket: vhost_socket vhost_user: false id: id - fd: - - 3 - - 3 mask: 255.255.255.0 device_tree: key: @@ -892,12 +922,12 @@ components: pci_segment: 6 vhost_mode: Client iommu: false + fds: + - 3 + - 3 vhost_socket: vhost_socket vhost_user: false id: id - fd: - - 3 - - 3 mask: 255.255.255.0 - tap: tap num_queues: 9 @@ -916,12 +946,12 @@ components: pci_segment: 6 vhost_mode: Client iommu: false + fds: + - 3 + - 3 vhost_socket: vhost_socket vhost_user: false id: id - fd: - - 3 - - 3 mask: 255.255.255.0 properties: cpus: @@ -1326,16 +1356,15 @@ components: pci_segment: 6 vhost_mode: Client iommu: false + fds: + - 3 + - 3 vhost_socket: vhost_socket vhost_user: false id: id - fd: - - 3 - - 3 mask: 255.255.255.0 properties: tap: - default: "" type: string ip: default: 192.168.249.1 @@ -1364,7 +1393,7 @@ components: type: string id: type: string - fd: + fds: items: format: int32 type: integer @@ -1691,3 +1720,20 @@ components: required: - source_url type: object + ReceiveMigrationData: + example: + receiver_url: receiver_url + properties: + receiver_url: + type: string + type: object + SendMigrationData: + example: + destination_url: destination_url + local: true + properties: + destination_url: + type: string + local: + type: boolean + type: object 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 725b83c22a..9c696060e3 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go @@ -1694,6 +1694,106 @@ func (a *DefaultApiService) VmInfoGetExecute(r ApiVmInfoGetRequest) (VmInfo, *_n return localVarReturnValue, localVarHTTPResponse, nil } +type ApiVmReceiveMigrationPutRequest struct { + ctx _context.Context + ApiService *DefaultApiService + receiveMigrationData *ReceiveMigrationData +} + +// The URL for the reception of migration state +func (r ApiVmReceiveMigrationPutRequest) ReceiveMigrationData(receiveMigrationData ReceiveMigrationData) ApiVmReceiveMigrationPutRequest { + r.receiveMigrationData = &receiveMigrationData + return r +} + +func (r ApiVmReceiveMigrationPutRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.VmReceiveMigrationPutExecute(r) +} + +/* +VmReceiveMigrationPut Receive a VM migration from URL + + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmReceiveMigrationPutRequest +*/ +func (a *DefaultApiService) VmReceiveMigrationPut(ctx _context.Context) ApiVmReceiveMigrationPutRequest { + return ApiVmReceiveMigrationPutRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *DefaultApiService) VmReceiveMigrationPutExecute(r ApiVmReceiveMigrationPutRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.VmReceiveMigrationPut") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vm.receive-migration" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.receiveMigrationData == nil { + return nil, reportError("receiveMigrationData 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.receiveMigrationData + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + type ApiVmRemoveDevicePutRequest struct { ctx _context.Context ApiService *DefaultApiService @@ -2094,6 +2194,106 @@ func (a *DefaultApiService) VmRestorePutExecute(r ApiVmRestorePutRequest) (*_net return localVarHTTPResponse, nil } +type ApiVmSendMigrationPutRequest struct { + ctx _context.Context + ApiService *DefaultApiService + sendMigrationData *SendMigrationData +} + +// The URL for sending the migration state +func (r ApiVmSendMigrationPutRequest) SendMigrationData(sendMigrationData SendMigrationData) ApiVmSendMigrationPutRequest { + r.sendMigrationData = &sendMigrationData + return r +} + +func (r ApiVmSendMigrationPutRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.VmSendMigrationPutExecute(r) +} + +/* +VmSendMigrationPut Send a VM migration to URL + + @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVmSendMigrationPutRequest +*/ +func (a *DefaultApiService) VmSendMigrationPut(ctx _context.Context) ApiVmSendMigrationPutRequest { + return ApiVmSendMigrationPutRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *DefaultApiService) VmSendMigrationPutExecute(r ApiVmSendMigrationPutRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.VmSendMigrationPut") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vm.send-migration" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.sendMigrationData == nil { + return nil, reportError("sendMigrationData 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.sendMigrationData + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + type ApiVmSnapshotPutRequest struct { ctx _context.Context ApiService *DefaultApiService 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 1fa82cc9b8..3c2c8821d9 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md @@ -21,10 +21,12 @@ Method | HTTP request | Description [**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. +[**VmReceiveMigrationPut**](DefaultApi.md#VmReceiveMigrationPut) | **Put** /vm.receive-migration | Receive a VM migration from URL [**VmRemoveDevicePut**](DefaultApi.md#VmRemoveDevicePut) | **Put** /vm.remove-device | Remove a device from the VM [**VmResizePut**](DefaultApi.md#VmResizePut) | **Put** /vm.resize | Resize the VM [**VmResizeZonePut**](DefaultApi.md#VmResizeZonePut) | **Put** /vm.resize-zone | Resize a memory zone [**VmRestorePut**](DefaultApi.md#VmRestorePut) | **Put** /vm.restore | Restore a VM from a snapshot. +[**VmSendMigrationPut**](DefaultApi.md#VmSendMigrationPut) | **Put** /vm.send-migration | Send a VM migration to URL [**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 @@ -1050,6 +1052,68 @@ No authorization required [[Back to README]](../README.md) +## VmReceiveMigrationPut + +> VmReceiveMigrationPut(ctx).ReceiveMigrationData(receiveMigrationData).Execute() + +Receive a VM migration from URL + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + receiveMigrationData := *openapiclient.NewReceiveMigrationData() // ReceiveMigrationData | The URL for the reception of migration state + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.DefaultApi.VmReceiveMigrationPut(context.Background()).ReceiveMigrationData(receiveMigrationData).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.VmReceiveMigrationPut``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiVmReceiveMigrationPutRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **receiveMigrationData** | [**ReceiveMigrationData**](ReceiveMigrationData.md) | The URL for the reception of migration state | + +### 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) + + ## VmRemoveDevicePut > VmRemoveDevicePut(ctx).VmRemoveDevice(vmRemoveDevice).Execute() @@ -1298,6 +1362,68 @@ No authorization required [[Back to README]](../README.md) +## VmSendMigrationPut + +> VmSendMigrationPut(ctx).SendMigrationData(sendMigrationData).Execute() + +Send a VM migration to URL + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + sendMigrationData := *openapiclient.NewSendMigrationData() // SendMigrationData | The URL for sending the migration state + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.DefaultApi.VmSendMigrationPut(context.Background()).SendMigrationData(sendMigrationData).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.VmSendMigrationPut``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiVmSendMigrationPutRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sendMigrationData** | [**SendMigrationData**](SendMigrationData.md) | The URL for sending the migration state | + +### 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(vmSnapshotConfig).Execute() diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md index 6d7fc78de3..ff4f2dcfb1 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Tap** | Pointer to **string** | | [optional] [default to ""] +**Tap** | Pointer to **string** | | [optional] **Ip** | Pointer to **string** | | [optional] [default to "192.168.249.1"] **Mask** | Pointer to **string** | | [optional] [default to "255.255.255.0"] **Mac** | Pointer to **string** | | [optional] @@ -15,7 +15,7 @@ Name | Type | Description | Notes **VhostSocket** | Pointer to **string** | | [optional] **VhostMode** | Pointer to **string** | | [optional] [default to "Client"] **Id** | Pointer to **string** | | [optional] -**Fd** | Pointer to **[]int32** | | [optional] +**Fds** | Pointer to **[]int32** | | [optional] **PciSegment** | Pointer to **int32** | | [optional] **RateLimiterConfig** | Pointer to [**RateLimiterConfig**](RateLimiterConfig.md) | | [optional] @@ -313,30 +313,30 @@ SetId sets Id field to given value. HasId returns a boolean if a field has been set. -### GetFd +### GetFds -`func (o *NetConfig) GetFd() []int32` +`func (o *NetConfig) GetFds() []int32` -GetFd returns the Fd field if non-nil, zero value otherwise. +GetFds returns the Fds field if non-nil, zero value otherwise. -### GetFdOk +### GetFdsOk -`func (o *NetConfig) GetFdOk() (*[]int32, bool)` +`func (o *NetConfig) GetFdsOk() (*[]int32, bool)` -GetFdOk returns a tuple with the Fd field if it's non-nil, zero value otherwise +GetFdsOk returns a tuple with the Fds field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetFd +### SetFds -`func (o *NetConfig) SetFd(v []int32)` +`func (o *NetConfig) SetFds(v []int32)` -SetFd sets Fd field to given value. +SetFds sets Fds field to given value. -### HasFd +### HasFds -`func (o *NetConfig) HasFd() bool` +`func (o *NetConfig) HasFds() bool` -HasFd returns a boolean if a field has been set. +HasFds returns a boolean if a field has been set. ### GetPciSegment diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/ReceiveMigrationData.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/ReceiveMigrationData.md new file mode 100644 index 0000000000..652bf96bc2 --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/ReceiveMigrationData.md @@ -0,0 +1,56 @@ +# ReceiveMigrationData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ReceiverUrl** | Pointer to **string** | | [optional] + +## Methods + +### NewReceiveMigrationData + +`func NewReceiveMigrationData() *ReceiveMigrationData` + +NewReceiveMigrationData instantiates a new ReceiveMigrationData 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 + +### NewReceiveMigrationDataWithDefaults + +`func NewReceiveMigrationDataWithDefaults() *ReceiveMigrationData` + +NewReceiveMigrationDataWithDefaults instantiates a new ReceiveMigrationData 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 + +### GetReceiverUrl + +`func (o *ReceiveMigrationData) GetReceiverUrl() string` + +GetReceiverUrl returns the ReceiverUrl field if non-nil, zero value otherwise. + +### GetReceiverUrlOk + +`func (o *ReceiveMigrationData) GetReceiverUrlOk() (*string, bool)` + +GetReceiverUrlOk returns a tuple with the ReceiverUrl field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReceiverUrl + +`func (o *ReceiveMigrationData) SetReceiverUrl(v string)` + +SetReceiverUrl sets ReceiverUrl field to given value. + +### HasReceiverUrl + +`func (o *ReceiveMigrationData) HasReceiverUrl() bool` + +HasReceiverUrl 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/SendMigrationData.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/SendMigrationData.md new file mode 100644 index 0000000000..03edd489e8 --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/SendMigrationData.md @@ -0,0 +1,82 @@ +# SendMigrationData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DestinationUrl** | Pointer to **string** | | [optional] +**Local** | Pointer to **bool** | | [optional] + +## Methods + +### NewSendMigrationData + +`func NewSendMigrationData() *SendMigrationData` + +NewSendMigrationData instantiates a new SendMigrationData 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 + +### NewSendMigrationDataWithDefaults + +`func NewSendMigrationDataWithDefaults() *SendMigrationData` + +NewSendMigrationDataWithDefaults instantiates a new SendMigrationData 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 + +### GetDestinationUrl + +`func (o *SendMigrationData) GetDestinationUrl() string` + +GetDestinationUrl returns the DestinationUrl field if non-nil, zero value otherwise. + +### GetDestinationUrlOk + +`func (o *SendMigrationData) GetDestinationUrlOk() (*string, bool)` + +GetDestinationUrlOk returns a tuple with the DestinationUrl field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDestinationUrl + +`func (o *SendMigrationData) SetDestinationUrl(v string)` + +SetDestinationUrl sets DestinationUrl field to given value. + +### HasDestinationUrl + +`func (o *SendMigrationData) HasDestinationUrl() bool` + +HasDestinationUrl returns a boolean if a field has been set. + +### GetLocal + +`func (o *SendMigrationData) GetLocal() bool` + +GetLocal returns the Local field if non-nil, zero value otherwise. + +### GetLocalOk + +`func (o *SendMigrationData) GetLocalOk() (*bool, bool)` + +GetLocalOk returns a tuple with the Local field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLocal + +`func (o *SendMigrationData) SetLocal(v bool)` + +SetLocal sets Local field to given value. + +### HasLocal + +`func (o *SendMigrationData) HasLocal() bool` + +HasLocal returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go index 473c55441b..72bdb5422b 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go @@ -27,7 +27,7 @@ type NetConfig struct { VhostSocket *string `json:"vhost_socket,omitempty"` VhostMode *string `json:"vhost_mode,omitempty"` Id *string `json:"id,omitempty"` - Fd *[]int32 `json:"fd,omitempty"` + Fds *[]int32 `json:"fds,omitempty"` PciSegment *int32 `json:"pci_segment,omitempty"` RateLimiterConfig *RateLimiterConfig `json:"rate_limiter_config,omitempty"` } @@ -38,8 +38,6 @@ type NetConfig struct { // will change when the set of required properties is changed func NewNetConfig() *NetConfig { this := NetConfig{} - var tap string = "" - this.Tap = &tap var ip string = "192.168.249.1" this.Ip = &ip var mask string = "255.255.255.0" @@ -62,8 +60,6 @@ func NewNetConfig() *NetConfig { // but it doesn't guarantee that properties required by API are set func NewNetConfigWithDefaults() *NetConfig { this := NetConfig{} - var tap string = "" - this.Tap = &tap var ip string = "192.168.249.1" this.Ip = &ip var mask string = "255.255.255.0" @@ -433,36 +429,36 @@ func (o *NetConfig) SetId(v string) { o.Id = &v } -// GetFd returns the Fd field value if set, zero value otherwise. -func (o *NetConfig) GetFd() []int32 { - if o == nil || o.Fd == nil { +// GetFds returns the Fds field value if set, zero value otherwise. +func (o *NetConfig) GetFds() []int32 { + if o == nil || o.Fds == nil { var ret []int32 return ret } - return *o.Fd + return *o.Fds } -// GetFdOk returns a tuple with the Fd field value if set, nil otherwise +// GetFdsOk returns a tuple with the Fds field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *NetConfig) GetFdOk() (*[]int32, bool) { - if o == nil || o.Fd == nil { +func (o *NetConfig) GetFdsOk() (*[]int32, bool) { + if o == nil || o.Fds == nil { return nil, false } - return o.Fd, true + return o.Fds, true } -// HasFd returns a boolean if a field has been set. -func (o *NetConfig) HasFd() bool { - if o != nil && o.Fd != nil { +// HasFds returns a boolean if a field has been set. +func (o *NetConfig) HasFds() bool { + if o != nil && o.Fds != nil { return true } return false } -// SetFd gets a reference to the given []int32 and assigns it to the Fd field. -func (o *NetConfig) SetFd(v []int32) { - o.Fd = &v +// SetFds gets a reference to the given []int32 and assigns it to the Fds field. +func (o *NetConfig) SetFds(v []int32) { + o.Fds = &v } // GetPciSegment returns the PciSegment field value if set, zero value otherwise. @@ -564,8 +560,8 @@ func (o NetConfig) MarshalJSON() ([]byte, error) { if o.Id != nil { toSerialize["id"] = o.Id } - if o.Fd != nil { - toSerialize["fd"] = o.Fd + if o.Fds != nil { + toSerialize["fds"] = o.Fds } if o.PciSegment != nil { toSerialize["pci_segment"] = o.PciSegment diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_receive_migration_data.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_receive_migration_data.go new file mode 100644 index 0000000000..fd7e6eff79 --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_receive_migration_data.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" +) + +// ReceiveMigrationData struct for ReceiveMigrationData +type ReceiveMigrationData struct { + ReceiverUrl *string `json:"receiver_url,omitempty"` +} + +// NewReceiveMigrationData instantiates a new ReceiveMigrationData 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 NewReceiveMigrationData() *ReceiveMigrationData { + this := ReceiveMigrationData{} + return &this +} + +// NewReceiveMigrationDataWithDefaults instantiates a new ReceiveMigrationData 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 NewReceiveMigrationDataWithDefaults() *ReceiveMigrationData { + this := ReceiveMigrationData{} + return &this +} + +// GetReceiverUrl returns the ReceiverUrl field value if set, zero value otherwise. +func (o *ReceiveMigrationData) GetReceiverUrl() string { + if o == nil || o.ReceiverUrl == nil { + var ret string + return ret + } + return *o.ReceiverUrl +} + +// GetReceiverUrlOk returns a tuple with the ReceiverUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReceiveMigrationData) GetReceiverUrlOk() (*string, bool) { + if o == nil || o.ReceiverUrl == nil { + return nil, false + } + return o.ReceiverUrl, true +} + +// HasReceiverUrl returns a boolean if a field has been set. +func (o *ReceiveMigrationData) HasReceiverUrl() bool { + if o != nil && o.ReceiverUrl != nil { + return true + } + + return false +} + +// SetReceiverUrl gets a reference to the given string and assigns it to the ReceiverUrl field. +func (o *ReceiveMigrationData) SetReceiverUrl(v string) { + o.ReceiverUrl = &v +} + +func (o ReceiveMigrationData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ReceiverUrl != nil { + toSerialize["receiver_url"] = o.ReceiverUrl + } + return json.Marshal(toSerialize) +} + +type NullableReceiveMigrationData struct { + value *ReceiveMigrationData + isSet bool +} + +func (v NullableReceiveMigrationData) Get() *ReceiveMigrationData { + return v.value +} + +func (v *NullableReceiveMigrationData) Set(val *ReceiveMigrationData) { + v.value = val + v.isSet = true +} + +func (v NullableReceiveMigrationData) IsSet() bool { + return v.isSet +} + +func (v *NullableReceiveMigrationData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReceiveMigrationData(val *ReceiveMigrationData) *NullableReceiveMigrationData { + return &NullableReceiveMigrationData{value: val, isSet: true} +} + +func (v NullableReceiveMigrationData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReceiveMigrationData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_send_migration_data.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_send_migration_data.go new file mode 100644 index 0000000000..11f913bf02 --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_send_migration_data.go @@ -0,0 +1,149 @@ +/* +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" +) + +// SendMigrationData struct for SendMigrationData +type SendMigrationData struct { + DestinationUrl *string `json:"destination_url,omitempty"` + Local *bool `json:"local,omitempty"` +} + +// NewSendMigrationData instantiates a new SendMigrationData 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 NewSendMigrationData() *SendMigrationData { + this := SendMigrationData{} + return &this +} + +// NewSendMigrationDataWithDefaults instantiates a new SendMigrationData 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 NewSendMigrationDataWithDefaults() *SendMigrationData { + this := SendMigrationData{} + return &this +} + +// GetDestinationUrl returns the DestinationUrl field value if set, zero value otherwise. +func (o *SendMigrationData) GetDestinationUrl() string { + if o == nil || o.DestinationUrl == nil { + var ret string + return ret + } + return *o.DestinationUrl +} + +// GetDestinationUrlOk returns a tuple with the DestinationUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SendMigrationData) GetDestinationUrlOk() (*string, bool) { + if o == nil || o.DestinationUrl == nil { + return nil, false + } + return o.DestinationUrl, true +} + +// HasDestinationUrl returns a boolean if a field has been set. +func (o *SendMigrationData) HasDestinationUrl() bool { + if o != nil && o.DestinationUrl != nil { + return true + } + + return false +} + +// SetDestinationUrl gets a reference to the given string and assigns it to the DestinationUrl field. +func (o *SendMigrationData) SetDestinationUrl(v string) { + o.DestinationUrl = &v +} + +// GetLocal returns the Local field value if set, zero value otherwise. +func (o *SendMigrationData) GetLocal() bool { + if o == nil || o.Local == nil { + var ret bool + return ret + } + return *o.Local +} + +// GetLocalOk returns a tuple with the Local field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SendMigrationData) GetLocalOk() (*bool, bool) { + if o == nil || o.Local == nil { + return nil, false + } + return o.Local, true +} + +// HasLocal returns a boolean if a field has been set. +func (o *SendMigrationData) HasLocal() bool { + if o != nil && o.Local != nil { + return true + } + + return false +} + +// SetLocal gets a reference to the given bool and assigns it to the Local field. +func (o *SendMigrationData) SetLocal(v bool) { + o.Local = &v +} + +func (o SendMigrationData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.DestinationUrl != nil { + toSerialize["destination_url"] = o.DestinationUrl + } + if o.Local != nil { + toSerialize["local"] = o.Local + } + return json.Marshal(toSerialize) +} + +type NullableSendMigrationData struct { + value *SendMigrationData + isSet bool +} + +func (v NullableSendMigrationData) Get() *SendMigrationData { + return v.value +} + +func (v *NullableSendMigrationData) Set(val *SendMigrationData) { + v.value = val + v.isSet = true +} + +func (v NullableSendMigrationData) IsSet() bool { + return v.isSet +} + +func (v *NullableSendMigrationData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSendMigrationData(val *SendMigrationData) *NullableSendMigrationData { + return &NullableSendMigrationData{value: val, isSet: true} +} + +func (v NullableSendMigrationData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSendMigrationData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index 163d811edd..476c179fe5 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -349,6 +349,38 @@ paths: 404: description: The VM instance could not be restored because it is already created. + /vm.receive-migration: + put: + summary: Receive a VM migration from URL + requestBody: + description: The URL for the reception of migration state + content: + application/json: + schema: + $ref: '#/components/schemas/ReceiveMigrationData' + required: true + responses: + 204: + description: The VM migration was successfully received. + 500: + description: The VM migration could not be received. + + /vm.send-migration: + put: + summary: Send a VM migration to URL + requestBody: + description: The URL for sending the migration state + content: + application/json: + schema: + $ref: '#/components/schemas/SendMigrationData' + required: true + responses: + 204: + description: The VM migration was successfully sent. + 500: + description: The VM migration could not be sent. + components: schemas: @@ -712,7 +744,6 @@ components: properties: tap: type: string - default: "" ip: type: string default: "192.168.249.1" @@ -740,7 +771,7 @@ components: default: "Client" id: type: string - fd: + fds: type: array items: type: integer @@ -998,3 +1029,17 @@ components: type: string prefault: type: boolean + + ReceiveMigrationData: + type: object + properties: + receiver_url: + type: string + + SendMigrationData: + type: object + properties: + destination_url: + type: string + local: + type: boolean