From c642637cec0a7a2db1331a15ea6949811a3ef341 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 9 Feb 2021 13:03:11 +0530 Subject: [PATCH] util: register replication controller as RBD is implementing the replication we are registering it. For CephFS, its not implementing the replication we are passing nil so we dont want to register it. Signed-off-by: Madhu Rajanna --- internal/cephfs/driver.go | 2 ++ internal/csi-common/server.go | 6 ++++++ internal/rbd/driver.go | 2 ++ 3 files changed, 10 insertions(+) diff --git a/internal/cephfs/driver.go b/internal/cephfs/driver.go index 2523cf46e..66921b656 100644 --- a/internal/cephfs/driver.go +++ b/internal/cephfs/driver.go @@ -156,6 +156,8 @@ func (fs *Driver) Run(conf *util.Config) { IS: fs.is, CS: fs.cs, NS: fs.ns, + // passing nil for replication server as cephFS does not support mirroring. + RS: nil, } server.Start(conf.Endpoint, conf.HistogramOption, srv, conf.EnableGRPCMetrics) if conf.EnableGRPCMetrics { diff --git a/internal/csi-common/server.go b/internal/csi-common/server.go index 1ef6d0a4e..b76d362b0 100644 --- a/internal/csi-common/server.go +++ b/internal/csi-common/server.go @@ -26,6 +26,7 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "github.com/kube-storage/spec/lib/go/replication" "github.com/prometheus/client_golang/prometheus" "google.golang.org/grpc" klog "k8s.io/klog/v2" @@ -50,6 +51,7 @@ type Servers struct { IS csi.IdentityServer CS csi.ControllerServer NS csi.NodeServer + RS replication.ControllerServer } // NewNonBlockingGRPCServer return non-blocking GRPC. @@ -122,6 +124,10 @@ func (s *nonBlockingGRPCServer) serve(endpoint, hstOptions string, srv Servers, if srv.NS != nil { csi.RegisterNodeServer(server, srv.NS) } + if srv.RS != nil { + replication.RegisterControllerServer(server, srv.RS) + } + util.DefaultLog("Listening for connections on address: %#v", listener.Addr()) if metrics { ho := strings.Split(hstOptions, ",") diff --git a/internal/rbd/driver.go b/internal/rbd/driver.go index fe0927e83..1414e0494 100644 --- a/internal/rbd/driver.go +++ b/internal/rbd/driver.go @@ -172,6 +172,8 @@ func (r *Driver) Run(conf *util.Config) { IS: r.ids, CS: r.cs, NS: r.ns, + // Register the replication controller to expose replication operations. + RS: r.cs, } s.Start(conf.Endpoint, conf.HistogramOption, srv, conf.EnableGRPCMetrics) if conf.EnableGRPCMetrics {