(&mut self, mut net_cfg: NetConfig)
| 2373 | } |
| 2374 | |
| 2375 | pub fn add_net(&mut self, mut net_cfg: NetConfig) -> Result<PciDeviceInfo> { |
| 2376 | let pci_device_info = self |
| 2377 | .device_manager |
| 2378 | .lock() |
| 2379 | .unwrap() |
| 2380 | .add_net(&mut net_cfg) |
| 2381 | .map_err(Error::DeviceManager)?; |
| 2382 | |
| 2383 | // Update VmConfig by adding the new device. This is important to |
| 2384 | // ensure the device would be created in case of a reboot. |
| 2385 | { |
| 2386 | let mut config = self.config.lock().unwrap(); |
| 2387 | add_to_config(&mut config.net, net_cfg); |
| 2388 | } |
| 2389 | |
| 2390 | self.device_manager |
| 2391 | .lock() |
| 2392 | .unwrap() |
| 2393 | .notify_hotplug(AcpiNotificationFlags::PCI_DEVICES_CHANGED) |
| 2394 | .map_err(Error::DeviceManager)?; |
| 2395 | |
| 2396 | Ok(pci_device_info) |
| 2397 | } |
| 2398 | |
| 2399 | pub fn add_vdpa(&mut self, mut vdpa_cfg: VdpaConfig) -> Result<PciDeviceInfo> { |
| 2400 | let pci_device_info = self |
no test coverage detected