From: TaoBai Date: Tue, 16 Sep 2014 08:14:16 +0000 (+0300) Subject: Check replication status failed for non-replication X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=3783c50dce3917257060dd977f69785238f58078;p=openstack-build%2Fcinder-build.git Check replication status failed for non-replication Need to check self.replication whether is None before the function get_replication_status be called. Closes-bug: #1365392 Change-Id: I6f6939a98091e40537f2355bb716b4b3205845e2 --- diff --git a/cinder/tests/test_storwize_svc.py b/cinder/tests/test_storwize_svc.py index a79b59271..6e474476a 100644 --- a/cinder/tests/test_storwize_svc.py +++ b/cinder/tests/test_storwize_svc.py @@ -2796,6 +2796,15 @@ class StorwizeSVCDriverTestCase(test.TestCase): self.assertEqual(term_data, term_ret) + def test_storwize_create_volume_with_replication_disable(self): + volume = self._generate_vol_info(None, None) + + model_update = self.driver.create_volume(volume) + self.assertIsNone(model_update) + + model_update = self.driver.get_replication_status(self.ctxt, volume) + self.assertIsNone(model_update) + def test_storwize_create_volume_with_strech_cluster_replication(self): # Set replication flag, set pool openstack2 for secondary volume. self._set_flag('storwize_svc_stretched_cluster_partner', 'openstack2') diff --git a/cinder/volume/drivers/ibm/storwize_svc/__init__.py b/cinder/volume/drivers/ibm/storwize_svc/__init__.py index ce649ac1c..4bdb194f8 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/__init__.py +++ b/cinder/volume/drivers/ibm/storwize_svc/__init__.py @@ -753,7 +753,10 @@ class StorwizeSVCDriver(san.SanDriver): return replica_status def get_replication_status(self, ctxt, volume): - return self.replication.get_replication_status(volume) + replica_status = None + if self.replication: + replica_status = self.replication.get_replication_status(volume) + return replica_status def _check_volume_copy_ops(self): LOG.debug("enter: update volume copy status")