journal: add volumeMap to the group

instead of adding single volumes to the
group journal, support adding multiple
volumeID's map to the group journal
which is required for RBD as well.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2024-06-18 11:19:11 +02:00
committed by mergify[bot]
parent fc0a7d2542
commit f8fbf2e95a
2 changed files with 21 additions and 19 deletions

View File

@ -461,11 +461,13 @@ func (cs *ControllerServer) createSnapshotAndAddMapping(
}
defer j.Destroy()
// Add the snapshot to the volume group journal
err = j.AddVolumeMapping(ctx,
err = j.AddVolumesMapping(ctx,
vgo.MetadataPool,
vgs.ReservedID,
req.GetSourceVolumeId(),
resp.GetSnapshot().GetSnapshotId())
map[string]string{
req.GetSourceVolumeId(): resp.GetSnapshot().GetSnapshotId(),
},
)
if err != nil {
log.ErrorLog(ctx, "failed to add volume snapshot mapping: %v", err)
// Delete the last created snapshot as its still not added to the
@ -640,7 +642,7 @@ func (cs *ControllerServer) deleteSnapshotsAndUndoReservation(ctx context.Contex
return err
}
// remove the entry from the omap
err = j.RemoveVolumeMapping(
err = j.RemoveVolumesMapping(
ctx,
vgo.MetadataPool,
vgsi.ReservedID,