From cfb849d4a9edc08395de4bb224aae1115eaa9a55 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathieu=20Gagne=CC=81?= Date: Tue, 9 Jul 2013 13:59:43 -0400 Subject: [PATCH] Handle errors raised by extend_volume 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index a446c3802..7c8500797 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -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'}) -- 2.45.2