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

Method add_device

vmm/src/vm.rs:2209–2231  ·  view source on GitHub ↗
(&mut self, mut device_cfg: DeviceConfig)

Source from the content-addressed store, hash-verified

2207 }
2208
2209 pub fn add_device(&mut self, mut device_cfg: DeviceConfig) -> Result<PciDeviceInfo> {
2210 let pci_device_info = self
2211 .device_manager
2212 .lock()
2213 .unwrap()
2214 .add_device(&mut device_cfg)
2215 .map_err(Error::DeviceManager)?;
2216
2217 // Update VmConfig by adding the new device. This is important to
2218 // ensure the device would be created in case of a reboot.
2219 {
2220 let mut config = self.config.lock().unwrap();
2221 add_to_config(&mut config.devices, device_cfg);
2222 }
2223
2224 self.device_manager
2225 .lock()
2226 .unwrap()
2227 .notify_hotplug(AcpiNotificationFlags::PCI_DEVICES_CHANGED)
2228 .map_err(Error::DeviceManager)?;
2229
2230 Ok(pci_device_info)
2231 }
2232
2233 pub fn add_user_device(&mut self, mut device_cfg: UserDeviceConfig) -> Result<PciDeviceInfo> {
2234 let pci_device_info = self

Callers 1

vm_add_deviceMethod · 0.45

Calls 2

add_to_configFunction · 0.85
notify_hotplugMethod · 0.80

Tested by

no test coverage detected