From 8a3deecb4a5294124e09eb975c5c42f379653b40 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Mon, 17 May 2021 19:19:13 +0530 Subject: [PATCH] Rename iscsi_lib to iscsiLib to avoid snake case import Signed-off-by: Humble Chirammal --- pkg/iscsi/iscsi.go | 40 ++++++++++++++++++++-------------------- pkg/iscsi/iscsi_util.go | 10 +++++----- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pkg/iscsi/iscsi.go b/pkg/iscsi/iscsi.go index 4e9cca74..b29fd84d 100644 --- a/pkg/iscsi/iscsi.go +++ b/pkg/iscsi/iscsi.go @@ -23,7 +23,7 @@ import ( "strings" "github.com/container-storage-interface/spec/lib/go/csi" - iscsi_lib "github.com/kubernetes-csi/csi-lib-iscsi/iscsi" + iscsiLib "github.com/kubernetes-csi/csi-lib-iscsi/iscsi" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/utils/exec" "k8s.io/utils/mount" @@ -98,17 +98,17 @@ func getISCSIInfo(req *csi.NodePublishVolumeRequest) (*iscsiDisk, error) { InitiatorName: initiatorName}, nil } -func buildISCSIConnector(iscsiInfo *iscsiDisk) *iscsi_lib.Connector { - c := iscsi_lib.Connector{ +func buildISCSIConnector(iscsiInfo *iscsiDisk) *iscsiLib.Connector { + c := iscsiLib.Connector{ VolumeName: iscsiInfo.VolName, TargetIqn: iscsiInfo.Iqn, TargetPortals: iscsiInfo.Portals, Multipath: len(iscsiInfo.Portals) > 1, } - if iscsiInfo.sessionSecret != (iscsi_lib.Secrets{}) { + if iscsiInfo.sessionSecret != (iscsiLib.Secrets{}) { c.SessionSecrets = iscsiInfo.sessionSecret - if iscsiInfo.discoverySecret != (iscsi_lib.Secrets{}) { + if iscsiInfo.discoverySecret != (iscsiLib.Secrets{}) { c.DiscoverySecrets = iscsiInfo.discoverySecret } } @@ -159,50 +159,50 @@ func parseSecret(secretParams string) map[string]string { return secret } -func parseSessionSecret(secretParams map[string]string) (iscsi_lib.Secrets, error) { +func parseSessionSecret(secretParams map[string]string) (iscsiLib.Secrets, error) { var ok bool - secret := iscsi_lib.Secrets{} + secret := iscsiLib.Secrets{} if len(secretParams) == 0 { return secret, nil } if secret.UserName, ok = secretParams["node.session.auth.username"]; !ok { - return iscsi_lib.Secrets{}, fmt.Errorf("node.session.auth.username not found in secret") + return iscsiLib.Secrets{}, fmt.Errorf("node.session.auth.username not found in secret") } if secret.Password, ok = secretParams["node.session.auth.password"]; !ok { - return iscsi_lib.Secrets{}, fmt.Errorf("node.session.auth.password not found in secret") + return iscsiLib.Secrets{}, fmt.Errorf("node.session.auth.password not found in secret") } if secret.UserNameIn, ok = secretParams["node.session.auth.username_in"]; !ok { - return iscsi_lib.Secrets{}, fmt.Errorf("node.session.auth.username_in not found in secret") + return iscsiLib.Secrets{}, fmt.Errorf("node.session.auth.username_in not found in secret") } if secret.PasswordIn, ok = secretParams["node.session.auth.password_in"]; !ok { - return iscsi_lib.Secrets{}, fmt.Errorf("node.session.auth.password_in not found in secret") + return iscsiLib.Secrets{}, fmt.Errorf("node.session.auth.password_in not found in secret") } secret.SecretsType = "chap" return secret, nil } -func parseDiscoverySecret(secretParams map[string]string) (iscsi_lib.Secrets, error) { +func parseDiscoverySecret(secretParams map[string]string) (iscsiLib.Secrets, error) { var ok bool - secret := iscsi_lib.Secrets{} + secret := iscsiLib.Secrets{} if len(secretParams) == 0 { return secret, nil } if secret.UserName, ok = secretParams["node.sendtargets.auth.username"]; !ok { - return iscsi_lib.Secrets{}, fmt.Errorf("node.sendtargets.auth.username not found in secret") + return iscsiLib.Secrets{}, fmt.Errorf("node.sendtargets.auth.username not found in secret") } if secret.Password, ok = secretParams["node.sendtargets.auth.password"]; !ok { - return iscsi_lib.Secrets{}, fmt.Errorf("node.sendtargets.auth.password not found in secret") + return iscsiLib.Secrets{}, fmt.Errorf("node.sendtargets.auth.password not found in secret") } if secret.UserNameIn, ok = secretParams["node.sendtargets.auth.username_in"]; !ok { - return iscsi_lib.Secrets{}, fmt.Errorf("node.sendtargets.auth.username_in not found in secret") + return iscsiLib.Secrets{}, fmt.Errorf("node.sendtargets.auth.username_in not found in secret") } if secret.PasswordIn, ok = secretParams["node.sendtargets.auth.password_in"]; !ok { - return iscsi_lib.Secrets{}, fmt.Errorf("node.sendtargets.auth.password_in not found in secret") + return iscsiLib.Secrets{}, fmt.Errorf("node.sendtargets.auth.password_in not found in secret") } secret.SecretsType = "chap" @@ -217,8 +217,8 @@ type iscsiDisk struct { chapDiscovery bool chapSession bool secret map[string]string - sessionSecret iscsi_lib.Secrets - discoverySecret iscsi_lib.Secrets + sessionSecret iscsiLib.Secrets + discoverySecret iscsiLib.Secrets InitiatorName string VolName string } @@ -232,7 +232,7 @@ type iscsiDiskMounter struct { exec exec.Interface deviceUtil util.DeviceUtil targetPath string - connector *iscsi_lib.Connector + connector *iscsiLib.Connector } type iscsiDiskUnmounter struct { diff --git a/pkg/iscsi/iscsi_util.go b/pkg/iscsi/iscsi_util.go index e482f5de..803b93da 100644 --- a/pkg/iscsi/iscsi_util.go +++ b/pkg/iscsi/iscsi_util.go @@ -21,7 +21,7 @@ import ( "os" "path" - iscsi_lib "github.com/kubernetes-csi/csi-lib-iscsi/iscsi" + iscsiLib "github.com/kubernetes-csi/csi-lib-iscsi/iscsi" "k8s.io/klog/v2" "k8s.io/utils/mount" ) @@ -29,7 +29,7 @@ import ( type ISCSIUtil struct{} func (util *ISCSIUtil) AttachDisk(b iscsiDiskMounter) (string, error) { - devicePath, err := iscsi_lib.Connect(*b.connector) + devicePath, err := iscsiLib.Connect(*b.connector) if err != nil { return "", err } @@ -55,7 +55,7 @@ func (util *ISCSIUtil) AttachDisk(b iscsiDiskMounter) (string, error) { // Persist iscsi disk config to json file for DetachDisk path file := path.Join(mntPath, b.VolName+".json") - err = iscsi_lib.PersistConnector(b.connector, file) + err = iscsiLib.PersistConnector(b.connector, file) if err != nil { klog.Errorf("failed to persist connection info: %v", err) klog.Errorf("disconnecting volume and failing the publish request because persistence files are required for reliable Unpublish") @@ -103,13 +103,13 @@ func (util *ISCSIUtil) DetachDisk(c iscsiDiskUnmounter, targetPath string) error // load iscsi disk config from json file file := path.Join(targetPath, c.iscsiDisk.VolName+".json") - connector, err := iscsi_lib.GetConnectorFromFile(file) + connector, err := iscsiLib.GetConnectorFromFile(file) if err != nil { klog.Errorf("iscsi detach disk: failed to get iscsi config from path %s Error: %v", targetPath, err) return err } - iscsi_lib.Disconnect(connector.TargetIqn, connector.TargetPortals) + iscsiLib.Disconnect(connector.TargetIqn, connector.TargetPortals) if err := os.RemoveAll(targetPath); err != nil { klog.Errorf("iscsi: failed to remove mount path Error: %v", err)