| 1795 | |
| 1796 | impl RequestHandler for Vmm { |
| 1797 | fn vm_create(&mut self, config: Box<VmConfig>) -> result::Result<(), VmError> { |
| 1798 | // We only store the passed VM config. |
| 1799 | // The VM will be created when being asked to boot it. |
| 1800 | if self.vm_config.is_some() { |
| 1801 | return Err(VmError::VmAlreadyCreated); |
| 1802 | } |
| 1803 | |
| 1804 | self.vm_config = Some(Arc::new(Mutex::new(*config))); |
| 1805 | self.console_info = |
| 1806 | Some(pre_create_console_devices(self).map_err(VmError::CreateConsoleDevices)?); |
| 1807 | |
| 1808 | if self |
| 1809 | .vm_config |
| 1810 | .as_ref() |
| 1811 | .is_some_and(|config| config.lock().unwrap().landlock_enable) |
| 1812 | { |
| 1813 | let mut config = self.vm_config.as_ref().unwrap().lock().unwrap(); |
| 1814 | apply_landlock(&mut config).map_err(VmError::ApplyLandlock)?; |
| 1815 | } |
| 1816 | Ok(()) |
| 1817 | } |
| 1818 | |
| 1819 | fn vm_boot(&mut self) -> result::Result<(), VmError> { |
| 1820 | tracer::start(); |