(&mut self, mut device_cfg: DeviceConfig)
| 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 |
no test coverage detected