mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 18:43:34 +00:00
util: add CSIDriver.GetInstanceID()
There has been some confusion about using different variables for the InstanceID of the RBD-driver. By removing the global variable CSIInstanceID, there should be no confusion anymore what variable to use. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
0092a47586
commit
dfb48bac17
@ -100,7 +100,7 @@ func (r *Driver) Run(conf *util.Config) {
|
||||
rbd.InitJournals(conf.InstanceID)
|
||||
|
||||
// Initialize default library driver
|
||||
r.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID)
|
||||
r.cd = csicommon.NewCSIDriver(conf.DriverName, util.DriverVersion, conf.NodeID, conf.InstanceID)
|
||||
if r.cd == nil {
|
||||
log.FatalLogMsg("Failed to initialize CSI Driver.")
|
||||
}
|
||||
@ -217,7 +217,7 @@ func (r *Driver) setupCSIAddonsServer(conf *util.Config) error {
|
||||
fcs := casrbd.NewFenceControllerServer()
|
||||
r.cas.RegisterService(fcs)
|
||||
|
||||
rcs := casrbd.NewReplicationServer(rbd.CSIInstanceID, NewControllerServer(r.cd))
|
||||
rcs := casrbd.NewReplicationServer(conf.InstanceID, NewControllerServer(r.cd))
|
||||
r.cas.RegisterService(rcs)
|
||||
|
||||
vgcs := casrbd.NewVolumeGroupServer(conf.InstanceID)
|
||||
|
@ -23,10 +23,6 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// 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.
|
||||
CSIInstanceID = "default"
|
||||
|
||||
// volJournal and snapJournal are used to maintain RADOS based journals for CO generated
|
||||
// VolumeName to backing RBD images.
|
||||
volJournal *journal.Config
|
||||
@ -91,11 +87,6 @@ func SetGlobalBool(name string, value bool) {
|
||||
// NodeService where appropriate. Using global journals limits the ability to
|
||||
// configure these options based on the Ceph cluster or StorageClass.
|
||||
func InitJournals(instance string) {
|
||||
// Use passed in instance ID, if provided for omap suffix naming
|
||||
if instance != "" {
|
||||
CSIInstanceID = instance
|
||||
}
|
||||
|
||||
volJournal = journal.NewCSIVolumeJournal(CSIInstanceID)
|
||||
snapJournal = journal.NewCSISnapshotJournal(CSIInstanceID)
|
||||
volJournal = journal.NewCSIVolumeJournal(instance)
|
||||
snapJournal = journal.NewCSISnapshotJournal(instance)
|
||||
}
|
||||
|
@ -547,7 +547,8 @@ func RegenerateJournal(
|
||||
volumeID,
|
||||
requestName,
|
||||
owner,
|
||||
clusterName string,
|
||||
clusterName,
|
||||
instanceID string,
|
||||
setMetadata bool,
|
||||
cr *util.Credentials,
|
||||
) (string, error) {
|
||||
@ -595,7 +596,7 @@ func RegenerateJournal(
|
||||
if rbdVol.JournalPool == "" {
|
||||
rbdVol.JournalPool = rbdVol.Pool
|
||||
}
|
||||
volJournal = journal.NewCSIVolumeJournal(CSIInstanceID)
|
||||
volJournal = journal.NewCSIVolumeJournal(instanceID)
|
||||
j, err := volJournal.Connect(rbdVol.Monitors, rbdVol.RadosNamespace, cr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
Reference in New Issue
Block a user