[Storwize] Provide IOPS based storage offering
Added fucntionality that returns throttle rate of maximum IOPS and bandwidth of all VDisks of a specified storage pool. Change-Id: I01ccc1acedb776cd4e2344cdc6adad167023c4f9
This commit is contained in:
parent
9ae4e48279
commit
cead51cea8
@ -5410,6 +5410,51 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
|
||||
if 'CMMVC7050E' not in e.stderr:
|
||||
raise
|
||||
|
||||
@ddt.data(('IOPs_limit', "50"), ('bandwidth_limit_MB', "100"))
|
||||
@mock.patch.object(storwize_svc_common.StorwizeHelpers, 'get_pool_volumes')
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'lsthrottle')
|
||||
@ddt.unpack
|
||||
def test_storwize_svc_max_pool_throttle_rate(self, fake_throttle_name,
|
||||
fake_throttle_value,
|
||||
io_throttles,
|
||||
get_pool_volumes):
|
||||
pools = _get_test_pool(get_all=True)
|
||||
for pool in pools:
|
||||
vol_throttles = []
|
||||
expected_throttle_value = 0
|
||||
if 'openstack' == pool:
|
||||
# Create volumes in the pool 'openstack'
|
||||
host = 'openstack@svc#%s' % pool
|
||||
vol1 = testutils.create_volume(
|
||||
self.ctxt, host=host,
|
||||
volume_type_id=self.vt['id'])
|
||||
self.driver.create_volume(vol1)
|
||||
self._assert_vol_exists(vol1['name'], True)
|
||||
|
||||
vol2 = testutils.create_volume(
|
||||
self.ctxt, host=host,
|
||||
volume_type_id=self.vt['id'])
|
||||
self.driver.create_volume(vol2)
|
||||
self._assert_vol_exists(vol1['name'], True)
|
||||
|
||||
# Set io_throttle values to volumes
|
||||
vol_throttles = [
|
||||
{'object_name': vol1.name, 'IOPs_limit': '20',
|
||||
'bandwidth_limit_MB': '40'},
|
||||
{'object_name': vol2.name, 'IOPs_limit': '30',
|
||||
'bandwidth_limit_MB': '60'}]
|
||||
expected_throttle_value = int(fake_throttle_value)
|
||||
|
||||
get_pool_volumes.return_value = [vol1, vol2]
|
||||
io_throttles.return_value = vol_throttles
|
||||
iothrottle_value = (
|
||||
self.driver._helpers.get_pool_max_throttle_rate_vdisk(
|
||||
pool, fake_throttle_name))
|
||||
# Check the sum of throttle values set to volumes from a pool
|
||||
self.assertEqual(expected_throttle_value, iothrottle_value)
|
||||
self.assertTrue(get_pool_volumes.called)
|
||||
self.assertTrue(io_throttles.called)
|
||||
|
||||
def test_storwize_svc_unicode_host_and_volume_names(self):
|
||||
# We'll check with iSCSI only - nothing protocol-dependent here
|
||||
self.driver.do_setup(None)
|
||||
|
@ -536,6 +536,13 @@ class StorwizeSSH(object):
|
||||
'-filtervalue', '%s=%s' % (filter_name, value)]
|
||||
return self.run_ssh_info(ssh_cmd, with_header=True)
|
||||
|
||||
def lsthrottle(self):
|
||||
"""Returns throttle objects for all vdisks."""
|
||||
ssh_cmd = ['svcinfo', 'lsthrottle', '-delim', '!', '-filtervalue',
|
||||
'throttle_type=vdisk']
|
||||
throttles = self.run_ssh_info(ssh_cmd, with_header=True)
|
||||
return throttles.result
|
||||
|
||||
def chvdisk(self, vdisk, params):
|
||||
ssh_cmd = ['svctask', 'chvdisk'] + params + ['"%s"' % vdisk]
|
||||
self.run_ssh_assert_no_output(ssh_cmd)
|
||||
@ -904,6 +911,25 @@ class StorwizeHelpers(object):
|
||||
LOG.debug("Selected io_group is %d", selected_iog)
|
||||
return selected_iog
|
||||
|
||||
def get_pool_max_throttle_rate_vdisk(self, pool, throttle_rate_type):
|
||||
"""Returns the IOPs or Bandwidth throttle rate.
|
||||
|
||||
Throttle rate of all vdisks for the specified pool.
|
||||
"""
|
||||
max_throttle_rate_vdisk = 0
|
||||
vdisks = self.get_pool_volumes(pool)
|
||||
if vdisks:
|
||||
throttles = self.ssh.lsthrottle()
|
||||
if throttles:
|
||||
vdisk_names = [
|
||||
vdisk['name'] for vdisk in vdisks if vdisk['name']]
|
||||
for throttle in throttles:
|
||||
if (throttle['object_name'] in vdisk_names and
|
||||
throttle[throttle_rate_type]):
|
||||
max_throttle_rate_vdisk += int(
|
||||
throttle[throttle_rate_type])
|
||||
return max_throttle_rate_vdisk
|
||||
|
||||
def get_volume_io_group(self, vol_name):
|
||||
vdisk = self.ssh.lsvdisk(vol_name)
|
||||
if vdisk:
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
IBM Spectrum Virtualize Family driver: Added fucntionality
|
||||
that returns throttle rate of maximum IOPS and bandwidth of
|
||||
all VDisks of a specified storage pool.
|
Loading…
Reference in New Issue
Block a user