]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix volume stats with multiple LeftHand clusters
authorJim Branen <james.branen@hp.com>
Thu, 27 Feb 2014 18:41:34 +0000 (10:41 -0800)
committerJim Branen <james.branen@hp.com>
Thu, 27 Feb 2014 21:30:48 +0000 (13:30 -0800)
When more than one cluster exists in a LeftHand management
group, get_volume_stats may return the stats for the wrong
cluster. This patch fixes the problem by listing the cluster
name in the getClusterInfo query.

Change-Id: I2d5a76869c6bb1b3d514f0546ea00998e5ee32fb
Closes-Bug: #1279897

cinder/tests/test_hplefthand.py
cinder/volume/drivers/san/hp/hp_lefthand_cliq_proxy.py

index 8b69124632cf1e0f29581164a63ff585d1a6d178..3fc7b96d19edad789ad0b6852407487f1e6ba240 100644 (file)
@@ -575,6 +575,24 @@ class TestHPLeftHandCLIQISCSIDriver(HPLeftHandBaseDriver, test.TestCase):
         # validate call chain
         mock_cliq_run.assert_has_calls(expected)
 
+    def test_get_volume_stats(self):
+
+        # set up driver with default config
+        mock_cliq_run = self.setup_driver()
+        volume_stats = self.driver.get_volume_stats(True)
+
+        self.assertEqual(volume_stats['vendor_name'], 'Hewlett-Packard')
+        self.assertEqual(volume_stats['storage_protocol'], 'iSCSI')
+
+        expected = [
+            mock.call('getClusterInfo', {
+                'searchDepth': 1,
+                'clusterName': 'CloudCluster1',
+                'output': 'XML'}, True)]
+
+        # validate call chain
+        mock_cliq_run.assert_has_calls(expected)
+
 
 class TestHPLeftHandRESTISCSIDriver(HPLeftHandBaseDriver, test.TestCase):
 
index 58be55fbd5c6a839cbc0f91abe8ea76487b1819e..443319b0c9ba08d122befe08e8c4835641d60e76 100644 (file)
@@ -69,9 +69,11 @@ class HPLeftHandCLIQProxy(SanISCSIDriver):
         1.1.0 - Added create/delete snapshot, extend volume, create volume
                 from snapshot support.
         1.2.0 - Ported into the new HP LeftHand driver.
+        1.2.1 - Fixed bug #1279897, HP LeftHand CLIQ proxy may return incorrect
+                capacity values.
     """
 
-    VERSION = "1.2.0"
+    VERSION = "1.2.1"
 
     device_stats = {}
 
@@ -427,7 +429,10 @@ class HPLeftHandCLIQProxy(SanISCSIDriver):
         data['storage_protocol'] = 'iSCSI'
         data['vendor_name'] = 'Hewlett-Packard'
 
-        result_xml = self._cliq_run_xml("getClusterInfo", {'searchDepth': 1})
+        result_xml = self._cliq_run_xml(
+            "getClusterInfo", {
+                'searchDepth': 1,
+                'clusterName': self.configuration.san_clustername})
         cluster_node = result_xml.find("response/cluster")
         total_capacity = cluster_node.attrib.get("spaceTotal")
         free_capacity = cluster_node.attrib.get("unprovisionedSpace")