Do not update flavor if timeout occurs in resize.

This update also makes sure the guest does not change my.cnf values
unnecessarily.

Change-Id: Ibb93e6fd2835f41f273c171c1b854facacc9e4a0
This commit is contained in:
Tim Simpson 2012-11-08 19:37:53 -06:00
parent 11a3e531f7
commit a070023752
2 changed files with 11 additions and 7 deletions

View File

@ -405,12 +405,10 @@ class BuiltInstanceTasks(BuiltInstance):
LOG.debug("Updating instance %s to flavor_id %s."
% (self.id, new_flavor_id))
self.update_db(flavor_id=new_flavor_id)
except PollTimeOut as pto:
LOG.error("Timeout trying to resize the flavor for instance "
" %s" % self.db_info.id)
except Exception as ex:
new_memory_size = old_memory_size
LOG.error("Error during resize compute! Aborting action.")
new_flavor_id = None
LOG.error("Error resizing instance %s." % self.db_info.id)
LOG.error(ex)
finally:
# Tell the guest to restart MySQL with the new RAM size.

View File

@ -23,6 +23,7 @@ import uuid
from reddwarf.tests.fakes.common import authorize
from reddwarf.tests.fakes.common import EventSimulator
from reddwarf.common.utils import poll_until
from reddwarf.common.exception import PollTimeOut
LOG = logging.getLogger(__name__)
@ -156,14 +157,19 @@ class FakeServer(object):
def resize(self, new_flavor_id):
self._current_status = "RESIZE"
if self.name.endswith("_RESIZE_TIMEOUT"):
raise PollTimeOut()
def set_to_confirm_mode():
self._current_status = "VERIFY_RESIZE"
def set_flavor():
flavor = self.parent.flavors.get(new_flavor_id)
self.flavor_ref = flavor.links[0]['href']
self.events.add_event(1, set_to_confirm_mode)
if self.name.endswith("_RESIZE_ERROR"):
self._current_status = "ACTIVE"
else:
flavor = self.parent.flavors.get(new_flavor_id)
self.flavor_ref = flavor.links[0]['href']
self.events.add_event(1, set_to_confirm_mode)
self.events.add_event(1, set_flavor)