Skip to content
Snippets Groups Projects
Commit cefade2d authored by Humble Chirammal's avatar Humble Chirammal
Browse files

Remove explicit dereferencing.

parent 71548ca5
No related branches found
No related tags found
No related merge requests found
...@@ -175,7 +175,7 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (* ...@@ -175,7 +175,7 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
// Create Volume // Create Volume
blockVolName := "" blockVolName := ""
if (*cfg).opMode == glusterBlockOpmode { if cfg.opMode == glusterBlockOpmode {
blockVolName = blockVolPrefix + string(uuid.NewUUID()) blockVolName = blockVolPrefix + string(uuid.NewUUID())
} }
blockVol, createErr := p.createVolume(volszInt, blockVolName, cfg) blockVol, createErr := p.createVolume(volszInt, blockVolName, cfg)
...@@ -189,17 +189,17 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (* ...@@ -189,17 +189,17 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
} }
//Store fields from response to iscsiSpec struct //Store fields from response to iscsiSpec struct
if (*cfg).opMode == heketiOpmode && (*blockVol).heketiBlockVolRes != nil { if cfg.opMode == heketiOpmode && blockVol.heketiBlockVolRes != nil {
iscsiVol.Portals = (*blockVol).heketiBlockVolRes.Portals iscsiVol.Portals = blockVol.heketiBlockVolRes.Portals
iscsiVol.Iqn = (*blockVol).heketiBlockVolRes.Iqn iscsiVol.Iqn = blockVol.heketiBlockVolRes.Iqn
iscsiVol.User = (*blockVol).heketiBlockVolRes.User iscsiVol.User = blockVol.heketiBlockVolRes.User
iscsiVol.AuthKey = (*blockVol).heketiBlockVolRes.AuthKey iscsiVol.AuthKey = blockVol.heketiBlockVolRes.AuthKey
iscsiVol.BlockVolName = blockVolPrefix + (*blockVol).heketiBlockVolRes.ID iscsiVol.BlockVolName = blockVolPrefix + blockVol.heketiBlockVolRes.ID
} else if (*cfg).opMode == glusterBlockOpmode && (*blockVol).glusterBlockExecVolRes != nil { } else if cfg.opMode == glusterBlockOpmode && blockVol.glusterBlockExecVolRes != nil {
iscsiVol.Portals = (*blockVol).glusterBlockExecVolRes.Portals iscsiVol.Portals = blockVol.glusterBlockExecVolRes.Portals
iscsiVol.Iqn = (*blockVol).glusterBlockExecVolRes.Iqn iscsiVol.Iqn = blockVol.glusterBlockExecVolRes.Iqn
iscsiVol.User = (*blockVol).glusterBlockExecVolRes.User iscsiVol.User = blockVol.glusterBlockExecVolRes.User
iscsiVol.AuthKey = (*blockVol).glusterBlockExecVolRes.AuthKey iscsiVol.AuthKey = blockVol.glusterBlockExecVolRes.AuthKey
iscsiVol.BlockVolName = blockVolName iscsiVol.BlockVolName = blockVolName
} else { } else {
return nil, fmt.Errorf("glusterblock: failed to parse blockvol : [%v]", *blockVol) return nil, fmt.Errorf("glusterblock: failed to parse blockvol : [%v]", *blockVol)
...@@ -223,16 +223,16 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (* ...@@ -223,16 +223,16 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
secretName := "glusterblk-" + user + "-secret" secretName := "glusterblk-" + user + "-secret"
secretRef := &v1.LocalObjectReference{} secretRef := &v1.LocalObjectReference{}
if (*cfg).chapAuthEnabled && user != "" && password != "" { if cfg.chapAuthEnabled && user != "" && password != "" {
secretRef, err = p.createSecretRef(nameSpace, secretName, user, password) secretRef, err = p.createSecretRef(nameSpace, secretName, user, password)
if err != nil { if err != nil {
glog.Errorf("glusterblock: failed to create credentials for pv") glog.Errorf("glusterblock: failed to create credentials for pv")
return nil, fmt.Errorf("glusterblock: failed to create credentials for pv") return nil, fmt.Errorf("glusterblock: failed to create credentials for pv")
} }
iscsiVol.SessionCHAPAuth = (*cfg).chapAuthEnabled iscsiVol.SessionCHAPAuth = cfg.chapAuthEnabled
iscsiVol.BlockSecret = secretName iscsiVol.BlockSecret = secretName
iscsiVol.BlockSecretNs = nameSpace iscsiVol.BlockSecretNs = nameSpace
} else if !((*cfg).chapAuthEnabled) { } else if !(cfg.chapAuthEnabled) {
glog.V(1).Infof("glusterblock: authentication requested is nil") glog.V(1).Infof("glusterblock: authentication requested is nil")
iscsiVol.SessionCHAPAuth = false iscsiVol.SessionCHAPAuth = false
secretRef = nil secretRef = nil
...@@ -240,14 +240,14 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (* ...@@ -240,14 +240,14 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
var blockString []string var blockString []string
modeAnn := "" modeAnn := ""
if (*cfg).opMode == glusterBlockOpmode { if cfg.opMode == glusterBlockOpmode {
for k, v := range (*cfg).blockModeArgs { for k, v := range cfg.blockModeArgs {
blockString = append(blockString, k+":"+v) blockString = append(blockString, k+":"+v)
modeAnn = dstrings.Join(blockString, ",") modeAnn = dstrings.Join(blockString, ",")
} }
} else { } else {
blockString = nil blockString = nil
modeAnn = "url:" + (*cfg).url + "," + "user:" + (*cfg).user + "," + "secret:" + (*cfg).restSecretName + "," + "secretnamespace:" + (*cfg).restSecretNamespace modeAnn = "url:" + cfg.url + "," + "user:" + cfg.user + "," + "secret:" + cfg.restSecretName + "," + "secretnamespace:" + cfg.restSecretNamespace
} }
pv := &v1.PersistentVolume{ pv := &v1.PersistentVolume{
...@@ -257,7 +257,7 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (* ...@@ -257,7 +257,7 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
provisionerIDAnn: p.identity, provisionerIDAnn: p.identity,
provisionerVersion: provisionerVersion, provisionerVersion: provisionerVersion,
shareIDAnn: iscsiVol.BlockVolName, shareIDAnn: iscsiVol.BlockVolName,
creatorAnn: (*cfg).opMode, creatorAnn: cfg.opMode,
volumeTypeAnn: "block", volumeTypeAnn: "block",
"Description": descAnn, "Description": descAnn,
"Blockstring": modeAnn, "Blockstring": modeAnn,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment