Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use go mod, and minor fixes #1

Merged
merged 5 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/Huawei/eSDK_K8S_Plugin

go 1.15

require (
github.com/container-storage-interface/spec v1.3.0
github.com/golang/protobuf v1.4.3
github.com/sirupsen/logrus v1.7.0
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad
google.golang.org/grpc v1.34.0
k8s.io/apimachinery v0.20.1
)
206 changes: 206 additions & 0 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package connector

import (
"fmt"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions src/connector/connector_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"regexp"
"strings"
"time"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

func GetDevice(findDeviceMap map[string]string, tgtLunGuid string) (string, error) {
Expand Down
7 changes: 4 additions & 3 deletions src/connector/fibrechannel/fc.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package fibrechannel

import (
"connector"
"dev"
"errors"
"fmt"
"time"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type FibreChannel struct{}
Expand Down
4 changes: 2 additions & 2 deletions src/connector/fibrechannel/fc_helper.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fibrechannel

import (
"utils"
"utils/log"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

func scanHost() {
Expand Down
7 changes: 4 additions & 3 deletions src/connector/iscsi/iscsi.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package iscsi

import (
"connector"
"dev"
"strings"
"time"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type iSCSI struct{}
Expand Down
12 changes: 6 additions & 6 deletions src/connector/iscsi/iscsi_helper.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package iscsi

import (
"connector"
"errors"
"fmt"
"math"
"runtime/debug"
"strings"
"sync"
"time"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type connectorInfo struct {
Expand Down Expand Up @@ -203,8 +204,7 @@ func findTgtMultiPath(lenIndex int, iscsiShareData *shareData, conn *connectorIn
var wwnAdded bool
var lastTryOn int64
for {
if (int64(lenIndex) == iscsiShareData.stoppedThreads && iscsiShareData.foundDevices == nil) || (
mPath != "" && int64(lenIndex) == iscsiShareData.numLogin+iscsiShareData.failedLogin) {
if (int64(lenIndex) == iscsiShareData.stoppedThreads && iscsiShareData.foundDevices == nil) || (mPath != "" && int64(lenIndex) == iscsiShareData.numLogin+iscsiShareData.failedLogin) {
break
}

Expand Down Expand Up @@ -239,7 +239,7 @@ func tryConnectVolume(connMap map[string]interface{}) (string, error) {
return "", err
}

// must ignore the error
// must ignore the error
allSessions, _ := utils.ExecShellCmd("iscsiadm -m session")

var mPath string
Expand Down
7 changes: 4 additions & 3 deletions src/connector/nvme/nvme.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package nvme

import (
"connector"
"errors"
"fmt"
"time"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type FCNVMe struct{}
Expand All @@ -22,7 +23,7 @@ func (fc *FCNVMe) ConnectVolume(conn map[string]interface{}) (string, error) {
log.Errorln(msg)
return "", errors.New(msg)
}
connectInfo := map[string]interface{} {
connectInfo := map[string]interface{}{
"protocol": "fc",
}
connector.ScanNVMe(connectInfo)
Expand Down
5 changes: 3 additions & 2 deletions src/connector/roce/roce.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package roce

import (
"connector"
"strings"
"time"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type RoCE struct{}
Expand Down
16 changes: 8 additions & 8 deletions src/connector/roce/roce_helper.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package roce

import (
"connector"
"errors"
"fmt"
"math"
"runtime/debug"
"strings"
"sync"
"time"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/connector"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type connectorInfo struct {
tgtPortals []string
tgtPortals []string
tgtLunGuids []string
}

Expand Down Expand Up @@ -97,8 +98,8 @@ func singleConnectVolume(allSessions, tgtPortal, tgtLunGuid string, nvmeShareDat
nvmeShareData.failedLogin += 1
} else {
nvmeShareData.numLogin += 1
connectInfo := map[string]interface{} {
"protocol": "iscsi",
connectInfo := map[string]interface{}{
"protocol": "iscsi",
"targetNqn": tgtNqn,
}
for i := 1; i < 4; i++ {
Expand Down Expand Up @@ -165,8 +166,7 @@ func findTgtMultiPath(lenIndex int, nvmeShareData *shareData, conn *connectorInf
var mPath string
var lastTryOn int64
for {
if (int64(lenIndex) == nvmeShareData.stoppedThreads && nvmeShareData.foundDevices == nil) || (
mPath != "" && int64(lenIndex) == nvmeShareData.numLogin+nvmeShareData.failedLogin) {
if (int64(lenIndex) == nvmeShareData.stoppedThreads && nvmeShareData.foundDevices == nil) || (mPath != "" && int64(lenIndex) == nvmeShareData.numLogin+nvmeShareData.failedLogin) {
break
}

Expand Down
10 changes: 5 additions & 5 deletions src/csi/backend/backend.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package backend

import (
"csi/backend/plugin"
"errors"
"fmt"
"regexp"
"sync"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/csi/backend/plugin"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

var (
Expand Down Expand Up @@ -168,8 +169,7 @@ func updateMetroBackends() {
continue
}

if (i.MetroDomain != "" && i.MetroDomain == j.MetroDomain) || (
i.MetrovStorePairID != "" && i.MetrovStorePairID == j.MetrovStorePairID) {
if (i.MetroDomain != "" && i.MetroDomain == j.MetroDomain) || (i.MetrovStorePairID != "" && i.MetrovStorePairID == j.MetrovStorePairID) {
i.MetroBackend, j.MetroBackend = j, i
i.Plugin.UpdateMetroRemotePlugin(j.Plugin)
j.Plugin.UpdateMetroRemotePlugin(i.Plugin)
Expand Down
3 changes: 2 additions & 1 deletion src/csi/backend/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (
"os"
"runtime/debug"
"sync"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

func updateBackendCapabilities(backend *Backend, sync bool) error {
Expand Down
11 changes: 6 additions & 5 deletions src/csi/backend/plugin/fusionstorage-nas.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package plugin

import (
"dev"
"errors"
"fmt"
"net"
"storage/fusionstorage/volume"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/fusionstorage/volume"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type FusionStorageNasPlugin struct {
FusionStoragePlugin
portal string
portal string
}

func init() {
Expand Down
13 changes: 7 additions & 6 deletions src/csi/backend/plugin/fusionstorage-san.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package plugin

import (
"dev"
"errors"
"fmt"
"net"
"proto"
"storage/fusionstorage/attacher"
"storage/fusionstorage/volume"
"strings"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/proto"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/fusionstorage/attacher"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/fusionstorage/volume"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

type FusionStorageSanPlugin struct {
Expand Down
11 changes: 6 additions & 5 deletions src/csi/backend/plugin/fusionstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package plugin

import (
"errors"
"storage/fusionstorage/client"
"strings"
"utils"
"utils/log"
"utils/pwd"

"github.com/Huawei/eSDK_K8S_Plugin/src/storage/fusionstorage/client"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/pwd"
)

const (
Expand All @@ -15,7 +16,7 @@ const (

type FusionStoragePlugin struct {
basePlugin
cli *client.Client
cli *client.Client
}

func (p *FusionStoragePlugin) init(config map[string]interface{}, keepLogin bool) error {
Expand Down
11 changes: 6 additions & 5 deletions src/csi/backend/plugin/oceanstor-nas.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package plugin

import (
"dev"
"errors"
"storage/oceanstor/client"
"storage/oceanstor/volume"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/oceanstor/client"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/oceanstor/volume"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

const (
Expand Down
15 changes: 8 additions & 7 deletions src/csi/backend/plugin/oceanstor-san.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package plugin

import (
"dev"
"encoding/json"
"errors"
"fmt"
"proto"
"reflect"
"storage/oceanstor/attacher"
"storage/oceanstor/client"
"storage/oceanstor/volume"
"utils"
"utils/log"

"github.com/Huawei/eSDK_K8S_Plugin/src/dev"
"github.com/Huawei/eSDK_K8S_Plugin/src/proto"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/oceanstor/attacher"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/oceanstor/client"
"github.com/Huawei/eSDK_K8S_Plugin/src/storage/oceanstor/volume"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
)

const (
Expand Down
12 changes: 6 additions & 6 deletions src/csi/backend/plugin/oceanstor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package plugin

import (
"errors"
"storage/oceanstor/client"
"strconv"
"strings"
"utils"
"utils/log"
"utils/pwd"

"github.com/Huawei/eSDK_K8S_Plugin/src/storage/oceanstor/client"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/log"
"github.com/Huawei/eSDK_K8S_Plugin/src/utils/pwd"
)

const (
Expand Down Expand Up @@ -175,8 +176,7 @@ func (p *OceanstorPlugin) updatePoolCapabilities(poolNames []string, usageType s
for _, name := range poolNames {
if pool, exist := pools[name].(map[string]interface{}); exist {
poolType, exist := pool["NEWUSAGETYPE"].(string)
if (pool["USAGETYPE"] == usageType || pool["USAGETYPE"] == DORADO_V6_POOL_USAGE_TYPE) || (
exist && poolType == DORADO_V6_POOL_USAGE_TYPE) {
if (pool["USAGETYPE"] == usageType || pool["USAGETYPE"] == DORADO_V6_POOL_USAGE_TYPE) || (exist && poolType == DORADO_V6_POOL_USAGE_TYPE) {
validPools = append(validPools, pool)
} else {
log.Warningf("Pool %s is not for %s", name, usageType)
Expand Down
Loading