mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Fix Cinder volume detection on OpenStack Train
Newer OpenStack does not truncate volumeID to 20 characters. /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_033fa19a-a5e3-445a-8631-3e9349e540e5 was seen on an OpenStack Train node.
This commit is contained in:
parent
b3fc888863
commit
92c3895115
@ -491,11 +491,14 @@ func (os *OpenStack) CreateVolume(name string, size int, vtype, availability str
|
|||||||
func (os *OpenStack) GetDevicePathBySerialID(volumeID string) string {
|
func (os *OpenStack) GetDevicePathBySerialID(volumeID string) string {
|
||||||
// Build a list of candidate device paths.
|
// Build a list of candidate device paths.
|
||||||
// Certain Nova drivers will set the disk serial ID, including the Cinder volume id.
|
// Certain Nova drivers will set the disk serial ID, including the Cinder volume id.
|
||||||
|
// Newer OpenStacks may not truncate the volumeID to 20 chars.
|
||||||
candidateDeviceNodes := []string{
|
candidateDeviceNodes := []string{
|
||||||
// KVM
|
// KVM
|
||||||
fmt.Sprintf("virtio-%s", volumeID[:20]),
|
fmt.Sprintf("virtio-%s", volumeID[:20]),
|
||||||
|
fmt.Sprintf("virtio-%s", volumeID),
|
||||||
// KVM virtio-scsi
|
// KVM virtio-scsi
|
||||||
fmt.Sprintf("scsi-0QEMU_QEMU_HARDDISK_%s", volumeID[:20]),
|
fmt.Sprintf("scsi-0QEMU_QEMU_HARDDISK_%s", volumeID[:20]),
|
||||||
|
fmt.Sprintf("scsi-0QEMU_QEMU_HARDDISK_%s", volumeID),
|
||||||
// ESXi
|
// ESXi
|
||||||
fmt.Sprintf("wwn-0x%s", strings.Replace(volumeID, "-", "", -1)),
|
fmt.Sprintf("wwn-0x%s", strings.Replace(volumeID, "-", "", -1)),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user