Skip to content

Commit

Permalink
Update node.go
Browse files Browse the repository at this point in the history
added changes for RDM volume
  • Loading branch information
Lakshmi3004 authored Jul 24, 2023
1 parent 93c540d commit 79c4eeb
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions service/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1061,32 +1061,34 @@ func (s *service) NodeGetInfo(
if err != nil {
return nil, fmt.Errorf("invalid value '%s' specified for 'max-powermax-volumes-per-node' node label", val)
}
if maxPowerMaxVolumesPerNode < 0 {
log.Errorf("Node label max-powermax-volumes-per-node should not be set to negative value, Using default value 0")
maxPowerMaxVolumesPerNode = 0
}
if s.opts.IsVsphereEnabled {
if maxPowerMaxVolumesPerNode < 0 || maxPowerMaxVolumesPerNode > 60 {
if maxPowerMaxVolumesPerNode <= 0 || maxPowerMaxVolumesPerNode > 60 {
log.Errorf("Node label max-powermax-volumes-per-node should not be greater than 60 or set to any negative value for RDM volumes, Setting to default value 60")
}
maxPowerMaxVolumesPerNode = 60
}
} else {
if maxPowerMaxVolumesPerNode < 0 {
log.Errorf("Node label max-powermax-volumes-per-node should not be set to negative value, Using default value 0")
maxPowerMaxVolumesPerNode = 0
}
}
log.Infof("node label 'max-powermax-volumes-per-node' is available and is set to value '%v'", maxPowerMaxVolumesPerNode)
} else {
// As per the csi spec the plugin MUST NOT set negative values to
// 'MaxVolumesPerNode' in the NodeGetInfoResponse response
if s.opts.MaxVolumesPerNode < 0 {
log.Errorf("maxPowerMaxVolumesPerNode MUST NOT be set to negative value, setting to default value 0")
s.opts.MaxVolumesPerNode = 0
}
if s.opts.IsVsphereEnabled {
if s.opts.MaxVolumesPerNode < 0 || s.opts.MaxVolumesPerNode > 60 {
if s.opts.MaxVolumesPerNode <= 0 || s.opts.MaxVolumesPerNode > 60 {
log.Errorf("maxPowerMaxVolumesPerNode MUST NOT be greater than 60 or set to any negative value for RDM volumes. Setting to default value 60")
}
s.opts.MaxVolumesPerNode = 60
} else {
if s.opts.MaxVolumesPerNode < 0 {
log.Errorf("maxPowerMaxVolumesPerNode MUST NOT be set to negative value, setting to default value 0")
s.opts.MaxVolumesPerNode = 0
}
}
maxPowerMaxVolumesPerNode = s.opts.MaxVolumesPerNode
log.Infof("Node label 'max-powermax-volumes-per-node' is not available. Using default volume limit '%v'", maxPowerMaxVolumesPerNode)
log.Infof("Node label 'max-powermax-volumes-per-node' is not available. Using value specified in value.yaml : '%v'", maxPowerMaxVolumesPerNode)
}
return &csi.NodeGetInfoResponse{
NodeId: s.opts.NodeName,
Expand Down

0 comments on commit 79c4eeb

Please sign in to comment.