diff --git a/src/runtime/versions.yaml b/src/runtime/versions.yaml index 69aacfa0f5..5d0bee1fc2 100644 --- a/src/runtime/versions.yaml +++ b/src/runtime/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: "a8ec8f3326628d34021ccae0f259a9509ff1e6da" + version: "f5debc4bc001fb14dad0aee28fef102e6c263565" firecracker: description: "Firecracker micro-VMM" diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index a348a94b87..73ac7bfbc6 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -218,6 +218,8 @@ func (clh *cloudHypervisor) createSandbox(ctx context.Context, id string, networ // Convert to int64 openApiClient only support int64 clh.vmconfig.Memory.Size = int64((utils.MemUnit(clh.config.MemorySize) * utils.MiB).ToBytes()) clh.vmconfig.Memory.File = "/dev/shm" + // shared memory should be enabled if using vhost-user(kata uses virtiofsd) + clh.vmconfig.Memory.Shared = true hostMemKb, err := getHostMemorySizeKb(procMemInfo) if err != nil { return nil diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md index 3503d1baaf..8e17bdcdf2 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -42,6 +42,7 @@ Class | Method | HTTP request | Description *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* | [**VmAddFsPut**](docs/DefaultApi.md#vmaddfsput) | **Put** /vm.add-fs | Add a new virtio-fs device to the VM *DefaultApi* | [**VmAddNetPut**](docs/DefaultApi.md#vmaddnetput) | **Put** /vm.add-net | Add a new network device to the VM *DefaultApi* | [**VmAddPmemPut**](docs/DefaultApi.md#vmaddpmemput) | **Put** /vm.add-pmem | Add a new pmem device to the VM *DefaultApi* | [**VmInfoGet**](docs/DefaultApi.md#vminfoget) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. 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 3d0eef0351..e045af5a74 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -173,6 +173,21 @@ paths: "500": description: The new disk could not be added to the VM instance. summary: Add a new disk to the VM + /vm.add-fs: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FsConfig' + description: The details of the new virtio-fs + 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 virtio-fs device to the VM /vm.add-pmem: put: requestBody: @@ -260,6 +275,8 @@ components: file: file iommu: false memory: + hugepages: false + shared: false mergeable: false file: file size: 1 @@ -382,6 +399,8 @@ components: file: file iommu: false memory: + hugepages: false + shared: false mergeable: false file: file size: 1 @@ -549,6 +568,8 @@ components: type: object MemoryConfig: example: + hugepages: false + shared: false mergeable: false file: file size: 1 @@ -569,6 +590,12 @@ components: hotplug_method: default: acpi type: string + shared: + default: false + type: boolean + hugepages: + default: false + type: boolean required: - size type: object @@ -749,7 +776,6 @@ components: type: boolean required: - file - - size type: object ConsoleConfig: example: 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 c68fda29ad..93b3623fb6 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go @@ -663,6 +663,72 @@ func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context, diskConfig DiskCo return localVarHTTPResponse, nil } +/* +VmAddFsPut Add a new virtio-fs device to the VM + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param fsConfig The details of the new virtio-fs +*/ +func (a *DefaultApiService) VmAddFsPut(ctx _context.Context, fsConfig FsConfig) (*_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-fs" + 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 = &fsConfig + 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(). 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 d414fadfda..eaa4291878 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md @@ -14,6 +14,7 @@ Method | HTTP request | Description [**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 +[**VmAddFsPut**](DefaultApi.md#VmAddFsPut) | **Put** /vm.add-fs | Add a new virtio-fs device to the VM [**VmAddNetPut**](DefaultApi.md#VmAddNetPut) | **Put** /vm.add-net | Add a new network device to the VM [**VmAddPmemPut**](DefaultApi.md#VmAddPmemPut) | **Put** /vm.add-pmem | Add a new pmem device to the VM [**VmInfoGet**](DefaultApi.md#VmInfoGet) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. @@ -317,6 +318,38 @@ No authorization required [[Back to README]](../README.md) +## VmAddFsPut + +> VmAddFsPut(ctx, fsConfig) + +Add a new virtio-fs device to the VM + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**fsConfig** | [**FsConfig**](FsConfig.md)| The details of the new virtio-fs | + +### 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) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md index 30ae9e0187..03dd5b31ec 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md @@ -9,6 +9,8 @@ Name | Type | Description | Notes **File** | **string** | | [optional] **Mergeable** | **bool** | | [optional] [default to false] **HotplugMethod** | **string** | | [optional] [default to acpi] +**Shared** | **bool** | | [optional] [default to false] +**Hugepages** | **bool** | | [optional] [default to false] [[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/PmemConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PmemConfig.md index a84de72ae6..fd532291df 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PmemConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PmemConfig.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **File** | **string** | | -**Size** | **int64** | | +**Size** | **int64** | | [optional] **Iommu** | **bool** | | [optional] [default to false] **Mergeable** | **bool** | | [optional] [default to false] **DiscardWrites** | **bool** | | [optional] [default to false] diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go index 3d4831c654..5601f46d31 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go @@ -15,4 +15,6 @@ type MemoryConfig struct { File string `json:"file,omitempty"` Mergeable bool `json:"mergeable,omitempty"` HotplugMethod string `json:"hotplug_method,omitempty"` + Shared bool `json:"shared,omitempty"` + Hugepages bool `json:"hugepages,omitempty"` } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_pmem_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_pmem_config.go index a1a26ff778..053fd5115a 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_pmem_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_pmem_config.go @@ -11,7 +11,7 @@ package openapi // PmemConfig struct for PmemConfig type PmemConfig struct { File string `json:"file"` - Size int64 `json:"size"` + Size int64 `json:"size,omitempty"` Iommu bool `json:"iommu,omitempty"` Mergeable bool `json:"mergeable,omitempty"` DiscardWrites bool `json:"discard_writes,omitempty"` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index 4a79b14066..f4287a4540 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -187,6 +187,22 @@ paths: 500: description: The new disk could not be added to the VM instance. + /vm.add-fs: + put: + summary: Add a new virtio-fs device to the VM + requestBody: + description: The details of the new virtio-fs + content: + application/json: + schema: + $ref: '#/components/schemas/FsConfig' + 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-pmem: put: summary: Add a new pmem device to the VM @@ -364,6 +380,12 @@ components: hotplug_method: type: string default: "acpi" + shared: + type: boolean + default: false + hugepages: + type: boolean + default: false KernelConfig: required: @@ -492,7 +514,6 @@ components: PmemConfig: required: - file - - size type: object properties: file: