Merge "NEC driver: Faster clone status check."

This commit is contained in:
Zuul 2018-06-16 02:46:30 +00:00 committed by Gerrit Code Review
commit 586e60becb
2 changed files with 18 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import mock
from cinder import exception
from cinder import test
from cinder.volume import configuration as conf
from cinder.volume.drivers.nec import cli
from cinder.volume.drivers.nec import volume_common
from cinder.volume.drivers.nec import volume_helper
@ -734,6 +735,11 @@ class BindLDTest(volume_helper.MStorageDSVDriver, test.TestCase):
self._convert_id2name,
self._select_leastused_poolnumber)
def test_bindld_CreateCloneWaitingInterval(self):
self.assertEqual(10, cli.get_sleep_time_for_clone(0))
self.assertEqual(12, cli.get_sleep_time_for_clone(2))
self.assertEqual(60, cli.get_sleep_time_for_clone(19))
class BindLDTest_Snap(volume_helper.MStorageDSVDriver, test.TestCase):

View File

@ -34,6 +34,13 @@ LOG = logging.getLogger(__name__)
retry_msgids = ['iSM31005', 'iSM31015', 'iSM42408', 'iSM42412', 'iSM19411']
def get_sleep_time_for_clone(retry_count):
if retry_count < 19:
return int(10.0 * (1.1 ** retry_count))
else:
return 60
class MStorageISMCLI(object):
"""SSH client."""
@ -683,13 +690,16 @@ class UnpairWait(object):
def _wait(self, unpair=True):
timeout = self._local_conf['thread_timeout'] * 24
start_time = time.time()
retry_count = 0
while True:
cur_time = time.time()
if (cur_time - start_time) > timeout:
raise exception.APITimeout(_('UnpairWait wait timeout.'))
LOG.debug('Sleep 60 seconds Start')
time.sleep(60)
sleep_time = get_sleep_time_for_clone(retry_count)
LOG.debug('Sleep %d seconds Start', sleep_time)
time.sleep(sleep_time)
retry_count += 1
query_status = self._cli.query_MV_RV_status(self._rvname, 'RV')
if query_status == 'separated':