Skip to content

Commit

Permalink
Merge pull request kubernetes#102969 from gnufied/automated-cherry-pi…
Browse files Browse the repository at this point in the history
…ck-of-#102892-upstream-release-1.21

Automated cherry pick of kubernetes#102892: Do not throw error when we can't get canonical path
  • Loading branch information
k8s-ci-robot authored Jun 28, 2021
2 parents 397ff0b + 9eac5b5 commit 5f8f5ab
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
Original file line number Diff line number Diff line change
Expand Up @@ -936,11 +936,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 5f8f5ab

Please sign in to comment.