MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / shutdown

Method shutdown

vmm/src/vm.rs:2049–2074  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

2047 }
2048
2049 pub fn shutdown(&mut self) -> Result<()> {
2050 let new_state = VmState::Shutdown;
2051
2052 self.state.valid_transition(new_state)?;
2053
2054 // Wake up the DeviceManager threads so they will get terminated cleanly
2055 self.device_manager
2056 .lock()
2057 .unwrap()
2058 .resume()
2059 .map_err(Error::Resume)?;
2060
2061 self.cpu_manager
2062 .lock()
2063 .unwrap()
2064 .shutdown()
2065 .map_err(Error::CpuManager)?;
2066
2067 // Wait for all the threads to finish
2068 for thread in self.threads.drain(..) {
2069 thread.join().map_err(Error::ThreadCleanup)?;
2070 }
2071 self.state = new_state;
2072
2073 Ok(())
2074 }
2075
2076 pub fn resize(
2077 &mut self,

Callers 6

dropMethod · 0.45
eject_deviceMethod · 0.45
dropMethod · 0.45
vm_shutdownMethod · 0.45
vm_rebootMethod · 0.45
start_threadMethod · 0.45

Calls 2

valid_transitionMethod · 0.80
resumeMethod · 0.45

Tested by

no test coverage detected