mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
util: add helper for group controller
Added helper function to add the group controller capabilities which needs to be included by csi driver that wants to implement group controller. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
dd235d88e0
commit
aa39b3dc1f
@ -33,6 +33,7 @@ type CSIDriver struct {
|
||||
// topology constraints that this nodeserver will advertise
|
||||
topology map[string]string
|
||||
capabilities []*csi.ControllerServiceCapability
|
||||
groupCapabilities []*csi.GroupControllerServiceCapability
|
||||
vc []*csi.VolumeCapability_AccessMode
|
||||
}
|
||||
|
||||
@ -116,3 +117,16 @@ func (d *CSIDriver) AddVolumeCapabilityAccessModes(
|
||||
func (d *CSIDriver) GetVolumeCapabilityAccessModes() []*csi.VolumeCapability_AccessMode {
|
||||
return d.vc
|
||||
}
|
||||
|
||||
// AddControllerServiceCapabilities stores the group controller capabilities
|
||||
// in driver object.
|
||||
func (d *CSIDriver) AddGroupControllerServiceCapabilities(cl []csi.GroupControllerServiceCapability_RPC_Type) {
|
||||
csc := make([]*csi.GroupControllerServiceCapability, 0, len(cl))
|
||||
|
||||
for _, c := range cl {
|
||||
log.DefaultLog("Enabling group controller service capability: %v", c.String())
|
||||
csc = append(csc, NewGroupControllerServiceCapability(c))
|
||||
}
|
||||
|
||||
d.groupCapabilities = csc
|
||||
}
|
||||
|
@ -95,6 +95,18 @@ func NewControllerServiceCapability(ctrlCap csi.ControllerServiceCapability_RPC_
|
||||
}
|
||||
}
|
||||
|
||||
// NewGroupControllerServiceCapability returns group controller capabilities.
|
||||
func NewGroupControllerServiceCapability(ctrlCap csi.GroupControllerServiceCapability_RPC_Type,
|
||||
) *csi.GroupControllerServiceCapability {
|
||||
return &csi.GroupControllerServiceCapability{
|
||||
Type: &csi.GroupControllerServiceCapability_Rpc{
|
||||
Rpc: &csi.GroupControllerServiceCapability_RPC{
|
||||
Type: ctrlCap,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewMiddlewareServerOption creates a new grpc.ServerOption that configures a
|
||||
// common format for log messages and other gRPC related handlers.
|
||||
func NewMiddlewareServerOption() grpc.ServerOption {
|
||||
|
Loading…
Reference in New Issue
Block a user