diff --git a/internal/cephfs/driver.go b/internal/cephfs/driver.go index 40fcefed7..ccc4d6223 100644 --- a/internal/cephfs/driver.go +++ b/internal/cephfs/driver.go @@ -110,11 +110,8 @@ func (fs *Driver) Run(conf *util.Config, cachePersister util.CachePersister) { CSIInstanceID = conf.InstanceID } // Create an instance of the volume journal - volJournal = journal.NewCSIVolumeJournal(CSIInstanceID) + volJournal = journal.NewCSIVolumeJournalWithNamespace(CSIInstanceID, radosNamespace) - // Update namespace for storing keys into a specific namespace on RADOS, in the CephFS - // metadata pool - volJournal.SetNamespace(radosNamespace) // Initialize default library driver fs.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID) diff --git a/internal/journal/voljournal.go b/internal/journal/voljournal.go index d50aa530a..3c530fc6e 100644 --- a/internal/journal/voljournal.go +++ b/internal/journal/voljournal.go @@ -176,6 +176,14 @@ func NewCSISnapshotJournal(suffix string) *CSIJournal { } } +// NewCSIVolumeJournalWithNamespace returns an instance of CSIJournal for +// volumes using a predetermined namespace value. +func NewCSIVolumeJournalWithNamespace(suffix, ns string) *CSIJournal { + j := NewCSIVolumeJournal(suffix) + j.namespace = ns + return j +} + // GetNameForUUID returns volume name func (cj *CSIJournal) GetNameForUUID(prefix, uid string, isSnapshot bool) string { if prefix == "" { @@ -188,11 +196,6 @@ func (cj *CSIJournal) GetNameForUUID(prefix, uid string, isSnapshot bool) string return prefix + uid } -// SetNamespace sets the namespace in which all RADOS objects would be created -func (cj *CSIJournal) SetNamespace(ns string) { - cj.namespace = ns -} - // ImageData contains image name and stored CSI properties type ImageData struct { ImageUUID string