mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-13 16:05:15 +00:00
main: Move default values preparation into a dedicated function
This brings more modularity to the code, which will be helpful when we will later test the CLI and OpenAPI generate the same VmConfig output. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
9c3a7ddcc9
commit
17a167dbb6
12
src/main.rs
12
src/main.rs
@ -62,6 +62,14 @@ impl log::Log for Logger {
|
||||
fn flush(&self) {}
|
||||
}
|
||||
|
||||
fn prepare_default_values() -> (String, String, String) {
|
||||
let default_vcpus = format! {"boot={}", config::DEFAULT_VCPUS};
|
||||
let default_memory = format! {"size={}M", config::DEFAULT_MEMORY_MB};
|
||||
let default_rng = format! {"src={}", config::DEFAULT_RNG_SOURCE};
|
||||
|
||||
(default_vcpus, default_memory, default_rng)
|
||||
}
|
||||
|
||||
fn create_app<'a, 'b>(
|
||||
default_vcpus: &'a str,
|
||||
default_memory: &'a str,
|
||||
@ -269,9 +277,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let default_vcpus = format! {"boot={}", config::DEFAULT_VCPUS};
|
||||
let default_memory = format! {"size={}M", config::DEFAULT_MEMORY_MB};
|
||||
let default_rng = format! {"src={}", config::DEFAULT_RNG_SOURCE};
|
||||
let (default_vcpus, default_memory, default_rng) = prepare_default_values();
|
||||
|
||||
let cmd_arguments = create_app(
|
||||
&default_vcpus,
|
||||
|
Loading…
x
Reference in New Issue
Block a user