mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-19 19:01:42 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user