From 34f0b8b023eb65d16599391424c4e13647335817 Mon Sep 17 00:00:00 2001 From: Kun Huang Date: Thu, 20 Aug 2015 16:24:44 +0800 Subject: [PATCH] Expose config for timeout of resource deletion The users who run rally in CI or periodically would like this option, because they could config this under different cases. Change-Id: I6fd70eb5565aeeb0442475439633baf2f441d174 Partial-Bug: #1469622 --- etc/rally/rally.conf.sample | 10 ++++++++++ rally/plugins/openstack/context/cleanup/base.py | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/etc/rally/rally.conf.sample b/etc/rally/rally.conf.sample index 19d51f1e..5ed7edb2 100644 --- a/etc/rally/rally.conf.sample +++ b/etc/rally/rally.conf.sample @@ -495,6 +495,16 @@ #ec2_server_boot_poll_interval = 1.0 +[cleanup] + +# +# From rally +# + +# A timeout in seconds for deleting resources (integer value) +#resource_deletion_timeout = 600 + + [database] # diff --git a/rally/plugins/openstack/context/cleanup/base.py b/rally/plugins/openstack/context/cleanup/base.py index cf3fd196..cc923825 100644 --- a/rally/plugins/openstack/context/cleanup/base.py +++ b/rally/plugins/openstack/context/cleanup/base.py @@ -13,12 +13,27 @@ # License for the specific language governing permissions and limitations # under the License. + +from oslo_config import cfg + from rally.task import utils +CONF = cfg.CONF + +CLEANUP_OPTS = [ + cfg.IntOpt("resource_deletion_timeout", default=600, + help="A timeout in seconds for deleting resources") +] +cleanup_group = cfg.OptGroup(name="cleanup", title="Cleanup Options") +CONF.register_group(cleanup_group) +CONF.register_opts(CLEANUP_OPTS, cleanup_group) + + def resource(service, resource, order=0, admin_required=False, perform_for_admin_only=False, tenant_resource=False, - max_attempts=3, timeout=600, interval=1, threads=20): + max_attempts=3, timeout=CONF.cleanup.resource_deletion_timeout, + interval=1, threads=20): """Decorator that overrides resource specification. Just put it on top of your resource class and specify arguments that you