mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-17 10:19:30 +00:00
cephfs: use conf.InstanceID instead of global variable
RBD does not have a global CSIInstanceID variable anymore, there is no need for CephFS to use one either. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
dfb48bac17
commit
130e8b42f2
@ -45,10 +45,6 @@ type Driver struct {
|
|||||||
cas *csiaddons.CSIAddonsServer
|
cas *csiaddons.CSIAddonsServer
|
||||||
}
|
}
|
||||||
|
|
||||||
// CSIInstanceID is the instance ID that is unique to an instance of CSI, used when sharing
|
|
||||||
// ceph clusters across CSI instances, to differentiate omap names per CSI instance.
|
|
||||||
var CSIInstanceID = "default"
|
|
||||||
|
|
||||||
// NewDriver returns new ceph driver.
|
// NewDriver returns new ceph driver.
|
||||||
func NewDriver() *Driver {
|
func NewDriver() *Driver {
|
||||||
return &Driver{}
|
return &Driver{}
|
||||||
@ -105,11 +101,6 @@ func (fs *Driver) Run(conf *util.Config) {
|
|||||||
log.FatalLogMsg("cephfs: failed to load ceph mounters: %v", err)
|
log.FatalLogMsg("cephfs: failed to load ceph mounters: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use passed in instance ID, if provided for omap suffix naming
|
|
||||||
if conf.InstanceID != "" {
|
|
||||||
CSIInstanceID = conf.InstanceID
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use passed in radosNamespace, if provided for storing CSI specific objects and keys.
|
// Use passed in radosNamespace, if provided for storing CSI specific objects and keys.
|
||||||
if conf.RadosNamespaceCephFS != "" {
|
if conf.RadosNamespaceCephFS != "" {
|
||||||
fsutil.RadosNamespace = conf.RadosNamespaceCephFS
|
fsutil.RadosNamespace = conf.RadosNamespaceCephFS
|
||||||
@ -127,16 +118,16 @@ func (fs *Driver) Run(conf *util.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create an instance of the volume journal
|
// Create an instance of the volume journal
|
||||||
store.VolJournal = journal.NewCSIVolumeJournalWithNamespace(CSIInstanceID, fsutil.RadosNamespace)
|
store.VolJournal = journal.NewCSIVolumeJournalWithNamespace(conf.InstanceID, fsutil.RadosNamespace)
|
||||||
|
|
||||||
store.SnapJournal = journal.NewCSISnapshotJournalWithNamespace(CSIInstanceID, fsutil.RadosNamespace)
|
store.SnapJournal = journal.NewCSISnapshotJournalWithNamespace(conf.InstanceID, fsutil.RadosNamespace)
|
||||||
|
|
||||||
store.VolumeGroupJournal = journal.NewCSIVolumeGroupJournalWithNamespace(
|
store.VolumeGroupJournal = journal.NewCSIVolumeGroupJournalWithNamespace(
|
||||||
CSIInstanceID,
|
conf.InstanceID,
|
||||||
fsutil.RadosNamespace)
|
fsutil.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, conf.InstanceID)
|
||||||
if fs.cd == nil {
|
if fs.cd == nil {
|
||||||
log.FatalLogMsg("failed to initialize CSI driver")
|
log.FatalLogMsg("failed to initialize CSI driver")
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ func TestControllerServer_validateCreateVolumeGroupSnapshotRequest(t *testing.T)
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
cs := ControllerServer{
|
cs := ControllerServer{
|
||||||
DefaultControllerServer: csicommon.NewDefaultControllerServer(
|
DefaultControllerServer: csicommon.NewDefaultControllerServer(
|
||||||
csicommon.NewCSIDriver("cephfs.csi.ceph.com", "1.0.0", "test")),
|
csicommon.NewCSIDriver("cephfs.csi.ceph.com", "1.0.0", "test", "default")),
|
||||||
}
|
}
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user