mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-01 22:50:54 +00:00
runtime-rs: preserve ccw address for modern block devices
Store the hotplugged CCW address in BlockModern configs and use it when building storage sources so s390x encrypted emptyDir paths no longer fall back to /dev/vda. Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
This commit is contained in:
@@ -53,6 +53,9 @@ pub struct BlockConfigModern {
|
||||
/// scsi_addr is of the format SCSI-Id:LUN
|
||||
pub scsi_addr: Option<String>,
|
||||
|
||||
/// CCW device address for virtio-blk-ccw on s390x (e.g., "0.0.0005")
|
||||
pub ccw_addr: Option<String>,
|
||||
|
||||
/// device attach count
|
||||
pub attach_count: u64,
|
||||
|
||||
|
||||
@@ -978,7 +978,7 @@ impl QemuInner {
|
||||
};
|
||||
|
||||
// Second, execute the asynchronous hotplug without holding the lock.
|
||||
let (pci_path, scsi_addr) = qmp
|
||||
let (pci_path, addr_str) = qmp
|
||||
.hotplug_block_device(
|
||||
&driver,
|
||||
index,
|
||||
@@ -1000,8 +1000,12 @@ impl QemuInner {
|
||||
if let Some(p) = pci_path {
|
||||
cfg.pci_path = Some(p);
|
||||
}
|
||||
if let Some(s) = scsi_addr {
|
||||
cfg.scsi_addr = Some(s);
|
||||
if let Some(addr) = addr_str {
|
||||
if driver == VIRTIO_BLK_CCW {
|
||||
cfg.ccw_addr = Some(addr);
|
||||
} else {
|
||||
cfg.scsi_addr = Some(addr);
|
||||
}
|
||||
}
|
||||
info!(sl!(), "Completed BlockModern hotplug: {:?}", &cfg);
|
||||
}
|
||||
|
||||
@@ -107,6 +107,13 @@ pub async fn handle_block_volume(
|
||||
return Err(anyhow!("block driver is scsi but no scsi address exists"));
|
||||
}
|
||||
}
|
||||
KATA_CCW_DEV_TYPE => {
|
||||
if let Some(ccw_addr) = &device.config.ccw_addr {
|
||||
ccw_addr.to_string()
|
||||
} else {
|
||||
return Err(anyhow!("block driver is ccw but no ccw address exists"));
|
||||
}
|
||||
}
|
||||
_ => device.config.virt_path.clone(),
|
||||
};
|
||||
device_id = device.device_id.clone();
|
||||
|
||||
Reference in New Issue
Block a user