Skip to content

Commit

Permalink
UPSTREAM: 102969: Do not throw error when we can't get canonical path
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed Aug 6, 2021
1 parent 558d959 commit 9df0b7c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere.go
Expand Up @@ -933,11 +933,10 @@ func (vs *VSphere) AttachDisk(vmDiskPath string, storagePolicyName string, nodeN
return "", err
}

// try and get canonical path for disk and if we can't throw error
vmDiskPath, err = getcanonicalVolumePath(ctx, vm.Datacenter, vmDiskPath)
if err != nil {
klog.Errorf("failed to get canonical path for %s on node %s: %v", vmDiskPath, convertToString(nodeName), err)
return "", err
// try and get canonical path for disk and if we can't use provided vmDiskPath
canonicalPath, pathFetchErr := getcanonicalVolumePath(ctx, vm.Datacenter, vmDiskPath)
if canonicalPath != "" && pathFetchErr == nil {
vmDiskPath = canonicalPath
}

diskUUID, err = vm.AttachDisk(ctx, vmDiskPath, &vclib.VolumeOptions{SCSIControllerType: vclib.PVSCSIControllerType, StoragePolicyName: storagePolicyName})
Expand Down

0 comments on commit 9df0b7c

Please sign in to comment.