Skip to content

Commit 883df6e

Browse files
journal: pass groupUUID to be used for omap name reserve
This commit adds groupUUID param for `ReserveName` to be used for OMAP name reserve instead of auto-generating. This is useful for mirroring and metro-DR ensuring that mirrored resources have consistent OMAP names across mirrored clusters. Signed-off-by: Praveen M <[email protected]>
1 parent 1278162 commit 883df6e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: internal/cephfs/store/volumegroup.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func ReserveVolumeGroup(
245245
defer j.Destroy()
246246

247247
groupUUID, vgsi.FsVolumeGroupSnapshotName, err = j.ReserveName(
248-
ctx, volOptions.MetadataPool, volOptions.RequestName, volOptions.NamePrefix)
248+
ctx, volOptions.MetadataPool, volOptions.RequestName, volOptions.ReservedID, volOptions.NamePrefix)
249249
if err != nil {
250250
return nil, err
251251
}

Diff for: internal/journal/volumegroupjournal.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type VolumeGroupJournal interface {
5353
ctx context.Context,
5454
journalPool,
5555
reqName,
56+
groupUUID,
5657
namePrefix string) (string, string, error)
5758
// AddVolumesMapping adds a volumeMap map which contains volumeID's and its
5859
// corresponding values mapping which need to be added to the UUID
@@ -300,6 +301,7 @@ held, to prevent parallel operations from modifying the state of the omaps for t
300301
Input arguments:
301302
- journalPool: Pool where the CSI journal is stored
302303
- reqName: Name of the volumeGroupSnapshot request received
304+
- groupUUID: UUID need to be reserved instead of auto-generating one (this is useful for mirroring and metro-DR)
303305
- namePrefix: Prefix to use when generating the volumeGroupName name (suffix is an auto-generated UUID)
304306
305307
Return values:
@@ -308,7 +310,7 @@ Return values:
308310
- error: non-nil in case of any errors
309311
*/
310312
func (vgjc *volumeGroupJournalConnection) ReserveName(ctx context.Context,
311-
journalPool, reqName, namePrefix string,
313+
journalPool, reqName, groupUUID, namePrefix string,
312314
) (string, string, error) {
313315
cj := vgjc.config
314316

@@ -323,7 +325,7 @@ func (vgjc *volumeGroupJournalConnection) ReserveName(ctx context.Context,
323325
journalPool,
324326
cj.namespace,
325327
cj.cephUUIDDirectoryPrefix,
326-
"")
328+
groupUUID)
327329
if err != nil {
328330
return "", "", err
329331
}

0 commit comments

Comments
 (0)