summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaomai Wang <haomai@unitedstack.com>2013-08-13 21:54:44 +0800
committerHaomai Wang <haomai@unitedstack.com>2013-08-16 01:16:29 +0800
commitca249b248b0a3096cc59b98922d08f28f31ba31b (patch)
treedc485dc9ce3f6bf2adfc456e1bf4215e0d5f90a9
parent885d4b6ddaa52923a4f60644fd4cd675eeb42b3b (diff)
downloadtrove-ca249b248b0a3096cc59b98922d08f28f31ba31b.tar.gz
Fix resize volume stuck in "RESIZE" status
While resizing a improper volume, it may stuck in "RESIZE" status and Trove can't deal with this status with other actions. We need to catch the exception. Now, resize volume method exists some problems to achieve the goal. This patch will solve the critical problem firstly. fix bug 1212767 Change-Id: I868694fc01217ef0e6e8450ce981c4cab544b612
-rw-r--r--trove/taskmanager/models.py11
-rw-r--r--trove/tests/fakes/nova.py2
2 files changed, 11 insertions, 2 deletions
diff --git a/trove/taskmanager/models.py b/trove/taskmanager/models.py
index 47edd58b..6fd45602 100644
--- a/trove/taskmanager/models.py
+++ b/trove/taskmanager/models.py
@@ -14,6 +14,7 @@
import traceback
+from cinderclient import exceptions as cinder_exceptions
from eventlet import greenthread
from novaclient import exceptions as nova_exceptions
from trove.common import cfg
@@ -456,7 +457,15 @@ class BuiltInstanceTasks(BuiltInstance, NotifyMixin, ConfigurationMixin):
LOG.debug("%s: Resizing volume for instance: %s from %s to %r GB"
% (greenthread.getcurrent(), self.server.id,
old_volume_size, new_size))
- self.volume_client.volumes.resize(self.volume_id, new_size)
+ try:
+ self.volume_client.volumes.extend(self.volume_id, new_size)
+ except cinder_exceptions.ClientException:
+ self.update_db(task_status=inst_models.InstanceTasks.NONE)
+ LOG.exception("Error encountered trying to rescan or resize the "
+ "attached volume filesystem for volume: "
+ "%s" % self.volume_id)
+ raise
+
try:
utils.poll_until(
lambda: self.volume_client.volumes.get(self.volume_id),
diff --git a/trove/tests/fakes/nova.py b/trove/tests/fakes/nova.py
index 8e4c5325..b86a4d44 100644
--- a/trove/tests/fakes/nova.py
+++ b/trove/tests/fakes/nova.py
@@ -497,7 +497,7 @@ class FakeVolumes(object):
def list(self, detailed=True):
return [self.db[key] for key in self.db]
- def resize(self, volume_id, new_size):
+ def extend(self, volume_id, new_size):
LOG.debug("Resize volume id (%s) to size (%s)" % (volume_id, new_size))
volume = self.get(volume_id)