From c4d3b7dbe9c6eb085d5de0ba26127665b4ca5fe4 Mon Sep 17 00:00:00 2001 From: Tom Swanson Date: Wed, 27 Apr 2016 15:46:49 -0500 Subject: [PATCH] Dell SC: Changed rename volume REST API call The Dell SC REST API call for renaming a volume should be a put StorageCenter/ScVolume/{instanceId} call and not a post StorageCenter/ScVolume/{instanceId}/Modify call. They both work but the post might go away in the future. Change-Id: I0ecc757e097e4f73bee1ea345a12da5ecce137b6 --- cinder/tests/unit/test_dellscapi.py | 12 ++++++------ cinder/volume/drivers/dell/dell_storagecenter_api.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cinder/tests/unit/test_dellscapi.py b/cinder/tests/unit/test_dellscapi.py index bf539092ae8..82126f54ebe 100644 --- a/cinder/tests/unit/test_dellscapi.py +++ b/cinder/tests/unit/test_dellscapi.py @@ -4647,27 +4647,27 @@ class DellSCSanAPITestCase(test.TestCase): self.assertIsNone(res, 'Expected None') @mock.patch.object(dell_storagecenter_api.HttpClient, - 'post', + 'put', return_value=RESPONSE_200) def test_rename_volume(self, - mock_post, + mock_put, mock_close_connection, mock_open_connection, mock_init): res = self.scapi.rename_volume(self.VOLUME, 'newname') - self.assertTrue(mock_post.called) + self.assertTrue(mock_put.called) self.assertTrue(res) @mock.patch.object(dell_storagecenter_api.HttpClient, - 'post', + 'put', return_value=RESPONSE_400) def test_rename_volume_failure(self, - mock_post, + mock_put, mock_close_connection, mock_open_connection, mock_init): res = self.scapi.rename_volume(self.VOLUME, 'newname') - self.assertTrue(mock_post.called) + self.assertTrue(mock_put.called) self.assertFalse(res) @mock.patch.object(dell_storagecenter_api.HttpClient, diff --git a/cinder/volume/drivers/dell/dell_storagecenter_api.py b/cinder/volume/drivers/dell/dell_storagecenter_api.py index 1438d0e8a69..6d775b48b02 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_api.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_api.py @@ -1906,9 +1906,9 @@ class StorageCenterApi(object): """ payload = {} payload['Name'] = name - r = self.client.post('StorageCenter/ScVolume/%s/Modify' - % self._get_id(scvolume), - payload) + r = self.client.put('StorageCenter/ScVolume/%s' + % self._get_id(scvolume), + payload) if self._check_result(r): return True