From 16f9c5535faddba127214a57b5626f1b9795a673 Mon Sep 17 00:00:00 2001 From: Naoki Saito Date: Fri, 1 Nov 2019 20:03:12 +0900 Subject: [PATCH] NEC driver: fix an undefined variable Currently, NEC driver references an undefined variable in message formatting. That causes volume creation failure when 4 or more volumes are created from same image in parallel. This patch removes the reference. Conflicts: cinder/tests/unit/volume/drivers/nec/test_volume.py Note: It is refactored in Train. Change-Id: I3dc6a55ee5ed496a37885a139fba11d1134e971f Closes-Bug: #1850913 (cherry picked from commit 16dbad18ccb98e1e89dc9d1d2369fdb893d855b0) (cherry picked from commit 41cf3b749797425d5ddd6cb93109299e14224b3a) --- cinder/tests/unit/volume/drivers/nec/test_volume.py | 7 +++++++ cinder/volume/drivers/nec/volume_helper.py | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/nec/test_volume.py b/cinder/tests/unit/volume/drivers/nec/test_volume.py index 41db89c2b9c..9904b8823ac 100644 --- a/cinder/tests/unit/volume/drivers/nec/test_volume.py +++ b/cinder/tests/unit/volume/drivers/nec/test_volume.py @@ -671,6 +671,13 @@ class BindLDTest(volume_helper.MStorageDSVDriver, test.TestCase): self.vol, self.vol.size, None, self._convert_id2name, self._select_leastused_poolnumber) + self.mock_object(self._cli, 'get_pair_lds', + return_value={'lds1', 'lds2', 'lds3'}) + with self.assertRaisesRegex(exception.VolumeBackendAPIException, + 'Cannot create clone volume. ' + 'number of pairs reached 3. ' + 'ldname=LX:287RbQoP7VdwR1WsPC2fZT'): + self.create_cloned_volume(self.vol, self.src) def test_bindld_CreateCloneWaitingInterval(self): self.assertEqual(10, cli.get_sleep_time_for_clone(0)) diff --git a/cinder/volume/drivers/nec/volume_helper.py b/cinder/volume/drivers/nec/volume_helper.py index 8ae2d9a9f2d..54d1cc2f8c2 100644 --- a/cinder/volume/drivers/nec/volume_helper.py +++ b/cinder/volume/drivers/nec/volume_helper.py @@ -475,8 +475,7 @@ class MStorageDriver(volume_common.MStorageVolumeCommon): if len(pair_lds) == 3: msg = (_('Cannot create clone volume. ' 'number of pairs reached 3. ' - '%(msg)s. ldname=%(ldname)s') % - {'msg': msg, 'ldname': source_name}) + 'ldname=%s') % source_name) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg)