PowerStore driver - Request data validation fix

Due to json.dumps({}) method returns {}, an error occurs in some
client's methods, such as when deleting volumes. This fix validate
if any payload was provided for the request.

Closes-Bug: #1981068
Change-Id: I0b389f4f53d3b34eddc23a7aebc85a5b42f3a09f
This commit is contained in:
olegnest 2022-07-13 11:06:07 +03:00
parent a2deecef89
commit a4ab9220fc
2 changed files with 7 additions and 3 deletions

View File

@ -85,8 +85,6 @@ class PowerStoreClient(object):
payload=None,
params=None,
log_response_data=True):
if not payload:
payload = {}
if not params:
params = {}
request_params = {
@ -94,7 +92,7 @@ class PowerStoreClient(object):
"verify": self._verify_cert,
"params": params
}
if method != "GET":
if payload and method != "GET":
request_params["data"] = json.dumps(payload)
request_url = self.base_url + url
r = requests.request(method, request_url, **request_params)

View File

@ -0,0 +1,6 @@
---
fixes:
- |
PowerStore driver `bug #1981068
<https://bugs.launchpad.net/cinder/+bug/1981068>`_: Fixed
request data validation for the REST client.