vmm: api: Make ConsoleConfig default match between CLI and HTTP API

A simple patch making sure the field "file" is provisioned with the same
default value through CLI and OpenAPI.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-12-10 15:40:47 +01:00 committed by Rob Bradford
parent cc08c44cb9
commit 793327cff8

View File

@ -591,19 +591,24 @@ impl ConsoleOutputMode {
#[derive(Clone, Deserialize, Serialize)]
pub struct ConsoleConfig {
#[serde(default = "default_consoleconfig_file")]
pub file: Option<PathBuf>,
pub mode: ConsoleOutputMode,
#[serde(default)]
pub iommu: bool,
}
fn default_consoleconfig_file() -> Option<PathBuf> {
None
}
impl ConsoleConfig {
pub fn parse(console: &str) -> Result<Self> {
// Split the parameters based on the comma delimiter
let params_list: Vec<&str> = console.split(',').collect();
let mut valid = false;
let mut file: Option<PathBuf> = None;
let mut file: Option<PathBuf> = default_consoleconfig_file();
let mut mode: ConsoleOutputMode = ConsoleOutputMode::Off;
let mut iommu_str: &str = "";