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
This commit is contained in:
Kun Huang 2015-08-20 16:24:44 +08:00
parent 0ba3106607
commit 3ecce33d6e
3 changed files with 29 additions and 2 deletions

View File

@ -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]
#

View File

@ -17,6 +17,7 @@ import itertools
from rally.common import log
from rally import exceptions
from rally import osclients
from rally.plugins.openstack.context.cleanup import base as cleanup_base
from rally.plugins.openstack.context.keystone import users
from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils
from rally.plugins.openstack.scenarios.ec2 import utils as ec2_utils
@ -44,5 +45,6 @@ def list_opts():
ec2_utils.EC2_BENCHMARK_OPTS)),
("image",
itertools.chain(tempest_conf.IMAGE_OPTS)),
("users_context", itertools.chain(users.USER_CONTEXT_OPTS))
("users_context", itertools.chain(users.USER_CONTEXT_OPTS)),
("cleanup", itertools.chain(cleanup_base.CLEANUP_OPTS))
]

View File

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