mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-09 11:58:16 +00:00
commit
2d89766d3a
@ -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"
|
||||
|
@ -52,6 +52,9 @@ const (
|
||||
// Values based on:
|
||||
clhTimeout = 10
|
||||
clhAPITimeout = 1
|
||||
// Timeout for hot-plug - hotplug devices can take more time, than usual API calls
|
||||
// Use longer time timeout for it.
|
||||
clhHotPlugAPITimeout = 5
|
||||
clhStopSandboxTimeout = 3
|
||||
clhSocket = "clh.sock"
|
||||
clhAPISocket = "clh-api.sock"
|
||||
@ -69,13 +72,21 @@ const (
|
||||
// The main purpose is to hide the client in an interface to allow mock testing.
|
||||
// This is an interface that has to match with OpenAPI CLH client
|
||||
type clhClient interface {
|
||||
// Check for the REST API availability
|
||||
VmmPingGet(ctx context.Context) (chclient.VmmPingResponse, *http.Response, error)
|
||||
// Shut the VMM down
|
||||
ShutdownVMM(ctx context.Context) (*http.Response, error)
|
||||
// Create the VM
|
||||
CreateVM(ctx context.Context, vmConfig chclient.VmConfig) (*http.Response, error)
|
||||
// Dump the VM information
|
||||
// No lint: golint suggest to rename to VMInfoGet.
|
||||
VmInfoGet(ctx context.Context) (chclient.VmInfo, *http.Response, error) //nolint:golint
|
||||
// Boot the VM
|
||||
BootVM(ctx context.Context) (*http.Response, error)
|
||||
// Add/remove CPUs to/from the VM
|
||||
VmResizePut(ctx context.Context, vmResize chclient.VmResize) (*http.Response, error)
|
||||
// Add VFIO PCI device to the VM
|
||||
VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (*http.Response, error)
|
||||
}
|
||||
|
||||
type CloudHypervisorVersion struct {
|
||||
@ -372,9 +383,35 @@ func (clh *cloudHypervisor) getThreadIDs() (vcpuThreadIDs, error) {
|
||||
return vcpuInfo, nil
|
||||
}
|
||||
|
||||
func (clh *cloudHypervisor) hotPlugVFIODevice(device config.VFIODev) error {
|
||||
cl := clh.client()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), clhHotPlugAPITimeout*time.Second)
|
||||
defer cancel()
|
||||
|
||||
_, _, err := cl.VmmPingGet(ctx)
|
||||
if err != nil {
|
||||
return openAPIClientError(err)
|
||||
}
|
||||
|
||||
_, err = cl.VmAddDevicePut(ctx, chclient.VmAddDevice{Path: device.SysfsDev})
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Failed to hotplug device %+v %s", device, openAPIClientError(err))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (clh *cloudHypervisor) hotplugAddDevice(devInfo interface{}, devType deviceType) (interface{}, error) {
|
||||
clh.Logger().WithField("function", "hotplugAddDevice").Warn("hotplug add device not supported")
|
||||
return nil, nil
|
||||
span, _ := clh.trace("hotplugAddDevice")
|
||||
defer span.Finish()
|
||||
|
||||
switch devType {
|
||||
case vfioDev:
|
||||
device := devInfo.(*config.VFIODev)
|
||||
return nil, clh.hotPlugVFIODevice(*device)
|
||||
default:
|
||||
return nil, fmt.Errorf("cannot hotplug device: unsupported device type '%v'", devType)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (clh *cloudHypervisor) hotplugRemoveDevice(devInfo interface{}, devType deviceType) (interface{}, error) {
|
||||
|
@ -86,6 +86,11 @@ func (c *clhClientMock) VmResizePut(ctx context.Context, vmResize chclient.VmRes
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
//nolint:golint
|
||||
func (c *clhClientMock) VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (*http.Response, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func TestCloudHypervisorAddVSock(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
clh := cloudHypervisor{}
|
||||
|
@ -194,6 +194,8 @@ func getVFIODetails(deviceFileName, iommuDevicesPath string) (deviceBDF, deviceS
|
||||
case config.VFIODeviceNormalType:
|
||||
// Get bdf of device eg. 0000:00:1c.0
|
||||
deviceBDF = getBDF(deviceFileName)
|
||||
// Get sysfs path used by cloud-hypervisor
|
||||
deviceSysfsDev = filepath.Join(config.SysBusPciDevicesPath, deviceFileName)
|
||||
case config.VFIODeviceMediatedType:
|
||||
// Get sysfsdev of device eg. /sys/devices/pci0000:00/0000:00:02.0/f79944e4-5a3d-11e8-99ce-479cbab002e4
|
||||
sysfsDevStr := filepath.Join(iommuDevicesPath, deviceFileName)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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().
|
||||
|
@ -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, )
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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]
|
||||
|
||||
|
@ -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"`
|
||||
}
|
||||
|
@ -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"`
|
||||
}
|
@ -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"`
|
||||
}
|
@ -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"`
|
||||
}
|
@ -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"`
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -217,6 +217,10 @@ func (v *virtiofsd) kill() (err error) {
|
||||
span, _ := v.trace("kill")
|
||||
defer span.Finish()
|
||||
|
||||
if v.PID == 0 {
|
||||
return errors.New("invalid virtiofsd PID(0)")
|
||||
}
|
||||
|
||||
err = syscall.Kill(v.PID, syscall.SIGKILL)
|
||||
if err != nil {
|
||||
v.PID = 0
|
||||
|
Loading…
Reference in New Issue
Block a user