Skip to content

Commit

Permalink
journal: pass groupUUID to be used for omap name reserve
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
iPraveenParihar committed Aug 20, 2024
1 parent ede36cf commit c4a1060
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/cephfs/store/volumegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func ReserveVolumeGroup(
defer j.Destroy()

groupUUID, vgsi.FsVolumeGroupSnapshotName, err = j.ReserveName(
ctx, volOptions.MetadataPool, volOptions.RequestName, volOptions.NamePrefix)
ctx, volOptions.MetadataPool, volOptions.RequestName, volOptions.ReservedID, volOptions.NamePrefix)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions internal/journal/volumegroupjournal.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type VolumeGroupJournal interface {
ctx context.Context,
journalPool,
reqName,
groupUUID,
namePrefix string) (string, string, error)
// AddVolumesMapping adds a volumeMap map which contains volumeID's and its
// corresponding values mapping which need to be added to the UUID
Expand Down Expand Up @@ -309,6 +310,7 @@ held, to prevent parallel operations from modifying the state of the omaps for t
Input arguments:
- journalPool: Pool where the CSI journal is stored
- reqName: Name of the volumeGroupSnapshot request received
- groupUUID: UUID need to be reserved instead of auto-generating one (this is useful for RBD mirroring)
- namePrefix: Prefix to use when generating the volumeGroupName name (suffix is an auto-generated UUID)
Return values:
Expand All @@ -317,7 +319,7 @@ Return values:
- error: non-nil in case of any errors
*/
func (vgjc *volumeGroupJournalConnection) ReserveName(ctx context.Context,
journalPool, reqName, namePrefix string,
journalPool, reqName, groupUUID, namePrefix string,
) (string, string, error) {
cj := vgjc.config

Expand All @@ -332,7 +334,7 @@ func (vgjc *volumeGroupJournalConnection) ReserveName(ctx context.Context,
journalPool,
cj.namespace,
cj.cephUUIDDirectoryPrefix,
"")
groupUUID)
if err != nil {
return "", "", err
}
Expand Down

0 comments on commit c4a1060

Please sign in to comment.