Skip to content

Commit

Permalink
Fix _update_volume_stats typos
Browse files Browse the repository at this point in the history
Fix _update_volume_stats typos in 'cinder/volume/driver.py' and
'cinder/volume/drivers/eqlx.py'.
'_update_volume_status' to '_update_volume_stats'

Change-Id: I0642bdb911ca72517ed655f795e0055f4c4654b8
Closes-Bug: #1254978
  • Loading branch information
KIYOHIRO ADACHI committed Nov 26, 2013
1 parent 0b71a3f commit 018ba63
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
16 changes: 14 additions & 2 deletions cinder/tests/test_eqlx.py
Expand Up @@ -217,17 +217,29 @@ def test_do_setup(self):
self.driver.do_setup(self._context)
self.assertEqual(fake_group_ip, self.driver._group_ip)

def test_update_volume_status(self):
def test_update_volume_stats(self):
self.driver._eql_execute = self.mox.\
CreateMock(self.driver._eql_execute)
self.driver._eql_execute('pool', 'select',
self.configuration.eqlx_pool, 'show').\
AndReturn(['TotalCapacity: 111GB', 'FreeSpace: 11GB'])
self.mox.ReplayAll()
self.driver._update_volume_status()
self.driver._update_volume_stats()
self.assertEqual(self.driver._stats['total_capacity_gb'], 111.0)
self.assertEqual(self.driver._stats['free_capacity_gb'], 11.0)

def test_update_volume_stats2(self):
self.driver._eql_execute = self.mox.\
CreateMock(self.driver._eql_execute)
self.driver._eql_execute('pool', 'select',
self.configuration.eqlx_pool, 'show').\
AndReturn(['TotalCapacity: 111GB', 'FreeSpace: 11GB'])
self.mox.ReplayAll()
stats = self.driver.get_volume_stats(refresh=True)
self.assertEqual(stats['total_capacity_gb'], float('111.0'))
self.assertEqual(stats['free_capacity_gb'], float('11.0'))
self.assertEqual(stats['vendor_name'], 'Dell')

def test_get_space_in_gb(self):
self.assertEqual(self.driver._get_space_in_gb('123.0GB'), 123.0)
self.assertEqual(self.driver._get_space_in_gb('123.0TB'), 123.0 * 1024)
Expand Down
28 changes: 28 additions & 0 deletions cinder/tests/test_volume.py
Expand Up @@ -2378,6 +2378,34 @@ def setUp(self):
self.configuration.iser_ip_address = '0.0.0.0'
self.configuration.iser_port = 3260

def test_get_volume_stats(self):
def _fake_get_all_volume_groups(obj, vg_name=None, no_suffix=True):
return [{'name': 'cinder-volumes',
'size': '5.52',
'available': '0.52',
'lv_count': '2',
'uuid': 'vR1JU3-FAKE-C4A9-PQFh-Mctm-9FwA-Xwzc1m'}]

self.stubs.Set(brick_lvm.LVM,
'get_all_volume_groups',
_fake_get_all_volume_groups)
self.volume.driver.vg = brick_lvm.LVM('cinder-volumes', 'sudo')

stats = self.volume.driver.get_volume_stats(refresh=True)

self.assertEqual(stats['total_capacity_gb'], float('5.52'))
self.assertEqual(stats['free_capacity_gb'], float('0.52'))
self.assertEqual(stats['storage_protocol'], 'iSER')

def test_get_volume_stats2(self):
iser_driver = self.base_driver(configuration=self.configuration)

stats = iser_driver.get_volume_stats(refresh=True)

self.assertEqual(stats['total_capacity_gb'], 'infinite')
self.assertEqual(stats['free_capacity_gb'], 'infinite')
self.assertEqual(stats['storage_protocol'], 'iSER')


class FibreChannelTestCase(DriverTestCase):
"""Test Case for FibreChannelDriver."""
Expand Down
6 changes: 3 additions & 3 deletions cinder/volume/driver.py
Expand Up @@ -795,10 +795,10 @@ def initialize_connection(self, volume, connector):
'data': iser_properties
}

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from volume group."""

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}
backend_name = self.configuration.safe_get('volume_backend_name')
data["volume_backend_name"] = backend_name or 'Generic_iSER'
Expand Down
6 changes: 3 additions & 3 deletions cinder/volume/drivers/eqlx.py
Expand Up @@ -241,10 +241,10 @@ def _get_space_in_gb(self, val):
part = 'TB'
return scale * float(val.partition(part)[0])

def _update_volume_status(self):
"""Retrieve status info from volume group."""
def _update_volume_stats(self):
"""Retrieve stats info from eqlx group."""

LOG.debug(_("Updating volume status"))
LOG.debug(_("Updating volume stats"))
data = {}
backend_name = "eqlx"
if self.configuration:
Expand Down

0 comments on commit 018ba63

Please sign in to comment.