]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
test_storwize_vdisk_copy_ops fails if green thread context switch
authorTao Bai <baitaosh@cn.ibm.com>
Fri, 20 Jun 2014 09:56:23 +0000 (02:56 -0700)
committerTao Bai <baitaosh@cn.ibm.com>
Mon, 23 Jun 2014 09:33:58 +0000 (02:33 -0700)
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

cinder/tests/test_storwize_svc.py
cinder/volume/drivers/ibm/storwize_svc/__init__.py

index 91021242c158e3f16d185f3ac3befadbf3d8c69c..bf32c4fbc3ce2441e54df761c077cdfcaa64a724 100644 (file)
@@ -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()
index def370117607093bcc6577d99357ac5e9bf59088..8105356439b56be823c1bb5863c7f4df24f54279 100644 (file)
@@ -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)