Skip to content

Commit c42a52e

Browse files
authored
Merge pull request #571 from saad-ali/noResizeBlock
Skip NodeExpandVolume for block volumes
2 parents a1ba4cb + b494144 commit c42a52e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/gce-pd-csi-driver/node.go

+14
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,20 @@ func (ns *GCENodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpa
461461
return nil, status.Error(codes.Internal, fmt.Sprintf("error when getting device path for %s: %v", volumeID, err))
462462
}
463463

464+
volumeCapability := req.GetVolumeCapability()
465+
if volumeCapability != nil {
466+
// VolumeCapability is optional, if specified, validate it
467+
if err := validateVolumeCapability(volumeCapability); err != nil {
468+
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("VolumeCapability is invalid: %v", err))
469+
}
470+
471+
if blk := volumeCapability.GetBlock(); blk != nil {
472+
// Noop for Block NodeExpandVolume
473+
klog.V(4).Infof("NodeExpandVolume succeeded on %v to %s, capability is block so this is a no-op", volumeID, volumePath)
474+
return &csi.NodeExpandVolumeResponse{}, nil
475+
}
476+
}
477+
464478
// TODO(#328): Use requested size in resize if provided
465479
resizer := resizefs.NewResizeFs(ns.Mounter)
466480
_, err = resizer.Resize(devicePath, volumePath)

0 commit comments

Comments
 (0)