diff --git a/pkg/volume/iscsi/iscsi.go b/pkg/volume/iscsi/iscsi.go index f8612d9dc1..54ad75febf 100644 --- a/pkg/volume/iscsi/iscsi.go +++ b/pkg/volume/iscsi/iscsi.go @@ -262,17 +262,17 @@ func (plugin *iscsiPlugin) ConstructBlockVolumeSpec(podUID types.UID, volumeName } type iscsiDisk struct { - VolName string - podUID types.UID - Portals []string - Iqn string - Lun string - Iface string - chap_discovery bool - chap_session bool - secret map[string]string - InitiatorName string - plugin *iscsiPlugin + VolName string + podUID types.UID + Portals []string + Iqn string + Lun string + Iface string + chapDiscovery bool + chapSession bool + secret map[string]string + InitiatorName string + plugin *iscsiPlugin // Utility interface that provides API calls to the provider to attach/detach disks. manager diskManager volume.MetricsProvider @@ -539,18 +539,18 @@ func createISCSIDisk(spec *volume.Spec, podUID types.UID, plugin *iscsiPlugin, m } return &iscsiDisk{ - podUID: podUID, - VolName: spec.Name(), - Portals: bkportal, - Iqn: iqn, - Lun: lun, - Iface: iface, - chap_discovery: chapDiscovery, - chap_session: chapSession, - secret: secret, - InitiatorName: initiatorName, - manager: manager, - plugin: plugin}, nil + podUID: podUID, + VolName: spec.Name(), + Portals: bkportal, + Iqn: iqn, + Lun: lun, + Iface: iface, + chapDiscovery: chapDiscovery, + chapSession: chapSession, + secret: secret, + InitiatorName: initiatorName, + manager: manager, + plugin: plugin}, nil } func createSecretMap(spec *volume.Spec, plugin *iscsiPlugin, namespace string) (map[string]string, error) { diff --git a/pkg/volume/iscsi/iscsi_util.go b/pkg/volume/iscsi/iscsi_util.go index ae9c7a70fc..e5e04c518f 100644 --- a/pkg/volume/iscsi/iscsi_util.go +++ b/pkg/volume/iscsi/iscsi_util.go @@ -54,12 +54,12 @@ const ( ) 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", @@ -69,7 +69,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") @@ -77,7 +77,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) @@ -90,7 +90,7 @@ func updateISCSIDiscoverydb(b iscsiDiskMounter, tp string) error { } func updateISCSINode(b iscsiDiskMounter, tp string) error { - if !b.chap_session { + if !b.chapSession { return nil } @@ -99,7 +99,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) @@ -210,7 +210,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 } @@ -224,7 +224,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 } diff --git a/pkg/volume/nfs/nfs_test.go b/pkg/volume/nfs/nfs_test.go index 924978454b..2c6b7667c7 100644 --- a/pkg/volume/nfs/nfs_test.go +++ b/pkg/volume/nfs/nfs_test.go @@ -89,8 +89,8 @@ func TestRecycler(t *testing.T) { plugMgr.InitPlugins([]volume.VolumePlugin{&nfsPlugin{nil, volume.VolumeConfig{}}}, nil, volumetest.NewFakeVolumeHost(tmpDir, nil, nil)) spec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{NFS: &v1.NFSVolumeSource{Path: "/foo"}}}}} - _, plugin_err := plugMgr.FindRecyclablePluginBySpec(spec) - if plugin_err != nil { + _, pluginErr := plugMgr.FindRecyclablePluginBySpec(spec) + if pluginErr != nil { t.Errorf("Can't find the plugin by name") } }