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

rbd: migration of replication service from controller server #3924

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/csi-addons/rbd/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ type ReplicationServer struct {
*corerbd.ControllerServer
}

// NewReplicationServer creates a new ReplicationServer which handles
// the Replication Service requests from the CSI-Addons specification.
func NewReplicationServer(c *corerbd.ControllerServer) *ReplicationServer {
return &ReplicationServer{ControllerServer: c}
}

func (rs *ReplicationServer) RegisterService(server grpc.ServiceRegistrar) {
replication.RegisterControllerServer(server, rs)
}
Expand Down
28 changes: 8 additions & 20 deletions internal/rbd/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ import (

// Driver contains the default identity,node and controller struct.
type Driver struct {
cd *csicommon.CSIDriver

cd *csicommon.CSIDriver
nixpanic marked this conversation as resolved.
Show resolved Hide resolved
ids *rbd.IdentityServer
ns *rbd.NodeServer
cs *rbd.ControllerServer
rs *casrbd.ReplicationServer

// cas is the CSIAddonsServer where CSI-Addons services are handled
cas *csiaddons.CSIAddonsServer
Expand Down Expand Up @@ -66,10 +64,6 @@ func NewControllerServer(d *csicommon.CSIDriver) *rbd.ControllerServer {
}
}

func NewReplicationServer(c *rbd.ControllerServer) *casrbd.ReplicationServer {
return &casrbd.ReplicationServer{ControllerServer: c}
}

// NewNodeServer initialize a node server for rbd CSI driver.
func NewNodeServer(
d *csicommon.CSIDriver,
Expand Down Expand Up @@ -105,12 +99,6 @@ func (r *Driver) Run(conf *util.Config) {
// Create instances of the volume and snapshot journal
rbd.InitJournals(conf.InstanceID)

// configre CSI-Addons server and components
err = r.setupCSIAddonsServer(conf)
if err != nil {
log.FatalLogMsg(err.Error())
}

// Initialize default library driver
r.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID)
if r.cd == nil {
Expand Down Expand Up @@ -175,19 +163,19 @@ func (r *Driver) Run(conf *util.Config) {
r.cs = NewControllerServer(r.cd)
r.cs.ClusterName = conf.ClusterName
r.cs.SetMetadata = conf.SetMetadata
log.WarningLogMsg("replication service running on controller server is deprecated " +
"and replaced by CSI-Addons, see https://github.com/ceph/ceph-csi/issues/3314 for more details")
r.rs = NewReplicationServer(r.cs)
}

// configre CSI-Addons server and components
err = r.setupCSIAddonsServer(conf)
if err != nil {
log.FatalLogMsg(err.Error())
}

s := csicommon.NewNonBlockingGRPCServer()
srv := csicommon.Servers{
IS: r.ids,
CS: r.cs,
NS: r.ns,
// Register the replication controller to expose replication
// operations.
RS: r.rs,
}
s.Start(conf.Endpoint, conf.HistogramOption, srv, conf.EnableGRPCMetrics)
if conf.EnableGRPCMetrics {
Expand Down Expand Up @@ -231,7 +219,7 @@ func (r *Driver) setupCSIAddonsServer(conf *util.Config) error {
fcs := casrbd.NewFenceControllerServer()
r.cas.RegisterService(fcs)

rcs := NewReplicationServer(NewControllerServer(r.cd))
rcs := casrbd.NewReplicationServer(NewControllerServer(r.cd))
r.cas.RegisterService(rcs)
}

Expand Down