rbd: return group not found error for Get,Delete RPC calls

We should return NotFound status if the group doesn't exists
for ControllerGetVolumeGroup RPC call.
And, an empty/OK response for DeleteVolumeGroup if the group
doesn't exists

Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
This commit is contained in:
Nikhil-Ladha
2024-12-04 12:07:44 +05:30
committed by mergify[bot]
parent 53d5eda020
commit c7d54ab776
3 changed files with 21 additions and 3 deletions

View File

@ -145,6 +145,12 @@ func (cvg *commonVolumeGroup) getVolumeGroupAttributes(ctx context.Context) (*jo
attrs = &journal.VolumeGroupAttributes{}
}
if attrs.GroupName == "" || attrs.CreationTime == nil {
log.ErrorLog(ctx, "volume group with id %v not found", cvg.id)
return nil, ErrRBDGroupNotFound
}
cvg.requestName = attrs.RequestName
cvg.name = attrs.GroupName
cvg.creationTime = attrs.CreationTime