mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 12:35:19 +00:00
main: Support VM restore from the command line
Through the new CLI --restore option. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
8f300bed83
commit
fe2d884605
20
src/main.rs
20
src/main.rs
@ -231,6 +231,17 @@ fn create_app<'a, 'b>(
|
||||
.default_value(&api_server_path)
|
||||
.group("vmm-config"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("restore")
|
||||
.long("restore")
|
||||
.help(
|
||||
"Restore from a VM snapshot. \
|
||||
Should be a valid URL (e.g file:///foo/bar or tcp://192.168.1.10/foo)",
|
||||
)
|
||||
.takes_value(true)
|
||||
.min_values(1)
|
||||
.group("vmm-config"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("net-backend")
|
||||
.long("net-backend")
|
||||
@ -333,6 +344,15 @@ fn start_vmm(cmd_arguments: ArgMatches) {
|
||||
)
|
||||
.expect("Could not create the VM");
|
||||
vmm::api::vm_boot(api_evt.try_clone().unwrap(), sender).expect("Could not boot the VM");
|
||||
} else if let Some(restore_url) = cmd_arguments.value_of("restore-from") {
|
||||
vmm::api::vm_restore(
|
||||
api_evt.try_clone().unwrap(),
|
||||
api_request_sender,
|
||||
Arc::new(vmm::api::VmRestoreConfig {
|
||||
source_url: restore_url.to_string(),
|
||||
}),
|
||||
)
|
||||
.expect("Could not restore the VM");
|
||||
}
|
||||
|
||||
match vmm_thread.join() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user