Merge "Use different timeouts for create and restore"

This commit is contained in:
Jenkins 2014-09-30 21:10:37 +00:00 committed by Gerrit Code Review
commit 4ea962bb26
3 changed files with 9 additions and 3 deletions

View File

@ -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.

View File

@ -364,6 +364,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.'),

View File

@ -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: