Look up trove instance by ID instead of name

update_statuses_on_time_out looks up the instance by name instead of ID.
This potentially means that we update the wrong instance to ERROR, since
instance name is not unique. This patchset fixes this issue by looking
up the trove instance by ID instead of name.

Change-Id: If9c7a518f50098390567d8e4df0f948b7d3be2c6
Closes-bug: 1356647
This commit is contained in:
Nikhil Manchanda 2014-08-13 18:00:34 -07:00
parent 315c20cc8c
commit 52e1dc1b75
1 changed files with 3 additions and 3 deletions

View File

@ -297,7 +297,7 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
def update_statuses_on_time_out(self):
if CONF.update_status_on_fail:
#Updating service status
# Updating service status
service = InstanceServiceStatus.find_by(instance_id=self.id)
service.set_status(ServiceStatuses.
FAILED_TIMEOUT_GUESTAGENT)
@ -308,8 +308,8 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
LOG.error(_("Service error description: %(desc)s") %
{'desc': ServiceStatuses.
FAILED_TIMEOUT_GUESTAGENT.description})
#Updating instance status
db_info = DBInstance.find_by(name=self.name)
# Updating instance status
db_info = DBInstance.find_by(id=self.id, deleted=False)
db_info.set_task_status(InstanceTasks.
BUILDING_ERROR_TIMEOUT_GA)
db_info.save()