]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Handle errors raised by extend_volume
authorMathieu Gagné <mgagne@iweb.com>
Tue, 9 Jul 2013 17:59:43 +0000 (13:59 -0400)
committerMathieu Gagné <mgagne@iweb.com>
Fri, 12 Jul 2013 03:05:04 +0000 (23:05 -0400)
Errors raised by extend_volume aren't handled by the manager.
This means the volume status will not be updated to 'error_extending'
when an error is raised during the process.

* Handle such errors and update volume status accordingly
* Add logging for the extend volume process

Fixes: bug #1199471
Change-Id: I06a037af0344d1eaf4115f0af5a85ceeab1ffd37

cinder/volume/manager.py

index a446c3802aafe5e8204e6f095a3b923c8a2f6a8b..7c8500797a9df73d769bc281d47b74fa0bc1d5e9 100644 (file)
@@ -803,4 +803,13 @@ class VolumeManager(manager.SchedulerDependentManager):
 
     def extend_volume(self, context, volume_id, new_size):
         volume_ref = self.db.volume_get(context, volume_id)
-        self.driver.extend_volume(volume_ref, new_size)
+
+        try:
+            LOG.info(_("volume %s: extending"), volume_ref['name'])
+            self.driver.extend_volume(volume_ref, new_size)
+            LOG.info(_("volume %s: extended successfully"), volume_ref['name'])
+        except Exception:
+            LOG.exception(_("volume %s: Error trying to extend volume"),
+                          volume_id)
+            self.db.volume_update(context, volume_ref['id'],
+                                  {'status': 'error_extending'})