From 5d5171c7d726413aa23d15bf214ebd877be2aca6 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 31 Oct 2024 17:07:33 +0100 Subject: [PATCH] journal: store `csi.groupid` for snapshots Commit 95733b3a9 introduced the `StoreGroupID()` function, but that unfortunately set an empty key in the journal. Passing the `csiGroupIDKey` key (with value `csi.groupid`) caused setting `csi.csi.groupid` as a key. Reading the value back with the right `csi.groupid` key always returned an empty value. Fixes: 95733b3a9 "journal: add option to store the groupID" Signed-off-by: Niels de Vos --- internal/journal/voljournal.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/journal/voljournal.go b/internal/journal/voljournal.go index 096375a68..d57ece947 100644 --- a/internal/journal/voljournal.go +++ b/internal/journal/voljournal.go @@ -199,6 +199,7 @@ func NewCSISnapshotJournal(suffix string) *Config { cephSnapSourceKey: "csi.source", namespace: "", csiImageIDKey: "csi.imageid", + csiGroupIDKey: "csi.groupid", encryptKMSKey: "csi.volume.encryptKMS", encryptionType: "csi.volume.encryptionType", ownerKey: "csi.volume.owner", @@ -805,7 +806,8 @@ func (conn *Connection) StoreAttribute(ctx context.Context, pool, reservedUUID, // StoreGroupID stores an groupID in omap. func (conn *Connection) StoreGroupID(ctx context.Context, pool, reservedUUID, groupID string) error { - err := conn.StoreAttribute(ctx, pool, reservedUUID, conn.config.csiGroupIDKey, groupID) + err := setOMapKeys(ctx, conn, pool, conn.config.namespace, conn.config.cephUUIDDirectoryPrefix+reservedUUID, + map[string]string{conn.config.csiGroupIDKey: groupID}) if err != nil { return fmt.Errorf("failed to store groupID %w", err) }