Fix volume stats with multiple LeftHand clusters

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
This commit is contained in:
Jim Branen 2014-02-27 10:41:34 -08:00
parent 289aa334b1
commit 0c6c57d708
2 changed files with 25 additions and 2 deletions

View 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):

View 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")