From 5d3843a04de14db4db523600cce6c175e62170dc Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Wed, 18 Nov 2020 10:51:13 +0100 Subject: [PATCH] UPSTREAM: 96673: 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. --- .../legacy-cloud-providers/openstack/openstack_volumes.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go b/staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go index 934cd0419576e..6c772a34bc995 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go +++ b/staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go @@ -491,11 +491,14 @@ func (os *OpenStack) CreateVolume(name string, size int, vtype, availability str func (os *OpenStack) GetDevicePathBySerialID(volumeID string) string { // Build a list of candidate device paths. // 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{ // KVM fmt.Sprintf("virtio-%s", volumeID[:20]), + fmt.Sprintf("virtio-%s", volumeID), // KVM virtio-scsi fmt.Sprintf("scsi-0QEMU_QEMU_HARDDISK_%s", volumeID[:20]), + fmt.Sprintf("scsi-0QEMU_QEMU_HARDDISK_%s", volumeID), // ESXi fmt.Sprintf("wwn-0x%s", strings.Replace(volumeID, "-", "", -1)), }