From c3ce6a1d15c42aa88ca253f293fbdc52315f09f8 Mon Sep 17 00:00:00 2001 From: Archana Shinde Date: Sat, 21 Oct 2023 05:44:30 -0700 Subject: [PATCH] runtime-rs: Provide PCI path to the agent for virtio-block If PCI path for block device is not empty for a block device, use that as identifier for agent instead of virt path which is valid only for mmio devices. Signed-off-by: Archana Shinde --- src/runtime-rs/crates/resource/src/manager_inner.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/runtime-rs/crates/resource/src/manager_inner.rs b/src/runtime-rs/crates/resource/src/manager_inner.rs index 1f51ca9c0f..53b3ac4a12 100644 --- a/src/runtime-rs/crates/resource/src/manager_inner.rs +++ b/src/runtime-rs/crates/resource/src/manager_inner.rs @@ -297,8 +297,16 @@ impl ResourceManagerInner { // create block device for kata agent, // if driver is virtio-blk-pci, the id will be pci address. if let DeviceType::Block(device) = device_info { + // The following would work for drivers virtio-blk-pci and mmio. + // Once scsi support is added, need to handle scsi identifiers. + let id = if let Some(pci_path) = device.config.pci_path { + pci_path.convert_to_string() + } else { + device.config.virt_path.clone() + }; + let agent_device = Device { - id: device.config.virt_path.clone(), + id, container_path: d.path.clone(), field_type: device.config.driver_option, vm_path: device.config.virt_path,