Skip to content

Commit

Permalink
formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Jul 25, 2023
1 parent 540bc71 commit af848b4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions service/envvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ const (

// EnvKubeConfigPath indicates kubernetes configuration that has to be used by CSI Driver
EnvKubeConfigPath = "KUBECONFIG"

// EnvConfigFilePath is an env variable which contains the full path for the config file
EnvConfigFilePath = "X_CSI_POWERMAX_CONFIG_PATH"

// EnvMaxVolumesPerNode specifies maximum number of volumes that controller can publish to the node.
EnvMaxVolumesPerNode = "X_CSI_MAX_VOLUMES_PER_NODE"

// EnvHealthMonitorEnabled is an env variable which indicated if volume health monitor is enabled
EnvHealthMonitorEnabled = "X_CSI_HEALTH_MONITOR_ENABLED"

Expand Down
10 changes: 5 additions & 5 deletions service/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1064,22 +1064,22 @@ func (s *service) NodeGetInfo(
if s.opts.IsVsphereEnabled {
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
// As per the csi spec the plugin MUST NOT set negative values to
// 'MaxVolumesPerNode' in the NodeGetInfoResponse response
log.Infof("Node label 'max-powermax-volumes-per-node' is not available. Retrieving the value from yaml file")
if s.opts.IsVsphereEnabled {
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")
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 {
Expand Down
12 changes: 6 additions & 6 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ import (
"time"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/dell/csi-powermax/v2/k8sutils"
"github.com/dell/gocsi"
csictx "github.com/dell/gocsi/context"
"github.com/dell/goiscsi"
types "github.com/dell/gopowermax/v2/types/v100"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/dell/csi-powermax/v2/k8sutils"

"github.com/dell/csi-powermax/v2/core"
migrext "github.com/dell/dell-csi-extensions/migration"
Expand Down Expand Up @@ -128,8 +128,8 @@ type Opts struct {
VCenterHostURL string // vCenter host url
VCenterHostUserName string // vCenter host username
VCenterHostPassword string // vCenter password
MaxVolumesPerNode int64 // to specify volume limits
KubeConfigPath string // to specify k8s configuration to be used CSI driver
MaxVolumesPerNode int64 // to specify volume limits
KubeConfigPath string // to specify k8s configuration to be used CSI driver
}

// NodeConfig defines rules for given node
Expand Down Expand Up @@ -396,12 +396,12 @@ func (s *service) BeforeServe(
}

if MaxVolumesPerNode, ok := csictx.LookupEnv(ctx, EnvMaxVolumesPerNode); ok {
val, err := strconv.ParseInt(MaxVolumesPerNode, 10, 64)
if err!=nil {
val, err := strconv.ParseInt(MaxVolumesPerNode, 10, 64)
if err != nil {
log.Warningf("error while parsing env variable '%s', %s, defaulting to 0", EnvMaxVolumesPerNode, err)
opts.MaxVolumesPerNode = 0
} else {
opts.MaxVolumesPerNode = val
opts.MaxVolumesPerNode = val
}
}

Expand Down

0 comments on commit af848b4

Please sign in to comment.