diff --git a/internal/cephfs/store/volumegroup.go b/internal/cephfs/store/volumegroup.go index ea1c66e4d755..35b3b06dd685 100644 --- a/internal/cephfs/store/volumegroup.go +++ b/internal/cephfs/store/volumegroup.go @@ -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 } diff --git a/internal/journal/volumegroupjournal.go b/internal/journal/volumegroupjournal.go index 8f81c0b4b071..e594b6d9cedb 100644 --- a/internal/journal/volumegroupjournal.go +++ b/internal/journal/volumegroupjournal.go @@ -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 @@ -308,6 +309,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 mirroring and metro-DR) - namePrefix: Prefix to use when generating the volumeGroupName name (suffix is an auto-generated UUID) Return values: @@ -316,7 +318,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 @@ -331,7 +333,7 @@ func (vgjc *volumeGroupJournalConnection) ReserveName(ctx context.Context, journalPool, cj.namespace, cj.cephUUIDDirectoryPrefix, - "") + groupUUID) if err != nil { return "", "", err } diff --git a/internal/rbd/manager.go b/internal/rbd/manager.go index 42d4b4268acf..f4aaf2673718 100644 --- a/internal/rbd/manager.go +++ b/internal/rbd/manager.go @@ -209,7 +209,7 @@ func (mgr *rbdManager) CreateVolumeGroup(ctx context.Context, name string) (type log.DebugLog(ctx, "the journal does not contain a reservation for a volume group with name %q yet", name) var vgName string - uuid, vgName, err = vgJournal.ReserveName(ctx, journalPool, name, prefix) + uuid, vgName, err = vgJournal.ReserveName(ctx, journalPool, name, vgData.GroupUUID, prefix) if err != nil { return nil, fmt.Errorf("failed to reserve volume group for name %q: %w", name, err) }