vmm: Add an identifier to the --fs device

By giving the devices ids this effectively enables the removal of the
device.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-04-27 09:55:25 +02:00
committed by Rob Bradford
parent 7e0ab6b56d
commit 9ed880d74e
2 changed files with 18 additions and 6 deletions
+7 -1
View File
@@ -865,6 +865,8 @@ pub struct FsConfig {
pub dax: bool,
#[serde(default = "default_fsconfig_cache_size")]
pub cache_size: u64,
#[serde(default)]
pub id: Option<String>,
}
fn default_fsconfig_num_queues() -> usize {
@@ -892,6 +894,7 @@ impl Default for FsConfig {
queue_size: default_fsconfig_queue_size(),
dax: default_fsconfig_dax(),
cache_size: default_fsconfig_cache_size(),
id: None,
}
}
}
@@ -900,7 +903,7 @@ impl FsConfig {
pub const SYNTAX: &'static str = "virtio-fs parameters \
\"tag=<tag_name>,sock=<socket_path>,num_queues=<number_of_queues>,\
queue_size=<size_of_each_queue>,dax=on|off,cache_size=<DAX cache size: \
default 8Gib>\"";
default 8Gib>,id=<device_id>\"";
pub fn parse(fs: &str) -> Result<Self> {
let mut parser = OptionParser::new();
@@ -941,6 +944,8 @@ impl FsConfig {
.unwrap_or_else(|| ByteSized(default_fsconfig_cache_size()))
.0;
let id = parser.get("id");
Ok(FsConfig {
tag,
sock,
@@ -948,6 +953,7 @@ impl FsConfig {
queue_size,
dax,
cache_size,
id,
})
}
}