Skip to content

Commit

Permalink
add logs and err messages for non-guid restrictedSdcMode
Browse files Browse the repository at this point in the history
  • Loading branch information
VamsiSiddu-7 committed Feb 2, 2023
1 parent 86fd202 commit 05ec44d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 11 additions & 1 deletion service/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func (s *service) approveSDC(opts Opts) error {
}

//fetch the restrictedSdcMode
if system.System.RestrictedSdcModeEnabled && system.System.RestrictedSdcMode == "Guid" {
if system.System.RestrictedSdcMode == "Guid" {
if !sdc.Sdc.SdcApproved {
resp, err := system.ApproveSdcByGUID(sdc.Sdc.SdcGUID)
if err != nil {
Expand All @@ -450,7 +450,17 @@ func (s *service) approveSDC(opts Opts) error {
} else {
Log.Infof("SDC already approved, SDC GUID: %s", sdc.Sdc.SdcGUID)
}
} else {
if !sdc.Sdc.SdcApproved {
return status.Errorf(codes.FailedPrecondition,
"Array RestrictedSdcMode is %s, driver only supports GUID RestrictedSdcMode cannot approve SDC %s",
system.System.RestrictedSdcMode, sdc.Sdc.SdcGUID)
}
Log.Warnf("Array RestrictedSdcMode is %s, driver only supports GUID RestrictedSdcMode If SDC becomes restricted again, driver will not be able to approve",
system.System.RestrictedSdcMode)

}

}
return nil
}
Expand Down
3 changes: 1 addition & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,8 @@ func (s *service) BeforeServe(
if approveSDC == "true" {
opts.IsApproveSDCEnabled = true
}
} else {
opts.IsApproveSDCEnabled = false
}

if s.privDir == "" {
s.privDir = defaultPrivDir
}
Expand Down

0 comments on commit 05ec44d

Please sign in to comment.