feat: set EBS volume-id as virtio-blk serial on attach (#395)

Stamp the dash-stripped volume-id (vol+17hex = 20 bytes, the virtio-blk
serial limit) as the hotplug disk serial so the EBS CSI node plugin can
locate the device via /dev/disk/by-id and match lsblk SERIAL.
This commit is contained in:
Josh Siviour
2026-06-19 10:21:58 +10:00
committed by GitHub
parent 1eda1ce88b
commit 5d9e948b31
+5
View File
@@ -135,11 +135,16 @@ func (m *Manager) AttachVolume(id, volumeID, device string) (AttachVolumeResult,
}
}
// serial is the volume-id with dashes stripped ("vol" + 17 hex = 20 bytes,
// the virtio-blk serial limit). It surfaces in-guest as the block device
// serial so the EBS CSI node plugin can locate /dev/disk/by-id and match
// `lsblk -o SERIAL` against the volume-id.
deviceAddArgs := map[string]any{
"driver": "virtio-blk-pci",
"id": deviceID,
"drive": nodeName,
"iothread": iothreadID,
"serial": strings.ReplaceAll(volumeID, "-", ""),
}
if hotplugBus != "" {
deviceAddArgs["bus"] = hotplugBus