main: Improve the error reporting when creating the hypervisor object
The ::new() does very little beyond trying to open the /dev/kvm device so provide a hint to the user about what has gone wrong. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
1d3c3bc6ec
commit
29b74804e1
1 changed files with 10 additions and 1 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -324,7 +324,16 @@ fn start_vmm(cmd_arguments: ArgMatches) {
|
|||
} else {
|
||||
SeccompAction::Trap
|
||||
};
|
||||
let hypervisor = hypervisor::new().unwrap();
|
||||
let hypervisor = match hypervisor::new() {
|
||||
Ok(h) => h,
|
||||
Err(e) => {
|
||||
eprintln!(
|
||||
"Failed to open hypervisor interface (is /dev/kvm available?): {:?}",
|
||||
e
|
||||
);
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
let vmm_thread = match vmm::start_vmm_thread(
|
||||
env!("CARGO_PKG_VERSION").to_string(),
|
||||
api_socket_path,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue