Remove unnecessary parameters from create volume API

From the beginning, user_id and project_id parameters are passed to the
create method which python-cinderclient includes in the request body
but these parameters were not used by the Cinder service. But now we
are adding schema validation support in Cinder service[1] and these
parameters are not allowed anymore. If cinder service will get these
parameters in create volume API request body, it will return 400
error. Even in the Cinder specs, these parameters are not documented
in api-ref <v2/v3>[2][3].
We are also planning to remove these parameters from
python-cinderclient[4].

This patch removes these unnecessary parameters passed to the create
Volume API.

Note: These changes doesn't have any impact on the python-cinderclient.
It won't break anything.

[1]https://review.openstack.org/#/c/573093/
[2]https://developer.openstack.org/api-ref/block-storage/v2/index.html#volumes-volumes
[3]https://developer.openstack.org/api-ref/block-storage/v3/index.html#volumes-volumes
[4]https://review.openstack.org/#/c/573622/

Change-Id: I1d4024b645dcee44008e7d55702d8afd89ff6f5a
This commit is contained in:
Pooja Jadhav 2018-06-11 17:53:34 +05:30
parent 5ef23af397
commit 1ae0603782
2 changed files with 2 additions and 6 deletions

View File

@ -192,9 +192,7 @@ class CinderApiTestCase(test.NoDBTestCase):
description='',
imageRef=None,
metadata=None, name='',
project_id=None,
snapshot_id=None,
user_id=None,
volume_type=None)
@mock.patch('nova.volume.cinder.cinderclient')
@ -212,9 +210,9 @@ class CinderApiTestCase(test.NoDBTestCase):
self.assertRaises(exception.OverQuota, self.api.create, self.ctx,
1, '', '')
mock_cinderclient.return_value.volumes.create.assert_called_once_with(
1, user_id=None, imageRef=None, availability_zone=None,
1, imageRef=None, availability_zone=None,
volume_type=None, description='', snapshot_id=None, name='',
project_id=None, metadata=None)
metadata=None)
@mock.patch('nova.volume.cinder.cinderclient')
def test_get_all(self, mock_cinderclient):

View File

@ -616,8 +616,6 @@ class API(object):
kwargs = dict(snapshot_id=snapshot_id,
volume_type=volume_type,
user_id=context.user_id,
project_id=context.project_id,
availability_zone=availability_zone,
metadata=metadata,
imageRef=image_id,