From 5d9e948b31014640bdbccab79fe2080dccd2bbf2 Mon Sep 17 00:00:00 2001 From: Josh Siviour Date: Fri, 19 Jun 2026 10:21:58 +1000 Subject: [PATCH] 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. --- spinifex/vm/volumes.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spinifex/vm/volumes.go b/spinifex/vm/volumes.go index 79b8a6e8b..5a2c741d3 100644 --- a/spinifex/vm/volumes.go +++ b/spinifex/vm/volumes.go @@ -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