Dynamic Workloads: Rally locks Garbage Collection
Closes-Bug: 1997513 Change-Id: I6184bbae0061dda52c5216a2af262f3c69739538
This commit is contained in:
parent
99512c928e
commit
e020920628
|
@ -139,6 +139,8 @@ BrowbeatPlugin.dynamic_workload:
|
|||
interface_name: '{{ iface_name }}'
|
||||
provider_phys_net: '{{ provider_phys_net }}'
|
||||
cidr_prefix: '{{ cidr_prefix }}'
|
||||
locks_context:
|
||||
locks_table_name: 'rallylocks'
|
||||
sla:
|
||||
max_avg_duration: {{sla_max_avg_duration}}
|
||||
max_seconds_per_iteration: {{sla_max_seconds}}
|
||||
|
|
|
@ -18,6 +18,8 @@ from rally_openstack.common import osclients
|
|||
from rally_openstack.common.wrappers import network as network_wrapper
|
||||
|
||||
import subprocess
|
||||
import tempfile
|
||||
from oslo_db.sqlalchemy import engines
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -213,3 +215,28 @@ class CreateExternalNetworksContext(context.Context):
|
|||
else:
|
||||
LOG.exception("Deleting vlan {}.{} failed".format(
|
||||
self.interface_name, i + 1))
|
||||
|
||||
@context.configure(name="locks_context", order=1200)
|
||||
class LocksContext(context.Context):
|
||||
"""This plugin handles cleanup of rally locks after each run of dynamic workloads"""
|
||||
|
||||
CONFIG_SCHEMA = {
|
||||
"type": "object",
|
||||
"$schema": consts.JSON_SCHEMA,
|
||||
"additionalProperties": False,
|
||||
"properties": {
|
||||
"locks_table_name": {
|
||||
"type": "string",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def setup(self):
|
||||
"""This method is called before the task starts."""
|
||||
engine = engines.create_engine("sqlite:///%s/stack.sqlite" % tempfile.gettempdir())
|
||||
self.sqlalchemy_connection = engine.connect()
|
||||
|
||||
def cleanup(self):
|
||||
"""This method is called after the task finishes."""
|
||||
self.sqlalchemy_connection.execute("DELETE FROM {}".format(
|
||||
self.config.get("locks_table_name", "rallylocks")))
|
||||
|
|
Loading…
Reference in New Issue