(&mut self, mut device_cfg: UserDeviceConfig)
| 2231 | } |
| 2232 | |
| 2233 | pub fn add_user_device(&mut self, mut device_cfg: UserDeviceConfig) -> Result<PciDeviceInfo> { |
| 2234 | let pci_device_info = self |
| 2235 | .device_manager |
| 2236 | .lock() |
| 2237 | .unwrap() |
| 2238 | .add_user_device(&mut device_cfg) |
| 2239 | .map_err(Error::DeviceManager)?; |
| 2240 | |
| 2241 | // Update VmConfig by adding the new device. This is important to |
| 2242 | // ensure the device would be created in case of a reboot. |
| 2243 | { |
| 2244 | let mut config = self.config.lock().unwrap(); |
| 2245 | add_to_config(&mut config.user_devices, device_cfg); |
| 2246 | } |
| 2247 | |
| 2248 | self.device_manager |
| 2249 | .lock() |
| 2250 | .unwrap() |
| 2251 | .notify_hotplug(AcpiNotificationFlags::PCI_DEVICES_CHANGED) |
| 2252 | .map_err(Error::DeviceManager)?; |
| 2253 | |
| 2254 | Ok(pci_device_info) |
| 2255 | } |
| 2256 | |
| 2257 | pub fn remove_device(&mut self, id: &str) -> Result<()> { |
| 2258 | self.device_manager |
no test coverage detected