From fc0a7d2542eb0da66461e4cf94e8882fc6c545a3 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 18 Jun 2024 11:14:37 +0200 Subject: [PATCH] journal: support removing multiple volumeID Updating the code to support removing multiple volumeID's mapping from the group journal. Signed-off-by: Madhu Rajanna --- internal/cephfs/groupcontrollerserver.go | 2 +- internal/journal/volumegroupjournal.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/cephfs/groupcontrollerserver.go b/internal/cephfs/groupcontrollerserver.go index 1d75709b8..40421517c 100644 --- a/internal/cephfs/groupcontrollerserver.go +++ b/internal/cephfs/groupcontrollerserver.go @@ -644,7 +644,7 @@ func (cs *ControllerServer) deleteSnapshotsAndUndoReservation(ctx context.Contex ctx, vgo.MetadataPool, vgsi.ReservedID, - volID) + []string{volID}) j.Destroy() if err != nil { log.ErrorLog(ctx, "failed to remove volume snapshot mapping: %v", err) diff --git a/internal/journal/volumegroupjournal.go b/internal/journal/volumegroupjournal.go index 5f8f2b3b4..4663731aa 100644 --- a/internal/journal/volumegroupjournal.go +++ b/internal/journal/volumegroupjournal.go @@ -64,12 +64,12 @@ type VolumeGroupJournal interface { reservedUUID, volumeID, value string) error - // RemoveVolumeMapping removes a volumeID mapping from the UUID directory. + // RemoveVolumeMapping removes volumeIDs mapping from the UUID directory. RemoveVolumeMapping( ctx context.Context, pool, - reservedUUID, - volumeID string) error + reservedUUID string, + volumeIDs []string) error } // VolumeGroupJournalConfig contains the configuration. @@ -424,14 +424,14 @@ func (vgjc *VolumeGroupJournalConnection) AddVolumeMapping( func (vgjc *VolumeGroupJournalConnection) RemoveVolumeMapping( ctx context.Context, pool, - reservedUUID, - volumeID string, + reservedUUID string, + volumeIDs []string, ) error { err := removeMapKeys(ctx, vgjc.connection, pool, vgjc.config.namespace, vgjc.config.cephUUIDDirectoryPrefix+reservedUUID, - []string{volumeID}) + volumeIDs) if err != nil { - log.ErrorLog(ctx, "failed removing volume mapping from group: key %q: %v", volumeID, err) + log.ErrorLog(ctx, "failed removing volume mapping from group: key: %q %v", volumeIDs, err) return err }