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

Method vm_remove_device

vmm/src/lib.rs:2268–2283  ·  view source on GitHub ↗
(&mut self, id: String)

Source from the content-addressed store, hash-verified

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)?;

Callers 1

api_vm_remove_deviceMethod · 0.45

Calls 1

remove_deviceMethod · 0.45

Tested by

no test coverage detected