Skip to content

Commit

Permalink
Merge pull request #461 from gnufied/backport-vsphere-name-fix-ocp
Browse files Browse the repository at this point in the history
Bug 1884800: Reduce volume name length for vsphere
  • Loading branch information
openshift-merge-robot committed Nov 21, 2020
2 parents 012834f + c8a6665 commit 13d6aa9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/volume/vsphere_volume/vsphere_volume_util.go
Expand Up @@ -91,7 +91,13 @@ func (util *VsphereDiskUtil) CreateVolume(v *vsphereVolumeProvisioner, selectedN
return nil, err
}
volSizeKiB := volSizeMiB * 1024
name := volumeutil.GenerateVolumeName(v.options.ClusterName, v.options.PVName, 255)
// reduce number of characters in vsphere volume name. The reason for setting length smaller than 255 is because typically
// volume name also becomes part of mount path - /var/lib/kubelet/plugins/kubernetes.io/vsphere-volume/mounts/<name>
// and systemd has a limit of 256 chars in a unit name - https://github.com/systemd/systemd/pull/14294
// so if we subtract the kubelet path prefix from 256, we are left with 191 characters.
// Since datastore name is typically part of volumeName we are choosing a shorter length of 90
// and leaving room of certain characters being escaped etc.
name := volumeutil.GenerateVolumeName(v.options.ClusterName, v.options.PVName, 90)
volumeOptions := &vclib.VolumeOptions{
CapacityKB: volSizeKiB,
Tags: *v.options.CloudTags,
Expand Down

0 comments on commit 13d6aa9

Please sign in to comment.