From 792c24bf360ca816055e6f492f67a41f1ce7e359 Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Thu, 1 Oct 2015 15:47:44 -0700 Subject: [PATCH] Fix enable/disable_replication raise InvalidVolume In both enable_replication and disable_replication, it tests to see the replication_state is in the correct state. When it's not it was raising InvalidVolume() InvalidVolume requires a reason text message. This patch adds the missing reason=msg when creating the InvalidVolume exception Change-Id: I66a3e4dc4359457e9669c5ddaa4b0529645334f9 Closes-Bug: 1501942 --- cinder/volume/manager.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 969979cc8..7dc47d9a3 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -3088,7 +3088,11 @@ class VolumeManager(manager.SchedulerDependentManager): # we are in an expected state ('enabling') volume = self.db.volume_get(context, volume['id']) if volume['replication_status'] != 'enabling': - raise exception.InvalidVolume() + msg = (_("Unable to enable replication due to invalid " + "replication status: %(status)s.") % + {'status': volume['replication_status']}) + LOG.error(msg, resource=volume) + raise exception.InvalidVolume(reason=msg) try: rep_driver_data = self.driver.replication_enable(context, @@ -3124,7 +3128,11 @@ class VolumeManager(manager.SchedulerDependentManager): volume = self.db.volume_get(context, volume['id']) if volume['replication_status'] != 'disabling': - raise exception.InvalidVolume() + msg = (_("Unable to disable replication due to invalid " + "replication status: %(status)s.") % + {'status': volume['replication_status']}) + LOG.error(msg, resource=volume) + raise exception.InvalidVolume(reason=msg) try: rep_driver_data = self.driver.replication_disable(context, -- 2.45.2