]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Set vol driver initialized before deleting volumes
authorBill Owen <billowen@us.ibm.com>
Fri, 27 Sep 2013 18:22:57 +0000 (11:22 -0700)
committerBill Owen <billowen@us.ibm.com>
Fri, 27 Sep 2013 18:34:19 +0000 (11:34 -0700)
Move the call to set_initialized before calling delete_volume in
init_host.  The delete_volume method has a precondition that the
driver be initialized.

Closes-Bug: #1232177

Change-Id: Ie73bd30e0ab80d489ab61ba8a60fac51ccb505b5

cinder/volume/manager.py

index 34b4357ab999af27ee60691f191185117312c8d7..7716a48543cdc18091a2177cca404b7843d1f8b6 100644 (file)
@@ -178,6 +178,11 @@ class VolumeManager(manager.SchedulerDependentManager):
             # to initialize the driver correctly.
             return
 
+        # at this point the driver is considered initailized.
+        # next re-initialize exports and clean up volumes that
+        # should be deleted.
+        self.driver.set_initialized()
+
         volumes = self.db.volume_get_all_by_host(ctxt, self.host)
         LOG.debug(_("Re-exporting %s volumes"), len(volumes))
         for volume in volumes:
@@ -197,8 +202,6 @@ class VolumeManager(manager.SchedulerDependentManager):
                 LOG.info(_('Resuming delete on volume: %s') % volume['id'])
                 self.delete_volume(ctxt, volume['id'])
 
-        self.driver.set_initialized()
-
         # collect and publish service capabilities
         self.publish_service_capabilities(ctxt)