mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 12:35:19 +00:00
vmm: api: Make FsConfig defaults match between CLI and HTTP API
In order to let the CLI and the HTTP API behave the same regarding the FsConfig structure, this patch defines some default values for num_queues, queue_size and the cache_size. num_queues is set to 1, queue_size is set to 1024, and cache_size is set to Some(8G) which means that DAX is enabled by default with a shared region of 8GiB. Fixes #508 Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
befd342da4
commit
ee528ae808
@ -312,8 +312,6 @@ components:
|
|||||||
required:
|
required:
|
||||||
- tag
|
- tag
|
||||||
- sock
|
- sock
|
||||||
- num_queues
|
|
||||||
- queue_size
|
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
tag:
|
tag:
|
||||||
@ -322,11 +320,14 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
num_queues:
|
num_queues:
|
||||||
type: integer
|
type: integer
|
||||||
|
default: 1
|
||||||
queue_size:
|
queue_size:
|
||||||
type: integer
|
type: integer
|
||||||
|
default: 1024
|
||||||
cache_size:
|
cache_size:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
|
default: 8589934592
|
||||||
|
|
||||||
PmemConfig:
|
PmemConfig:
|
||||||
required:
|
required:
|
||||||
|
@ -427,11 +427,26 @@ impl Default for RngConfig {
|
|||||||
pub struct FsConfig {
|
pub struct FsConfig {
|
||||||
pub tag: String,
|
pub tag: String,
|
||||||
pub sock: PathBuf,
|
pub sock: PathBuf,
|
||||||
|
#[serde(default = "default_fsconfig_num_queues")]
|
||||||
pub num_queues: usize,
|
pub num_queues: usize,
|
||||||
|
#[serde(default = "default_fsconfig_queue_size")]
|
||||||
pub queue_size: u16,
|
pub queue_size: u16,
|
||||||
|
#[serde(default = "default_fsconfig_cache_size")]
|
||||||
pub cache_size: Option<u64>,
|
pub cache_size: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_fsconfig_num_queues() -> usize {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_fsconfig_queue_size() -> u16 {
|
||||||
|
1024
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_fsconfig_cache_size() -> Option<u64> {
|
||||||
|
Some(0x0002_0000_0000)
|
||||||
|
}
|
||||||
|
|
||||||
impl FsConfig {
|
impl FsConfig {
|
||||||
pub fn parse(fs: &str) -> Result<Self> {
|
pub fn parse(fs: &str) -> Result<Self> {
|
||||||
// Split the parameters based on the comma delimiter
|
// Split the parameters based on the comma delimiter
|
||||||
@ -460,11 +475,11 @@ impl FsConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut num_queues: usize = 1;
|
let mut num_queues: usize = default_fsconfig_num_queues();
|
||||||
let mut queue_size: u16 = 1024;
|
let mut queue_size: u16 = default_fsconfig_queue_size();
|
||||||
let mut dax: bool = true;
|
let mut dax: bool = true;
|
||||||
// Default cache size set to 8Gib.
|
// Default cache size set to 8Gib.
|
||||||
let mut cache_size: Option<u64> = Some(0x0002_0000_0000);
|
let mut cache_size: Option<u64> = default_fsconfig_cache_size();
|
||||||
|
|
||||||
if tag.is_empty() {
|
if tag.is_empty() {
|
||||||
return Err(Error::ParseFsTagParam);
|
return Err(Error::ParseFsTagParam);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user