Skip to content

Commit

Permalink
Check replication status failed for non-replication
Browse files Browse the repository at this point in the history
Need to check self.replication whether is None before the
function get_replication_status be called.

Closes-bug: #1365392

Change-Id: I6f6939a98091e40537f2355bb716b4b3205845e2
  • Loading branch information
JamesBai committed Sep 17, 2014
1 parent 58eda5d commit 3783c50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions cinder/tests/test_storwize_svc.py
Expand Up @@ -2796,6 +2796,15 @@ def test_storwize_initiator_target_map(self):

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')
Expand Down
5 changes: 4 additions & 1 deletion cinder/volume/drivers/ibm/storwize_svc/__init__.py
Expand Up @@ -753,7 +753,10 @@ def create_replica_test_volume(self, tgt_volume, src_volume):
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")
Expand Down

0 comments on commit 3783c50

Please sign in to comment.