summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Manchanda <SlickNik@gmail.com>2014-09-24 02:55:41 -0700
committerNikhil Manchanda <SlickNik@gmail.com>2014-09-29 00:17:41 -0700
commit1654031cc6b0fa28efb322717efabf2bebffabf8 (patch)
tree4f615355b688e30c02a78a2299a0fd14f2884fcf
parent3cebe105188dd0b53e38a25c8dcede35f7c3dfce (diff)
downloadtrove-1654031cc6b0fa28efb322717efabf2bebffabf8.tar.gz
Use different timeouts for create and restore
Restoring an instance from a backup can take significantly longer than just creating an instance. Introduce a new timeout for the restore case with a higher default value Change-Id: I44af03e9b2c966dd94fcfd0ff475f112ac21be5b Closes-Bug: 1356645
-rw-r--r--etc/trove/trove-taskmanager.conf.sample2
-rw-r--r--trove/common/cfg.py3
-rwxr-xr-xtrove/taskmanager/models.py7
3 files changed, 9 insertions, 3 deletions
diff --git a/etc/trove/trove-taskmanager.conf.sample b/etc/trove/trove-taskmanager.conf.sample
index f7046319..3edf3ea6 100644
--- a/etc/trove/trove-taskmanager.conf.sample
+++ b/etc/trove/trove-taskmanager.conf.sample
@@ -7,6 +7,8 @@ debug = True
# Update the service and instance statuses if the instances fails to become
# active within the configured usage_timeout.
+# usage_timeout = 600
+# restore_usage_timeout = 36000
update_status_on_fail = True
# The RabbitMQ broker address where a single node is used.
diff --git a/trove/common/cfg.py b/trove/common/cfg.py
index 6d77e0f6..8f74b8a4 100644
--- a/trove/common/cfg.py
+++ b/trove/common/cfg.py
@@ -361,6 +361,9 @@ common_opts = [
cfg.IntOpt('usage_timeout', default=600,
help='Maximum time (in seconds) to wait for a Guest to become '
'active.'),
+ cfg.IntOpt('restore_usage_timeout', default=36000,
+ help='Maximum time (in seconds) to wait for a Guest instance '
+ 'restored from a backup to become active.'),
cfg.IntOpt('cluster_usage_timeout', default=675,
help='Maximum time (in seconds) to wait for a cluster to '
'become active.'),
diff --git a/trove/taskmanager/models.py b/trove/taskmanager/models.py
index d9934698..6360608a 100755
--- a/trove/taskmanager/models.py
+++ b/trove/taskmanager/models.py
@@ -297,10 +297,11 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
# record to avoid over billing a customer for an instance that
# fails to build properly.
try:
- usage_timeout = CONF.usage_timeout
+ timeout = (CONF.restore_usage_timeout if backup_info
+ else CONF.usage_timeout)
utils.poll_until(self._service_is_active,
sleep_time=USAGE_SLEEP_TIME,
- time_out=usage_timeout)
+ time_out=timeout)
LOG.info(_("Created instance %s successfully.") % self.id)
self.send_usage_event('create', instance_size=flavor['ram'])
except PollTimeOut:
@@ -357,7 +358,7 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
"from instance %(source)s "
"for new replica %(replica)s.") % {'source': slave_of_id,
'replica': self.id})
- err = inst_models.InstanceTasks.BUILDING_ERROR_SLAVE
+ err = inst_models.InstanceTasks.BUILDING_ERROR_REPLICA
Backup.delete(context, snapshot_info['id'])
self._log_and_raise(e, msg, err)
except Exception: