From: Patrick East Date: Fri, 5 Dec 2014 23:25:21 +0000 (-0800) Subject: Fix for typo in Purity Host create/delete methods in PureISCSIDriver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ce23f238fb8ce89b35d7da22ef06f5a61cbfba47;p=openstack-build%2Fcinder-build.git Fix for typo in Purity Host create/delete methods in PureISCSIDriver When refactoring the string manipulation methods there was a typo introduced in: https://git.openstack.org/cgit/openstack/cinder/commit/? id=1ebe1bddd0a02e9efaa05c8ec9d71a299b6877e1 That change modified the methods to create/delete hosts in purity. The REST API url was incorrectly pointing to /host//volume instead of /host/ This commit fixes the url and adds in unit tests to prevent this type of regression in the future. Change-Id: Iba24fc0a36e01e1d163b398bf32c41fbb9103861 Closes-Bug: 1399820 --- diff --git a/cinder/tests/test_pure.py b/cinder/tests/test_pure.py index 7e650c02e..b0bae9a59 100644 --- a/cinder/tests/test_pure.py +++ b/cinder/tests/test_pure.py @@ -709,6 +709,26 @@ class FlashArrayRESTTestCase(FlashArrayBaseTestCase): self.assert_error_propagates([mock_req], self.array.list_hosts, **self.kwargs) + def test_create_host(self, mock_req): + mock_req.return_value = self.result + host_name = "host1" + params = {'iqnlist': ['iqn1']} + result = self.array.create_host(host_name, iqnlist=['iqn1']) + self.assertEqual(result, self.result) + mock_req.assert_called_with(self.array, "POST", "host/" + host_name, + params) + self.assert_error_propagates([mock_req], self.array.create_host, + host_name, iqnlist=['iqn1']) + + def test_delete_host(self, mock_req): + mock_req.return_value = self.result + host_name = "host1" + result = self.array.delete_host(host_name) + self.assertEqual(result, self.result) + mock_req.assert_called_with(self.array, "DELETE", "host/" + host_name) + self.assert_error_propagates([mock_req], self.array.delete_host, + host_name) + def test_connect_host(self, mock_req): mock_req.return_value = self.result result = self.array.connect_host("host-name", "vol-name", diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py index 2a2d7944c..12c7362b2 100644 --- a/cinder/volume/drivers/pure.py +++ b/cinder/volume/drivers/pure.py @@ -435,11 +435,11 @@ class FlashArray(object): def create_host(self, host, **kwargs): """Create a host.""" - return self._http_request("POST", "host/%s/volume" % host, kwargs) + return self._http_request("POST", "host/%s" % host, kwargs) def delete_host(self, host): """Delete a host.""" - return self._http_request("DELETE", "host/%s/volume" % host) + return self._http_request("DELETE", "host/%s" % host) def connect_host(self, host, volume, **kwargs): """Create a connection between a host and a volume."""