]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Use the error_out_volume from flow common instead
authorJoshua Harlow <harlowja@yahoo-inc.com>
Thu, 13 Mar 2014 00:31:29 +0000 (17:31 -0700)
committerJoshua Harlow <harlowja@yahoo-inc.com>
Fri, 14 Mar 2014 01:42:21 +0000 (18:42 -0700)
Instead of a custom piece of logic that errors out
a volume due to the driver not initialized issue
just use the same one that is used in other flows
to accomplish the same update.

Change-Id: I2c8f2fbb4d9bb25a19f26cba3dee5e87913d609b

cinder/volume/flows/manager/manage_existing.py

index 246a38e4c77f1132f7909597481d12a113229a4c..5ee2860c476242d4df917381db10ae8220d909fc 100644 (file)
@@ -19,6 +19,7 @@ from cinder import exception
 from cinder import flow_utils
 from cinder.openstack.common import log as logging
 from cinder.volume.flows.api import create_volume as create_api
+from cinder.volume.flows import common as flow_common
 from cinder.volume.flows.manager import create_volume as create_mgr
 
 LOG = logging.getLogger(__name__)
@@ -43,7 +44,10 @@ class PrepareForQuotaReservationTask(flow_utils.CinderTask):
             driver_name = self.driver.__class__.__name__
             LOG.error(_("Unable to manage existing volume. "
                         "Volume driver %s not initialized.") % driver_name)
-            self.db.volume_update(context, volume_id, dict(status='error'))
+            flow_common.error_out_volume(context, self.db, volume_id,
+                                         reason=_("Volume driver %s "
+                                                  "not initialized.") %
+                                         driver_name)
             raise exception.DriverNotInitialized()
 
         size = self.driver.manage_existing_get_size(volume_ref,