From 46cde1a38efc3368907e7243842a3a47f269626b Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Mon, 30 Sep 2019 11:53:49 +0200 Subject: [PATCH] vmm: Rename the VM start and stop operations to boot and shutdown To match the OpenAPI description. And also to map the real life terminology. Signed-off-by: Samuel Ortiz --- src/main.rs | 4 ++-- vmm/src/api/mod.rs | 18 +++++++++--------- vmm/src/lib.rs | 30 +++++++++++++++--------------- vmm/src/vm.rs | 4 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/main.rs b/src/main.rs index b53f3b196..a939d569f 100755 --- a/src/main.rs +++ b/src/main.rs @@ -356,7 +356,7 @@ fn main() { }; if cmd_arguments.is_present("vm-config") && vm_config.valid() { - // Create and start the VM based off the VM config we just built. + // Create and boot the VM based off the VM config we just built. let sender = api_request_sender.clone(); vmm::api::vm_create( api_evt.try_clone().unwrap(), @@ -364,7 +364,7 @@ fn main() { Arc::new(vm_config), ) .expect("Could not create the VM"); - vmm::api::vm_start(api_evt.try_clone().unwrap(), sender).expect("Could not start the VM"); + vmm::api::vm_boot(api_evt.try_clone().unwrap(), sender).expect("Could not boot the VM"); } match vmm_thread.join() { diff --git a/vmm/src/api/mod.rs b/vmm/src/api/mod.rs index c3be9ec16..9972ac8bf 100644 --- a/vmm/src/api/mod.rs +++ b/vmm/src/api/mod.rs @@ -48,8 +48,8 @@ pub enum ApiError { /// The VM could not be created. VmCreate(VmError), - /// The VM could not start. - VmStart(VmError), + /// The VM could not boot. + VmBoot(VmError), } pub enum ApiResponsePayload { @@ -68,10 +68,10 @@ pub enum ApiRequest { /// error back. VmCreate(Arc, Sender), - /// Start the previously created virtual machine. + /// Boot the previously created virtual machine. /// If the VM was not previously created, the VMM API server will send a - /// VmStart error back. - VmStart(Sender), + /// VmBoot error back. + VmBoot(Sender), } pub fn vm_create( @@ -95,19 +95,19 @@ pub fn vm_create( Ok(()) } -pub fn vm_start(api_evt: EventFd, api_sender: Sender) -> Result<()> { +pub fn vm_boot(api_evt: EventFd, api_sender: Sender) -> Result<()> { let (response_sender, response_receiver) = channel(); - // Send the VM start request. + // Send the VM boot request. api_sender - .send(ApiRequest::VmStart(response_sender)) + .send(ApiRequest::VmBoot(response_sender)) .map_err(Error::ApiRequestSend)?; api_evt.write(1).map_err(Error::EventFdWrite)?; response_receiver .recv() .map_err(Error::ApiResponseRecv)? - .map_err(Error::ApiVmStart)?; + .map_err(Error::ApiVmBoot)?; Ok(()) } diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 5bc148fef..5465e5821 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -48,8 +48,8 @@ pub enum Error { /// Cannot create a VM from the API ApiVmCreate(ApiError), - /// Cannot start a VM from the API - ApiVmStart(ApiError), + /// Cannot boot a VM from the API + ApiVmBoot(ApiError), /// Cannot bind to the UNIX domain socket path Bind(io::Error), @@ -78,11 +78,11 @@ pub enum Error { /// Cannot create a VM VmCreate(VmError), - /// Cannot start a VM - VmStart(VmError), + /// Cannot boot a VM + VmBoot(VmError), - /// Cannot stop a VM - VmStop(VmError), + /// Cannot shut a VM down + VmShutdown(VmError), /// Cannot create VMM thread VmmThreadSpawn(io::Error), @@ -177,14 +177,14 @@ pub fn start_vmm_thread( Ok(ExitBehaviour::Reset) => { // The VMM control loop exites with a reset behaviour. // We have to reboot the VM, i.e. we create a new VM - // based on the same VM config, start it and restart + // based on the same VM config, boot it and restart // the control loop. // Without ACPI, a reset is equivalent to a shutdown #[cfg(not(feature = "acpi"))] { if let Some(ref mut vm) = vmm.vm { - vm.stop().map_err(Error::VmStop)?; + vm.shtudown().map_err(Error::VmShutdown)?; break 'outer; } } @@ -192,7 +192,7 @@ pub fn start_vmm_thread( // First we stop the current VM and create a new one. if let Some(ref mut vm) = vmm.vm { let config = vm.get_config(); - vm.stop().map_err(Error::VmStop)?; + vm.shutdown().map_err(Error::VmShutdown)?; let exit_evt = vmm.exit_evt.try_clone().map_err(Error::EventFdClone)?; let reset_evt = @@ -203,9 +203,9 @@ pub fn start_vmm_thread( ); } - // Then we start the new VM. + // Then we boot the new VM. if let Some(ref mut vm) = vmm.vm { - vm.start().map_err(Error::VmStart)?; + vm.boot().map_err(Error::VmBoot)?; } // Continue and restart the VMM control loop @@ -215,7 +215,7 @@ pub fn start_vmm_thread( // The VMM control loop exites with a shutdown behaviour. // We have to stop the VM and we exit thr thread. if let Some(ref mut vm) = vmm.vm { - vm.stop().map_err(Error::VmStop)?; + vm.shutdown().map_err(Error::VmShutdown)?; } break 'outer; } @@ -345,11 +345,11 @@ impl Vmm { sender.send(response).map_err(Error::ApiResponseSend)?; } - ApiRequest::VmStart(sender) => { + ApiRequest::VmBoot(sender) => { if let Some(ref mut vm) = self.vm { - let response = match vm.start() { + let response = match vm.boot() { Ok(_) => Ok(ApiResponsePayload::Empty), - Err(e) => Err(ApiError::VmStart(e)), + Err(e) => Err(ApiError::VmBoot(e)), }; sender.send(response).map_err(Error::ApiResponseSend)?; diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 2e2f81974..9351c52f7 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -753,7 +753,7 @@ impl Vm { } } - pub fn stop(&mut self) -> Result<()> { + pub fn shutdown(&mut self) -> Result<()> { if self.on_tty { // Don't forget to set the terminal in canonical mode // before to exit. @@ -798,7 +798,7 @@ impl Vm { } } - pub fn start(&mut self) -> Result<()> { + pub fn boot(&mut self) -> Result<()> { let entry_addr = self.load_kernel()?; let vcpu_count = u8::from(&self.config.cpus); let vcpu_thread_barrier = Arc::new(Barrier::new((vcpu_count + 1) as usize));