Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3073 from devimc/2020-11-12/backport/clhDaxFix
Browse files Browse the repository at this point in the history
[backport] runtime: clh: disable virtiofs DAX when FS cache size is 0
  • Loading branch information
likebreath authored Nov 13, 2020
2 parents 4ec184a + e4a68a7 commit 1f6c2ce
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 26 deletions.
2 changes: 1 addition & 1 deletion versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "v0.11.0"
version: "270631922deee9bdea13635a104e111768446c7b"

firecracker:
description: "Firecracker micro-VMM"
Expand Down
33 changes: 17 additions & 16 deletions virtcontainers/clh.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,22 +1209,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)
Expand Down
4 changes: 4 additions & 0 deletions virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,10 @@ components:
id:
type: string
required:
- cache_size
- dax
- num_queues
- queue_size
- socket
- tag
type: object
Expand Down
8 changes: 4 additions & 4 deletions virtcontainers/pkg/cloud-hypervisor/client/docs/FsConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions virtcontainers/pkg/cloud-hypervisor/client/model_fs_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
6 changes: 5 additions & 1 deletion virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,12 @@ components:

FsConfig:
required:
- tag
- cache_size
- dax
- num_queues
- queue_size
- socket
- tag
type: object
properties:
tag:
Expand Down

0 comments on commit 1f6c2ce

Please sign in to comment.