self.driver = CloudByteISCSIDriver(configuration=configuration)
# override some parts of driver configuration
- self.driver.configuration.tsm_name = 'openstack'
+ self.driver.configuration.cb_tsm_name = 'openstack'
self.driver.configuration.cb_account_name = 'CustomerA'
def _side_effect_api_req(self, cmd, params, version='1.0'):
# assert equality checks for certain configuration attributes
self.assertEqual(
- 'openstack', self.driver.configuration.tsm_name)
+ 'openstack', self.driver.configuration.cb_tsm_name)
self.assertEqual(
'CustomerA', self.driver.configuration.cb_account_name)
self.assertThat(
self.assertEqual(1, mock_api_req.call_count)
# assert the result attributes with respective values
+ self.assertEqual(1024.0, vol_stats['total_capacity_gb'])
+ self.assertEqual(824.0, vol_stats['free_capacity_gb'])
self.assertEqual(0, vol_stats['reserved_percentage'])
self.assertEqual('CloudByte', vol_stats['vendor_name'])
self.assertEqual('iSCSI', vol_stats['storage_protocol'])
import time
import urllib
+from oslo_utils import units
import six
from cinder import exception
for tsms in tsm_details:
if tsms['name'] == tsmname:
flag = 1
- storage_buckets = {}
- storage_buckets = tsms['storageBuckets']
- quota = 0
- for bucket in storage_buckets:
- quota = bucket['quota']
- break
-
- data['total_capacity_gb'] = quota
+ data['total_capacity_gb'] = (
+ float(tsms['numericquota']) / units.Ki)
data['free_capacity_gb'] = (
- int(tsms['availablequota']) / 1000)
+ float(tsms['availablequota']) / units.Ki)
+ break
# TSM not found in CloudByte storage
if flag == 0:
LOG.error(_LE("TSM [%s] not found in CloudByte storage."), tsmname)
- data['total_capacity_gb'] = 0
- data['free_capacity_gb'] = 0
+ data['total_capacity_gb'] = 0.0
+ data['free_capacity_gb'] = 0.0
return data