]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Cleanup 3PAR/LeftHand failover_host exceptions
authorAlex O'Rourke <alex.orourke@hpe.com>
Fri, 11 Mar 2016 00:09:01 +0000 (16:09 -0800)
committerAlex O'Rourke <alex.orourke@hpe.com>
Fri, 11 Mar 2016 15:34:32 +0000 (07:34 -0800)
The 3PAR and LeftHand drivers were raising the wrong exception,
VolumeBackendAPIException, instead of InvalidReplicationTarget,
which was putting the host in an unrecoverable state,

Change-Id: I1c0ee4adb399dd1e89669477c53f79332a9f79ef
Closes-Bug: #1556150

cinder/tests/unit/test_hpe3par.py
cinder/tests/unit/test_hpelefthand.py
cinder/volume/drivers/hpe/hpe_3par_common.py
cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py

index 03b963b73902bf7f6e1f60ef6280287ee593d2ee..463ce3ee203b8b6a7593a901763b27dcfb159188 100644 (file)
@@ -4231,7 +4231,7 @@ class HPE3PARBaseDriver(object):
             volumes = [self.volume_replicated]
             # Test invalid secondary target.
             self.assertRaises(
-                exception.VolumeBackendAPIException,
+                exception.InvalidReplicationTarget,
                 self.driver.failover_host,
                 context.get_admin_context(),
                 volumes,
@@ -4239,7 +4239,7 @@ class HPE3PARBaseDriver(object):
 
             # Test no secondary target.
             self.assertRaises(
-                exception.VolumeBackendAPIException,
+                exception.InvalidReplicationTarget,
                 self.driver.failover_host,
                 context.get_admin_context(),
                 volumes,
@@ -4349,7 +4349,7 @@ class HPE3PARBaseDriver(object):
             volume['replication_status'] = 'failed-over'
 
             self.assertRaises(
-                exception.VolumeDriverException,
+                exception.InvalidReplicationTarget,
                 self.driver.failover_host,
                 context.get_admin_context(),
                 [volume],
index 489957ef677055bde80576a141d275c1c4cf053d..2f0e76a3a2ace45803459d7fd794931ff122d80d 100644 (file)
@@ -2243,7 +2243,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
 
             # Test invalid secondary target.
             self.assertRaises(
-                exception.VolumeBackendAPIException,
+                exception.InvalidReplicationTarget,
                 self.driver.failover_host,
                 ctxt,
                 [self.volume_replicated],
@@ -2350,7 +2350,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
 
             volume = self.volume_replicated.copy()
             self.assertRaises(
-                exception.VolumeDriverException,
+                exception.InvalidReplicationTarget,
                 self.driver.failover_host,
                 context.get_admin_context(),
                 [volume],
index 66ed9e63ce89be0ebe3b025eef641eba84d04711..92a3f67e7f3a3539fbb95ed5a78033ac489d4dc2 100644 (file)
@@ -2890,7 +2890,7 @@ class HPE3PARCommon(object):
                 msg = _("A valid secondary target MUST be specified in order "
                         "to failover.")
                 LOG.error(msg)
-                raise exception.VolumeBackendAPIException(data=msg)
+                raise exception.InvalidReplicationTarget(reason=msg)
 
             target_id = failover_target['backend_id']
             # For each volume, if it is replicated, we want to fail it over.
@@ -2947,7 +2947,7 @@ class HPE3PARCommon(object):
                     "resynchronize the volumes and resume replication on the "
                     "3PAR backends.")
             LOG.error(msg)
-            raise exception.VolumeDriverException(data=msg)
+            raise exception.InvalidReplicationTarget(reason=msg)
 
         # Update the volumes status to available.
         volume_update_list = []
index 36264f2edcd6b1e9cea5fc38af890917422faac0..b7a04439da356e0c7cf3fbfa4c7d5fe9b53aecfe 100644 (file)
@@ -1414,7 +1414,7 @@ class HPELeftHandISCSIDriver(driver.ISCSIDriver):
                 msg = _("A valid secondary target MUST be specified in order "
                         "to failover.")
                 LOG.error(msg)
-                raise exception.VolumeBackendAPIException(data=msg)
+                raise exception.InvalidReplicationTarget(reason=msg)
 
             target_id = failover_target['backend_id']
             self._active_backend_id = target_id
@@ -1580,7 +1580,7 @@ class HPELeftHandISCSIDriver(driver.ISCSIDriver):
                     "resynchronize the volumes and resume replication on the "
                     "LeftHand backends.")
             LOG.error(msg)
-            raise exception.VolumeDriverException(data=msg)
+            raise exception.InvalidReplicationTarget(reason=msg)
 
         cl = None
         volume_update_list = []