rbd: verify if pool name is not empty

Validate Snapshot request to check if the
passed pool name is not empty.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
Yug 2021-03-18 16:58:23 +05:30 committed by mergify[bot]
parent 3898ae34a7
commit 1f6a9cabfd

View File

@ -904,7 +904,9 @@ func (cs *ControllerServer) validateSnapshotReq(ctx context.Context, req *csi.Cr
if value, ok := options["snapshotNamePrefix"]; ok && value == "" { if value, ok := options["snapshotNamePrefix"]; ok && value == "" {
return status.Error(codes.InvalidArgument, "empty snapshot name prefix to provision snapshot from") return status.Error(codes.InvalidArgument, "empty snapshot name prefix to provision snapshot from")
} }
if value, ok := options["pool"]; ok && value == "" {
return status.Error(codes.InvalidArgument, "empty pool name in which rbd image will be created")
}
return nil return nil
} }