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
This commit is contained in:
TaoBai 2014-09-16 11:14:16 +03:00
parent 58eda5d1f4
commit 3783c50dce
2 changed files with 13 additions and 1 deletions

View File

@ -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')

View File

@ -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")