From 1ae0603782ea1df19f614b8de08e3161fcc4ee91 Mon Sep 17 00:00:00 2001 From: Pooja Jadhav Date: Mon, 11 Jun 2018 17:53:34 +0530 Subject: [PATCH] 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 [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 --- nova/tests/unit/volume/test_cinder.py | 6 ++---- nova/volume/cinder.py | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/nova/tests/unit/volume/test_cinder.py b/nova/tests/unit/volume/test_cinder.py index 06712e715ed2..9af5af994e13 100644 --- a/nova/tests/unit/volume/test_cinder.py +++ b/nova/tests/unit/volume/test_cinder.py @@ -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): diff --git a/nova/volume/cinder.py b/nova/volume/cinder.py index 8f0b2a8c3596..a729349f81ff 100644 --- a/nova/volume/cinder.py +++ b/nova/volume/cinder.py @@ -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,