UPSTREAM: 90638: Fix race in VSphere volume provisioning
@@ -70,6 +70,11 @@ func (diskManager virtualDiskManager) Create(ctx context.Context, datastore *vcl
taskInfo, err := task.WaitForResult(ctx, nil)
vclib.RecordvSphereMetric(vclib.APICreateVolume, requestTime, err)
if err != nil {
+ if isAlreadyExists(diskManager.diskPath, err) {
+ // The disk already exists, log info message and return success
+ klog.V(vclib.LogLevel).Infof("File: %v already exists", diskManager.diskPath)
+ return diskManager.diskPath, nil
+ }
klog.Errorf("Failed to complete virtual disk creation: %s. err: %+v", diskManager.diskPath, err)
return "", err
}
