]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix for typo in Purity Host create/delete methods in PureISCSIDriver
authorPatrick East <patrick.east@purestorage.com>
Fri, 5 Dec 2014 23:25:21 +0000 (15:25 -0800)
committerPatrick East <patrick.east@purestorage.com>
Sun, 7 Dec 2014 01:24:55 +0000 (17:24 -0800)
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/<host_name>/volume
instead of /host/<host_name>

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

cinder/tests/test_pure.py
cinder/volume/drivers/pure.py

index 7e650c02eb7e82472c2f7d927a2178aa0e5cb4d0..b0bae9a59092689357d2001ed6b64869e8d29bfe 100644 (file)
@@ -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",
index 2a2d7944c5335713dfd65db761c27342806b7925..12c7362b2fadc9615661fb369a20174099bec1e7 100644 (file)
@@ -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."""