rbd: Fix dataPool in createVolumeResponse

Return the dataPool used to create the image instead of the default one
provided by the createVolumeRequest.
In case of topologyConstrainedDataPools, they may differ.
Don't add datapool if it's not present

Signed-off-by: Sébastien Bernard <sebastien.bernard@sfr.com>
This commit is contained in:
Sébastien BERNARD 2022-01-28 12:08:09 +01:00 committed by mergify[bot]
parent 8f6a7da538
commit ee8fb3f05f

View File

@ -166,6 +166,11 @@ func buildCreateVolumeResponse(req *csi.CreateVolumeRequest, rbdVol *rbdVolume)
if rbdVol.RadosNamespace != "" {
volumeContext["radosNamespace"] = rbdVol.RadosNamespace
}
if rbdVol.DataPool != "" {
volumeContext["dataPool"] = rbdVol.DataPool
}
volume := &csi.Volume{
VolumeId: rbdVol.VolID,
CapacityBytes: rbdVol.VolSize,