Skip to content

Commit c339464

Browse files
committed
[build][fix] not change volume type in the annotation
1 parent ffc2639 commit c339464

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pkg/driver/controller.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,10 @@ func (s *controllerService) ControllerModifyVolume(ctx lctx.Context, preq *lcsi.
552552
}
553553

554554
func (s *controllerService) ModifyVolumeProperties(pctx lctx.Context, preq *lvmrpc.ModifyVolumePropertiesRequest) (*lvmrpc.ModifyVolumePropertiesResponse, error) {
555-
llog.V(5).InfoS("ModifyVolumeProperties: called", "preq", preq)
555+
llog.V(5).InfoS("[INFO] - ModifyVolumeProperties: Called", "request", preq)
556556

557557
if err := validateModifyVolumePropertiesRequest(preq); err != nil {
558+
llog.ErrorS(err, "[ERROR] - ModifyVolumeProperties: Invalid request because of volume ID is empty", "request", preq)
558559
return nil, err
559560
}
560561

@@ -569,16 +570,18 @@ func (s *controllerService) ModifyVolumeProperties(pctx lctx.Context, preq *lvmr
569570

570571
volume, errSdk := s.cloud.GetVolume(volumeID)
571572
if errSdk != nil {
572-
llog.ErrorS(errSdk.GetError(), "ModifyVolumeProperties: failed to get volume", "volumeID", volumeID)
573+
llog.ErrorS(errSdk.GetError(), "[ERROR] - ModifyVolumeProperties: Failed to get volume", "volumeID", volumeID)
573574
return nil, ErrFailedToGetVolume(volumeID)
574575
}
575576

576577
if volume.VolumeTypeID == options.VolumeType {
577-
llog.V(2).Infof("ModifyVolumeProperties: volume %s already has volume type %s", volumeID, options.VolumeType)
578+
llog.V(2).Infof("[INFO] - ModifyVolumeProperties: Volume %s already has volume type %s", volumeID, options.VolumeType)
578579
return &lvmrpc.ModifyVolumePropertiesResponse{}, nil
579580
}
580581

581-
err := s.cloud.ExpandVolume(volumeID, options.VolumeType, volume.Size)
582+
_, err := s.cloud.ResizeOrModifyDisk(volumeID, lsutil.GiBToBytes(int64(volume.Size)), &lscloud.ModifyDiskOptions{
583+
VolumeType: options.VolumeType,
584+
})
582585
if err != nil {
583586
llog.ErrorS(err, "ModifyVolumeProperties: failed to modify volume", "volumeID", volumeID)
584587
return nil, ErrFailedToModifyVolume(volumeID)

0 commit comments

Comments
 (0)