diff --git a/pkg/iscsi/iscsi.go b/pkg/iscsi/iscsi.go index db20a48f..96647786 100644 --- a/pkg/iscsi/iscsi.go +++ b/pkg/iscsi/iscsi.go @@ -65,15 +65,15 @@ func getISCSIInfo(req *csi.NodePublishVolumeRequest) (*iscsiDisk, error) { } return &iscsiDisk{ - VolName: volName, - Portals: bkportal, - Iqn: iqn, - lun: lun, - Iface: iface, - chap_discovery: chapDiscovery, - chap_session: chapSession, - secret: secret, - InitiatorName: initiatorName}, nil + VolName: volName, + Portals: bkportal, + Iqn: iqn, + lun: lun, + Iface: iface, + chapDiscovery: chapDiscovery, + chapSession: chapSession, + secret: secret, + InitiatorName: initiatorName}, nil } func getISCSIDiskMounter(iscsiInfo *iscsiDisk, req *csi.NodePublishVolumeRequest) *iscsiDiskMounter { @@ -119,15 +119,15 @@ func parseSecret(secretParams string) map[string]string { } type iscsiDisk struct { - Portals []string - Iqn string - lun string - Iface string - chap_discovery bool - chap_session bool - secret map[string]string - InitiatorName string - VolName string + Portals []string + Iqn string + lun string + Iface string + chapDiscovery bool + chapSession bool + secret map[string]string + InitiatorName string + VolName string } type iscsiDiskMounter struct { diff --git a/pkg/iscsi/iscsi_util.go b/pkg/iscsi/iscsi_util.go index 03ce3d53..2dc18c78 100644 --- a/pkg/iscsi/iscsi_util.go +++ b/pkg/iscsi/iscsi_util.go @@ -32,12 +32,12 @@ import ( ) var ( - chap_st = []string{ + chapSt = []string{ "discovery.sendtargets.auth.username", "discovery.sendtargets.auth.password", "discovery.sendtargets.auth.username_in", "discovery.sendtargets.auth.password_in"} - chap_sess = []string{ + chapSess = []string{ "node.session.auth.username", "node.session.auth.password", "node.session.auth.username_in", @@ -46,7 +46,7 @@ var ( ) func updateISCSIDiscoverydb(b iscsiDiskMounter, tp string) error { - if !b.chap_discovery { + if !b.chapDiscovery { return nil } out, err := b.exec.Run("iscsiadm", "-m", "discoverydb", "-t", "sendtargets", "-p", tp, "-I", b.Iface, "-o", "update", "-n", "discovery.sendtargets.auth.authmethod", "-v", "CHAP") @@ -54,7 +54,7 @@ func updateISCSIDiscoverydb(b iscsiDiskMounter, tp string) error { return fmt.Errorf("iscsi: failed to update discoverydb with CHAP, output: %v", string(out)) } - for _, k := range chap_st { + for _, k := range chapSt { v := b.secret[k] if len(v) > 0 { 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 { } func updateISCSINode(b iscsiDiskMounter, tp string) error { - if !b.chap_session { + if !b.chapSession { return nil } @@ -76,7 +76,7 @@ func updateISCSINode(b iscsiDiskMounter, tp string) error { return fmt.Errorf("iscsi: failed to update node with CHAP, output: %v", string(out)) } - for _, k := range chap_sess { + for _, k := range chapSess { v := b.secret[k] if len(v) > 0 { 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 { defer fp.Close() encoder := json.NewEncoder(fp) if err = encoder.Encode(conf); err != nil { - return fmt.Errorf("iscsi: encode err: %v.", err) + return fmt.Errorf("iscsi: encode err: %v", err) } return nil } @@ -158,7 +158,7 @@ func (util *ISCSIUtil) loadISCSI(conf *iscsiDisk, mnt string) error { defer fp.Close() decoder := json.NewDecoder(fp) if err = decoder.Decode(conf); err != nil { - return fmt.Errorf("iscsi: decode err: %v.", err) + return fmt.Errorf("iscsi: decode err: %v", err) } return nil }