Fix concurrent map access in Portworx create volume call

Fixes #76340

Signed-off-by: Harsh Desai <harsh@portworx.com>
pull/564/head
Harsh Desai 2019-04-09 09:52:19 -07:00
parent 3c949c7d41
commit 9141812ee6
1 changed files with 5 additions and 3 deletions

View File

@ -72,12 +72,14 @@ func (util *portworxVolumeUtil) CreateVolume(p *portworxVolumeProvisioner) (stri
}
// Pass all parameters as volume labels for Portworx server-side processing
if len(p.options.Parameters) > 0 {
spec.VolumeLabels = p.options.Parameters
} else {
if spec.VolumeLabels == nil {
spec.VolumeLabels = make(map[string]string, 0)
}
for k, v := range p.options.Parameters {
spec.VolumeLabels[k] = v
}
// Update the requested size in the spec
spec.Size = uint64(requestGiB * volumehelpers.GiB)