diff --git a/cinder/tests/unit/test_emc_vnxdirect.py b/cinder/tests/unit/test_emc_vnxdirect.py index a951f584eef..e4385074c17 100644 --- a/cinder/tests/unit/test_emc_vnxdirect.py +++ b/cinder/tests/unit/test_emc_vnxdirect.py @@ -1713,7 +1713,7 @@ Time Remaining: 0 second(s) expected = [mock.call(*self.testData.SNAP_CREATE_CMD('snapshot1'), poll=False), mock.call(*self.testData.LUN_PROPERTY_ALL_CMD('vol1'), - poll=False), + poll=True), mock.call(*self.testData.LUN_PROPERTY_ALL_CMD('vol1'), poll=False), mock.call(*self.testData.LUN_PROPERTY_ALL_CMD('vol1'), @@ -2439,7 +2439,7 @@ Time Remaining: 0 second(s) expected = [mock.call(*self.testData.LUN_EXTEND_CMD('vol1', 2), poll=False), mock.call(*self.testData.LUN_PROPERTY_ALL_CMD('vol1'), - poll=False), + poll=True), mock.call(*self.testData.LUN_PROPERTY_ALL_CMD('vol1'), poll=False), mock.call(*self.testData.LUN_PROPERTY_ALL_CMD('vol1'), diff --git a/cinder/volume/drivers/emc/emc_vnx_cli.py b/cinder/volume/drivers/emc/emc_vnx_cli.py index 69f68e344cb..840c28cf85c 100644 --- a/cinder/volume/drivers/emc/emc_vnx_cli.py +++ b/cinder/volume/drivers/emc/emc_vnx_cli.py @@ -1219,14 +1219,18 @@ class CommandLineHelper(object): return data def get_lun_current_ops_state(self, name, poll=False): - data = self.get_lun_by_name(name, poll=False) + data = self.get_lun_by_name(name, poll=poll) return data[self.LUN_OPERATION.key] def wait_until_lun_ready_for_ops(self, name): def is_lun_ready_for_ops(): data = self.get_lun_current_ops_state(name, False) return data == 'None' - self._wait_for_a_condition(is_lun_ready_for_ops) + # Get the volume's latest operation state by polling. + # Otherwise, the operation state may be out of date. + ops = self.get_lun_current_ops_state(name, True) + if ops != 'None': + self._wait_for_a_condition(is_lun_ready_for_ops) def get_pool(self, name, properties=POOL_ALL, poll=True): data = self.get_pool_properties(('-name', name),