From 2062fbd047b4fd36842f8dd7552c02205da5fbef Mon Sep 17 00:00:00 2001 From: delldubey Date: Mon, 22 Jul 2024 20:20:38 +0530 Subject: [PATCH] Rearrange protocol preference for automatic selection (#317) --- .../pkg/standaloneproxy/standaloneproxy.go | 1 - service/node.go | 29 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/csireverseproxy/pkg/standaloneproxy/standaloneproxy.go b/csireverseproxy/pkg/standaloneproxy/standaloneproxy.go index fa16bd8b..c658afa0 100644 --- a/csireverseproxy/pkg/standaloneproxy/standaloneproxy.go +++ b/csireverseproxy/pkg/standaloneproxy/standaloneproxy.go @@ -106,7 +106,6 @@ func newReverseProxy(mgmtServer config.ManagementServer) common.Proxy { } func newTLSConfig(mgmtServer config.ManagementServer) *tls.Config { - tlsConfig := tls.Config{ InsecureSkipVerify: mgmtServer.SkipCertificateValidation, // #nosec G402 InsecureSkipVerify cannot be false always as expected by gosec, this needs to be configurable } diff --git a/service/node.go b/service/node.go index 96e0a4d4..76a7b8b5 100644 --- a/service/node.go +++ b/service/node.go @@ -1779,12 +1779,26 @@ func (s *service) nodeHostSetup(ctx context.Context, portWWNs []string, IQNs []s } if !s.useFC && !s.useIscsi && !s.useNVMeTCP { - log.Error("No valid initiators- could not initialize FC or iSCSI") + log.Error("No valid initiators- could not initialize NVMeTCP or FC or iSCSI") return err } nodeChroot, _ := csictx.LookupEnv(context.Background(), EnvNodeChroot) - if s.useFC { + if s.useNVMeTCP { + // resetOtherProtocols + s.useFC = false + s.useIscsi = false + // check nvme module availability on the host + err = s.setupArrayForNVMeTCP(ctx, symID, validNVMeTCPs, pmaxClient) + if err != nil { + log.Errorf("Failed to do the NVMe setup for the Array(%s). Error - %s", symID, err.Error()) + } + s.initNVMeTCPConnector(nodeChroot) + s.arrayTransportProtocolMap[symID] = NvmeTCPTransportProtocol + } else if s.useFC { + // resetOtherProtocols + s.useNVMeTCP = false + s.useIscsi = false formattedFCs := make([]string, 0) for _, initiatorID := range validFCs { elems := strings.Split(initiatorID, ":") @@ -1798,6 +1812,9 @@ func (s *service) nodeHostSetup(ctx context.Context, portWWNs []string, IQNs []s s.arrayTransportProtocolMap[symID] = FcTransportProtocol isSymConnFC[symID] = true } else if s.useIscsi { + // resetOtherProtocols + s.useNVMeTCP = false + s.useNFS = false err := s.ensureISCSIDaemonStarted() if err != nil { log.Errorf("Failed to start the ISCSI Daemon. Error - %s", err.Error()) @@ -1808,14 +1825,6 @@ func (s *service) nodeHostSetup(ctx context.Context, portWWNs []string, IQNs []s } s.initISCSIConnector(nodeChroot) s.arrayTransportProtocolMap[symID] = IscsiTransportProtocol - } else if s.useNVMeTCP { - // check nvme module availability on the host - err = s.setupArrayForNVMeTCP(ctx, symID, validNVMeTCPs, pmaxClient) - if err != nil { - log.Errorf("Failed to do the NVMe setup for the Array(%s). Error - %s", symID, err.Error()) - } - s.initNVMeTCPConnector(nodeChroot) - s.arrayTransportProtocolMap[symID] = NvmeTCPTransportProtocol } }