Merge pull request #1256 from devimc/2021-01-13/stable-2.0/fixVfio

[stable 2.0] backport VFIO fixes
This commit is contained in:
Eric Ernst 2021-01-13 11:29:54 -08:00 committed by GitHub
commit 216eb29e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 191 additions and 121 deletions

View File

@ -1208,22 +1208,23 @@ func (clh *cloudHypervisor) addVolume(volume types.Volume) error {
return err
}
if clh.config.VirtioFSCache == virtioFsCacheAlways {
clh.vmconfig.Fs = []chclient.FsConfig{
{
Tag: volume.MountTag,
CacheSize: int64(clh.config.VirtioFSCacheSize << 20),
Socket: vfsdSockPath,
},
}
} else {
clh.vmconfig.Fs = []chclient.FsConfig{
{
Tag: volume.MountTag,
Socket: vfsdSockPath,
},
}
// disable DAX if VirtioFSCacheSize is 0
dax := clh.config.VirtioFSCacheSize != 0
// numQueues and queueSize are required, let's use the
// default values defined by cloud-hypervisor
numQueues := int32(1)
queueSize := int32(1024)
clh.vmconfig.Fs = []chclient.FsConfig{
{
Tag: volume.MountTag,
Socket: vfsdSockPath,
Dax: dax,
CacheSize: int64(clh.config.VirtioFSCacheSize << 20),
NumQueues: numQueues,
QueueSize: queueSize,
},
}
clh.Logger().Debug("Adding share volume to hypervisor: ", volume.MountTag)

View File

@ -58,6 +58,7 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [BalloonConfig](docs/BalloonConfig.md)
- [CmdLineConfig](docs/CmdLineConfig.md)
- [ConsoleConfig](docs/ConsoleConfig.md)
- [CpuTopology](docs/CpuTopology.md)

View File

@ -332,19 +332,21 @@ components:
VmInfo:
description: Virtual Machine information
example:
memory_actual_size: 2
state: Created
config:
console:
mode: "false"
file: file
iommu: false
balloon:
size: 4
memory:
hugepages: false
shared: false
mergeable: false
balloon: false
size: 7
hotplugged_size: 3
size: 9
hotplugged_size: 2
zones:
- hugepages: false
shared: false
@ -364,9 +366,8 @@ components:
host_numa_node: 7
id: id
hotplug_size: 1
hotplug_size: 9
hotplug_size: 3
hotplug_method: acpi
balloon_size: 2
disks:
- path: path
num_queues: 1
@ -394,6 +395,7 @@ components:
threads_per_core: 1
cores_per_die: 5
packages: 2
max_phys_bits: 7
boot_vcpus: 1
max_vcpus: 1
devices:
@ -407,47 +409,47 @@ components:
path: path
numa:
- distances:
- distance: 6
destination: 3
- distance: 6
destination: 3
- distance: 1
destination: 6
- distance: 1
destination: 6
cpus:
- 6
- 6
- 3
- 3
memory_zones:
- memory_zones
- memory_zones
guest_numa_id: 9
guest_numa_id: 6
- distances:
- distance: 6
destination: 3
- distance: 6
destination: 3
- distance: 1
destination: 6
- distance: 1
destination: 6
cpus:
- 6
- 6
- 3
- 3
memory_zones:
- memory_zones
- memory_zones
guest_numa_id: 9
guest_numa_id: 6
rng:
iommu: false
src: /dev/urandom
sgx_epc:
- prefault: false
size: 8
size: 9
- prefault: false
size: 8
size: 9
fs:
- num_queues: 4
queue_size: 5
- num_queues: 5
queue_size: 9
cache_size: 9
dax: true
tag: tag
socket: socket
id: id
- num_queues: 4
queue_size: 5
- num_queues: 5
queue_size: 9
cache_size: 9
dax: true
tag: tag
@ -461,18 +463,19 @@ components:
pmem:
- mergeable: false
file: file
size: 9
size: 6
iommu: false
id: id
discard_writes: false
- mergeable: false
file: file
size: 9
size: 6
iommu: false
id: id
discard_writes: false
cmdline:
args: args
watchdog: false
iommu: false
serial:
mode: "false"
@ -511,6 +514,9 @@ components:
- Shutdown
- Paused
type: string
memory_actual_size:
format: int64
type: integer
required:
- config
- state
@ -543,13 +549,14 @@ components:
mode: "false"
file: file
iommu: false
balloon:
size: 4
memory:
hugepages: false
shared: false
mergeable: false
balloon: false
size: 7
hotplugged_size: 3
size: 9
hotplugged_size: 2
zones:
- hugepages: false
shared: false
@ -569,9 +576,8 @@ components:
host_numa_node: 7
id: id
hotplug_size: 1
hotplug_size: 9
hotplug_size: 3
hotplug_method: acpi
balloon_size: 2
disks:
- path: path
num_queues: 1
@ -599,6 +605,7 @@ components:
threads_per_core: 1
cores_per_die: 5
packages: 2
max_phys_bits: 7
boot_vcpus: 1
max_vcpus: 1
devices:
@ -612,47 +619,47 @@ components:
path: path
numa:
- distances:
- distance: 6
destination: 3
- distance: 6
destination: 3
- distance: 1
destination: 6
- distance: 1
destination: 6
cpus:
- 6
- 6
- 3
- 3
memory_zones:
- memory_zones
- memory_zones
guest_numa_id: 9
guest_numa_id: 6
- distances:
- distance: 6
destination: 3
- distance: 6
destination: 3
- distance: 1
destination: 6
- distance: 1
destination: 6
cpus:
- 6
- 6
- 3
- 3
memory_zones:
- memory_zones
- memory_zones
guest_numa_id: 9
guest_numa_id: 6
rng:
iommu: false
src: /dev/urandom
sgx_epc:
- prefault: false
size: 8
size: 9
- prefault: false
size: 8
size: 9
fs:
- num_queues: 4
queue_size: 5
- num_queues: 5
queue_size: 9
cache_size: 9
dax: true
tag: tag
socket: socket
id: id
- num_queues: 4
queue_size: 5
- num_queues: 5
queue_size: 9
cache_size: 9
dax: true
tag: tag
@ -666,18 +673,19 @@ components:
pmem:
- mergeable: false
file: file
size: 9
size: 6
iommu: false
id: id
discard_writes: false
- mergeable: false
file: file
size: 9
size: 6
iommu: false
id: id
discard_writes: false
cmdline:
args: args
watchdog: false
iommu: false
serial:
mode: "false"
@ -727,6 +735,8 @@ components:
type: array
rng:
$ref: '#/components/schemas/RngConfig'
balloon:
$ref: '#/components/schemas/BalloonConfig'
fs:
items:
$ref: '#/components/schemas/FsConfig'
@ -756,6 +766,9 @@ components:
iommu:
default: false
type: boolean
watchdog:
default: false
type: boolean
required:
- kernel
type: object
@ -782,6 +795,7 @@ components:
threads_per_core: 1
cores_per_die: 5
packages: 2
max_phys_bits: 7
boot_vcpus: 1
max_vcpus: 1
properties:
@ -795,6 +809,8 @@ components:
type: integer
topology:
$ref: '#/components/schemas/CpuTopology'
max_phys_bits:
type: integer
required:
- boot_vcpus
- max_vcpus
@ -845,9 +861,8 @@ components:
hugepages: false
shared: false
mergeable: false
balloon: false
size: 7
hotplugged_size: 3
size: 9
hotplugged_size: 2
zones:
- hugepages: false
shared: false
@ -867,9 +882,8 @@ components:
host_numa_node: 7
id: id
hotplug_size: 1
hotplug_size: 9
hotplug_size: 3
hotplug_method: acpi
balloon_size: 2
properties:
size:
format: int64
@ -892,12 +906,6 @@ components:
hugepages:
default: false
type: boolean
balloon:
default: false
type: boolean
balloon_size:
format: int64
type: integer
zones:
items:
$ref: '#/components/schemas/MemoryZoneConfig'
@ -1031,10 +1039,20 @@ components:
required:
- src
type: object
BalloonConfig:
example:
size: 4
properties:
size:
format: int64
type: integer
required:
- size
type: object
FsConfig:
example:
num_queues: 4
queue_size: 5
num_queues: 5
queue_size: 9
cache_size: 9
dax: true
tag: tag
@ -1060,6 +1078,10 @@ components:
id:
type: string
required:
- cache_size
- dax
- num_queues
- queue_size
- socket
- tag
type: object
@ -1067,7 +1089,7 @@ components:
example:
mergeable: false
file: file
size: 9
size: 6
iommu: false
id: id
discard_writes: false
@ -1155,7 +1177,7 @@ components:
SgxEpcConfig:
example:
prefault: false
size: 8
size: 9
properties:
size:
format: int64
@ -1168,8 +1190,8 @@ components:
type: object
NumaDistance:
example:
distance: 6
destination: 3
distance: 1
destination: 6
properties:
destination:
format: int32
@ -1184,17 +1206,17 @@ components:
NumaConfig:
example:
distances:
- distance: 6
destination: 3
- distance: 6
destination: 3
- distance: 1
destination: 6
- distance: 1
destination: 6
cpus:
- 6
- 6
- 3
- 3
memory_zones:
- memory_zones
- memory_zones
guest_numa_id: 9
guest_numa_id: 6
properties:
guest_numa_id:
format: int32
@ -1217,8 +1239,8 @@ components:
type: object
VmResize:
example:
desired_balloon: 1
desired_vcpus: 1
desired_ram_w_balloon: 1
desired_ram: 6
properties:
desired_vcpus:
@ -1228,8 +1250,8 @@ components:
description: desired memory ram in bytes
format: int64
type: integer
desired_ram_w_balloon:
description: desired ballon size in bytes
desired_balloon:
description: desired balloon size in bytes
format: int64
type: integer
type: object

View File

@ -0,0 +1,11 @@
# BalloonConfig
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Size** | **int64** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**BootVcpus** | **int32** | | [default to 1]
**MaxVcpus** | **int32** | | [default to 1]
**Topology** | [**CpuTopology**](CpuTopology.md) | | [optional]
**MaxPhysBits** | **int32** | | [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)

View File

@ -6,10 +6,10 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Tag** | **string** | |
**Socket** | **string** | |
**NumQueues** | **int32** | | [optional] [default to 1]
**QueueSize** | **int32** | | [optional] [default to 1024]
**Dax** | **bool** | | [optional] [default to true]
**CacheSize** | **int64** | | [optional]
**NumQueues** | **int32** | | [default to 1]
**QueueSize** | **int32** | | [default to 1024]
**Dax** | **bool** | | [default to true]
**CacheSize** | **int64** | |
**Id** | **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)

View File

@ -11,8 +11,6 @@ Name | Type | Description | Notes
**HotplugMethod** | **string** | | [optional] [default to acpi]
**Shared** | **bool** | | [optional] [default to false]
**Hugepages** | **bool** | | [optional] [default to false]
**Balloon** | **bool** | | [optional] [default to false]
**BalloonSize** | **int64** | | [optional]
**Zones** | [**[]MemoryZoneConfig**](MemoryZoneConfig.md) | | [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)

View File

@ -12,6 +12,7 @@ Name | Type | Description | Notes
**Disks** | [**[]DiskConfig**](DiskConfig.md) | | [optional]
**Net** | [**[]NetConfig**](NetConfig.md) | | [optional]
**Rng** | [**RngConfig**](RngConfig.md) | | [optional]
**Balloon** | [**BalloonConfig**](BalloonConfig.md) | | [optional]
**Fs** | [**[]FsConfig**](FsConfig.md) | | [optional]
**Pmem** | [**[]PmemConfig**](PmemConfig.md) | | [optional]
**Serial** | [**ConsoleConfig**](ConsoleConfig.md) | | [optional]
@ -21,6 +22,7 @@ Name | Type | Description | Notes
**SgxEpc** | [**[]SgxEpcConfig**](SgxEpcConfig.md) | | [optional]
**Numa** | [**[]NumaConfig**](NumaConfig.md) | | [optional]
**Iommu** | **bool** | | [optional] [default to false]
**Watchdog** | **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)

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Config** | [**VmConfig**](VmConfig.md) | |
**State** | **string** | |
**MemoryActualSize** | **int64** | | [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)

View File

@ -6,7 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**DesiredVcpus** | **int32** | | [optional]
**DesiredRam** | **int64** | desired memory ram in bytes | [optional]
**DesiredRamWBalloon** | **int64** | desired ballon size in bytes | [optional]
**DesiredBalloon** | **int64** | desired balloon size in bytes | [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)

View File

@ -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
// BalloonConfig struct for BalloonConfig
type BalloonConfig struct {
Size int64 `json:"size"`
}

View File

@ -13,4 +13,5 @@ type CpusConfig struct {
BootVcpus int32 `json:"boot_vcpus"`
MaxVcpus int32 `json:"max_vcpus"`
Topology CpuTopology `json:"topology,omitempty"`
MaxPhysBits int32 `json:"max_phys_bits,omitempty"`
}

View File

@ -12,9 +12,9 @@ package openapi
type FsConfig struct {
Tag string `json:"tag"`
Socket string `json:"socket"`
NumQueues int32 `json:"num_queues,omitempty"`
QueueSize int32 `json:"queue_size,omitempty"`
Dax bool `json:"dax,omitempty"`
CacheSize int64 `json:"cache_size,omitempty"`
NumQueues int32 `json:"num_queues"`
QueueSize int32 `json:"queue_size"`
Dax bool `json:"dax"`
CacheSize int64 `json:"cache_size"`
Id string `json:"id,omitempty"`
}

View File

@ -17,7 +17,5 @@ type MemoryConfig struct {
HotplugMethod string `json:"hotplug_method,omitempty"`
Shared bool `json:"shared,omitempty"`
Hugepages bool `json:"hugepages,omitempty"`
Balloon bool `json:"balloon,omitempty"`
BalloonSize int64 `json:"balloon_size,omitempty"`
Zones []MemoryZoneConfig `json:"zones,omitempty"`
}

View File

@ -18,6 +18,7 @@ type VmConfig struct {
Disks []DiskConfig `json:"disks,omitempty"`
Net []NetConfig `json:"net,omitempty"`
Rng RngConfig `json:"rng,omitempty"`
Balloon BalloonConfig `json:"balloon,omitempty"`
Fs []FsConfig `json:"fs,omitempty"`
Pmem []PmemConfig `json:"pmem,omitempty"`
Serial ConsoleConfig `json:"serial,omitempty"`
@ -27,4 +28,5 @@ type VmConfig struct {
SgxEpc []SgxEpcConfig `json:"sgx_epc,omitempty"`
Numa []NumaConfig `json:"numa,omitempty"`
Iommu bool `json:"iommu,omitempty"`
Watchdog bool `json:"watchdog,omitempty"`
}

View File

@ -12,4 +12,5 @@ package openapi
type VmInfo struct {
Config VmConfig `json:"config"`
State string `json:"state"`
MemoryActualSize int64 `json:"memory_actual_size,omitempty"`
}

View File

@ -13,6 +13,6 @@ type VmResize struct {
DesiredVcpus int32 `json:"desired_vcpus,omitempty"`
// desired memory ram in bytes
DesiredRam int64 `json:"desired_ram,omitempty"`
// desired ballon size in bytes
DesiredRamWBalloon int64 `json:"desired_ram_w_balloon,omitempty"`
// desired balloon size in bytes
DesiredBalloon int64 `json:"desired_balloon,omitempty"`
}

View File

@ -360,6 +360,9 @@ components:
state:
type: string
enum: [Created, Running, Shutdown, Paused]
memory_actual_size:
type: integer
format: int64
description: Virtual Machine information
VmCounters:
@ -407,6 +410,8 @@ components:
$ref: '#/components/schemas/NetConfig'
rng:
$ref: '#/components/schemas/RngConfig'
balloon:
$ref: '#/components/schemas/BalloonConfig'
fs:
type: array
items:
@ -436,6 +441,9 @@ components:
iommu:
type: boolean
default: false
watchdog:
type: boolean
default: false
description: Virtual machine configuration
CpuTopology:
@ -466,6 +474,8 @@ components:
type: integer
topology:
$ref: '#/components/schemas/CpuTopology'
max_phys_bits:
type: integer
MemoryZoneConfig:
required:
@ -527,12 +537,6 @@ components:
hugepages:
type: boolean
default: false
balloon:
type: boolean
default: false
balloon_size:
type: integer
format: int64
zones:
type: array
items:
@ -639,10 +643,23 @@ components:
type: boolean
default: false
BalloonConfig:
required:
- size
type: object
properties:
size:
type: integer
format: int64
FsConfig:
required:
- tag
- cache_size
- dax
- num_queues
- queue_size
- socket
- tag
type: object
properties:
tag:
@ -791,8 +808,8 @@ components:
description: desired memory ram in bytes
type: integer
format: int64
desired_ram_w_balloon:
description: desired ballon size in bytes
desired_balloon:
description: desired balloon size in bytes
type: integer
format: int64

View File

@ -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: "6d30fe05e4febd930d91bb36294f0219faf2254c"
version: "270631922deee9bdea13635a104e111768446c7b"
firecracker:
description: "Firecracker micro-VMM"