Merge "Storwize: create vol fails near licensed limit"

This commit is contained in:
Jenkins
2017-01-24 15:06:10 +00:00
committed by Gerrit Code Review
2 changed files with 37 additions and 1 deletions

View File

@@ -5674,6 +5674,7 @@ class StorwizeHelpersTestCase(test.TestCase):
self.assertTrue(self.storwize_svc_common.replication_licensed())
@ddt.ddt
class StorwizeSSHTestCase(test.TestCase):
def setUp(self):
super(StorwizeSSHTestCase, self).setUp()
@@ -5714,6 +5715,28 @@ class StorwizeSSHTestCase(test.TestCase):
self.storwize_ssh.mkvdiskhostmap,
'HOST3', '9999', 511, True)
@ddt.data((exception.VolumeBackendAPIException(data='CMMVC6372W'), None),
(exception.VolumeBackendAPIException(data='CMMVC6372W'),
{'name': 'fakevol', 'id': '0', 'uid': '0', 'IO_group_id': '0',
'IO_group_name': 'fakepool'}),
(exception.VolumeBackendAPIException(data='error'), None))
@ddt.unpack
def test_mkvdisk_with_warning(self, run_ssh_check, lsvol):
opt = {'iogrp': 0}
with mock.patch.object(storwize_svc_common.StorwizeSSH,
'run_ssh_check_created',
side_effect=run_ssh_check),\
mock.patch.object(storwize_svc_common.StorwizeSSH, 'lsvdisk',
return_value=lsvol):
if lsvol:
ret = self.storwize_ssh.mkvdisk('fakevol', '1', 'gb',
'fakepool', opt, [])
self.assertEqual('0', ret)
else:
self.assertRaises(exception.VolumeBackendAPIException,
self.storwize_ssh.mkvdisk,
'fakevol', '1', 'gb', 'fakepool', opt, [])
class StorwizeSVCReplicationTestCase(test.TestCase):
@mock.patch.object(time, 'sleep')

View File

@@ -387,7 +387,20 @@ class StorwizeSSH(object):
ssh_cmd = ['svctask', 'mkvdisk', '-name', name, '-mdiskgrp',
'"%s"' % pool, '-iogrp', six.text_type(opts['iogrp']),
'-size', size, '-unit', units] + params
try:
return self.run_ssh_check_created(ssh_cmd)
except Exception as ex:
if hasattr(ex, 'msg') and 'CMMVC6372W' in ex.msg:
vdisk = self.lsvdisk(name)
if vdisk:
LOG.warning(_LW('CMMVC6372W The virtualized storage '
'capacity that the cluster is using is '
'approaching the virtualized storage '
'capacity that is licensed.'))
return vdisk['id']
with excutils.save_and_reraise_exception():
LOG.exception(_LE('Failed to create vdisk %(vol)s.'),
{'vol': name})
def rmvdisk(self, vdisk, force=True):
ssh_cmd = ['svctask', 'rmvdisk']