mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
journal: split journal types creating a new Connection type
Before, the one CSIJournal type was handling both configuration and providing methods to make changes to the journal. This created the temptation to modify the state of the global configuration object to enact changes through the method calls. This change creates a new type `journal.Connection` that takes the monitors and credentials to create a short(er)-lived object to actually read and make changes on the journal. This also avoid mixing the arguments needed to connect to the cluster with the arguments needed for the various journal read & update calls. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
f0b3cee94a
commit
52603d595a
@ -391,8 +391,14 @@ func genSnapFromSnapID(ctx context.Context, rbdSnap *rbdSnapshot, snapshotID str
|
||||
}
|
||||
rbdSnap.JournalPool = rbdSnap.Pool
|
||||
|
||||
imageAttributes, err := snapJournal.GetImageAttributes(ctx, rbdSnap.Monitors,
|
||||
cr, rbdSnap.Pool, vi.ObjectUUID, true)
|
||||
j, err := snapJournal.Connect(rbdSnap.Monitors, cr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer j.Destroy()
|
||||
|
||||
imageAttributes, err := j.GetImageAttributes(
|
||||
ctx, rbdSnap.Pool, vi.ObjectUUID, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -453,8 +459,14 @@ func genVolFromVolID(ctx context.Context, volumeID string, cr *util.Credentials,
|
||||
}
|
||||
rbdVol.JournalPool = rbdVol.Pool
|
||||
|
||||
imageAttributes, err := volJournal.GetImageAttributes(ctx, rbdVol.Monitors, cr,
|
||||
rbdVol.Pool, vi.ObjectUUID, false)
|
||||
j, err := volJournal.Connect(rbdVol.Monitors, cr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer j.Destroy()
|
||||
|
||||
imageAttributes, err := j.GetImageAttributes(
|
||||
ctx, rbdVol.Pool, vi.ObjectUUID, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user