cephfs: add snapshot create/delete capabilities in controllerserver

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2020-08-04 09:20:13 +05:30 committed by mergify[bot]
parent 5a71949dcd
commit f9257ed1cb

View File

@ -54,6 +54,10 @@ var (
// volJournal is used to maintain RADOS based journals for CO generated // volJournal is used to maintain RADOS based journals for CO generated
// VolumeName to backing CephFS subvolumes // VolumeName to backing CephFS subvolumes
volJournal *journal.Config volJournal *journal.Config
// snapJournal is used to maintain RADOS based journals for CO generated
// SnapshotName to backing CephFS subvolumes
snapJournal *journal.Config
) )
// NewDriver returns new ceph driver. // NewDriver returns new ceph driver.
@ -73,6 +77,8 @@ func NewControllerServer(d *csicommon.CSIDriver) *ControllerServer {
return &ControllerServer{ return &ControllerServer{
DefaultControllerServer: csicommon.NewDefaultControllerServer(d), DefaultControllerServer: csicommon.NewDefaultControllerServer(d),
VolumeLocks: util.NewVolumeLocks(), VolumeLocks: util.NewVolumeLocks(),
SnapshotLocks: util.NewVolumeLocks(),
OperationLocks: util.NewOperationLock(),
} }
} }
@ -106,6 +112,7 @@ func (fs *Driver) Run(conf *util.Config) {
// Create an instance of the volume journal // Create an instance of the volume journal
volJournal = journal.NewCSIVolumeJournalWithNamespace(CSIInstanceID, radosNamespace) volJournal = journal.NewCSIVolumeJournalWithNamespace(CSIInstanceID, radosNamespace)
snapJournal = journal.NewCSISnapshotJournalWithNamespace(CSIInstanceID, radosNamespace)
// Initialize default library driver // Initialize default library driver
fs.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID) fs.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID)
@ -116,7 +123,9 @@ func (fs *Driver) Run(conf *util.Config) {
if conf.IsControllerServer || !conf.IsNodeServer { if conf.IsControllerServer || !conf.IsNodeServer {
fs.cd.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{ fs.cd.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{
csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME, csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
csi.ControllerServiceCapability_RPC_EXPAND_VOLUME, csi.ControllerServiceCapability_RPC_EXPAND_VOLUME,
csi.ControllerServiceCapability_RPC_CLONE_VOLUME,
}) })
fs.cd.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{ fs.cd.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{