Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.

Commit b8ae2fe

Browse files
committed
Correct some variables in iscsi driver
Signed-off-by: Humble Chirammal <[email protected]>
1 parent c1e71bd commit b8ae2fe

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

pkg/iscsi/iscsi.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ func getISCSIInfo(req *csi.NodePublishVolumeRequest) (*iscsiDisk, error) {
6565
}
6666

6767
return &iscsiDisk{
68-
VolName: volName,
69-
Portals: bkportal,
70-
Iqn: iqn,
71-
lun: lun,
72-
Iface: iface,
73-
chap_discovery: chapDiscovery,
74-
chap_session: chapSession,
75-
secret: secret,
76-
InitiatorName: initiatorName}, nil
68+
VolName: volName,
69+
Portals: bkportal,
70+
Iqn: iqn,
71+
lun: lun,
72+
Iface: iface,
73+
chapDiscovery: chapDiscovery,
74+
chapSession: chapSession,
75+
secret: secret,
76+
InitiatorName: initiatorName}, nil
7777
}
7878

7979
func getISCSIDiskMounter(iscsiInfo *iscsiDisk, req *csi.NodePublishVolumeRequest) *iscsiDiskMounter {
@@ -119,15 +119,15 @@ func parseSecret(secretParams string) map[string]string {
119119
}
120120

121121
type iscsiDisk struct {
122-
Portals []string
123-
Iqn string
124-
lun string
125-
Iface string
126-
chap_discovery bool
127-
chap_session bool
128-
secret map[string]string
129-
InitiatorName string
130-
VolName string
122+
Portals []string
123+
Iqn string
124+
lun string
125+
Iface string
126+
chapDiscovery bool
127+
chapSession bool
128+
secret map[string]string
129+
InitiatorName string
130+
VolName string
131131
}
132132

133133
type iscsiDiskMounter struct {

pkg/iscsi/iscsi_util.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ import (
3232
)
3333

3434
var (
35-
chap_st = []string{
35+
chapSt = []string{
3636
"discovery.sendtargets.auth.username",
3737
"discovery.sendtargets.auth.password",
3838
"discovery.sendtargets.auth.username_in",
3939
"discovery.sendtargets.auth.password_in"}
40-
chap_sess = []string{
40+
chapSess = []string{
4141
"node.session.auth.username",
4242
"node.session.auth.password",
4343
"node.session.auth.username_in",
@@ -46,15 +46,15 @@ var (
4646
)
4747

4848
func updateISCSIDiscoverydb(b iscsiDiskMounter, tp string) error {
49-
if !b.chap_discovery {
49+
if !b.chapDiscovery {
5050
return nil
5151
}
5252
out, err := b.exec.Run("iscsiadm", "-m", "discoverydb", "-t", "sendtargets", "-p", tp, "-I", b.Iface, "-o", "update", "-n", "discovery.sendtargets.auth.authmethod", "-v", "CHAP")
5353
if err != nil {
5454
return fmt.Errorf("iscsi: failed to update discoverydb with CHAP, output: %v", string(out))
5555
}
5656

57-
for _, k := range chap_st {
57+
for _, k := range chapSt {
5858
v := b.secret[k]
5959
if len(v) > 0 {
6060
out, err := b.exec.Run("iscsiadm", "-m", "discoverydb", "-t", "sendtargets", "-p", tp, "-I", b.Iface, "-o", "update", "-n", k, "-v", v)
@@ -67,7 +67,7 @@ func updateISCSIDiscoverydb(b iscsiDiskMounter, tp string) error {
6767
}
6868

6969
func updateISCSINode(b iscsiDiskMounter, tp string) error {
70-
if !b.chap_session {
70+
if !b.chapSession {
7171
return nil
7272
}
7373

@@ -76,7 +76,7 @@ func updateISCSINode(b iscsiDiskMounter, tp string) error {
7676
return fmt.Errorf("iscsi: failed to update node with CHAP, output: %v", string(out))
7777
}
7878

79-
for _, k := range chap_sess {
79+
for _, k := range chapSess {
8080
v := b.secret[k]
8181
if len(v) > 0 {
8282
out, err := b.exec.Run("iscsiadm", "-m", "node", "-p", tp, "-T", b.Iqn, "-I", b.Iface, "-o", "update", "-n", k, "-v", v)
@@ -143,7 +143,7 @@ func (util *ISCSIUtil) persistISCSI(conf iscsiDisk, mnt string) error {
143143
defer fp.Close()
144144
encoder := json.NewEncoder(fp)
145145
if err = encoder.Encode(conf); err != nil {
146-
return fmt.Errorf("iscsi: encode err: %v.", err)
146+
return fmt.Errorf("iscsi: encode err: %v", err)
147147
}
148148
return nil
149149
}
@@ -158,7 +158,7 @@ func (util *ISCSIUtil) loadISCSI(conf *iscsiDisk, mnt string) error {
158158
defer fp.Close()
159159
decoder := json.NewDecoder(fp)
160160
if err = decoder.Decode(conf); err != nil {
161-
return fmt.Errorf("iscsi: decode err: %v.", err)
161+
return fmt.Errorf("iscsi: decode err: %v", err)
162162
}
163163
return nil
164164
}

0 commit comments

Comments
 (0)