From bff0a625820f7ffda10ba50ec0533c356a00d42c Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Wed, 12 Apr 2023 02:13:22 -0400 Subject: [PATCH 01/16] Add checkNfs method. --- service/controller.go | 8 ++++++++ service/node.go | 3 +++ service/service.go | 20 ++++++++++++-------- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/service/controller.go b/service/controller.go index 9c96f35b..80f82919 100644 --- a/service/controller.go +++ b/service/controller.go @@ -552,6 +552,14 @@ func validateVolSize(cr *csi.CapacityRange) (int64, error) { return sizeKiB, nil } +func (s *service) checkNFS(systemID string) bool { + array := s.opts.arrays[systemID] + if array.NasName == nil || *(array.NasName) == "" { + return false + } + return true +} + func (s *service) DeleteVolume( ctx context.Context, req *csi.DeleteVolumeRequest) ( diff --git a/service/node.go b/service/node.go index dcf6512d..101265d4 100644 --- a/service/node.go +++ b/service/node.go @@ -651,6 +651,9 @@ func (s *service) NodeGetInfo( // csi-vxflexos.dellemc.com/: topology := map[string]string{} for _, sysID := range connectedSystemID { + if s.checkNFS(sysID) { + topology[Name+"/"+sysID+"-nfs"] = "true" + } topology[Name+"/"+sysID] = SystemTopologySystemValue } diff --git a/service/service.go b/service/service.go index 84ca5688..92935fab 100644 --- a/service/service.go +++ b/service/service.go @@ -92,14 +92,16 @@ var Log = logrus.New() // ArrayConnectionData contains data required to connect to array type ArrayConnectionData struct { - SystemID string `json:"systemID"` - Username string `json:"username"` - Password string `json:"password"` - Endpoint string `json:"endpoint"` - SkipCertificateValidation bool `json:"skipCertificateValidation,omitempty"` - Insecure bool `json:"insecure,omitempty"` - IsDefault bool `json:"isDefault,omitempty"` - AllSystemNames string `json:"allSystemNames"` + SystemID string `json:"systemID"` + Username string `json:"username"` + Password string `json:"password"` + Endpoint string `json:"endpoint"` + SkipCertificateValidation bool `json:"skipCertificateValidation,omitempty"` + Insecure bool `json:"insecure,omitempty"` + IsDefault bool `json:"isDefault,omitempty"` + AllSystemNames string `json:"allSystemNames"` + NasName *string `json:"nasName"` + NfsAcls string `json:"nfsAcls"` } // Manifest is the SP's manifest. @@ -698,6 +700,8 @@ func getArrayConfig(ctx context.Context) (map[string]*ArrayConnectionData, error "isDefault": c.IsDefault, "systemID": c.SystemID, "allSystemNames": c.AllSystemNames, + "nasName": c.NasName, + "nfsAcls": c.NfsAcls, } Log.WithFields(fields).Infof("configured %s", c.SystemID) From 6f5d8830fe213159143d7cf9be60de912f6d3c85 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 10:55:59 -0400 Subject: [PATCH 02/16] add version check in checkNFS. --- go.mod | 2 +- go.sum | 2 ++ service/controller.go | 23 ++++++++++++++++++----- service/node.go | 8 ++++++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 49df291e..23507498 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/dell/dell-csi-extensions/volumeGroupSnapshot v1.2.2 github.com/dell/gocsi v1.7.0 github.com/dell/gofsutil v1.12.0 - github.com/dell/goscaleio v1.10.0 + github.com/dell/goscaleio v1.10.1-0.20230413104908-fafc4b32b7ca github.com/fsnotify/fsnotify v1.5.1 github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.3.0 diff --git a/go.sum b/go.sum index 4c0235a5..a43c947e 100644 --- a/go.sum +++ b/go.sum @@ -116,6 +116,8 @@ github.com/dell/gofsutil v1.12.0 h1:oo2YHfGFKHvHS1urtqjOIKpaHwcdyqacwKHLXzUg33M= github.com/dell/gofsutil v1.12.0/go.mod h1:mGMN5grVDtHv2imNw5+gFr2RmCqeyYgBFBldUbHtV78= github.com/dell/goscaleio v1.10.0 h1:XCEI9j+IlbqNPY7uvBjNNlT0Nt2PMXlnyxUavmennVY= github.com/dell/goscaleio v1.10.0/go.mod h1:Zh2iQ44Jd8FMqU2h+rT5x1K6mdPMKQ15lkFxojU4z3w= +github.com/dell/goscaleio v1.10.1-0.20230413104908-fafc4b32b7ca h1:QkD1D+ROLt3hQpQ7fX8BU3adc3/CxlqjsUFmiidFv74= +github.com/dell/goscaleio v1.10.1-0.20230413104908-fafc4b32b7ca/go.mod h1:Zh2iQ44Jd8FMqU2h+rT5x1K6mdPMKQ15lkFxojU4z3w= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= diff --git a/service/controller.go b/service/controller.go index 80f82919..01247a6e 100644 --- a/service/controller.go +++ b/service/controller.go @@ -552,12 +552,25 @@ func validateVolSize(cr *csi.CapacityRange) (int64, error) { return sizeKiB, nil } -func (s *service) checkNFS(systemID string) bool { - array := s.opts.arrays[systemID] - if array.NasName == nil || *(array.NasName) == "" { - return false +func (s *service) checkNFS(systemID string) (bool, error) { + version, err := s.adminClients[systemID].GetVersion() + if err != nil { + return false, err } - return true + ver, err := strconv.ParseFloat(version, 64) + if err != nil { + return false, err + } + if ver >= 4.0 { + array := s.opts.arrays[systemID] + if array.NasName == nil || *(array.NasName) == "" { + return false, nil + } + return true, nil + } + + return false, nil + } func (s *service) DeleteVolume( diff --git a/service/node.go b/service/node.go index 101265d4..093e085e 100644 --- a/service/node.go +++ b/service/node.go @@ -651,8 +651,12 @@ func (s *service) NodeGetInfo( // csi-vxflexos.dellemc.com/: topology := map[string]string{} for _, sysID := range connectedSystemID { - if s.checkNFS(sysID) { - topology[Name+"/"+sysID+"-nfs"] = "true" + isNFS, err := s.checkNFS(sysID) + if err != nil { + return nil, err + } + if isNFS { + topology[Name+"/"+sysID+"-nfs"] = SystemTopologySystemValue } topology[Name+"/"+sysID] = SystemTopologySystemValue } From 666c2342a653167a47cec8e88edb076d0a3a1ecd Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 10:58:45 -0400 Subject: [PATCH 03/16] changed the nfs topology to true. --- service/node.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/node.go b/service/node.go index 093e085e..b5f0cb56 100644 --- a/service/node.go +++ b/service/node.go @@ -656,7 +656,7 @@ func (s *service) NodeGetInfo( return nil, err } if isNFS { - topology[Name+"/"+sysID+"-nfs"] = SystemTopologySystemValue + topology[Name+"/"+sysID+"-nfs"] = "true" } topology[Name+"/"+sysID] = SystemTopologySystemValue } From 24fb065e94dc0765bb32b9391771bd66fed74da2 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 12:36:43 -0400 Subject: [PATCH 04/16] add debug. --- service/controller.go | 2 ++ service/node.go | 1 + 2 files changed, 3 insertions(+) diff --git a/service/controller.go b/service/controller.go index 01247a6e..13e0307a 100644 --- a/service/controller.go +++ b/service/controller.go @@ -553,6 +553,8 @@ func validateVolSize(cr *csi.CapacityRange) (int64, error) { } func (s *service) checkNFS(systemID string) (bool, error) { + c := s.adminClients[systemID] + fmt.Println("goscaleclient", c) version, err := s.adminClients[systemID].GetVersion() if err != nil { return false, err diff --git a/service/node.go b/service/node.go index b5f0cb56..eff2f8f3 100644 --- a/service/node.go +++ b/service/node.go @@ -651,6 +651,7 @@ func (s *service) NodeGetInfo( // csi-vxflexos.dellemc.com/: topology := map[string]string{} for _, sysID := range connectedSystemID { + fmt.Println("sysID*******", sysID) isNFS, err := s.checkNFS(sysID) if err != nil { return nil, err From d0791890b4fdd5f586dc8dd504ea5cbd0bca20d2 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 12:54:54 -0400 Subject: [PATCH 05/16] add debug1. --- service/controller.go | 4 +++- service/node.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/service/controller.go b/service/controller.go index 13e0307a..044b8b07 100644 --- a/service/controller.go +++ b/service/controller.go @@ -552,9 +552,11 @@ func validateVolSize(cr *csi.CapacityRange) (int64, error) { return sizeKiB, nil } -func (s *service) checkNFS(systemID string) (bool, error) { +func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { c := s.adminClients[systemID] fmt.Println("goscaleclient", c) + + s.requireProbe(ctx, systemID) version, err := s.adminClients[systemID].GetVersion() if err != nil { return false, err diff --git a/service/node.go b/service/node.go index eff2f8f3..66dfc607 100644 --- a/service/node.go +++ b/service/node.go @@ -652,7 +652,7 @@ func (s *service) NodeGetInfo( topology := map[string]string{} for _, sysID := range connectedSystemID { fmt.Println("sysID*******", sysID) - isNFS, err := s.checkNFS(sysID) + isNFS, err := s.checkNFS(ctx,sysID) if err != nil { return nil, err } From ccd01901bdd399e4b6adec4b3ca40c95c3b6e3d7 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 13:17:53 -0400 Subject: [PATCH 06/16] add debug3. --- service/controller.go | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/service/controller.go b/service/controller.go index 044b8b07..acad5424 100644 --- a/service/controller.go +++ b/service/controller.go @@ -554,9 +554,38 @@ func validateVolSize(cr *csi.CapacityRange) (int64, error) { func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { c := s.adminClients[systemID] + array := s.opts.arrays[systemID] fmt.Println("goscaleclient", c) - s.requireProbe(ctx, systemID) + var altSystemNames []string + if array.AllSystemNames != "" { + altSystemNames = strings.Split(array.AllSystemNames, ",") + } + + // Create ScaleIO API client if needed + if s.adminClients[systemID] == nil { + skipCertificateValidation := array.SkipCertificateValidation || array.Insecure + c, err := goscaleio.NewClientWithArgs(array.Endpoint, "", math.MaxInt64, skipCertificateValidation, !s.opts.DisableCerts) + if err != nil { + return false, err + } + s.adminClients[systemID] = c + for _, name := range altSystemNames { + s.adminClients[name] = c + } + } + + if s.adminClients[systemID].GetToken() == "" { + _, err := s.adminClients[systemID].Authenticate(&goscaleio.ConfigConnect{ + Endpoint: array.Endpoint, + Username: array.Username, + Password: array.Password, + }) + if err != nil { + return false, err + + } + } version, err := s.adminClients[systemID].GetVersion() if err != nil { return false, err From 1185a95fe71c8d35ed723f6f3d3078c464ecacfb Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 13:39:35 -0400 Subject: [PATCH 07/16] removed the version logic. --- service/controller.go | 100 ++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/service/controller.go b/service/controller.go index acad5424..1ef69650 100644 --- a/service/controller.go +++ b/service/controller.go @@ -553,56 +553,60 @@ func validateVolSize(cr *csi.CapacityRange) (int64, error) { } func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { - c := s.adminClients[systemID] - array := s.opts.arrays[systemID] - fmt.Println("goscaleclient", c) - - var altSystemNames []string - if array.AllSystemNames != "" { - altSystemNames = strings.Split(array.AllSystemNames, ",") - } - - // Create ScaleIO API client if needed - if s.adminClients[systemID] == nil { - skipCertificateValidation := array.SkipCertificateValidation || array.Insecure - c, err := goscaleio.NewClientWithArgs(array.Endpoint, "", math.MaxInt64, skipCertificateValidation, !s.opts.DisableCerts) - if err != nil { - return false, err - } - s.adminClients[systemID] = c - for _, name := range altSystemNames { - s.adminClients[name] = c - } - } + // c := s.adminClients[systemID] + // array := s.opts.arrays[systemID] + // fmt.Println("goscaleclient", c) + + // var altSystemNames []string + // if array.AllSystemNames != "" { + // altSystemNames = strings.Split(array.AllSystemNames, ",") + // } + + // // Create ScaleIO API client if needed + // if s.adminClients[systemID] == nil { + // skipCertificateValidation := array.SkipCertificateValidation || array.Insecure + // c, err := goscaleio.NewClientWithArgs(array.Endpoint, "", math.MaxInt64, skipCertificateValidation, !s.opts.DisableCerts) + // if err != nil { + // return false, err + // } + // s.adminClients[systemID] = c + // for _, name := range altSystemNames { + // s.adminClients[name] = c + // } + // } + + // if s.adminClients[systemID].GetToken() == "" { + // _, err := s.adminClients[systemID].Authenticate(&goscaleio.ConfigConnect{ + // Endpoint: array.Endpoint, + // Username: array.Username, + // Password: array.Password, + // }) + // if err != nil { + // return false, err + + // } + // } + // version, err := s.adminClients[systemID].GetVersion() + // if err != nil { + // return false, err + // } + // ver, err := strconv.ParseFloat(version, 64) + // if err != nil { + // return false, err + // } + // if ver >= 4.0 { + // array := s.opts.arrays[systemID] + // if array.NasName == nil || *(array.NasName) == "" { + // return false, nil + // } + // return true, nil + // } - if s.adminClients[systemID].GetToken() == "" { - _, err := s.adminClients[systemID].Authenticate(&goscaleio.ConfigConnect{ - Endpoint: array.Endpoint, - Username: array.Username, - Password: array.Password, - }) - if err != nil { - return false, err - - } - } - version, err := s.adminClients[systemID].GetVersion() - if err != nil { - return false, err - } - ver, err := strconv.ParseFloat(version, 64) - if err != nil { - return false, err - } - if ver >= 4.0 { - array := s.opts.arrays[systemID] - if array.NasName == nil || *(array.NasName) == "" { - return false, nil - } - return true, nil + array := s.opts.arrays[systemID] + if array.NasName == nil || *(array.NasName) == "" { + return false, nil } - - return false, nil + return true, nil } From f325e785c12aeaa20f1a3d1884c41c0c943fd0dc Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 13:54:24 -0400 Subject: [PATCH 08/16] add debug 4. --- service/controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/controller.go b/service/controller.go index 1ef69650..eada3002 100644 --- a/service/controller.go +++ b/service/controller.go @@ -603,6 +603,9 @@ func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { // } array := s.opts.arrays[systemID] + + fmt.Println("array****", array) + fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) if array.NasName == nil || *(array.NasName) == "" { return false, nil } From f37c5c25cea9daf6e3e0d0e2c5a9d01e9e354b28 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 22:26:38 -0400 Subject: [PATCH 09/16] move logic to service.go --- service/controller.go | 120 +++++++++++++++++++++--------------------- service/service.go | 17 ++++++ 2 files changed, 77 insertions(+), 60 deletions(-) diff --git a/service/controller.go b/service/controller.go index eada3002..84202fe4 100644 --- a/service/controller.go +++ b/service/controller.go @@ -552,66 +552,66 @@ func validateVolSize(cr *csi.CapacityRange) (int64, error) { return sizeKiB, nil } -func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { - // c := s.adminClients[systemID] - // array := s.opts.arrays[systemID] - // fmt.Println("goscaleclient", c) - - // var altSystemNames []string - // if array.AllSystemNames != "" { - // altSystemNames = strings.Split(array.AllSystemNames, ",") - // } - - // // Create ScaleIO API client if needed - // if s.adminClients[systemID] == nil { - // skipCertificateValidation := array.SkipCertificateValidation || array.Insecure - // c, err := goscaleio.NewClientWithArgs(array.Endpoint, "", math.MaxInt64, skipCertificateValidation, !s.opts.DisableCerts) - // if err != nil { - // return false, err - // } - // s.adminClients[systemID] = c - // for _, name := range altSystemNames { - // s.adminClients[name] = c - // } - // } - - // if s.adminClients[systemID].GetToken() == "" { - // _, err := s.adminClients[systemID].Authenticate(&goscaleio.ConfigConnect{ - // Endpoint: array.Endpoint, - // Username: array.Username, - // Password: array.Password, - // }) - // if err != nil { - // return false, err - - // } - // } - // version, err := s.adminClients[systemID].GetVersion() - // if err != nil { - // return false, err - // } - // ver, err := strconv.ParseFloat(version, 64) - // if err != nil { - // return false, err - // } - // if ver >= 4.0 { - // array := s.opts.arrays[systemID] - // if array.NasName == nil || *(array.NasName) == "" { - // return false, nil - // } - // return true, nil - // } - - array := s.opts.arrays[systemID] - - fmt.Println("array****", array) - fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) - if array.NasName == nil || *(array.NasName) == "" { - return false, nil - } - return true, nil - -} +// func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { +// // c := s.adminClients[systemID] +// // array := s.opts.arrays[systemID] +// // fmt.Println("goscaleclient", c) + +// // var altSystemNames []string +// // if array.AllSystemNames != "" { +// // altSystemNames = strings.Split(array.AllSystemNames, ",") +// // } + +// // // Create ScaleIO API client if needed +// // if s.adminClients[systemID] == nil { +// // skipCertificateValidation := array.SkipCertificateValidation || array.Insecure +// // c, err := goscaleio.NewClientWithArgs(array.Endpoint, "", math.MaxInt64, skipCertificateValidation, !s.opts.DisableCerts) +// // if err != nil { +// // return false, err +// // } +// // s.adminClients[systemID] = c +// // for _, name := range altSystemNames { +// // s.adminClients[name] = c +// // } +// // } + +// // if s.adminClients[systemID].GetToken() == "" { +// // _, err := s.adminClients[systemID].Authenticate(&goscaleio.ConfigConnect{ +// // Endpoint: array.Endpoint, +// // Username: array.Username, +// // Password: array.Password, +// // }) +// // if err != nil { +// // return false, err + +// // } +// // } +// // version, err := s.adminClients[systemID].GetVersion() +// // if err != nil { +// // return false, err +// // } +// // ver, err := strconv.ParseFloat(version, 64) +// // if err != nil { +// // return false, err +// // } +// // if ver >= 4.0 { +// // array := s.opts.arrays[systemID] +// // if array.NasName == nil || *(array.NasName) == "" { +// // return false, nil +// // } +// // return true, nil +// // } + +// array := s.opts.arrays[systemID] + +// fmt.Println("array****", array) +// fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) +// if array.NasName == nil || *(array.NasName) == "" { +// return false, nil +// } +// return true, nil + +// } func (s *service) DeleteVolume( ctx context.Context, diff --git a/service/service.go b/service/service.go index 92935fab..e0288fb9 100644 --- a/service/service.go +++ b/service/service.go @@ -161,6 +161,7 @@ type service struct { //maps the first 24 bits of a volume ID to the volume's systemID volumePrefixToSystems map[string][]string connectedSystemNameToID map[string]string + isNfs bool } // Process dynamic changes to configMap or Secret. @@ -447,6 +448,19 @@ func (s *service) BeforeServe( return nil } +func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { + + array := s.opts.arrays[systemID] + + fmt.Println("array****", array) + fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) + if array.NasName == nil || *(array.NasName) == "" { + return false, nil + } + return true, nil + +} + // Probe all systems managed by driver func (s *service) doProbe(ctx context.Context) error { @@ -718,6 +732,9 @@ func getArrayConfig(ctx context.Context) (map[string]*ArrayConnectionData, error copy := ArrayConnectionData{} copy = c arrays[c.SystemID] = © + fmt.Println("nasname", copy.NasName) + fmt.Println("nasname***", arrays[c.SystemID].NasName) + fmt.Println("arrays****", arrays) } } else { return nil, fmt.Errorf("arrays details are not provided in vxflexos-creds secret") From 56e2ac00890182c3e25ae1efaf8463f06659256a Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 22:46:35 -0400 Subject: [PATCH 10/16] add debug 5 --- service/service.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/service/service.go b/service/service.go index e0288fb9..c08d2f95 100644 --- a/service/service.go +++ b/service/service.go @@ -450,7 +450,15 @@ func (s *service) BeforeServe( func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { - array := s.opts.arrays[systemID] + arrayConData, err := getArrayConfig(ctx) + + fmt.Println("arrayConData*****", arrayConData) + + if err != nil { + return false, err + } + + array := arrayConData[systemID] fmt.Println("array****", array) fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) From c2b8cb7148fc0f2e29934cfbeeb8ea11819aa16d Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 23:30:51 -0400 Subject: [PATCH 11/16] add debug 6 --- service/service.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/service/service.go b/service/service.go index c08d2f95..c0b14a95 100644 --- a/service/service.go +++ b/service/service.go @@ -450,6 +450,16 @@ func (s *service) BeforeServe( func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { + err := s.systemProbeAll(ctx) + + if err != nil { + return false, err + } + + c := s.adminClients[systemID] + + fmt.Println("adminClient******", c) + arrayConData, err := getArrayConfig(ctx) fmt.Println("arrayConData*****", arrayConData) From 908f26936b7626bf5fd82b620832e78dcab2be5f Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Thu, 13 Apr 2023 23:43:18 -0400 Subject: [PATCH 12/16] add debug 7. --- service/service.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service/service.go b/service/service.go index c0b14a95..1a1502fb 100644 --- a/service/service.go +++ b/service/service.go @@ -460,6 +460,11 @@ func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { fmt.Println("adminClient******", c) + version, err := c.GetVersion() + + fmt.Println("version****", version) + fmt.Println("err*****", err) + arrayConData, err := getArrayConfig(ctx) fmt.Println("arrayConData*****", arrayConData) From 9fbfcddd542b1cba441b30ecb713e9b4486a00e1 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Fri, 14 Apr 2023 00:03:03 -0400 Subject: [PATCH 13/16] add debug 8. --- service/service.go | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/service/service.go b/service/service.go index 1a1502fb..3e3f58c3 100644 --- a/service/service.go +++ b/service/service.go @@ -462,25 +462,36 @@ func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { version, err := c.GetVersion() - fmt.Println("version****", version) - fmt.Println("err*****", err) - - arrayConData, err := getArrayConfig(ctx) - - fmt.Println("arrayConData*****", arrayConData) - if err != nil { return false, err } - array := arrayConData[systemID] + ver, err := strconv.ParseFloat(version, 64) + fmt.Println("ver*****", ver) + fmt.Println("err", err) + if err != nil { + return false, err + } - fmt.Println("array****", array) - fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) - if array.NasName == nil || *(array.NasName) == "" { - return false, nil + if ver >= 4.0 { + arrayConData, err := getArrayConfig(ctx) + fmt.Println("arrayConData*****", arrayConData) + if err != nil { + return false, err + } + array := arrayConData[systemID] + fmt.Println("array****", array) + fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) + if array.NasName == nil || *(array.NasName) == "" { + return false, nil + } + return true, nil } - return true, nil + + fmt.Println("version****", version) + fmt.Println("err*****", err) + + return false, nil } From 7e3a2df6d43aa1305aaf09d0fc26a8d337237712 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Fri, 14 Apr 2023 02:49:37 -0400 Subject: [PATCH 14/16] removed the debug logs. --- service/controller.go | 61 ------------------------------------------- service/node.go | 3 +-- service/service.go | 21 --------------- 3 files changed, 1 insertion(+), 84 deletions(-) diff --git a/service/controller.go b/service/controller.go index 84202fe4..9c96f35b 100644 --- a/service/controller.go +++ b/service/controller.go @@ -552,67 +552,6 @@ func validateVolSize(cr *csi.CapacityRange) (int64, error) { return sizeKiB, nil } -// func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { -// // c := s.adminClients[systemID] -// // array := s.opts.arrays[systemID] -// // fmt.Println("goscaleclient", c) - -// // var altSystemNames []string -// // if array.AllSystemNames != "" { -// // altSystemNames = strings.Split(array.AllSystemNames, ",") -// // } - -// // // Create ScaleIO API client if needed -// // if s.adminClients[systemID] == nil { -// // skipCertificateValidation := array.SkipCertificateValidation || array.Insecure -// // c, err := goscaleio.NewClientWithArgs(array.Endpoint, "", math.MaxInt64, skipCertificateValidation, !s.opts.DisableCerts) -// // if err != nil { -// // return false, err -// // } -// // s.adminClients[systemID] = c -// // for _, name := range altSystemNames { -// // s.adminClients[name] = c -// // } -// // } - -// // if s.adminClients[systemID].GetToken() == "" { -// // _, err := s.adminClients[systemID].Authenticate(&goscaleio.ConfigConnect{ -// // Endpoint: array.Endpoint, -// // Username: array.Username, -// // Password: array.Password, -// // }) -// // if err != nil { -// // return false, err - -// // } -// // } -// // version, err := s.adminClients[systemID].GetVersion() -// // if err != nil { -// // return false, err -// // } -// // ver, err := strconv.ParseFloat(version, 64) -// // if err != nil { -// // return false, err -// // } -// // if ver >= 4.0 { -// // array := s.opts.arrays[systemID] -// // if array.NasName == nil || *(array.NasName) == "" { -// // return false, nil -// // } -// // return true, nil -// // } - -// array := s.opts.arrays[systemID] - -// fmt.Println("array****", array) -// fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) -// if array.NasName == nil || *(array.NasName) == "" { -// return false, nil -// } -// return true, nil - -// } - func (s *service) DeleteVolume( ctx context.Context, req *csi.DeleteVolumeRequest) ( diff --git a/service/node.go b/service/node.go index 66dfc607..2167e823 100644 --- a/service/node.go +++ b/service/node.go @@ -651,8 +651,7 @@ func (s *service) NodeGetInfo( // csi-vxflexos.dellemc.com/: topology := map[string]string{} for _, sysID := range connectedSystemID { - fmt.Println("sysID*******", sysID) - isNFS, err := s.checkNFS(ctx,sysID) + isNFS, err := s.checkNFS(ctx, sysID) if err != nil { return nil, err } diff --git a/service/service.go b/service/service.go index 3e3f58c3..a7ac59d6 100644 --- a/service/service.go +++ b/service/service.go @@ -161,7 +161,6 @@ type service struct { //maps the first 24 bits of a volume ID to the volume's systemID volumePrefixToSystems map[string][]string connectedSystemNameToID map[string]string - isNfs bool } // Process dynamic changes to configMap or Secret. @@ -451,48 +450,31 @@ func (s *service) BeforeServe( func (s *service) checkNFS(ctx context.Context, systemID string) (bool, error) { err := s.systemProbeAll(ctx) - if err != nil { return false, err } - c := s.adminClients[systemID] - fmt.Println("adminClient******", c) - version, err := c.GetVersion() - if err != nil { return false, err } - ver, err := strconv.ParseFloat(version, 64) - fmt.Println("ver*****", ver) - fmt.Println("err", err) if err != nil { return false, err } - if ver >= 4.0 { arrayConData, err := getArrayConfig(ctx) - fmt.Println("arrayConData*****", arrayConData) if err != nil { return false, err } array := arrayConData[systemID] - fmt.Println("array****", array) - fmt.Println("array details****", array.NasName, array.Endpoint, array.SystemID) if array.NasName == nil || *(array.NasName) == "" { return false, nil } return true, nil } - - fmt.Println("version****", version) - fmt.Println("err*****", err) - return false, nil - } // Probe all systems managed by driver @@ -766,9 +748,6 @@ func getArrayConfig(ctx context.Context) (map[string]*ArrayConnectionData, error copy := ArrayConnectionData{} copy = c arrays[c.SystemID] = © - fmt.Println("nasname", copy.NasName) - fmt.Println("nasname***", arrays[c.SystemID].NasName) - fmt.Println("arrays****", arrays) } } else { return nil, fmt.Errorf("arrays details are not provided in vxflexos-creds secret") From c6229510cf5998933b8efa79c359387519b9aa97 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Sun, 16 Apr 2023 03:22:13 -0400 Subject: [PATCH 15/16] unit test changes for nodeGetInfo. --- service/features/array-config/config | 6 ++++-- service/features/array-config/config.2 | 3 +++ service/service_unit_test.go | 1 + service/step_handlers_test.go | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/service/features/array-config/config b/service/features/array-config/config index 498242e2..9da7f6f7 100644 --- a/service/features/array-config/config +++ b/service/features/array-config/config @@ -5,7 +5,8 @@ "password": "Password123", "insecure": true, "isDefault": true, - "systemID": "14dbbf5617523654" + "systemID": "14dbbf5617523654", + "nasName": "dummy-name" }, { "endpoint": "http://127.0.0.2", @@ -14,6 +15,7 @@ "skipCertificateValidation": true, "isDefault": false, "systemID": "15dbbf5617523655", - "AllSystemNames" : "15dbbf5617523655-previous-name" + "AllSystemNames" : "15dbbf5617523655-previous-name", + "nasName": "dummy-name" } ] diff --git a/service/features/array-config/config.2 b/service/features/array-config/config.2 index 9bdd6d8b..2730c6cf 100644 --- a/service/features/array-config/config.2 +++ b/service/features/array-config/config.2 @@ -6,6 +6,7 @@ "insecure": true, "isDefault": true, "systemID": "14dbbf5617523654" + "nasName": "dummy-name" }, { "endpoint": "http://127.0.0.2", @@ -14,6 +15,7 @@ "insecure": true, "isDefault": false, "systemID": "15dbbf5617523655" + "nasName": "dummy-name" }, { "username": "admin", @@ -22,5 +24,6 @@ "endpoint": "https://1.2.3.4", "insecure": true, "isDefault": false + "nasName": "dummy-name" } ] diff --git a/service/service_unit_test.go b/service/service_unit_test.go index f322372f..66eea2e9 100644 --- a/service/service_unit_test.go +++ b/service/service_unit_test.go @@ -18,6 +18,7 @@ import ( "errors" "fmt" + csi "github.com/container-storage-interface/spec/lib/go/csi" siotypes "github.com/dell/goscaleio/types/v1" "github.com/stretchr/testify/assert" diff --git a/service/step_handlers_test.go b/service/step_handlers_test.go index c23c32aa..d776d0fd 100644 --- a/service/step_handlers_test.go +++ b/service/step_handlers_test.go @@ -250,7 +250,7 @@ func handleVersion(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusRequestTimeout) return } - w.Write([]byte("2.5")) + w.Write([]byte("4.0")) } // handleSystemInstances implements GET /api/types/System/instances From 33aaf461138bb70895eb5a4c93302ded1bf55582 Mon Sep 17 00:00:00 2001 From: Vamsikrishna_Siddu Date: Sun, 16 Apr 2023 23:27:43 -0400 Subject: [PATCH 16/16] updated go mod and go sum. --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 23507498..04aa3022 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/dell/dell-csi-extensions/volumeGroupSnapshot v1.2.2 github.com/dell/gocsi v1.7.0 github.com/dell/gofsutil v1.12.0 - github.com/dell/goscaleio v1.10.1-0.20230413104908-fafc4b32b7ca + github.com/dell/goscaleio v1.10.1-0.20230414022734-b253e33e4863 github.com/fsnotify/fsnotify v1.5.1 github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.3.0 diff --git a/go.sum b/go.sum index a43c947e..3019cfef 100644 --- a/go.sum +++ b/go.sum @@ -118,6 +118,8 @@ github.com/dell/goscaleio v1.10.0 h1:XCEI9j+IlbqNPY7uvBjNNlT0Nt2PMXlnyxUavmennVY github.com/dell/goscaleio v1.10.0/go.mod h1:Zh2iQ44Jd8FMqU2h+rT5x1K6mdPMKQ15lkFxojU4z3w= github.com/dell/goscaleio v1.10.1-0.20230413104908-fafc4b32b7ca h1:QkD1D+ROLt3hQpQ7fX8BU3adc3/CxlqjsUFmiidFv74= github.com/dell/goscaleio v1.10.1-0.20230413104908-fafc4b32b7ca/go.mod h1:Zh2iQ44Jd8FMqU2h+rT5x1K6mdPMKQ15lkFxojU4z3w= +github.com/dell/goscaleio v1.10.1-0.20230414022734-b253e33e4863 h1:dmarfgxpB+NiuMOuOISNJGNajhFCJ6+mYUc8wrh56FQ= +github.com/dell/goscaleio v1.10.1-0.20230414022734-b253e33e4863/go.mod h1:Zh2iQ44Jd8FMqU2h+rT5x1K6mdPMKQ15lkFxojU4z3w= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=