From: Tao Bai Date: Fri, 20 Jun 2014 09:56:23 +0000 (-0700) Subject: test_storwize_vdisk_copy_ops fails if green thread context switch X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=0edfa2eaab08a0756bf3ec7818cdc9a8a379ba87;p=openstack-build%2Fcinder-build.git test_storwize_vdisk_copy_ops fails if green thread context switch There is loopingcall(green thread)will cause _rm_vdisk_copy_op() run twice.On the second time, the exception KeyError is not caught. Closes-Bug: #1302670 Change-Id: I788f07c33f76693a13f0d581e687a32c6736a394 --- diff --git a/cinder/tests/test_storwize_svc.py b/cinder/tests/test_storwize_svc.py index 91021242c..bf32c4fbc 100644 --- a/cinder/tests/test_storwize_svc.py +++ b/cinder/tests/test_storwize_svc.py @@ -21,7 +21,6 @@ Tests for the IBM Storwize family and SVC volume driver. import mock import random import re -import testtools from cinder import context from cinder import exception @@ -1504,15 +1503,8 @@ class StorwizeSVCDriverTestCase(test.TestCase): self.driver.db = self.db self.driver.do_setup(None) self.driver.check_for_setup_error() - self.sleeppatch = mock.patch('eventlet.greenthread.sleep') - self.sleeppatch.start() self.driver._helpers.check_fcmapping_interval = 0 - def tearDown(self): - if self.USESIM: - self.sleeppatch.stop() - super(StorwizeSVCDriverTestCase, self).tearDown() - def _set_flag(self, flag, value): group = self.driver.configuration.config_group self.driver.configuration.set_override(flag, value, group) @@ -2371,7 +2363,6 @@ class StorwizeSVCDriverTestCase(test.TestCase): self.assertEqual((7, 2, 0, 0), res['code_level'], 'Get code level error') - @testtools.skip("Bug #1302670") def test_storwize_vdisk_copy_ops(self): ctxt = testutils.get_test_admin_context() volume = self._create_volume() diff --git a/cinder/volume/drivers/ibm/storwize_svc/__init__.py b/cinder/volume/drivers/ibm/storwize_svc/__init__.py index def370117..810535643 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/__init__.py +++ b/cinder/volume/drivers/ibm/storwize_svc/__init__.py @@ -613,7 +613,7 @@ class StorwizeSVCDriver(san.SanDriver): if not len(self._vdiskcopyops): self._vdiskcopyops_loop.stop() self._vdiskcopyops_loop = None - except IndexError: + except KeyError: msg = (_('_rm_vdisk_copy_op: Volume %s does not have any ' 'registered vdisk copy operations.') % volume['id']) LOG.error(msg)