From f7c78ae4feedbdce8d98a0f47b72f7c7ca0d3fa7 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 29 Jul 2024 14:47:57 +0200 Subject: [PATCH] rbd: update group Stringer method updated the group stringer method to have pool and namespace for proper debugging/logging and to use it with CLI as agrument as well. Signed-off-by: Madhu Rajanna --- internal/rbd/group/volume_group.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/rbd/group/volume_group.go b/internal/rbd/group/volume_group.go index e4f818b3c..6e6e59019 100644 --- a/internal/rbd/group/volume_group.go +++ b/internal/rbd/group/volume_group.go @@ -151,18 +151,17 @@ func GetVolumeGroup( return vg, nil } -// String makes it easy to include the volumeGroup object in log and error -// messages. +// String returns the image-spec (pool/{namespace}/{name}) format of the group. func (vg *volumeGroup) String() string { - if vg.name != "" { - return vg.name + if vg.namespace != "" && vg.pool != "" && vg.name != "" { + return fmt.Sprintf("%s/%s/%s", vg.pool, vg.namespace, vg.name) } - if vg.id != "" { - return vg.id + if vg.name != "" && vg.pool != "" { + return fmt.Sprintf("%s/%s", vg.pool, vg.name) } - return fmt.Sprintf("", *vg) + return fmt.Sprintf("", *vg) } // GetID returns the CSI-Addons VolumeGroupId of the VolumeGroup.