diff --git a/internal/cephfs/driver.go b/internal/cephfs/driver.go index 9c3176f38..40fcefed7 100644 --- a/internal/cephfs/driver.go +++ b/internal/cephfs/driver.go @@ -109,11 +109,8 @@ func (fs *Driver) Run(conf *util.Config, cachePersister util.CachePersister) { if conf.InstanceID != "" { CSIInstanceID = conf.InstanceID } - // Get an instance of the volume journal - volJournal = journal.NewCSIVolumeJournal() - - // Update keys with CSI instance suffix - volJournal.SetCSIDirectorySuffix(CSIInstanceID) + // Create an instance of the volume journal + volJournal = journal.NewCSIVolumeJournal(CSIInstanceID) // Update namespace for storing keys into a specific namespace on RADOS, in the CephFS // metadata pool diff --git a/internal/journal/voljournal.go b/internal/journal/voljournal.go index 5df20200e..d50aa530a 100644 --- a/internal/journal/voljournal.go +++ b/internal/journal/voljournal.go @@ -147,9 +147,9 @@ type CSIJournal struct { } // NewCSIVolumeJournal returns an instance of CSIJournal for volumes -func NewCSIVolumeJournal() *CSIJournal { +func NewCSIVolumeJournal(suffix string) *CSIJournal { return &CSIJournal{ - csiDirectory: "csi.volumes", + csiDirectory: "csi.volumes." + suffix, csiNameKeyPrefix: "csi.volume.", cephUUIDDirectoryPrefix: "csi.volume.", csiNameKey: "csi.volname", @@ -162,9 +162,9 @@ func NewCSIVolumeJournal() *CSIJournal { } // NewCSISnapshotJournal returns an instance of CSIJournal for snapshots -func NewCSISnapshotJournal() *CSIJournal { +func NewCSISnapshotJournal(suffix string) *CSIJournal { return &CSIJournal{ - csiDirectory: "csi.snaps", + csiDirectory: "csi.snaps." + suffix, csiNameKeyPrefix: "csi.snap.", cephUUIDDirectoryPrefix: "csi.snap.", csiNameKey: "csi.snapname", @@ -188,11 +188,6 @@ func (cj *CSIJournal) GetNameForUUID(prefix, uid string, isSnapshot bool) string return prefix + uid } -// SetCSIDirectorySuffix sets the given suffix for the csiDirectory omap -func (cj *CSIJournal) SetCSIDirectorySuffix(suffix string) { - cj.csiDirectory = cj.csiDirectory + "." + suffix -} - // SetNamespace sets the namespace in which all RADOS objects would be created func (cj *CSIJournal) SetNamespace(ns string) { cj.namespace = ns diff --git a/internal/rbd/driver.go b/internal/rbd/driver.go index f203007a4..04e8cd029 100644 --- a/internal/rbd/driver.go +++ b/internal/rbd/driver.go @@ -103,13 +103,9 @@ func (r *Driver) Run(conf *util.Config, cachePersister util.CachePersister) { CSIInstanceID = conf.InstanceID } - // Get an instance of the volume and snapshot journal keys - volJournal = journal.NewCSIVolumeJournal() - snapJournal = journal.NewCSISnapshotJournal() - - // Update keys with CSI instance suffix - volJournal.SetCSIDirectorySuffix(CSIInstanceID) - snapJournal.SetCSIDirectorySuffix(CSIInstanceID) + // Create instances of the volume and snapshot journal + volJournal = journal.NewCSIVolumeJournal(CSIInstanceID) + snapJournal = journal.NewCSISnapshotJournal(CSIInstanceID) // Initialize default library driver r.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID)