mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 06:10:22 +00:00
rbd: migration of replication controller server
this commit migrates the replication controller server from internal/rbd and adds it to csi-addons. Signed-off-by: riya-singhal31 <rsinghal@redhat.com>
This commit is contained in:
parent
cdaa9264eb
commit
dbdb9086d8
@ -82,6 +82,12 @@ type ReplicationServer struct {
|
|||||||
*corerbd.ControllerServer
|
*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) {
|
func (rs *ReplicationServer) RegisterService(server grpc.ServiceRegistrar) {
|
||||||
replication.RegisterControllerServer(server, rs)
|
replication.RegisterControllerServer(server, rs)
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,10 @@ import (
|
|||||||
|
|
||||||
// Driver contains the default identity,node and controller struct.
|
// Driver contains the default identity,node and controller struct.
|
||||||
type Driver struct {
|
type Driver struct {
|
||||||
cd *csicommon.CSIDriver
|
cd *csicommon.CSIDriver
|
||||||
|
|
||||||
ids *rbd.IdentityServer
|
ids *rbd.IdentityServer
|
||||||
ns *rbd.NodeServer
|
ns *rbd.NodeServer
|
||||||
cs *rbd.ControllerServer
|
cs *rbd.ControllerServer
|
||||||
rs *casrbd.ReplicationServer
|
|
||||||
|
|
||||||
// cas is the CSIAddonsServer where CSI-Addons services are handled
|
// cas is the CSIAddonsServer where CSI-Addons services are handled
|
||||||
cas *csiaddons.CSIAddonsServer
|
cas *csiaddons.CSIAddonsServer
|
||||||
@ -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.
|
// NewNodeServer initialize a node server for rbd CSI driver.
|
||||||
func NewNodeServer(
|
func NewNodeServer(
|
||||||
d *csicommon.CSIDriver,
|
d *csicommon.CSIDriver,
|
||||||
@ -105,12 +99,6 @@ func (r *Driver) Run(conf *util.Config) {
|
|||||||
// Create instances of the volume and snapshot journal
|
// Create instances of the volume and snapshot journal
|
||||||
rbd.InitJournals(conf.InstanceID)
|
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
|
// Initialize default library driver
|
||||||
r.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID)
|
r.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID)
|
||||||
if r.cd == nil {
|
if r.cd == nil {
|
||||||
@ -175,9 +163,12 @@ func (r *Driver) Run(conf *util.Config) {
|
|||||||
r.cs = NewControllerServer(r.cd)
|
r.cs = NewControllerServer(r.cd)
|
||||||
r.cs.ClusterName = conf.ClusterName
|
r.cs.ClusterName = conf.ClusterName
|
||||||
r.cs.SetMetadata = conf.SetMetadata
|
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()
|
s := csicommon.NewNonBlockingGRPCServer()
|
||||||
@ -185,9 +176,6 @@ func (r *Driver) Run(conf *util.Config) {
|
|||||||
IS: r.ids,
|
IS: r.ids,
|
||||||
CS: r.cs,
|
CS: r.cs,
|
||||||
NS: r.ns,
|
NS: r.ns,
|
||||||
// Register the replication controller to expose replication
|
|
||||||
// operations.
|
|
||||||
RS: r.rs,
|
|
||||||
}
|
}
|
||||||
s.Start(conf.Endpoint, conf.HistogramOption, srv, conf.EnableGRPCMetrics)
|
s.Start(conf.Endpoint, conf.HistogramOption, srv, conf.EnableGRPCMetrics)
|
||||||
if conf.EnableGRPCMetrics {
|
if conf.EnableGRPCMetrics {
|
||||||
@ -231,7 +219,7 @@ func (r *Driver) setupCSIAddonsServer(conf *util.Config) error {
|
|||||||
fcs := casrbd.NewFenceControllerServer()
|
fcs := casrbd.NewFenceControllerServer()
|
||||||
r.cas.RegisterService(fcs)
|
r.cas.RegisterService(fcs)
|
||||||
|
|
||||||
rcs := NewReplicationServer(NewControllerServer(r.cd))
|
rcs := casrbd.NewReplicationServer(NewControllerServer(r.cd))
|
||||||
r.cas.RegisterService(rcs)
|
r.cas.RegisterService(rcs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user