Skip to content

Commit 143b5b0

Browse files
authored
Merge pull request #74 from lpabon/pick72
Fixes issue#72
2 parents fa366f3 + 32efba7 commit 143b5b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/controller/controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func checkDriverState(grpcClient *grpc.ClientConn, timeout time.Duration) (strin
246246
return driverName, nil
247247
}
248248

249-
func makeVolumeName(prefix, pvcUID string) (string, error) {
249+
func makeVolumeName(prefix, pvcUID string, volumeNameUUIDLength int) (string, error) {
250250
// create persistent name based on a volumeNamePrefix and volumeNameUUIDLength
251251
// of PVC's UID
252252
if len(prefix) == 0 {
@@ -255,7 +255,7 @@ func makeVolumeName(prefix, pvcUID string) (string, error) {
255255
if len(pvcUID) == 0 {
256256
return "", fmt.Errorf("corrupted PVC object, it is missing UID")
257257
}
258-
return fmt.Sprintf("%s-%s", prefix, pvcUID), nil
258+
return fmt.Sprintf("%s-%s", prefix, strings.Replace(string(pvcUID), "-", "", -1)[0:volumeNameUUIDLength]), nil
259259
}
260260

261261
func (p *csiProvisioner) Provision(options controller.VolumeOptions) (*v1.PersistentVolume, error) {
@@ -268,7 +268,7 @@ func (p *csiProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
268268
return nil, err
269269
}
270270

271-
share, err := makeVolumeName(p.volumeNamePrefix, fmt.Sprintf("%s", options.PVC.ObjectMeta.UID))
271+
share, err := makeVolumeName(p.volumeNamePrefix, fmt.Sprintf("%s", options.PVC.ObjectMeta.UID), p.volumeNameUUIDLength)
272272
if err != nil {
273273
return nil, err
274274
}

0 commit comments

Comments
 (0)