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

Method add_disk

vmm/src/vm.rs:2276–2298  ·  view source on GitHub ↗
(&mut self, mut disk_cfg: DiskConfig)

Source from the content-addressed store, hash-verified

2274 }
2275
2276 pub fn add_disk(&mut self, mut disk_cfg: DiskConfig) -> Result<PciDeviceInfo> {
2277 let pci_device_info = self
2278 .device_manager
2279 .lock()
2280 .unwrap()
2281 .add_disk(&mut disk_cfg)
2282 .map_err(Error::DeviceManager)?;
2283
2284 // Update VmConfig by adding the new device. This is important to
2285 // ensure the device would be created in case of a reboot.
2286 {
2287 let mut config = self.config.lock().unwrap();
2288 add_to_config(&mut config.disks, disk_cfg);
2289 }
2290
2291 self.device_manager
2292 .lock()
2293 .unwrap()
2294 .notify_hotplug(AcpiNotificationFlags::PCI_DEVICES_CHANGED)
2295 .map_err(Error::DeviceManager)?;
2296
2297 Ok(pci_device_info)
2298 }
2299
2300 pub fn add_fs(&mut self, mut fs_cfg: FsConfig) -> Result<PciDeviceInfo> {
2301 let pci_device_info = self

Callers 1

vm_add_diskMethod · 0.45

Calls 2

add_to_configFunction · 0.85
notify_hotplugMethod · 0.80

Tested by

no test coverage detected