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)
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."""
'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'
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: