Skip to content

Commit e760640

Browse files
dhananjay-ngYashwantGohokar
authored andcommitted
Added wait in volume expansion for volume to become available
1 parent 64279c9 commit e760640

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/csi/driver/bv_controller.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,16 @@ func (d *BlockVolumeControllerDriver) ControllerExpandVolume(ctx context.Context
12531253
metrics.SendMetricData(d.metricPusher, metrics.PVExpand, time.Since(startTime).Seconds(), dimensionsMap)
12541254
return nil, status.Error(codes.Internal, message)
12551255
}
1256+
_, err = d.client.BlockStorage().AwaitVolumeAvailableORTimeout(ctx, volumeId)
1257+
if err != nil {
1258+
log.With("service", "blockstorage", "verb", "get", "resource", "volume", "statusCode", util.GetHttpStatusCode(err)).
1259+
Error("Volume Expansion failed with time out")
1260+
errorType = util.GetError(err)
1261+
csiMetricDimension = util.GetMetricDimensionForComponent(errorType, util.CSIStorageType)
1262+
dimensionsMap[metrics.ComponentDimension] = csiMetricDimension
1263+
metrics.SendMetricData(d.metricPusher, metrics.PVExpand, time.Since(startTime).Seconds(), dimensionsMap)
1264+
return nil, status.Errorf(codes.DeadlineExceeded, "ControllerExpand failed with time out %v", err.Error())
1265+
}
12561266

12571267
log.Info("Volume is expanded.")
12581268
csiMetricDimension = util.GetMetricDimensionForComponent(util.Success, util.CSIStorageType)

0 commit comments

Comments
 (0)