diff --git a/etc/trove/trove-taskmanager.conf.sample b/etc/trove/trove-taskmanager.conf.sample index f70463191e..3edf3ea6a5 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 6d77e0f68b..8f74b8a43f 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 d993469890..6360608a20 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: