Fix some problems

1.fix path error in deploy/kubernetes/csi-nvmf-node.yaml
2.delete glog from the code
3.check vol uuid param before attach nvmf volume
This commit is contained in:
zhangdi 2022-10-21 17:26:39 +08:00
parent 9864cbfc93
commit 305dddba10
5 changed files with 7 additions and 9 deletions

View File

@ -23,8 +23,8 @@ import (
"sync"
"time"
"github.com/golang/glog"
"github.com/kubernetes-csi/csi-driver-nvmf/pkg/nvmf"
"k8s.io/klog"
)
var (
@ -32,9 +32,10 @@ var (
)
func init() {
klog.InitFlags(nil)
flag.StringVar(&conf.Endpoint, "endpoint", "unix://csi/csi.sock", "CSI endpoint")
flag.StringVar(&conf.NodeID, "nodeid", "CSINode", "node id")
flag.BoolVar(&conf.IsControllerServer, "IsControllerServer", false, "Only run as controller service")
flag.BoolVar(&conf.IsControllerServer, "IsControllerServer", false, "also run as controller service")
flag.StringVar(&conf.DriverName, "drivername", nvmf.DefaultDriverName, "CSI Driver")
flag.StringVar(&conf.Region, "region", "test_region", "Region")
flag.StringVar(&conf.Version, "version", nvmf.DefaultDriverVersion, "Version")
@ -62,12 +63,12 @@ func runDriver() {
servicePort = nvmf.DefaultDriverServicePort
}
glog.Info("CSI is running")
klog.Info("CSI is running")
server := &http.Server{Addr: ":" + servicePort}
http.HandleFunc("/healthz", healthHandler)
if err := server.ListenAndServe(); err != nil {
glog.Fatalf("Service health port listen and serve err : %s", err.Error())
klog.Fatalf("Service health port listen and serve err : %s", err.Error())
}
wg.Wait()
os.Exit(0)

View File

@ -21,7 +21,7 @@ spec:
lifecycle:
preStop:
exec:
command: ["bin/sh", "-c", "rm -rf /registration/csi.nvmf.com \
command: ["/bin/sh", "-c", "rm -rf /registration/csi.nvmf.com \
/registration/csi.nvmf.com-reg.sock"]
env:
- name: KUBE_NODE_NAME

1
go.mod
View File

@ -4,7 +4,6 @@ go 1.14
require (
github.com/container-storage-interface/spec v1.5.0
github.com/golang/glog v1.0.0
github.com/google/go-cmp v0.5.6 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.11.0
github.com/sirupsen/logrus v1.8.1

2
go.sum
View File

@ -122,8 +122,6 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=

View File

@ -61,7 +61,7 @@ func getNVMfDiskInfo(req *csi.NodePublishVolumeRequest) (*nvmfDiskInfo, error) {
deviceUUID := volOpts["deviceUUID"]
nqn := volOpts["nqn"]
if targetTrAddr == "" || nqn == "" || targetTrPort == "" || targetTrType == "" {
if targetTrAddr == "" || nqn == "" || targetTrPort == "" || targetTrType == "" || deviceUUID == "" {
return nil, fmt.Errorf("Some Nvme target info is missing, volID: %s ", volName)
}