(&mut self, id: String)
| 2266 | } |
| 2267 | |
| 2268 | fn vm_remove_device(&mut self, id: String) -> result::Result<(), VmError> { |
| 2269 | if let Some(ref mut vm) = self.vm { |
| 2270 | vm.remove_device(&id) |
| 2271 | .inspect_err(|e| error!("Error when removing device from the VM: {e:?}"))?; |
| 2272 | Ok(()) |
| 2273 | } else if let Some(ref config) = self.vm_config { |
| 2274 | let mut config = config.lock().unwrap(); |
| 2275 | if config.remove_device(&id) { |
| 2276 | Ok(()) |
| 2277 | } else { |
| 2278 | Err(VmError::NoDeviceToRemove(id)) |
| 2279 | } |
| 2280 | } else { |
| 2281 | Err(VmError::VmNotCreated) |
| 2282 | } |
| 2283 | } |
| 2284 | |
| 2285 | fn vm_add_disk(&mut self, disk_cfg: DiskConfig) -> result::Result<Option<Vec<u8>>, VmError> { |
| 2286 | self.vm_config.as_ref().ok_or(VmError::VmNotCreated)?; |
no test coverage detected