mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: {De}serialize VmConfig
We use the serde crate to serialize and deserialize the VmVConfig structure. This structure will be passed from the HTTP API caller as a JSON payload and we need to deserialize it into a VmConfig. For a convenient use of the HTTP API, we also provide Default traits implementations for some of the VmConfig fields (vCPUs, memory, etc...). Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
@@ -79,6 +79,9 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let default_vcpus = format! {"{}", config::DEFAULT_VCPUS};
|
||||
let default_memory = &format! {"size={}M", config::DEFAULT_MEMORY_MB};
|
||||
|
||||
let cmd_arguments = App::new("cloud-hypervisor")
|
||||
.version(crate_version!())
|
||||
.author(crate_authors!())
|
||||
@@ -89,7 +92,7 @@ fn main() {
|
||||
Arg::with_name("cpus")
|
||||
.long("cpus")
|
||||
.help("Number of virtual CPUs")
|
||||
.default_value(config::DEFAULT_VCPUS)
|
||||
.default_value(&default_vcpus)
|
||||
.group("vm-config"),
|
||||
)
|
||||
.arg(
|
||||
@@ -99,7 +102,7 @@ fn main() {
|
||||
"Memory parameters \"size=<guest_memory_size>,\
|
||||
file=<backing_file_path>\"",
|
||||
)
|
||||
.default_value(config::DEFAULT_MEMORY)
|
||||
.default_value(&default_memory)
|
||||
.group("vm-config"),
|
||||
)
|
||||
.arg(
|
||||
|
||||
Reference in New Issue
Block a user