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

Method add_net

vmm/src/vm.rs:2375–2397  ·  view source on GitHub ↗
(&mut self, mut net_cfg: NetConfig)

Source from the content-addressed store, hash-verified

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

Callers 1

vm_add_netMethod · 0.45

Calls 2

add_to_configFunction · 0.85
notify_hotplugMethod · 0.80

Tested by

no test coverage detected