Make delete_volume in volumes_client.py use **params

I99f9910f75aef095f2bbb37680ee584e52bf82da introduced a new
kwarg to the delete_volume() method. But the correct way to
do this is to introduce a generic **params argument, so avoid
changing the signature of the method too often.

Change-Id: Ifb6731fd893a32bea6c7832236bb26a2eacaf56c
This commit is contained in:
Jordan Pittier 2017-04-10 14:27:39 +02:00
parent 8bf816a7fb
commit cb5f650fd4
2 changed files with 16 additions and 4 deletions

View File

@ -0,0 +1,7 @@
---
features:
- |
The ``delete_volume`` method of the ``VolumesClient`` class
now has an additional ``**params`` argument that enables passing
additional information in the query string of the HTTP request.

View File

@ -118,11 +118,16 @@ class VolumesClient(rest_client.RestClient):
self.expected_success(200, resp.status)
return rest_client.ResponseBody(resp, body)
def delete_volume(self, volume_id, cascade=False):
"""Deletes the Specified Volume."""
def delete_volume(self, volume_id, **params):
"""Deletes the Specified Volume.
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/block-storage/v2/#delete-volume
"""
url = 'volumes/%s' % volume_id
if cascade:
url += '?cascade=True'
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.delete(url)
self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp, body)