(&mut self, mut vsock_cfg: VsockConfig)
| 2421 | } |
| 2422 | |
| 2423 | pub fn add_vsock(&mut self, mut vsock_cfg: VsockConfig) -> Result<PciDeviceInfo> { |
| 2424 | let pci_device_info = self |
| 2425 | .device_manager |
| 2426 | .lock() |
| 2427 | .unwrap() |
| 2428 | .add_vsock(&mut vsock_cfg) |
| 2429 | .map_err(Error::DeviceManager)?; |
| 2430 | |
| 2431 | // Update VmConfig by adding the new device. This is important to |
| 2432 | // ensure the device would be created in case of a reboot. |
| 2433 | { |
| 2434 | let mut config = self.config.lock().unwrap(); |
| 2435 | config.vsock = Some(vsock_cfg); |
| 2436 | } |
| 2437 | |
| 2438 | self.device_manager |
| 2439 | .lock() |
| 2440 | .unwrap() |
| 2441 | .notify_hotplug(AcpiNotificationFlags::PCI_DEVICES_CHANGED) |
| 2442 | .map_err(Error::DeviceManager)?; |
| 2443 | |
| 2444 | Ok(pci_device_info) |
| 2445 | } |
| 2446 | |
| 2447 | pub fn counters(&self) -> Result<HashMap<String, HashMap<&'static str, Wrapping<u64>>>> { |
| 2448 | Ok(self.device_manager.lock().unwrap().counters()) |
no test coverage detected