rbd: have GetVolumeGroup() return an empty volume group if it was not found

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2024-10-01 10:37:35 +02:00 committed by mergify[bot]
parent 5d5171c7d7
commit 4b13e9132b

View File

@ -74,6 +74,12 @@ func GetVolumeGroup(
attrs, err := vg.getVolumeGroupAttributes(ctx) attrs, err := vg.getVolumeGroupAttributes(ctx)
if err != nil { if err != nil {
if errors.Is(err, librbd.ErrNotFound) {
log.ErrorLog(ctx, "%v, returning empty volume group %q", vg, err)
return vg, err
}
return nil, fmt.Errorf("failed to get volume attributes for id %q: %w", vg, err) return nil, fmt.Errorf("failed to get volume attributes for id %q: %w", vg, err)
} }