Skip to content

Commit

Permalink
Removing ''
Browse files Browse the repository at this point in the history
  • Loading branch information
aqu-dell committed Aug 19, 2024
1 parent 33833bd commit 09062ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
35 changes: 17 additions & 18 deletions service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ func (s *service) CreateVolume(
var errMsg string
if err == nil {
if foundVol {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "the export may not be ready yet and the path is '%s'", path))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "the export may not be ready yet and the path is %s", path))
}
} else {
// internal error
Expand Down Expand Up @@ -678,7 +678,7 @@ func (s *service) CreateVolume(
return nil, err
}
}
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "the export id '%d' and path '%s' may not be ready yet after retrying", exportID, path))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "the export id %d and path %s may not be ready yet after retrying", exportID, path))
}

func (s *service) createVolumeFromSnapshot(ctx context.Context, isiConfig *IsilonClusterConfig,
Expand Down Expand Up @@ -1134,14 +1134,14 @@ func (s *service) ControllerPublishVolume(
if isROVolumeFromSnapshot {
log.Info("Volume source is snapshot")
if export, err := isiConfig.isiSvc.GetExportWithPathAndZone(ctx, exportPath, accessZone); err != nil || export == nil {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "error retrieving export for '%s'", exportPath))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "error retrieving export for %s", exportPath))
}
} else {
isiPath = utils.GetIsiPathFromExportPath(exportPath)
vol, err := isiConfig.isiSvc.GetVolume(ctx, isiPath, "", volName)
if err != nil || vol.Name == "" {
return nil, status.Error(codes.Internal,
utils.GetMessageWithRunID(runID, "failure checking volume status before controller publish: '%s'",
utils.GetMessageWithRunID(runID, "failure checking volume status before controller publish: %s",
err.Error()))
}
}
Expand Down Expand Up @@ -1216,8 +1216,7 @@ func (s *service) ControllerPublishVolume(
}
if isiConfig.isiSvc.OtherClientsAlreadyAdded(ctx, exportID, accessZone, nodeID) {
return nil, status.Error(codes.FailedPrecondition, utils.GetMessageWithRunID(runID,
"export '%d' in access zone '%s' already has other clients added to it, and the access mode is "+
"%s, thus the request fails", exportID, accessZone, am.Mode))
"export %d in access zone %s already has other clients added to it, and the access mode is %s, thus the request fails", exportID, accessZone, am.Mode))
}

if !isiConfig.isiSvc.IsHostAlreadyAdded(ctx, exportID, accessZone, utils.DummyHostNodeID) {
Expand All @@ -1228,12 +1227,12 @@ func (s *service) ControllerPublishVolume(
err = isiConfig.isiSvc.AddExportClientNetworkIdentifierByIDWithZone(ctx, clusterName, exportID, accessZone, nodeID, *isiConfig.IgnoreUnresolvableHosts, isiConfig.isiSvc.AddExportClientByIDWithZone)
}
default:
return nil, status.Error(codes.InvalidArgument, utils.GetMessageWithRunID(runID, "unsupported access mode: '%s'", am.String()))
return nil, status.Error(codes.InvalidArgument, utils.GetMessageWithRunID(runID, "unsupported access mode: %s", am.String()))
}

if err != nil {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID,
"internal error occurred when attempting to add client ip '%s' to export '%d', error : '%v'", nodeID, exportID, err))
"internal error occurred when attempting to add client ip %s to export %d, error : %v", nodeID, exportID, err))
}
return &csi.ControllerPublishVolumeResponse{}, nil
}
Expand Down Expand Up @@ -1281,7 +1280,7 @@ func (s *service) ValidateVolumeCapabilities(
vol, err := s.getVolByName(ctx, isiPath, volName, isiConfig)
if err != nil {
return nil, status.Error(codes.Internal,
utils.GetMessageWithRunID(runID, "failure checking volume status for capabilities: '%s'",
utils.GetMessageWithRunID(runID, "failure checking volume status for capabilities: %s",
err.Error()))
}

Expand Down Expand Up @@ -1395,7 +1394,7 @@ func (s *service) ControllerUnpublishVolume(

_, exportID, accessZone, clusterName, err := utils.ParseNormalizedVolumeID(ctx, req.VolumeId)
if err != nil {
return nil, status.Error(codes.InvalidArgument, utils.GetMessageWithRunID(runID, "failed to parse volume ID '%s', error : '%s'", req.VolumeId, err.Error()))
return nil, status.Error(codes.InvalidArgument, utils.GetMessageWithRunID(runID, "failed to parse volume ID %s, error : %s", req.VolumeId, err.Error()))
}

isiConfig, err := s.getIsilonConfig(ctx, &clusterName)
Expand Down Expand Up @@ -1427,7 +1426,7 @@ func (s *service) ControllerUnpublishVolume(
return nil, delErr
}
} else {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "error encountered when trying to remove client '%s' from export '%d' with access zone '%s' on cluster '%s', error %s", nodeID, exportID, accessZone, clusterName, err.Error()))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "error encountered when trying to remove client %s from export %d with access zone %s on cluster %s, error %s", nodeID, exportID, accessZone, clusterName, err.Error()))
}
}

Expand Down Expand Up @@ -1472,10 +1471,10 @@ func (s *service) GetCapacity(

stat, err := isiConfig.isiSvc.GetStatistics(ctx, keyArray)
if err != nil || len(stat.StatsList) < 1 {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "Could not retrieve capacity. Error '%s'", err.Error()))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "Could not retrieve capacity. Error %s", err.Error()))
}
if stat.StatsList[0].Error != "" {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "Could not retrieve capacity. Data returned error '%s'", stat.StatsList[0].Error))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "Could not retrieve capacity. Data returned error %s", stat.StatsList[0].Error))
}
remainingCapInBytes := stat.StatsList[0].Value

Expand Down Expand Up @@ -1761,7 +1760,7 @@ func (s *service) DeleteSnapshot(
// parse the input snapshot id and fetch it's components
snapshotID, clusterName, accessZone, err := utils.ParseNormalizedSnapshotID(ctx, req.GetSnapshotId())
if err != nil {
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("failed to parse snapshot ID '%s', error : '%v'", req.GetSnapshotId(), err))
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("failed to parse snapshot ID %s, error : %v", req.GetSnapshotId(), err))
}
isiConfig, err := s.getIsilonConfig(ctx, &clusterName)
if err != nil {
Expand All @@ -1779,7 +1778,7 @@ func (s *service) DeleteSnapshot(

id, err := strconv.ParseInt(snapshotID, 10, 64)
if err != nil {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "cannot convert snapshot to integer: '%s'", err.Error()))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "cannot convert snapshot to integer: %s", err.Error()))
}
snapshot, err := isiConfig.isiSvc.GetSnapshot(ctx, snapshotID)
// Idempotency check
Expand All @@ -1792,13 +1791,13 @@ func (s *service) DeleteSnapshot(
return &csi.DeleteSnapshotResponse{}, nil
}
// Internal server error if the error is not about "not found"
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "cannot check the existence of the snapshot: '%s'", err.Error()))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "cannot check the existence of the snapshot: %s", err.Error()))
}

if jsonError.StatusCode == 404 {
return &csi.DeleteSnapshotResponse{}, nil
}
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "cannot check the existence of the snapshot: '%s'", err.Error()))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "cannot check the existence of the snapshot: %s", err.Error()))
}

// Get snapshot path
Expand Down Expand Up @@ -1829,7 +1828,7 @@ func (s *service) DeleteSnapshot(
if deleteSnapshot {
err = isiConfig.isiSvc.DeleteSnapshot(ctx, id, "")
if err != nil {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "error deleting snapshot: '%s'", err.Error()))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "error deleting snapshot: %s", err.Error()))
}
}
log.Infof("Snapshot with id '%s' deleted", snapshotID)
Expand Down
2 changes: 1 addition & 1 deletion service/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (s *service) NodePublishVolume(
if isROVolumeFromSnapshot {
log.Info("Volume source is snapshot")
if export, err := isiConfig.isiSvc.GetExportWithPathAndZone(ctx, path, accessZone); err != nil || export == nil {
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "error retrieving export for '%s'", path))
return nil, status.Error(codes.Internal, utils.GetMessageWithRunID(runID, "error retrieving export for %s", path))
}
} else {
// Parse the target path and empty volume name to get the volume
Expand Down

0 comments on commit 09062ff

Please sign in to comment.