Merge "Refactoring of scenario plugin base"
This commit is contained in:
commit
f12a745ae3
@ -41,13 +41,14 @@ Inherit a class for your plugin from the base *Scenario* class and implement a s
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import scenario
|
||||
|
||||
|
||||
class ScenarioPlugin(base.Scenario):
|
||||
class ScenarioPlugin(scenario.Scenario):
|
||||
"""Sample plugin which lists flavors."""
|
||||
|
||||
@base.atomic_action_timer("list_flavors")
|
||||
@atomic.action_timer("list_flavors")
|
||||
def _list_flavors(self):
|
||||
"""Sample of usage clients - list flavors
|
||||
|
||||
@ -55,12 +56,12 @@ Inherit a class for your plugin from the base *Scenario* class and implement a s
|
||||
initialized on scenario instance creation"""
|
||||
self.clients("nova").flavors.list()
|
||||
|
||||
@base.atomic_action_timer("list_flavors_as_admin")
|
||||
@atomic.action_timer("list_flavors_as_admin")
|
||||
def _list_flavors_as_admin(self):
|
||||
"""The same with admin clients"""
|
||||
self.admin_clients("nova").flavors.list()
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_flavors(self):
|
||||
"""List flavors."""
|
||||
self._list_flavors()
|
||||
|
@ -17,24 +17,25 @@
|
||||
import random
|
||||
import time
|
||||
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import scenario
|
||||
|
||||
# This is used to test relative import
|
||||
from test_relative_import import zzz
|
||||
|
||||
|
||||
class FakePlugin(base.Scenario):
|
||||
class FakePlugin(scenario.Scenario):
|
||||
"""Fake plugin with a scenario."""
|
||||
|
||||
@base.atomic_action_timer("test1")
|
||||
@atomic.action_timer("test1")
|
||||
def _test1(self, factor):
|
||||
time.sleep(random.random() * 0.1)
|
||||
|
||||
@base.atomic_action_timer("test2")
|
||||
@atomic.action_timer("test2")
|
||||
def _test2(self, factor):
|
||||
time.sleep(random.random() * factor)
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def testplugin(self, factor=1):
|
||||
"""Fake scenario.
|
||||
|
||||
|
@ -58,7 +58,7 @@ from rally.deployment import engine
|
||||
from rally.deployment.serverprovider import provider
|
||||
from rally import exceptions
|
||||
from rally import plugins
|
||||
from rally.task.scenarios import base as scenario_base
|
||||
from rally.task import scenario
|
||||
from rally.task import sla
|
||||
|
||||
|
||||
@ -117,10 +117,9 @@ class InfoCommands(object):
|
||||
def BenchmarkScenarios(self):
|
||||
"""Get information about benchmark scenarios available in Rally."""
|
||||
def scenarios_filter(scenario_cls):
|
||||
return any(scenario_base.Scenario.is_scenario(scenario_cls, m)
|
||||
return any(scenario.Scenario.is_scenario(scenario_cls, m)
|
||||
for m in dir(scenario_cls))
|
||||
scenarios = self._get_descriptions(scenario_base.Scenario,
|
||||
scenarios_filter)
|
||||
scenarios = self._get_descriptions(scenario.Scenario, scenarios_filter)
|
||||
info = (self._make_header("Rally - Benchmark scenarios") +
|
||||
"\n\n"
|
||||
"Benchmark scenarios are what Rally actually uses to test "
|
||||
@ -268,7 +267,7 @@ class InfoCommands(object):
|
||||
|
||||
def _find_substitution(self, query):
|
||||
max_distance = min(3, len(query) / 4)
|
||||
scenarios = scenario_base.Scenario.list_benchmark_scenarios()
|
||||
scenarios = scenario.Scenario.list_benchmark_scenarios()
|
||||
scenario_groups = list(set(s.split(".")[0] for s in scenarios))
|
||||
scenario_methods = list(set(s.split(".")[1] for s in scenarios))
|
||||
sla_info = [cls.get_name() for cls in sla.SLA.get_all()]
|
||||
@ -289,8 +288,8 @@ class InfoCommands(object):
|
||||
|
||||
def _get_scenario_group_info(self, query):
|
||||
try:
|
||||
scenario_group = scenario_base.Scenario.get_by_name(query)
|
||||
if not any(scenario_base.Scenario.is_scenario(scenario_group, m)
|
||||
scenario_group = scenario.Scenario.get_by_name(query)
|
||||
if not any(scenario.Scenario.is_scenario(scenario_group, m)
|
||||
for m in dir(scenario_group)):
|
||||
return None
|
||||
info = self._make_header("%s (benchmark scenario group)" %
|
||||
@ -302,8 +301,8 @@ class InfoCommands(object):
|
||||
for scenario_name in scenarios:
|
||||
cls, method_name = scenario_name.split(".")
|
||||
if hasattr(scenario_group, method_name):
|
||||
scenario = getattr(scenario_group, method_name)
|
||||
doc = utils.parse_docstring(scenario.__doc__)
|
||||
scenario_inst = getattr(scenario_group, method_name)
|
||||
doc = utils.parse_docstring(scenario_inst.__doc__)
|
||||
descr = doc["short_description"] or ""
|
||||
descriptions.append((scenario_name, descr))
|
||||
info += self._compose_table("Benchmark scenarios", descriptions)
|
||||
@ -313,22 +312,22 @@ class InfoCommands(object):
|
||||
|
||||
def _get_scenario_info(self, query):
|
||||
try:
|
||||
scenario = scenario_base.Scenario.get_scenario_by_name(query)
|
||||
scenario_group_name = utils.get_method_class(scenario).get_name()
|
||||
scenario_inst = scenario.Scenario.get_scenario_by_name(query)
|
||||
scenario_gr_name = utils.get_method_class(scenario_inst).get_name()
|
||||
header = ("%(scenario_group)s.%(scenario_name)s "
|
||||
"(benchmark scenario)" %
|
||||
{"scenario_group": scenario_group_name,
|
||||
"scenario_name": scenario.__name__})
|
||||
{"scenario_group": scenario_gr_name,
|
||||
"scenario_name": scenario_inst.__name__})
|
||||
info = self._make_header(header)
|
||||
info += "\n\n"
|
||||
doc = utils.parse_docstring(scenario.__doc__)
|
||||
doc = utils.parse_docstring(scenario_inst.__doc__)
|
||||
if not doc["short_description"]:
|
||||
return None
|
||||
info += doc["short_description"] + "\n\n"
|
||||
if doc["long_description"]:
|
||||
info += doc["long_description"] + "\n\n"
|
||||
if doc["params"]:
|
||||
args = inspect.getargspec(scenario)
|
||||
args = inspect.getargspec(scenario_inst)
|
||||
if args.defaults:
|
||||
default_values = dict(zip(args.args[-len(args.defaults):],
|
||||
args.defaults))
|
||||
|
@ -15,7 +15,8 @@ import time
|
||||
|
||||
from rally.common.i18n import _
|
||||
from rally import exceptions
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import scenario
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -23,10 +24,10 @@ class DummyScenarioException(exceptions.RallyException):
|
||||
msg_fmt = _("Dummy scenario expected exception: '%(message)s'")
|
||||
|
||||
|
||||
class Dummy(base.Scenario):
|
||||
class Dummy(scenario.Scenario):
|
||||
"""Dummy benchmarks for testing Rally benchmark engine at scale."""
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def dummy(self, sleep=0):
|
||||
"""Do nothing and sleep for the given number of seconds (0 by default).
|
||||
|
||||
@ -41,7 +42,7 @@ class Dummy(base.Scenario):
|
||||
|
||||
@validation.number("size_of_message",
|
||||
minval=1, integer_only=True, nullable=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def dummy_exception(self, size_of_message=1, sleep=0):
|
||||
"""Throw an exception.
|
||||
|
||||
@ -60,7 +61,7 @@ class Dummy(base.Scenario):
|
||||
|
||||
@validation.number("exception_probability",
|
||||
minval=0, maxval=1, integer_only=False, nullable=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def dummy_exception_probability(self, exception_probability=0.5):
|
||||
"""Throw an exception with given probability.
|
||||
|
||||
@ -79,7 +80,7 @@ class Dummy(base.Scenario):
|
||||
% exception_probability
|
||||
)
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def dummy_with_scenario_output(self):
|
||||
"""Return a dummy scenario output.
|
||||
|
||||
@ -93,7 +94,7 @@ class Dummy(base.Scenario):
|
||||
err = ""
|
||||
return {"data": out, "errors": err}
|
||||
|
||||
@base.atomic_action_timer("dummy_fail_test")
|
||||
@atomic.action_timer("dummy_fail_test")
|
||||
def _random_fail_emitter(self, exception_probability):
|
||||
"""Throw an exception with given probability.
|
||||
|
||||
@ -102,7 +103,7 @@ class Dummy(base.Scenario):
|
||||
if random.random() < exception_probability:
|
||||
raise KeyError("Dummy test exception")
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def dummy_random_fail_in_atomic(self, exception_probability=0.5):
|
||||
"""Randomly throw exceptions in atomic actions.
|
||||
|
||||
|
@ -13,13 +13,13 @@
|
||||
import random
|
||||
|
||||
from rally.plugins.common.scenarios.requests import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
|
||||
|
||||
class HttpRequests(utils.RequestScenario):
|
||||
"""Benchmark scenarios for HTTP requests."""
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def check_request(self, url, method, status_code, **kwargs):
|
||||
"""Standard way to benchmark web services.
|
||||
|
||||
@ -34,7 +34,7 @@ class HttpRequests(utils.RequestScenario):
|
||||
|
||||
self._check_request(url, method, status_code, **kwargs)
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def check_random_request(self, requests, status_code):
|
||||
"""Benchmark the list of requests
|
||||
|
||||
|
@ -13,13 +13,14 @@
|
||||
import requests
|
||||
|
||||
from rally.common.i18n import _
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import scenario
|
||||
|
||||
|
||||
class RequestScenario(base.Scenario):
|
||||
class RequestScenario(scenario.Scenario):
|
||||
"""Base class for Request scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("requests.check_request")
|
||||
@atomic.action_timer("requests.check_request")
|
||||
def _check_request(self, url, method, status_code, **kwargs):
|
||||
"""Compare request status code with specified code
|
||||
|
||||
|
@ -19,7 +19,7 @@ from rally import consts
|
||||
from rally.plugins.openstack.context.cleanup import manager as resource_manager
|
||||
from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils
|
||||
from rally.task import context
|
||||
from rally.task.scenarios import base as scenario_base
|
||||
from rally.task import scenario
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -60,7 +60,7 @@ class VolumeGenerator(context.Context):
|
||||
self.context["tenants"][tenant_id].setdefault("volumes", [])
|
||||
cinder_util = cinder_utils.CinderScenario({"user": user})
|
||||
for i in range(volumes_per_tenant):
|
||||
rnd_name = scenario_base.Scenario._generate_random_name(
|
||||
rnd_name = scenario.Scenario._generate_random_name(
|
||||
prefix="ctx_rally_volume_")
|
||||
vol = cinder_util._create_volume(size, display_name=rnd_name)
|
||||
self.context["tenants"][tenant_id]["volumes"].append(vol._info)
|
||||
|
@ -14,10 +14,14 @@
|
||||
# under the License.
|
||||
|
||||
from rally import osclients
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
|
||||
# NOTE(boris-42): Shortcut to remove import of both rally.task.scenario and
|
||||
# rally.plugins.openstack.scenario
|
||||
configure = scenario.configure
|
||||
|
||||
|
||||
class OpenStackScenario(base.Scenario):
|
||||
class OpenStackScenario(scenario.Scenario):
|
||||
"""Base class for all OpenStack scenarios."""
|
||||
|
||||
def __init__(self, context=None, admin_clients=None, clients=None):
|
||||
|
@ -13,7 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -25,14 +25,14 @@ class Authenticate(scenario.OpenStackScenario):
|
||||
"""
|
||||
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def keystone(self):
|
||||
"""Check Keystone Client."""
|
||||
self.clients("keystone")
|
||||
|
||||
@validation.number("repetitions", minval=1)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def validate_glance(self, repetitions):
|
||||
"""Check Glance Client to ensure validation of token.
|
||||
|
||||
@ -45,12 +45,12 @@ class Authenticate(scenario.OpenStackScenario):
|
||||
glance_client = self.clients("glance")
|
||||
image_name = "__intentionally_non_existent_image___"
|
||||
for i in range(repetitions):
|
||||
with base.AtomicAction(self, "authenticate.validate_glance"):
|
||||
with atomic.ActionTimer(self, "authenticate.validate_glance"):
|
||||
list(glance_client.images.list(name=image_name))
|
||||
|
||||
@validation.number("repetitions", minval=1)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def validate_nova(self, repetitions):
|
||||
"""Check Nova Client to ensure validation of token.
|
||||
|
||||
@ -61,12 +61,12 @@ class Authenticate(scenario.OpenStackScenario):
|
||||
"""
|
||||
nova_client = self.clients("nova")
|
||||
for i in range(repetitions):
|
||||
with base.AtomicAction(self, "authenticate.validate_nova"):
|
||||
with atomic.ActionTimer(self, "authenticate.validate_nova"):
|
||||
nova_client.flavors.list()
|
||||
|
||||
@validation.number("repetitions", minval=1)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def validate_cinder(self, repetitions):
|
||||
"""Check Cinder Client to ensure validation of token.
|
||||
|
||||
@ -77,12 +77,12 @@ class Authenticate(scenario.OpenStackScenario):
|
||||
"""
|
||||
cinder_client = self.clients("cinder")
|
||||
for i in range(repetitions):
|
||||
with base.AtomicAction(self, "authenticate.validate_cinder"):
|
||||
with atomic.ActionTimer(self, "authenticate.validate_cinder"):
|
||||
cinder_client.volume_types.list()
|
||||
|
||||
@validation.number("repetitions", minval=1)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def validate_neutron(self, repetitions):
|
||||
"""Check Neutron Client to ensure validation of token.
|
||||
|
||||
@ -93,12 +93,12 @@ class Authenticate(scenario.OpenStackScenario):
|
||||
"""
|
||||
neutron_client = self.clients("neutron")
|
||||
for i in range(repetitions):
|
||||
with base.AtomicAction(self, "authenticate.validate_neutron"):
|
||||
with atomic.ActionTimer(self, "authenticate.validate_neutron"):
|
||||
neutron_client.list_networks()
|
||||
|
||||
@validation.number("repetitions", minval=1)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def validate_heat(self, repetitions):
|
||||
"""Check Heat Client to ensure validation of token.
|
||||
|
||||
@ -109,5 +109,5 @@ class Authenticate(scenario.OpenStackScenario):
|
||||
"""
|
||||
heat_client = self.clients("heat")
|
||||
for i in range(repetitions):
|
||||
with base.AtomicAction(self, "authenticate.validate_heat"):
|
||||
with atomic.ActionTimer(self, "authenticate.validate_heat"):
|
||||
list(heat_client.stacks.list(limit=0))
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_alarm(self, meter_name, threshold, **kwargs):
|
||||
"""Create an alarm.
|
||||
|
||||
@ -40,7 +40,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_alarms(self):
|
||||
"""Fetch all alarms.
|
||||
|
||||
@ -50,7 +50,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_and_list_alarm(self, meter_name, threshold, **kwargs):
|
||||
"""Create and get the newly created alarm.
|
||||
|
||||
@ -70,7 +70,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_and_update_alarm(self, meter_name, threshold, **kwargs):
|
||||
"""Create and update the newly created alarm.
|
||||
|
||||
@ -90,7 +90,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_and_delete_alarm(self, meter_name, threshold, **kwargs):
|
||||
"""Create and delete the newly created alarm.
|
||||
|
||||
@ -109,7 +109,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_alarm_and_get_history(self, meter_name, threshold, state,
|
||||
timeout=60, **kwargs):
|
||||
"""Create an alarm, get and set the state and get the alarm history.
|
||||
|
@ -13,9 +13,9 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ceilometer import utils as cutils
|
||||
from rally.plugins.openstack.scenarios.keystone import utils as kutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ class CeilometerEvents(cutils.CeilometerScenario, kutils.KeystoneScenario):
|
||||
@validation.required_services(consts.Service.CEILOMETER,
|
||||
consts.Service.KEYSTONE)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
def create_user_and_list_events(self):
|
||||
"""Fetch all events.
|
||||
|
||||
@ -43,8 +43,8 @@ class CeilometerEvents(cutils.CeilometerScenario, kutils.KeystoneScenario):
|
||||
@validation.required_services(consts.Service.CEILOMETER,
|
||||
consts.Service.KEYSTONE)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
def create_user_and_list_event_types(self):
|
||||
"""Fetch all event types.
|
||||
|
||||
@ -57,8 +57,8 @@ class CeilometerEvents(cutils.CeilometerScenario, kutils.KeystoneScenario):
|
||||
@validation.required_services(consts.Service.CEILOMETER,
|
||||
consts.Service.KEYSTONE)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
def create_user_and_get_event(self):
|
||||
"""Get event.
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class CeilometerMeters(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_meters(self):
|
||||
"""Fetch user's meters."""
|
||||
self._list_meters()
|
||||
|
@ -15,8 +15,8 @@
|
||||
import json
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class CeilometerQueries(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_and_query_alarms(self, meter_name, threshold, filter=None,
|
||||
orderby=None, limit=None, **kwargs):
|
||||
"""Create an alarm and then query it with specific parameters.
|
||||
@ -48,7 +48,7 @@ class CeilometerQueries(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_and_query_alarm_history(self, meter_name, threshold,
|
||||
orderby=None, limit=None, **kwargs):
|
||||
"""Create an alarm and then query for its history.
|
||||
@ -69,7 +69,7 @@ class CeilometerQueries(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_and_query_samples(self, counter_name, counter_type,
|
||||
counter_unit, counter_volume, resource_id,
|
||||
filter=None, orderby=None, limit=None,
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class CeilometerResource(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_resources(self):
|
||||
"""Fetch all resources.
|
||||
|
||||
@ -34,7 +34,7 @@ class CeilometerResource(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def get_tenant_resources(self):
|
||||
"""Get all tenant resources.
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class CeilometerSamples(ceiloutils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_samples(self):
|
||||
"""Fetch all samples.
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ceilometer import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class CeilometerStats(utils.CeilometerScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CEILOMETER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"cleanup": ["ceilometer"]})
|
||||
def create_meter_and_get_stats(self, **kwargs):
|
||||
"""Create a meter and fetch its statistics.
|
||||
|
||||
|
@ -13,9 +13,9 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ceilometer import utils as cutils
|
||||
from rally.plugins.openstack.scenarios.keystone import utils as kutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ class CeilometerTraits(cutils.CeilometerScenario, kutils.KeystoneScenario):
|
||||
@validation.required_services(consts.Service.CEILOMETER,
|
||||
consts.Service.KEYSTONE)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
def create_user_and_list_traits(self):
|
||||
"""Fetch all events traits.
|
||||
|
||||
@ -47,8 +47,8 @@ class CeilometerTraits(cutils.CeilometerScenario, kutils.KeystoneScenario):
|
||||
@validation.required_services(consts.Service.CEILOMETER,
|
||||
consts.Service.KEYSTONE)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"],
|
||||
"cleanup": ["ceilometer"]})
|
||||
def create_user_and_list_trait_descriptions(self):
|
||||
"""Fetch all trait descriptions.
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils as bench_utils
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
alarm.update(kwargs)
|
||||
return alarm
|
||||
|
||||
@base.atomic_action_timer("ceilometer.list_alarms")
|
||||
@atomic.action_timer("ceilometer.list_alarms")
|
||||
def _list_alarms(self, alarm_id=None):
|
||||
"""List alarms.
|
||||
|
||||
@ -51,7 +51,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
else:
|
||||
return self.clients("ceilometer").alarms.list()
|
||||
|
||||
@base.atomic_action_timer("ceilometer.create_alarm")
|
||||
@atomic.action_timer("ceilometer.create_alarm")
|
||||
def _create_alarm(self, meter_name, threshold, kwargs):
|
||||
"""Create an alarm.
|
||||
|
||||
@ -66,7 +66,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
alarm = self.clients("ceilometer").alarms.create(**alarm_dict)
|
||||
return alarm
|
||||
|
||||
@base.atomic_action_timer("ceilometer.delete_alarm")
|
||||
@atomic.action_timer("ceilometer.delete_alarm")
|
||||
def _delete_alarm(self, alarm_id):
|
||||
"""Delete an alarm.
|
||||
|
||||
@ -74,7 +74,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.clients("ceilometer").alarms.delete(alarm_id)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.update_alarm")
|
||||
@atomic.action_timer("ceilometer.update_alarm")
|
||||
def _update_alarm(self, alarm_id, alarm_dict_delta):
|
||||
"""Update an alarm.
|
||||
|
||||
@ -83,7 +83,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.clients("ceilometer").alarms.update(alarm_id, **alarm_dict_delta)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.get_alarm_history")
|
||||
@atomic.action_timer("ceilometer.get_alarm_history")
|
||||
def _get_alarm_history(self, alarm_id):
|
||||
"""Assemble the alarm history requested.
|
||||
|
||||
@ -92,7 +92,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.clients("ceilometer").alarms.get_history(alarm_id)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.get_alarm_state")
|
||||
@atomic.action_timer("ceilometer.get_alarm_state")
|
||||
def _get_alarm_state(self, alarm_id):
|
||||
"""Get the state of the alarm.
|
||||
|
||||
@ -101,7 +101,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.clients("ceilometer").alarms.get_state(alarm_id)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.set_alarm_state")
|
||||
@atomic.action_timer("ceilometer.set_alarm_state")
|
||||
def _set_alarm_state(self, alarm, state, timeout):
|
||||
"""Set the state of the alarm.
|
||||
|
||||
@ -118,7 +118,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
.get_from_manager(),
|
||||
timeout=timeout, check_interval=1)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.list_events")
|
||||
@atomic.action_timer("ceilometer.list_events")
|
||||
def _list_events(self):
|
||||
"""Get list of user's events.
|
||||
|
||||
@ -127,7 +127,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.admin_clients("ceilometer").events.list()
|
||||
|
||||
@base.atomic_action_timer("ceilometer.get_event")
|
||||
@atomic.action_timer("ceilometer.get_event")
|
||||
def _get_event(self, event_id):
|
||||
"""Get event with specific id.
|
||||
|
||||
@ -138,7 +138,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.admin_clients("ceilometer").events.get(event_id)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.list_event_types")
|
||||
@atomic.action_timer("ceilometer.list_event_types")
|
||||
def _list_event_types(self):
|
||||
"""Get list of all event types.
|
||||
|
||||
@ -146,7 +146,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.admin_clients("ceilometer").event_types.list()
|
||||
|
||||
@base.atomic_action_timer("ceilometer.list_event_traits")
|
||||
@atomic.action_timer("ceilometer.list_event_traits")
|
||||
def _list_event_traits(self, event_type, trait_name):
|
||||
"""Get list of event traits.
|
||||
|
||||
@ -157,7 +157,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
return self.admin_clients("ceilometer").traits.list(event_type,
|
||||
trait_name)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.list_event_trait_descriptions")
|
||||
@atomic.action_timer("ceilometer.list_event_trait_descriptions")
|
||||
def _list_event_trait_descriptions(self, event_type):
|
||||
"""Get list of event trait descriptions.
|
||||
|
||||
@ -167,12 +167,12 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
return self.admin_clients("ceilometer").trait_descriptions.list(
|
||||
event_type)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.list_meters")
|
||||
@atomic.action_timer("ceilometer.list_meters")
|
||||
def _list_meters(self):
|
||||
"""Get list of user's meters."""
|
||||
return self.clients("ceilometer").meters.list()
|
||||
|
||||
@base.atomic_action_timer("ceilometer.list_resources")
|
||||
@atomic.action_timer("ceilometer.list_resources")
|
||||
def _list_resources(self):
|
||||
"""List all resources.
|
||||
|
||||
@ -180,7 +180,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.clients("ceilometer").resources.list()
|
||||
|
||||
@base.atomic_action_timer("ceilometer.list_samples")
|
||||
@atomic.action_timer("ceilometer.list_samples")
|
||||
def _list_samples(self):
|
||||
"""List all Samples.
|
||||
|
||||
@ -188,12 +188,12 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.clients("ceilometer").samples.list()
|
||||
|
||||
@base.atomic_action_timer("ceilometer.get_resource")
|
||||
@atomic.action_timer("ceilometer.get_resource")
|
||||
def _get_resource(self, resource_id):
|
||||
"""Retrieve details about one resource."""
|
||||
return self.clients("ceilometer").resources.get(resource_id)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.get_stats")
|
||||
@atomic.action_timer("ceilometer.get_stats")
|
||||
def _get_stats(self, meter_name):
|
||||
"""Get stats for a specific meter.
|
||||
|
||||
@ -201,7 +201,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.clients("ceilometer").statistics.list(meter_name)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.create_meter")
|
||||
@atomic.action_timer("ceilometer.create_meter")
|
||||
def _create_meter(self, **kwargs):
|
||||
"""Create a new meter.
|
||||
|
||||
@ -214,7 +214,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
counter_name=name, **kwargs)
|
||||
return samples[0]
|
||||
|
||||
@base.atomic_action_timer("ceilometer.query_alarms")
|
||||
@atomic.action_timer("ceilometer.query_alarms")
|
||||
def _query_alarms(self, filter, orderby, limit):
|
||||
"""Query alarms with specific parameters.
|
||||
|
||||
@ -229,7 +229,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
return self.clients("ceilometer").query_alarms.query(
|
||||
filter, orderby, limit)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.query_alarm_history")
|
||||
@atomic.action_timer("ceilometer.query_alarm_history")
|
||||
def _query_alarm_history(self, filter, orderby, limit):
|
||||
"""Query history of an alarm.
|
||||
|
||||
@ -244,7 +244,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
return self.clients("ceilometer").query_alarm_history.query(
|
||||
filter, orderby, limit)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.create_sample")
|
||||
@atomic.action_timer("ceilometer.create_sample")
|
||||
def _create_sample(self, counter_name, counter_type, counter_unit,
|
||||
counter_volume, resource_id=None, **kwargs):
|
||||
"""Create a Sample with specified parameters.
|
||||
@ -266,7 +266,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
prefix="rally_resource_")})
|
||||
return self.clients("ceilometer").samples.create(**kwargs)
|
||||
|
||||
@base.atomic_action_timer("ceilometer.query_samples")
|
||||
@atomic.action_timer("ceilometer.query_samples")
|
||||
def _query_samples(self, filter, orderby, limit):
|
||||
"""Query samples with specified parameters.
|
||||
|
||||
|
@ -20,7 +20,7 @@ from oslo_config import cfg
|
||||
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils as bench_utils
|
||||
|
||||
CINDER_BENCHMARK_OPTS = [
|
||||
@ -54,13 +54,13 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
|
||||
RESOURCE_NAME_PREFIX = "rally_volume_"
|
||||
|
||||
@base.atomic_action_timer("cinder.list_volumes")
|
||||
@atomic.action_timer("cinder.list_volumes")
|
||||
def _list_volumes(self, detailed=True):
|
||||
"""Returns user volumes list."""
|
||||
|
||||
return self.clients("cinder").volumes.list(detailed)
|
||||
|
||||
@base.atomic_action_timer("cinder.list_snapshots")
|
||||
@atomic.action_timer("cinder.list_snapshots")
|
||||
def _list_snapshots(self, detailed=True):
|
||||
"""Returns user snapshots list."""
|
||||
|
||||
@ -75,7 +75,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
:returns: A list of keys that were set
|
||||
"""
|
||||
key = "cinder.set_%s_metadatas_%s_times" % (set_size, sets)
|
||||
with base.AtomicAction(self, key):
|
||||
with atomic.ActionTimer(self, key):
|
||||
keys = []
|
||||
for i in range(sets):
|
||||
metadata = {}
|
||||
@ -110,12 +110,12 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
random.shuffle(keys)
|
||||
action_name = "cinder.delete_%s_metadatas_%s_times" % (delete_size,
|
||||
deletes)
|
||||
with base.AtomicAction(self, action_name):
|
||||
with atomic.ActionTimer(self, action_name):
|
||||
for i in range(deletes):
|
||||
to_del = keys[i * delete_size:(i + 1) * delete_size]
|
||||
self.clients("cinder").volumes.delete_metadata(volume, to_del)
|
||||
|
||||
@base.atomic_action_timer("cinder.create_volume")
|
||||
@atomic.action_timer("cinder.create_volume")
|
||||
def _create_volume(self, size, **kwargs):
|
||||
"""Create one volume.
|
||||
|
||||
@ -148,7 +148,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
)
|
||||
return volume
|
||||
|
||||
@base.atomic_action_timer("cinder.delete_volume")
|
||||
@atomic.action_timer("cinder.delete_volume")
|
||||
def _delete_volume(self, volume):
|
||||
"""Delete the given volume.
|
||||
|
||||
@ -164,7 +164,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("cinder.extend_volume")
|
||||
@atomic.action_timer("cinder.extend_volume")
|
||||
def _extend_volume(self, volume, new_size):
|
||||
"""Extend the given volume.
|
||||
|
||||
@ -190,7 +190,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.cinder_volume_create_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("cinder.upload_volume_to_image")
|
||||
@atomic.action_timer("cinder.upload_volume_to_image")
|
||||
def _upload_volume_to_image(self, volume, force=False,
|
||||
container_format="bare", disk_format="raw"):
|
||||
"""Upload the given volume to image.
|
||||
@ -230,7 +230,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
|
||||
return image
|
||||
|
||||
@base.atomic_action_timer("cinder.create_snapshot")
|
||||
@atomic.action_timer("cinder.create_snapshot")
|
||||
def _create_snapshot(self, volume_id, force=False, **kwargs):
|
||||
"""Create one snapshot.
|
||||
|
||||
@ -258,7 +258,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
)
|
||||
return snapshot
|
||||
|
||||
@base.atomic_action_timer("cinder.delete_snapshot")
|
||||
@atomic.action_timer("cinder.delete_snapshot")
|
||||
def _delete_snapshot(self, snapshot):
|
||||
"""Delete the given snapshot.
|
||||
|
||||
@ -274,7 +274,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("cinder.create_backup")
|
||||
@atomic.action_timer("cinder.create_backup")
|
||||
def _create_backup(self, volume_id, **kwargs):
|
||||
"""Create a volume backup of the given volume.
|
||||
|
||||
@ -290,7 +290,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.cinder_volume_create_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("cinder.delete_backup")
|
||||
@atomic.action_timer("cinder.delete_backup")
|
||||
def _delete_backup(self, backup):
|
||||
"""Delete the given backup.
|
||||
|
||||
@ -306,7 +306,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("cinder.restore_backup")
|
||||
@atomic.action_timer("cinder.restore_backup")
|
||||
def _restore_backup(self, backup_id, volume_id=None):
|
||||
"""Restore the given backup.
|
||||
|
||||
@ -323,7 +323,7 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.cinder_volume_create_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("cinder.list_backups")
|
||||
@atomic.action_timer("cinder.list_backups")
|
||||
def _list_backups(self, detailed=True):
|
||||
"""Return user volume backups list.
|
||||
|
||||
|
@ -18,10 +18,10 @@ import random
|
||||
from rally.common import log as logging
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.cinder import utils
|
||||
from rally.plugins.openstack.scenarios.glance import utils as glance_utils
|
||||
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -37,7 +37,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.image_exists("image", nullable=True)
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_and_list_volume(self, size, detailed=True,
|
||||
image=None, **kwargs):
|
||||
"""Create a volume and list all volumes.
|
||||
@ -67,7 +67,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def list_volumes(self, detailed=True):
|
||||
"""List all volumes.
|
||||
|
||||
@ -84,7 +84,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.image_exists("image", nullable=True)
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_and_delete_volume(self, size, image=None,
|
||||
min_sleep=0, max_sleep=0,
|
||||
**kwargs):
|
||||
@ -117,7 +117,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.image_exists("image", nullable=True)
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_volume(self, size, image=None, **kwargs):
|
||||
"""Create a volume.
|
||||
|
||||
@ -139,7 +139,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_contexts("volumes")
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def modify_volume_metadata(self, sets=10, set_size=3,
|
||||
deletes=5, delete_size=3):
|
||||
"""Modify a volume's metadata.
|
||||
@ -168,7 +168,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_and_extend_volume(self, size, new_size, min_sleep=0,
|
||||
max_sleep=0, **kwargs):
|
||||
"""Create and extend a volume and then delete it.
|
||||
@ -198,7 +198,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_contexts("volumes")
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_from_volume_and_delete_volume(self, size, min_sleep=0,
|
||||
max_sleep=0, **kwargs):
|
||||
"""Create volume from volume and then delete it.
|
||||
@ -228,7 +228,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_contexts("volumes")
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_and_delete_snapshot(self, force=False, min_sleep=0,
|
||||
max_sleep=0, **kwargs):
|
||||
"""Create and then delete a volume-snapshot.
|
||||
@ -255,7 +255,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder", "nova"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder", "nova"]})
|
||||
def create_and_attach_volume(self, size, image, flavor, **kwargs):
|
||||
"""Create a VM and attach a volume to it.
|
||||
|
||||
@ -283,7 +283,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.volume_type_exists("volume_type")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder", "nova"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder", "nova"]})
|
||||
def create_snapshot_and_attach_volume(self, volume_type=False,
|
||||
size=None, **kwargs):
|
||||
|
||||
@ -325,7 +325,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder", "nova"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder", "nova"]})
|
||||
def create_nested_snapshots_and_attach_volume(self,
|
||||
size=None,
|
||||
nested_level=None,
|
||||
@ -388,7 +388,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_contexts("volumes")
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_and_list_snapshots(self, force=False, detailed=True, **kwargs):
|
||||
"""Create and then list a volume-snapshot.
|
||||
|
||||
@ -406,7 +406,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.required_services(consts.Service.CINDER, consts.Service.GLANCE)
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_parameters("size")
|
||||
@base.scenario(context={"cleanup": ["cinder", "glance"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder", "glance"]})
|
||||
def create_and_upload_volume_to_image(self, size, force=False,
|
||||
container_format="bare",
|
||||
disk_format="raw",
|
||||
@ -436,7 +436,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.required_cinder_services("cinder-backup")
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_volume_backup(self, size, do_delete=True,
|
||||
create_volume_kwargs=None,
|
||||
create_backup_kwargs=None):
|
||||
@ -461,7 +461,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.required_cinder_services("cinder-backup")
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_and_restore_volume_backup(self, size, do_delete=True,
|
||||
create_volume_kwargs=None,
|
||||
create_backup_kwargs=None):
|
||||
@ -487,7 +487,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
@validation.required_cinder_services("cinder-backup")
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder"]})
|
||||
def create_and_list_volume_backups(self, size, detailed=True,
|
||||
do_delete=True,
|
||||
create_volume_kwargs=None,
|
||||
|
@ -15,8 +15,9 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.designate import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -25,7 +26,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def create_and_list_domains(self):
|
||||
"""Create a domain and list all domains.
|
||||
|
||||
@ -42,7 +43,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def list_domains(self):
|
||||
"""List Designate domains.
|
||||
|
||||
@ -58,7 +59,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def create_and_delete_domain(self):
|
||||
"""Add and then delete a domain.
|
||||
|
||||
@ -70,7 +71,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def create_and_delete_records(self, records_per_domain=5):
|
||||
"""Add and then delete records.
|
||||
|
||||
@ -84,20 +85,20 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
records = []
|
||||
|
||||
key = "designate.create_%s_records" % records_per_domain
|
||||
with base.AtomicAction(self, key):
|
||||
with atomic.ActionTimer(self, key):
|
||||
for i in range(records_per_domain):
|
||||
record = self._create_record(domain, atomic_action=False)
|
||||
records.append(record)
|
||||
|
||||
key = "designate.delete_%s_records" % records_per_domain
|
||||
with base.AtomicAction(self, key):
|
||||
with atomic.ActionTimer(self, key):
|
||||
for record in records:
|
||||
self._delete_record(
|
||||
domain["id"], record["id"], atomic_action=False)
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def list_records(self, domain_id):
|
||||
"""List Designate records.
|
||||
|
||||
@ -115,7 +116,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def create_and_list_records(self, records_per_domain=5):
|
||||
"""Add and then list records.
|
||||
|
||||
@ -130,7 +131,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
domain = self._create_domain()
|
||||
|
||||
key = "designate.create_%s_records" % records_per_domain
|
||||
with base.AtomicAction(self, key):
|
||||
with atomic.ActionTimer(self, key):
|
||||
for i in range(records_per_domain):
|
||||
self._create_record(domain, atomic_action=False)
|
||||
|
||||
@ -138,7 +139,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def create_and_list_servers(self):
|
||||
"""Create a Designate server and list all servers.
|
||||
|
||||
@ -153,7 +154,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def create_and_delete_server(self):
|
||||
"""Add and then delete a server.
|
||||
|
||||
@ -165,7 +166,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"cleanup": ["designate"]})
|
||||
@scenario.configure(context={"cleanup": ["designate"]})
|
||||
def list_servers(self):
|
||||
"""List Designate servers.
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
|
||||
class DesignateScenario(scenario.OpenStackScenario):
|
||||
@ -23,7 +23,7 @@ class DesignateScenario(scenario.OpenStackScenario):
|
||||
|
||||
RESOURCE_NAME_PREFIX = "rally_"
|
||||
|
||||
@base.atomic_action_timer("designate.create_domain")
|
||||
@atomic.action_timer("designate.create_domain")
|
||||
def _create_domain(self, domain=None):
|
||||
"""Create domain.
|
||||
|
||||
@ -36,12 +36,12 @@ class DesignateScenario(scenario.OpenStackScenario):
|
||||
domain.setdefault("name", "%s.name." % self._generate_random_name())
|
||||
return self.clients("designate").domains.create(domain)
|
||||
|
||||
@base.atomic_action_timer("designate.list_domains")
|
||||
@atomic.action_timer("designate.list_domains")
|
||||
def _list_domains(self):
|
||||
"""Return user domain list."""
|
||||
return self.clients("designate").domains.list()
|
||||
|
||||
@base.atomic_action_timer("designate.delete_domain")
|
||||
@atomic.action_timer("designate.delete_domain")
|
||||
def _delete_domain(self, domain_id):
|
||||
"""Delete designate zone.
|
||||
|
||||
@ -67,12 +67,12 @@ class DesignateScenario(scenario.OpenStackScenario):
|
||||
client = self.clients("designate")
|
||||
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "designate.create_record"):
|
||||
with atomic.ActionTimer(self, "designate.create_record"):
|
||||
return client.records.create(domain["id"], record)
|
||||
|
||||
return client.records.create(domain["id"], record)
|
||||
|
||||
@base.atomic_action_timer("designate.list_records")
|
||||
@atomic.action_timer("designate.list_records")
|
||||
def _list_records(self, domain_id):
|
||||
"""List domain records.
|
||||
|
||||
@ -92,12 +92,12 @@ class DesignateScenario(scenario.OpenStackScenario):
|
||||
client = self.clients("designate")
|
||||
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "designate.delete_record"):
|
||||
with atomic.ActionTimer(self, "designate.delete_record"):
|
||||
client.records.delete(domain_id, record_id)
|
||||
else:
|
||||
client.records.delete(domain_id, record_id)
|
||||
|
||||
@base.atomic_action_timer("designate.create_server")
|
||||
@atomic.action_timer("designate.create_server")
|
||||
def _create_server(self, server=None):
|
||||
"""Create server.
|
||||
|
||||
@ -109,12 +109,12 @@ class DesignateScenario(scenario.OpenStackScenario):
|
||||
server.setdefault("name", "name.%s." % self._generate_random_name())
|
||||
return self.admin_clients("designate").servers.create(server)
|
||||
|
||||
@base.atomic_action_timer("designate.list_servers")
|
||||
@atomic.action_timer("designate.list_servers")
|
||||
def _list_servers(self):
|
||||
"""Return user server list."""
|
||||
return self.admin_clients("designate").servers.list()
|
||||
|
||||
@base.atomic_action_timer("designate.delete_server")
|
||||
@atomic.action_timer("designate.delete_server")
|
||||
def _delete_server(self, server_id):
|
||||
"""Delete Server.
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
from rally.common import log as logging
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ec2 import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -28,7 +28,7 @@ class EC2Servers(utils.EC2Scenario):
|
||||
|
||||
@validation.required_services(consts.Service.EC2)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ec2"]})
|
||||
@scenario.configure(context={"cleanup": ["ec2"]})
|
||||
def list_servers(self):
|
||||
"""List all servers.
|
||||
|
||||
@ -42,7 +42,7 @@ class EC2Servers(utils.EC2Scenario):
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.EC2)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["ec2"]})
|
||||
@scenario.configure(context={"cleanup": ["ec2"]})
|
||||
def boot_server(self, image, flavor, **kwargs):
|
||||
"""Boot a server.
|
||||
|
||||
|
@ -17,7 +17,7 @@ import time
|
||||
from oslo_config import cfg
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils
|
||||
|
||||
|
||||
@ -48,12 +48,12 @@ CONF.register_opts(EC2_BENCHMARK_OPTS, group=benchmark_group)
|
||||
class EC2Scenario(scenario.OpenStackScenario):
|
||||
"""Base class for EC2 scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("ec2.list_servers")
|
||||
@atomic.action_timer("ec2.list_servers")
|
||||
def _list_servers(self):
|
||||
"""Returns user servers list."""
|
||||
return self.clients("ec2").get_only_instances()
|
||||
|
||||
@base.atomic_action_timer("ec2.boot_servers")
|
||||
@atomic.action_timer("ec2.boot_servers")
|
||||
def _boot_servers(self, image_id, flavor_name,
|
||||
instance_num=1, **kwargs):
|
||||
"""Boot multiple servers.
|
||||
|
@ -12,8 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.fuel import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ class FuelEnvironments(utils.FuelScenario):
|
||||
|
||||
@validation.required_clients("fuel", admin=True)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_environments(self):
|
||||
"""List Fuel environments."""
|
||||
self._list_environments()
|
||||
|
@ -19,7 +19,7 @@ import six
|
||||
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
|
||||
class FuelClient(object):
|
||||
@ -59,7 +59,7 @@ def fuel(instance):
|
||||
class FuelScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Fuel scenarios."""
|
||||
|
||||
@base.atomic_action_timer("fuel.list_environments")
|
||||
@atomic.action_timer("fuel.list_environments")
|
||||
def _list_environments(self):
|
||||
"""List Fuel environments."""
|
||||
return self.admin_clients("fuel").environment.get_all()
|
||||
|
@ -14,9 +14,9 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.glance import utils
|
||||
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -29,7 +29,7 @@ class GlanceImages(utils.GlanceScenario, nova_utils.NovaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.GLANCE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["glance"]})
|
||||
@scenario.configure(context={"cleanup": ["glance"]})
|
||||
def create_and_list_image(self, container_format,
|
||||
image_location, disk_format, **kwargs):
|
||||
"""Add an image and then list all images.
|
||||
@ -57,7 +57,7 @@ class GlanceImages(utils.GlanceScenario, nova_utils.NovaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.GLANCE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["glance"]})
|
||||
@scenario.configure(context={"cleanup": ["glance"]})
|
||||
def list_images(self):
|
||||
"""List all images.
|
||||
|
||||
@ -73,7 +73,7 @@ class GlanceImages(utils.GlanceScenario, nova_utils.NovaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.GLANCE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["glance"]})
|
||||
@scenario.configure(context={"cleanup": ["glance"]})
|
||||
def create_and_delete_image(self, container_format,
|
||||
image_location, disk_format, **kwargs):
|
||||
"""Add and then delete an image.
|
||||
@ -95,7 +95,7 @@ class GlanceImages(utils.GlanceScenario, nova_utils.NovaScenario):
|
||||
@validation.flavor_exists("flavor")
|
||||
@validation.required_services(consts.Service.GLANCE, consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["glance", "nova"]})
|
||||
@scenario.configure(context={"cleanup": ["glance", "nova"]})
|
||||
def create_image_and_boot_instances(self, container_format,
|
||||
image_location, disk_format,
|
||||
flavor, number_instances,
|
||||
|
@ -19,7 +19,7 @@ import time
|
||||
from oslo_config import cfg
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils
|
||||
|
||||
|
||||
@ -53,12 +53,12 @@ CONF.register_opts(GLANCE_BENCHMARK_OPTS, group=benchmark_group)
|
||||
class GlanceScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Glance scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("glance.list_images")
|
||||
@atomic.action_timer("glance.list_images")
|
||||
def _list_images(self):
|
||||
"""Returns user images list."""
|
||||
return list(self.clients("glance").images.list())
|
||||
|
||||
@base.atomic_action_timer("glance.create_image")
|
||||
@atomic.action_timer("glance.create_image")
|
||||
def _create_image(self, container_format, image_location, disk_format,
|
||||
name=None, prefix=None, length=None, **kwargs):
|
||||
"""Create a new image.
|
||||
@ -110,7 +110,7 @@ class GlanceScenario(scenario.OpenStackScenario):
|
||||
|
||||
return image
|
||||
|
||||
@base.atomic_action_timer("glance.delete_image")
|
||||
@atomic.action_timer("glance.delete_image")
|
||||
def _delete_image(self, image):
|
||||
"""Deletes given image.
|
||||
|
||||
|
@ -14,8 +14,9 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.heat import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -29,7 +30,7 @@ class HeatStacks(utils.HeatScenario):
|
||||
@types.set(template_path=types.FileType, files=types.FileTypeDict)
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["heat"]})
|
||||
@scenario.configure(context={"cleanup": ["heat"]})
|
||||
def create_and_list_stack(self, template_path, parameters=None,
|
||||
files=None, environment=None):
|
||||
"""Add a stack and then list all stacks.
|
||||
@ -47,12 +48,12 @@ class HeatStacks(utils.HeatScenario):
|
||||
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_stacks_and_resources(self):
|
||||
"""List all resources from tenant stacks."""
|
||||
|
||||
stacks = self._list_stacks()
|
||||
with base.AtomicAction(
|
||||
with atomic.ActionTimer(
|
||||
self, "heat.list_resources_of_%s_stacks" % len(stacks)):
|
||||
for stack in stacks:
|
||||
self.clients("heat").resources.list(stack.id)
|
||||
@ -60,7 +61,7 @@ class HeatStacks(utils.HeatScenario):
|
||||
@types.set(template_path=types.FileType, files=types.FileTypeDict)
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["heat"]})
|
||||
@scenario.configure(context={"cleanup": ["heat"]})
|
||||
def create_and_delete_stack(self, template_path, parameters=None,
|
||||
files=None, environment=None):
|
||||
"""Add and then delete a stack.
|
||||
@ -81,7 +82,7 @@ class HeatStacks(utils.HeatScenario):
|
||||
@types.set(template_path=types.FileType, files=types.FileTypeDict)
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["heat"]})
|
||||
@scenario.configure(context={"cleanup": ["heat"]})
|
||||
def create_check_delete_stack(self, template_path, parameters=None,
|
||||
files=None, environment=None):
|
||||
"""Create, check and delete a stack.
|
||||
@ -108,7 +109,7 @@ class HeatStacks(utils.HeatScenario):
|
||||
updated_files=types.FileTypeDict)
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["heat"]})
|
||||
@scenario.configure(context={"cleanup": ["heat"]})
|
||||
def create_update_delete_stack(self, template_path,
|
||||
updated_template_path,
|
||||
parameters=None, updated_parameters=None,
|
||||
@ -143,7 +144,7 @@ class HeatStacks(utils.HeatScenario):
|
||||
@types.set(template_path=types.FileType, files=types.FileTypeDict)
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["heat"]})
|
||||
@scenario.configure(context={"cleanup": ["heat"]})
|
||||
def create_stack_and_scale(self, template_path, output_key, delta,
|
||||
parameters=None, files=None,
|
||||
environment=None):
|
||||
@ -180,7 +181,7 @@ class HeatStacks(utils.HeatScenario):
|
||||
@types.set(template_path=types.FileType, files=types.FileTypeDict)
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["heat"]})
|
||||
@scenario.configure(context={"cleanup": ["heat"]})
|
||||
def create_suspend_resume_delete_stack(self, template_path,
|
||||
parameters=None, files=None,
|
||||
environment=None):
|
||||
@ -205,12 +206,12 @@ class HeatStacks(utils.HeatScenario):
|
||||
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_stacks_and_events(self):
|
||||
"""List events from tenant stacks."""
|
||||
|
||||
stacks = self._list_stacks()
|
||||
with base.AtomicAction(
|
||||
with atomic.ActionTimer(
|
||||
self, "heat.list_events_of_%s_stacks" % len(stacks)):
|
||||
for stack in stacks:
|
||||
self.clients("heat").events.list(stack.id)
|
||||
@ -218,7 +219,7 @@ class HeatStacks(utils.HeatScenario):
|
||||
@types.set(template_path=types.FileType, files=types.FileTypeDict)
|
||||
@validation.required_services(consts.Service.HEAT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["heat"]})
|
||||
@scenario.configure(context={"cleanup": ["heat"]})
|
||||
def create_snapshot_restore_delete_stack(self, template_path,
|
||||
parameters=None, files=None,
|
||||
environment=None):
|
||||
|
@ -21,7 +21,7 @@ import requests
|
||||
from rally.common import log as logging
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -110,13 +110,13 @@ CONF.register_opts(HEAT_BENCHMARK_OPTS, group=benchmark_group)
|
||||
class HeatScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Heat scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("heat.list_stacks")
|
||||
@atomic.action_timer("heat.list_stacks")
|
||||
def _list_stacks(self):
|
||||
"""Return user stack list."""
|
||||
|
||||
return list(self.clients("heat").stacks.list())
|
||||
|
||||
@base.atomic_action_timer("heat.create_stack")
|
||||
@atomic.action_timer("heat.create_stack")
|
||||
def _create_stack(self, template, parameters=None,
|
||||
files=None, environment=None):
|
||||
"""Create a new stack.
|
||||
@ -154,7 +154,7 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
|
||||
return stack
|
||||
|
||||
@base.atomic_action_timer("heat.update_stack")
|
||||
@atomic.action_timer("heat.update_stack")
|
||||
def _update_stack(self, stack, template, parameters=None,
|
||||
files=None, environment=None):
|
||||
"""Update an existing stack
|
||||
@ -187,7 +187,7 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.heat_stack_update_poll_interval)
|
||||
return stack
|
||||
|
||||
@base.atomic_action_timer("heat.check_stack")
|
||||
@atomic.action_timer("heat.check_stack")
|
||||
def _check_stack(self, stack):
|
||||
"""Check given stack.
|
||||
|
||||
@ -203,7 +203,7 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
timeout=CONF.benchmark.heat_stack_check_timeout,
|
||||
check_interval=CONF.benchmark.heat_stack_check_poll_interval)
|
||||
|
||||
@base.atomic_action_timer("heat.delete_stack")
|
||||
@atomic.action_timer("heat.delete_stack")
|
||||
def _delete_stack(self, stack):
|
||||
"""Delete given stack.
|
||||
|
||||
@ -218,7 +218,7 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
timeout=CONF.benchmark.heat_stack_delete_timeout,
|
||||
check_interval=CONF.benchmark.heat_stack_delete_poll_interval)
|
||||
|
||||
@base.atomic_action_timer("heat.suspend_stack")
|
||||
@atomic.action_timer("heat.suspend_stack")
|
||||
def _suspend_stack(self, stack):
|
||||
"""Suspend given stack.
|
||||
|
||||
@ -234,7 +234,7 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
timeout=CONF.benchmark.heat_stack_suspend_timeout,
|
||||
check_interval=CONF.benchmark.heat_stack_suspend_poll_interval)
|
||||
|
||||
@base.atomic_action_timer("heat.resume_stack")
|
||||
@atomic.action_timer("heat.resume_stack")
|
||||
def _resume_stack(self, stack):
|
||||
"""Resume given stack.
|
||||
|
||||
@ -250,7 +250,7 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
timeout=CONF.benchmark.heat_stack_resume_timeout,
|
||||
check_interval=CONF.benchmark.heat_stack_resume_poll_interval)
|
||||
|
||||
@base.atomic_action_timer("heat.snapshot_stack")
|
||||
@atomic.action_timer("heat.snapshot_stack")
|
||||
def _snapshot_stack(self, stack):
|
||||
"""Creates a snapshot for given stack.
|
||||
|
||||
@ -268,7 +268,7 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.heat_stack_snapshot_poll_interval)
|
||||
return snapshot
|
||||
|
||||
@base.atomic_action_timer("heat.restore_stack")
|
||||
@atomic.action_timer("heat.restore_stack")
|
||||
def _restore_stack(self, stack, snapshot_id):
|
||||
"""Restores stack from given snapshot.
|
||||
|
||||
@ -311,7 +311,7 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
expected_instances = num_instances + delta
|
||||
LOG.debug("Scaling stack %s from %s to %s instances with %s" %
|
||||
(stack.id, num_instances, expected_instances, output_key))
|
||||
with base.AtomicAction(self, "heat.scale_with_%s" % output_key):
|
||||
with atomic.ActionTimer(self, "heat.scale_with_%s" % output_key):
|
||||
self._stack_webhook(stack, output_key)
|
||||
utils.wait_for(
|
||||
stack,
|
||||
@ -341,5 +341,5 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
"No output key %(key)s found in stack %(id)s" %
|
||||
{"key": output_key, "id": stack.id})
|
||||
|
||||
with base.AtomicAction(self, "heat.%s_webhook" % output_key):
|
||||
with atomic.ActionTimer(self, "heat.%s_webhook" % output_key):
|
||||
requests.post(url).raise_for_status()
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.ironic import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class IronicNodes(utils.IronicScenario):
|
||||
@validation.required_parameters("driver")
|
||||
@validation.required_services(consts.Service.IRONIC)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["ironic"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["ironic"]})
|
||||
def create_and_list_node(
|
||||
self, associated=None, maintenance=None,
|
||||
marker=None, limit=None, detail=False, sort_key=None,
|
||||
@ -68,7 +68,7 @@ class IronicNodes(utils.IronicScenario):
|
||||
@validation.required_parameters("driver")
|
||||
@validation.required_services(consts.Service.IRONIC)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["ironic"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["ironic"]})
|
||||
def create_and_delete_node(self, **kwargs):
|
||||
"""Create and delete node.
|
||||
|
||||
|
@ -20,7 +20,7 @@ from oslo_config import cfg
|
||||
|
||||
from rally.common import utils
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
|
||||
IRONIC_BENCHMARK_OPTS = [
|
||||
@ -38,7 +38,7 @@ CONF.register_opts(IRONIC_BENCHMARK_OPTS, group=benchmark_group)
|
||||
class IronicScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Ironic scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("ironic.create_node")
|
||||
@atomic.action_timer("ironic.create_node")
|
||||
def _create_node(self, **kwargs):
|
||||
"""Create node immediately.
|
||||
|
||||
@ -58,7 +58,7 @@ class IronicScenario(scenario.OpenStackScenario):
|
||||
|
||||
return self.admin_clients("ironic").node.create(**kwargs)
|
||||
|
||||
@base.atomic_action_timer("ironic.list_nodes")
|
||||
@atomic.action_timer("ironic.list_nodes")
|
||||
def _list_nodes(self, associated=None, maintenance=None, marker=None,
|
||||
limit=None, detail=False, sort_key=None, sort_dir=None):
|
||||
"""Return list of nodes.
|
||||
@ -93,7 +93,7 @@ class IronicScenario(scenario.OpenStackScenario):
|
||||
associated=associated, maintenance=maintenance, marker=marker,
|
||||
limit=limit, detail=detail, sort_key=sort_key, sort_dir=sort_dir)
|
||||
|
||||
@base.atomic_action_timer("ironic.delete_node")
|
||||
@atomic.action_timer("ironic.delete_node")
|
||||
def _delete_node(self, node_id):
|
||||
"""Delete the node with specific id.
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally.common import utils
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.keystone import utils as kutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
|
||||
@validation.number("name_length", minval=10)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_user(self, name_length=10, **kwargs):
|
||||
"""Create a keystone user with random name.
|
||||
|
||||
@ -36,7 +36,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
|
||||
@validation.number("name_length", minval=10)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_delete_user(self, name_length=10, **kwargs):
|
||||
"""Create a keystone user with random name and then delete it.
|
||||
|
||||
@ -48,7 +48,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
self._resource_delete(user)
|
||||
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_user_set_enabled_and_delete(self, enabled=True, **kwargs):
|
||||
"""Create a keystone user, enable or disable it, and delete it.
|
||||
|
||||
@ -63,7 +63,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
|
||||
@validation.number("name_length", minval=10)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_tenant(self, name_length=10, **kwargs):
|
||||
"""Create a keystone tenant with random name.
|
||||
|
||||
@ -75,7 +75,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
@validation.number("name_length", minval=10)
|
||||
@validation.number("users_per_tenant", minval=1)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_tenant_with_users(self, users_per_tenant, name_length=10,
|
||||
**kwargs):
|
||||
"""Create a keystone tenant and several users belonging to it.
|
||||
@ -91,7 +91,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
|
||||
@validation.number("name_length", minval=10)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_and_list_users(self, name_length=10, **kwargs):
|
||||
"""Create a keystone user with random name and list all users.
|
||||
|
||||
@ -104,7 +104,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
|
||||
@validation.number("name_length", minval=10)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_and_list_tenants(self, name_length=10, **kwargs):
|
||||
"""Create a keystone tenant with random name and list all tenants.
|
||||
|
||||
@ -115,7 +115,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
self._list_tenants()
|
||||
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def add_and_remove_user_role(self):
|
||||
"""Create a user role add to a user and disassociate."""
|
||||
tenant_id = self.context["tenant"]["id"]
|
||||
@ -125,14 +125,14 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
self._role_remove(user_id, role, tenant_id)
|
||||
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_and_delete_role(self):
|
||||
"""Create a user role and delete it."""
|
||||
role = self._role_create()
|
||||
self._resource_delete(role)
|
||||
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_add_and_list_user_roles(self):
|
||||
"""Create user role, add it and list user roles for given user."""
|
||||
tenant_id = self.context["tenant"]["id"]
|
||||
@ -142,7 +142,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
self._list_roles_for_user(user_id, tenant_id)
|
||||
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def get_entities(self, service_name="keystone"):
|
||||
"""Get instance of a tenant, user, role and service by id's.
|
||||
|
||||
@ -173,7 +173,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
@utils.log_deprecated_args(
|
||||
"The 'name' argument to create_and_delete_service will be ignored",
|
||||
"0.0.5", ["name"])
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_and_delete_service(self, name=None, service_type=None,
|
||||
description=None):
|
||||
"""Create and delete service.
|
||||
@ -186,7 +186,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
|
||||
@validation.number("name_length", minval=10)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_update_and_delete_tenant(self, name_length=10, **kwargs):
|
||||
"""Create, update and delete tenant.
|
||||
|
||||
@ -200,7 +200,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
@validation.number("password_length", minval=10)
|
||||
@validation.number("name_length", minval=10)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_user_update_password(self, name_length=10, password_length=10):
|
||||
"""Create user and update password for that user.
|
||||
|
||||
@ -215,7 +215,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
@utils.log_deprecated_args(
|
||||
"The 'name' argument to create_and_list_services will be ignored",
|
||||
"0.0.5", ["name"])
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_and_list_services(self, name=None, service_type=None,
|
||||
description=None):
|
||||
"""Create and list services.
|
||||
@ -227,7 +227,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
self._list_services()
|
||||
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_and_list_ec2credentials(self):
|
||||
"""Create and List all keystone ec2-credentials."""
|
||||
self._create_ec2credentials(self.context["user"]["id"],
|
||||
@ -235,7 +235,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
|
||||
self._list_ec2credentials(self.context["user"]["id"])
|
||||
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["keystone"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["keystone"]})
|
||||
def create_and_delete_ec2credential(self):
|
||||
"""Create and delete keystone ec2-credential."""
|
||||
creds = self._create_ec2credentials(self.context["user"]["id"],
|
||||
|
@ -16,7 +16,7 @@
|
||||
import uuid
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
|
||||
def is_temporary(resource):
|
||||
@ -28,7 +28,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
|
||||
RESOURCE_NAME_PREFIX = "rally_keystone_"
|
||||
|
||||
@base.atomic_action_timer("keystone.create_user")
|
||||
@atomic.action_timer("keystone.create_user")
|
||||
def _user_create(self, name_length=10, email=None, **kwargs):
|
||||
"""Creates keystone user with random name.
|
||||
|
||||
@ -46,7 +46,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
return self.admin_clients("keystone").users.create(
|
||||
name, password=password, email=email, **kwargs)
|
||||
|
||||
@base.atomic_action_timer("keystone.update_user_enabled")
|
||||
@atomic.action_timer("keystone.update_user_enabled")
|
||||
def _update_user_enabled(self, user, enabled):
|
||||
"""Enable or disable a user.
|
||||
|
||||
@ -59,10 +59,10 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
def _resource_delete(self, resource):
|
||||
""""Delete keystone resource."""
|
||||
r = "keystone.delete_%s" % resource.__class__.__name__.lower()
|
||||
with base.AtomicAction(self, r):
|
||||
with atomic.ActionTimer(self, r):
|
||||
resource.delete()
|
||||
|
||||
@base.atomic_action_timer("keystone.create_tenant")
|
||||
@atomic.action_timer("keystone.create_tenant")
|
||||
def _tenant_create(self, name_length=10, **kwargs):
|
||||
"""Creates keystone tenant with random name.
|
||||
|
||||
@ -73,7 +73,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
name = self._generate_random_name(length=name_length)
|
||||
return self.admin_clients("keystone").tenants.create(name, **kwargs)
|
||||
|
||||
@base.atomic_action_timer("keystone.create_service")
|
||||
@atomic.action_timer("keystone.create_service")
|
||||
def _service_create(self, service_type="rally_test_type",
|
||||
description=None):
|
||||
"""Creates keystone service with random name.
|
||||
@ -89,7 +89,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
self._generate_random_name(),
|
||||
service_type, description)
|
||||
|
||||
@base.atomic_action_timer("keystone.create_users")
|
||||
@atomic.action_timer("keystone.create_users")
|
||||
def _users_create(self, tenant, users_per_tenant, name_length=10):
|
||||
"""Adds users to a tenant.
|
||||
|
||||
@ -104,7 +104,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
self.admin_clients("keystone").users.create(
|
||||
name, password=password, email=email, tenant_id=tenant.id)
|
||||
|
||||
@base.atomic_action_timer("keystone.create_role")
|
||||
@atomic.action_timer("keystone.create_role")
|
||||
def _role_create(self, name_length=5):
|
||||
"""Creates keystone user role with random name.
|
||||
|
||||
@ -115,22 +115,22 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
self._generate_random_name(length=name_length))
|
||||
return role
|
||||
|
||||
@base.atomic_action_timer("keystone.list_users")
|
||||
@atomic.action_timer("keystone.list_users")
|
||||
def _list_users(self):
|
||||
"""List users."""
|
||||
return self.admin_clients("keystone").users.list()
|
||||
|
||||
@base.atomic_action_timer("keystone.list_tenants")
|
||||
@atomic.action_timer("keystone.list_tenants")
|
||||
def _list_tenants(self):
|
||||
"""List tenants."""
|
||||
return self.admin_clients("keystone").tenants.list()
|
||||
|
||||
@base.atomic_action_timer("keystone.service_list")
|
||||
@atomic.action_timer("keystone.service_list")
|
||||
def _list_services(self):
|
||||
"""List services."""
|
||||
return self.admin_clients("keystone").services.list()
|
||||
|
||||
@base.atomic_action_timer("keystone.list_roles")
|
||||
@atomic.action_timer("keystone.list_roles")
|
||||
def _list_roles_for_user(self, user, tenant):
|
||||
"""List user roles.
|
||||
|
||||
@ -140,7 +140,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
return self.admin_clients("keystone").roles.roles_for_user(
|
||||
user, tenant)
|
||||
|
||||
@base.atomic_action_timer("keystone.add_role")
|
||||
@atomic.action_timer("keystone.add_role")
|
||||
def _role_add(self, user, role, tenant):
|
||||
"""Add role to a given user on a tenant.
|
||||
|
||||
@ -150,7 +150,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.admin_clients("keystone").roles.add_user_role(user, role, tenant)
|
||||
|
||||
@base.atomic_action_timer("keystone.remove_role")
|
||||
@atomic.action_timer("keystone.remove_role")
|
||||
def _role_remove(self, user, role, tenant):
|
||||
"""Dissociate user with role.
|
||||
|
||||
@ -161,7 +161,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
self.admin_clients("keystone").roles.remove_user_role(user,
|
||||
role, tenant)
|
||||
|
||||
@base.atomic_action_timer("keystone.get_tenant")
|
||||
@atomic.action_timer("keystone.get_tenant")
|
||||
def _get_tenant(self, tenant_id):
|
||||
"""Get given tenant.
|
||||
|
||||
@ -169,7 +169,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.admin_clients("keystone").tenants.get(tenant_id)
|
||||
|
||||
@base.atomic_action_timer("keystone.get_user")
|
||||
@atomic.action_timer("keystone.get_user")
|
||||
def _get_user(self, user_id):
|
||||
"""Get given user.
|
||||
|
||||
@ -177,7 +177,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.admin_clients("keystone").users.get(user_id)
|
||||
|
||||
@base.atomic_action_timer("keystone.get_role")
|
||||
@atomic.action_timer("keystone.get_role")
|
||||
def _get_role(self, role_id):
|
||||
"""Get given user role.
|
||||
|
||||
@ -185,7 +185,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.admin_clients("keystone").roles.get(role_id)
|
||||
|
||||
@base.atomic_action_timer("keystone.get_service")
|
||||
@atomic.action_timer("keystone.get_service")
|
||||
def _get_service(self, service_id):
|
||||
"""Get service with given service id.
|
||||
|
||||
@ -198,7 +198,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
if i.name == name:
|
||||
return i
|
||||
|
||||
@base.atomic_action_timer("keystone.delete_service")
|
||||
@atomic.action_timer("keystone.delete_service")
|
||||
def _delete_service(self, service_id):
|
||||
"""Delete service.
|
||||
|
||||
@ -206,7 +206,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.admin_clients("keystone").services.delete(service_id)
|
||||
|
||||
@base.atomic_action_timer("keystone.update_tenant")
|
||||
@atomic.action_timer("keystone.update_tenant")
|
||||
def _update_tenant(self, tenant, name=None, description=None):
|
||||
"""Update tenant name and description.
|
||||
|
||||
@ -219,7 +219,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
self.admin_clients("keystone").tenants.update(tenant.id,
|
||||
name, description)
|
||||
|
||||
@base.atomic_action_timer("keystone.update_user_password")
|
||||
@atomic.action_timer("keystone.update_user_password")
|
||||
def _update_user_password(self, user_id, password):
|
||||
"""Update user password.
|
||||
|
||||
@ -232,7 +232,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
else:
|
||||
admin_clients.users.update_password(user_id, password)
|
||||
|
||||
@base.atomic_action_timer("keystone.create_ec2creds")
|
||||
@atomic.action_timer("keystone.create_ec2creds")
|
||||
def _create_ec2credentials(self, user_id, tenant_id):
|
||||
"""Create ec2credentials.
|
||||
|
||||
@ -243,7 +243,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.clients("keystone").ec2.create(user_id, tenant_id)
|
||||
|
||||
@base.atomic_action_timer("keystone.list_ec2creds")
|
||||
@atomic.action_timer("keystone.list_ec2creds")
|
||||
def _list_ec2credentials(self, user_id):
|
||||
"""List of access/secret pairs for a user_id.
|
||||
|
||||
@ -253,7 +253,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
return self.clients("keystone").ec2.list(user_id)
|
||||
|
||||
@base.atomic_action_timer("keystone.delete_ec2creds")
|
||||
@atomic.action_timer("keystone.delete_ec2creds")
|
||||
def _delete_ec2credential(self, user_id, access):
|
||||
"""Delete ec2credential.
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.manila import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class ManilaShares(utils.ManilaScenario):
|
||||
@validation.validate_share_proto()
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["manila"]})
|
||||
@scenario.configure(context={"cleanup": ["manila"]})
|
||||
def create_and_delete_share(self, share_proto, size=1, min_sleep=0,
|
||||
max_sleep=0, **kwargs):
|
||||
"""Create and delete a share.
|
||||
@ -50,7 +50,7 @@ class ManilaShares(utils.ManilaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_shares(self, detailed=True, search_opts=None):
|
||||
"""Basic scenario for 'share list' operation.
|
||||
|
||||
@ -63,7 +63,7 @@ class ManilaShares(utils.ManilaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["manila"]})
|
||||
@scenario.configure(context={"cleanup": ["manila"]})
|
||||
def create_share_network_and_delete(self,
|
||||
neutron_net_id=None,
|
||||
neutron_subnet_id=None,
|
||||
@ -89,7 +89,7 @@ class ManilaShares(utils.ManilaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["manila"]})
|
||||
@scenario.configure(context={"cleanup": ["manila"]})
|
||||
def create_share_network_and_list(self,
|
||||
neutron_net_id=None,
|
||||
neutron_subnet_id=None,
|
||||
@ -124,7 +124,7 @@ class ManilaShares(utils.ManilaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_share_servers(self, search_opts=None):
|
||||
"""Lists share servers.
|
||||
|
||||
@ -137,7 +137,7 @@ class ManilaShares(utils.ManilaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["manila"]})
|
||||
@scenario.configure(context={"cleanup": ["manila"]})
|
||||
def create_security_service_and_delete(self, security_service_type,
|
||||
dns_ip=None, server=None,
|
||||
domain=None, user=None,
|
||||
@ -169,7 +169,7 @@ class ManilaShares(utils.ManilaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["manila"]})
|
||||
@scenario.configure(context={"cleanup": ["manila"]})
|
||||
def attach_security_service_to_share_network(self,
|
||||
security_service_type="ldap"):
|
||||
"""Attaches security service to share network.
|
||||
|
@ -18,7 +18,7 @@ import time
|
||||
from oslo_config import cfg
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ CONF.register_opts(MANILA_BENCHMARK_OPTS, group=benchmark_group)
|
||||
class ManilaScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Manila scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("manila.create_share")
|
||||
@atomic.action_timer("manila.create_share")
|
||||
def _create_share(self, share_proto, size=1, **kwargs):
|
||||
"""Create a share.
|
||||
|
||||
@ -87,7 +87,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
)
|
||||
return share
|
||||
|
||||
@base.atomic_action_timer("manila.delete_share")
|
||||
@atomic.action_timer("manila.delete_share")
|
||||
def _delete_share(self, share):
|
||||
"""Delete the given share.
|
||||
|
||||
@ -101,7 +101,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
timeout=CONF.benchmark.manila_share_delete_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
|
||||
|
||||
@base.atomic_action_timer("manila.list_shares")
|
||||
@atomic.action_timer("manila.list_shares")
|
||||
def _list_shares(self, detailed=True, search_opts=None):
|
||||
"""Returns user shares list.
|
||||
|
||||
@ -113,7 +113,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
return self.clients("manila").shares.list(
|
||||
detailed=detailed, search_opts=search_opts)
|
||||
|
||||
@base.atomic_action_timer("manila.create_share_network")
|
||||
@atomic.action_timer("manila.create_share_network")
|
||||
def _create_share_network(self, neutron_net_id=None,
|
||||
neutron_subnet_id=None,
|
||||
nova_net_id=None, name=None, description=None):
|
||||
@ -135,7 +135,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
description=description)
|
||||
return share_network
|
||||
|
||||
@base.atomic_action_timer("manila.delete_share_network")
|
||||
@atomic.action_timer("manila.delete_share_network")
|
||||
def _delete_share_network(self, share_network):
|
||||
"""Delete share network.
|
||||
|
||||
@ -148,7 +148,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
timeout=CONF.benchmark.manila_share_delete_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
|
||||
|
||||
@base.atomic_action_timer("manila.list_share_networks")
|
||||
@atomic.action_timer("manila.list_share_networks")
|
||||
def _list_share_networks(self, detailed=True, search_opts=None):
|
||||
"""List share networks.
|
||||
|
||||
@ -162,7 +162,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
detailed=detailed, search_opts=search_opts)
|
||||
return share_networks
|
||||
|
||||
@base.atomic_action_timer("manila.list_share_servers")
|
||||
@atomic.action_timer("manila.list_share_servers")
|
||||
def _list_share_servers(self, search_opts=None):
|
||||
"""List share servers. Admin only.
|
||||
|
||||
@ -174,7 +174,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
search_opts=search_opts)
|
||||
return share_servers
|
||||
|
||||
@base.atomic_action_timer("manila.create_security_service")
|
||||
@atomic.action_timer("manila.create_security_service")
|
||||
def _create_security_service(self, security_service_type, dns_ip=None,
|
||||
server=None, domain=None, user=None,
|
||||
password=None, name=None, description=None):
|
||||
@ -206,7 +206,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
description=description)
|
||||
return security_service
|
||||
|
||||
@base.atomic_action_timer("manila.delete_security_service")
|
||||
@atomic.action_timer("manila.delete_security_service")
|
||||
def _delete_security_service(self, security_service):
|
||||
"""Delete security service.
|
||||
|
||||
@ -219,7 +219,7 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
timeout=CONF.benchmark.manila_share_delete_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
|
||||
|
||||
@base.atomic_action_timer("manila.add_security_service_to_share_network")
|
||||
@atomic.action_timer("manila.add_security_service_to_share_network")
|
||||
def _add_security_service_to_share_network(self, share_network,
|
||||
security_service):
|
||||
"""Associate given security service with a share network.
|
||||
|
@ -16,18 +16,18 @@
|
||||
import yaml
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
|
||||
class MistralScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Mistral scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("mistral.list_workbooks")
|
||||
@atomic.action_timer("mistral.list_workbooks")
|
||||
def _list_workbooks(self):
|
||||
"""Gets list of existing workbooks."""
|
||||
return self.clients("mistral").workbooks.list()
|
||||
|
||||
@base.atomic_action_timer("mistral.create_workbook")
|
||||
@atomic.action_timer("mistral.create_workbook")
|
||||
def _create_workbook(self, definition):
|
||||
"""Create a new workbook.
|
||||
|
||||
@ -41,7 +41,7 @@ class MistralScenario(scenario.OpenStackScenario):
|
||||
|
||||
return self.clients("mistral").workbooks.create(definition)
|
||||
|
||||
@base.atomic_action_timer("mistral.delete_workbook")
|
||||
@atomic.action_timer("mistral.delete_workbook")
|
||||
def _delete_workbook(self, wb_name):
|
||||
"""Delete the given workbook.
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.mistral import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -26,7 +26,7 @@ class MistralWorkbooks(utils.MistralScenario):
|
||||
@validation.required_clients("mistral")
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_services(consts.Service.MISTRAL)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_workbooks(self):
|
||||
"""Scenario test mistral workbook-list command.
|
||||
|
||||
@ -41,7 +41,7 @@ class MistralWorkbooks(utils.MistralScenario):
|
||||
@validation.required_clients("mistral")
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_services(consts.Service.MISTRAL)
|
||||
@base.scenario(context={"cleanup": ["mistral"]})
|
||||
@scenario.configure(context={"cleanup": ["mistral"]})
|
||||
def create_workbook(self, definition, do_delete=False):
|
||||
"""Scenario tests workbook creation and deletion.
|
||||
|
||||
|
@ -15,8 +15,9 @@
|
||||
|
||||
from rally.common import log as logging
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.murano import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import validation
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -26,7 +27,7 @@ class MuranoEnvironments(utils.MuranoScenario):
|
||||
"""Benchmark scenarios for Murano environments."""
|
||||
@validation.required_clients("murano")
|
||||
@validation.required_services(consts.Service.MURANO)
|
||||
@base.scenario(context={"cleanup": ["murano.environments"]})
|
||||
@scenario.configure(context={"cleanup": ["murano.environments"]})
|
||||
def list_environments(self):
|
||||
"""List the murano environments.
|
||||
|
||||
@ -36,7 +37,7 @@ class MuranoEnvironments(utils.MuranoScenario):
|
||||
|
||||
@validation.required_clients("murano")
|
||||
@validation.required_services(consts.Service.MURANO)
|
||||
@base.scenario(context={"cleanup": ["murano.environments"]})
|
||||
@scenario.configure(context={"cleanup": ["murano.environments"]})
|
||||
def create_and_delete_environment(self):
|
||||
"""Create environment, session and delete environment."""
|
||||
environment = self._create_environment()
|
||||
@ -47,7 +48,7 @@ class MuranoEnvironments(utils.MuranoScenario):
|
||||
@validation.required_clients("murano")
|
||||
@validation.required_services(consts.Service.MURANO)
|
||||
@validation.required_contexts("murano_packages")
|
||||
@base.scenario(context={"cleanup": ["murano"], "roles": ["admin"]})
|
||||
@scenario.configure(context={"cleanup": ["murano"], "roles": ["admin"]})
|
||||
def create_and_deploy_environment(self, packages_per_env=1):
|
||||
"""Create environment, session and deploy environment.
|
||||
|
||||
@ -60,7 +61,7 @@ class MuranoEnvironments(utils.MuranoScenario):
|
||||
session = self._create_session(environment.id)
|
||||
package = self.context["tenant"]["packages"][0]
|
||||
|
||||
with base.AtomicAction(self, "murano.create_service"):
|
||||
with atomic.ActionTimer(self, "murano.create_service"):
|
||||
for i in range(packages_per_env):
|
||||
self._create_service(environment, session,
|
||||
package.fully_qualified_name,
|
||||
|
@ -18,7 +18,7 @@ import uuid
|
||||
from oslo_config import cfg
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
@ -41,12 +41,12 @@ CONF.register_opts(MURANO_TIMEOUT_OPTS, group=benchmark_group)
|
||||
class MuranoScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Murano scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("murano.list_environments")
|
||||
@atomic.action_timer("murano.list_environments")
|
||||
def _list_environments(self):
|
||||
"""Return environments list."""
|
||||
return self.clients("murano").environments.list()
|
||||
|
||||
@base.atomic_action_timer("murano.create_environment")
|
||||
@atomic.action_timer("murano.create_environment")
|
||||
def _create_environment(self, env_name=None):
|
||||
"""Create environment.
|
||||
|
||||
@ -57,7 +57,7 @@ class MuranoScenario(scenario.OpenStackScenario):
|
||||
env_name = env_name or self._generate_random_name()
|
||||
return self.clients("murano").environments.create({"name": env_name})
|
||||
|
||||
@base.atomic_action_timer("murano.delete_environment")
|
||||
@atomic.action_timer("murano.delete_environment")
|
||||
def _delete_environment(self, environment):
|
||||
"""Delete given environment.
|
||||
|
||||
@ -73,7 +73,7 @@ class MuranoScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.delete_environment_check_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("murano.create_session")
|
||||
@atomic.action_timer("murano.create_session")
|
||||
def _create_session(self, environment_id):
|
||||
"""Create session for environment with specific id
|
||||
|
||||
@ -101,7 +101,7 @@ class MuranoScenario(scenario.OpenStackScenario):
|
||||
"name": self._generate_random_name("rally_")}
|
||||
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "murano.create_service"):
|
||||
with atomic.ActionTimer(self, "murano.create_service"):
|
||||
return self.clients("murano").services.post(
|
||||
environment_id=environment.id, path="/", data=data,
|
||||
session_id=session.id)
|
||||
@ -110,7 +110,7 @@ class MuranoScenario(scenario.OpenStackScenario):
|
||||
environment_id=environment.id, path="/", data=data,
|
||||
session_id=session.id)
|
||||
|
||||
@base.atomic_action_timer("murano.deploy_environment")
|
||||
@atomic.action_timer("murano.deploy_environment")
|
||||
def _deploy_environment(self, environment, session):
|
||||
"""Deploy environment.
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.neutron import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class NeutronLoadbalancerV1(utils.NeutronScenario):
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_contexts("network")
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_list_pools(self, pool_create_args=None):
|
||||
"""Create a pool(v1) and then list pools(v1).
|
||||
|
||||
@ -43,7 +43,7 @@ class NeutronLoadbalancerV1(utils.NeutronScenario):
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_contexts("network")
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_delete_pools(self, pool_create_args=None):
|
||||
"""Create pools(v1) and delete pools(v1).
|
||||
|
||||
@ -64,7 +64,7 @@ class NeutronLoadbalancerV1(utils.NeutronScenario):
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_contexts("network")
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_update_pools(self, pool_update_args=None,
|
||||
pool_create_args=None):
|
||||
"""Create pools(v1) and update pools(v1).
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.neutron import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_list_networks(self, network_create_args=None):
|
||||
"""Create a network and then list all networks.
|
||||
|
||||
@ -43,7 +43,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_update_networks(self,
|
||||
network_update_args,
|
||||
network_create_args=None):
|
||||
@ -58,7 +58,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
self._update_network(network, network_update_args)
|
||||
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_delete_networks(self, network_create_args=None):
|
||||
"""Create and delete a network.
|
||||
|
||||
@ -72,7 +72,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
@validation.number("subnets_per_network", minval=1, integer_only=True)
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_list_subnets(self,
|
||||
network_create_args=None,
|
||||
subnet_create_args=None,
|
||||
@ -97,7 +97,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
@validation.number("subnets_per_network", minval=1, integer_only=True)
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_update_subnets(self,
|
||||
subnet_update_args,
|
||||
network_create_args=None,
|
||||
@ -127,7 +127,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
|
||||
@validation.required_parameters("subnets_per_network")
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_delete_subnets(self,
|
||||
network_create_args=None,
|
||||
subnet_create_args=None,
|
||||
@ -155,7 +155,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
@validation.number("subnets_per_network", minval=1, integer_only=True)
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_list_routers(self,
|
||||
network_create_args=None,
|
||||
subnet_create_args=None,
|
||||
@ -190,7 +190,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
@validation.number("subnets_per_network", minval=1, integer_only=True)
|
||||
@validation.required_parameters("subnets_per_network")
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_update_routers(self,
|
||||
router_update_args,
|
||||
network_create_args=None,
|
||||
@ -223,9 +223,9 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
{"subnet_id": subnet["subnet"]["id"]})
|
||||
self._update_router(router, router_update_args)
|
||||
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@validation.required_parameters("subnets_per_network")
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_delete_routers(self,
|
||||
network_create_args=None,
|
||||
subnet_create_args=None,
|
||||
@ -268,7 +268,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
@validation.number("ports_per_network", minval=1, integer_only=True)
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_list_ports(self,
|
||||
network_create_args=None,
|
||||
port_create_args=None,
|
||||
@ -288,7 +288,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
@validation.number("ports_per_network", minval=1, integer_only=True)
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_update_ports(self,
|
||||
port_update_args,
|
||||
network_create_args=None,
|
||||
@ -311,7 +311,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
|
||||
@validation.required_parameters("ports_per_network")
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@base.scenario(context={"cleanup": ["neutron"]})
|
||||
@scenario.configure(context={"cleanup": ["neutron"]})
|
||||
def create_and_delete_ports(self,
|
||||
network_create_args=None,
|
||||
port_create_args=None,
|
||||
|
@ -17,7 +17,7 @@ from rally.common.i18n import _
|
||||
from rally.common import log as logging
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -62,7 +62,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
"id": list(resource.values())[0]["id"],
|
||||
"name": kwargs["name"]})
|
||||
|
||||
@base.atomic_action_timer("neutron.create_network")
|
||||
@atomic.action_timer("neutron.create_network")
|
||||
def _create_network(self, network_create_args):
|
||||
"""Create neutron network.
|
||||
|
||||
@ -73,12 +73,12 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
return self.clients("neutron").create_network(
|
||||
{"network": network_create_args})
|
||||
|
||||
@base.atomic_action_timer("neutron.list_networks")
|
||||
@atomic.action_timer("neutron.list_networks")
|
||||
def _list_networks(self):
|
||||
"""Return user networks list."""
|
||||
return self.clients("neutron").list_networks()["networks"]
|
||||
|
||||
@base.atomic_action_timer("neutron.update_network")
|
||||
@atomic.action_timer("neutron.update_network")
|
||||
def _update_network(self, network, network_update_args):
|
||||
"""Update the network.
|
||||
|
||||
@ -93,7 +93,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
return self.clients("neutron").update_network(
|
||||
network["network"]["id"], body)
|
||||
|
||||
@base.atomic_action_timer("neutron.delete_network")
|
||||
@atomic.action_timer("neutron.delete_network")
|
||||
def _delete_network(self, network):
|
||||
"""Delete neutron network.
|
||||
|
||||
@ -101,7 +101,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.clients("neutron").delete_network(network["id"])
|
||||
|
||||
@base.atomic_action_timer("neutron.create_subnet")
|
||||
@atomic.action_timer("neutron.create_subnet")
|
||||
def _create_subnet(self, network, subnet_create_args, start_cidr=None):
|
||||
"""Create neutron subnet.
|
||||
|
||||
@ -124,12 +124,12 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
return self.clients("neutron").create_subnet(
|
||||
{"subnet": subnet_create_args})
|
||||
|
||||
@base.atomic_action_timer("neutron.list_subnets")
|
||||
@atomic.action_timer("neutron.list_subnets")
|
||||
def _list_subnets(self):
|
||||
"""Returns user subnetworks list."""
|
||||
return self.clients("neutron").list_subnets()["subnets"]
|
||||
|
||||
@base.atomic_action_timer("neutron.update_subnet")
|
||||
@atomic.action_timer("neutron.update_subnet")
|
||||
def _update_subnet(self, subnet, subnet_update_args):
|
||||
"""Update the neutron subnet.
|
||||
|
||||
@ -144,7 +144,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
return self.clients("neutron").update_subnet(
|
||||
subnet["subnet"]["id"], body)
|
||||
|
||||
@base.atomic_action_timer("neutron.delete_subnet")
|
||||
@atomic.action_timer("neutron.delete_subnet")
|
||||
def _delete_subnet(self, subnet):
|
||||
"""Delete neutron subnet
|
||||
|
||||
@ -152,7 +152,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.clients("neutron").delete_subnet(subnet["subnet"]["id"])
|
||||
|
||||
@base.atomic_action_timer("neutron.create_router")
|
||||
@atomic.action_timer("neutron.create_router")
|
||||
def _create_router(self, router_create_args, external_gw=False):
|
||||
"""Create neutron router.
|
||||
|
||||
@ -174,12 +174,12 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
return self.clients("neutron").create_router(
|
||||
{"router": router_create_args})
|
||||
|
||||
@base.atomic_action_timer("neutron.list_routers")
|
||||
@atomic.action_timer("neutron.list_routers")
|
||||
def _list_routers(self):
|
||||
"""Returns user routers list."""
|
||||
return self.clients("neutron").list_routers()["routers"]
|
||||
|
||||
@base.atomic_action_timer("neutron.delete_router")
|
||||
@atomic.action_timer("neutron.delete_router")
|
||||
def _delete_router(self, router):
|
||||
"""Delete neutron router
|
||||
|
||||
@ -187,7 +187,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.clients("neutron").delete_router(router["router"]["id"])
|
||||
|
||||
@base.atomic_action_timer("neutron.update_router")
|
||||
@atomic.action_timer("neutron.update_router")
|
||||
def _update_router(self, router, router_update_args):
|
||||
"""Update the neutron router.
|
||||
|
||||
@ -202,7 +202,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
return self.clients("neutron").update_router(
|
||||
router["router"]["id"], body)
|
||||
|
||||
@base.atomic_action_timer("neutron.create_port")
|
||||
@atomic.action_timer("neutron.create_port")
|
||||
def _create_port(self, network, port_create_args):
|
||||
"""Create neutron port.
|
||||
|
||||
@ -215,12 +215,12 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
"name", self._generate_random_name("rally_port_"))
|
||||
return self.clients("neutron").create_port({"port": port_create_args})
|
||||
|
||||
@base.atomic_action_timer("neutron.list_ports")
|
||||
@atomic.action_timer("neutron.list_ports")
|
||||
def _list_ports(self):
|
||||
"""Return user ports list."""
|
||||
return self.clients("neutron").list_ports()["ports"]
|
||||
|
||||
@base.atomic_action_timer("neutron.update_port")
|
||||
@atomic.action_timer("neutron.update_port")
|
||||
def _update_port(self, port, port_update_args):
|
||||
"""Update the neutron port.
|
||||
|
||||
@ -234,7 +234,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
body = {"port": port_update_args}
|
||||
return self.clients("neutron").update_port(port["port"]["id"], body)
|
||||
|
||||
@base.atomic_action_timer("neutron.delete_port")
|
||||
@atomic.action_timer("neutron.delete_port")
|
||||
def _delete_port(self, port):
|
||||
"""Delete neutron port.
|
||||
|
||||
@ -264,7 +264,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
subnets.append(subnet)
|
||||
return network, subnets
|
||||
|
||||
@base.atomic_action_timer("neutron.add_interface_router")
|
||||
@atomic.action_timer("neutron.add_interface_router")
|
||||
def _add_interface_router(self, subnet, router):
|
||||
"""Connect subnet to router.
|
||||
|
||||
@ -274,7 +274,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
self.clients("neutron").add_interface_router(
|
||||
router["id"], {"subnet_id": subnet["id"]})
|
||||
|
||||
@base.atomic_action_timer("neutron.remove_interface_router")
|
||||
@atomic.action_timer("neutron.remove_interface_router")
|
||||
def _remove_interface_router(self, subnet, router):
|
||||
"""Remove subnet from router
|
||||
|
||||
@ -299,7 +299,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
"subnet_id": subnet_id}
|
||||
args.update(pool_create_args)
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "neutron.create_pool"):
|
||||
with atomic.ActionTimer(self, "neutron.create_pool"):
|
||||
return self.clients("neutron").create_pool({"pool": args})
|
||||
return self.clients("neutron").create_pool({"pool": args})
|
||||
|
||||
@ -314,19 +314,19 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
pools = []
|
||||
for net in networks:
|
||||
subnets.extend(net.get("subnets", []))
|
||||
with base.AtomicAction(self, "neutron.create_%s_pools" %
|
||||
len(subnets)):
|
||||
with atomic.ActionTimer(self, "neutron.create_%s_pools" %
|
||||
len(subnets)):
|
||||
for subnet_id in subnets:
|
||||
pools.append(self._create_lb_pool(
|
||||
subnet_id, atomic_action=False, **pool_create_args))
|
||||
return pools
|
||||
|
||||
@base.atomic_action_timer("neutron.list_pools")
|
||||
@atomic.action_timer("neutron.list_pools")
|
||||
def _list_v1_pools(self, **kwargs):
|
||||
"""Return user lb pool list(v1)."""
|
||||
return self.clients("neutron").list_pools(**kwargs)
|
||||
|
||||
@base.atomic_action_timer("neutron.delete_pool")
|
||||
@atomic.action_timer("neutron.delete_pool")
|
||||
def _delete_v1_pool(self, pool):
|
||||
"""Delete neutron pool.
|
||||
|
||||
@ -334,7 +334,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.clients("neutron").delete_pool(pool["id"])
|
||||
|
||||
@base.atomic_action_timer("neutron.update_pool")
|
||||
@atomic.action_timer("neutron.update_pool")
|
||||
def _update_v1_pool(self, pool, **pool_update_args):
|
||||
"""Update pool.
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.nova import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ class NovaFloatingIpsBulk(utils.NovaScenario):
|
||||
@validation.required_parameters("start_cidr")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.NOVA_NET)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["nova"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["nova"]})
|
||||
def create_and_list_floating_ips_bulk(self, start_cidr, **kwargs):
|
||||
"""Create nova floating IP by range and list it.
|
||||
|
||||
@ -43,7 +43,7 @@ class NovaFloatingIpsBulk(utils.NovaScenario):
|
||||
@validation.required_parameters("start_cidr")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.NOVA_NET)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["nova"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["nova"]})
|
||||
def create_and_delete_floating_ips_bulk(self, start_cidr, **kwargs):
|
||||
"""Create nova floating IP by range and delete it.
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
from rally.common import log as logging
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.nova import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ class NovaHypervisors(utils.NovaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list_hypervisors(self, detailed=True):
|
||||
"""List hypervisors.
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.nova import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -25,7 +25,7 @@ class NovaKeypair(utils.NovaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def create_and_list_keypairs(self, **kwargs):
|
||||
"""Create a keypair with random name and list keypairs.
|
||||
|
||||
@ -39,7 +39,7 @@ class NovaKeypair(utils.NovaScenario):
|
||||
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def create_and_delete_keypair(self, **kwargs):
|
||||
"""Create a keypair with random name and delete keypair.
|
||||
|
||||
@ -56,7 +56,7 @@ class NovaKeypair(utils.NovaScenario):
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_delete_server_with_keypair(self, image, flavor,
|
||||
**kwargs):
|
||||
"""Boot and delete server with keypair.
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.nova import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ class NovaNetworks(utils.NovaScenario):
|
||||
@validation.required_parameters("start_cidr")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.NOVA_NET)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["nova.networks"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["nova.networks"]})
|
||||
def create_and_list_networks(self, start_cidr, **kwargs):
|
||||
"""Create nova network and list all networks.
|
||||
|
||||
@ -41,7 +41,7 @@ class NovaNetworks(utils.NovaScenario):
|
||||
@validation.required_parameters("start_cidr")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.NOVA_NET)
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"admin_cleanup": ["nova.networks"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["nova.networks"]})
|
||||
def create_and_delete_network(self, start_cidr, **kwargs):
|
||||
"""Create nova network and delete it.
|
||||
|
||||
|
@ -16,8 +16,9 @@
|
||||
from rally.common.i18n import _
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.nova import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -35,7 +36,7 @@ class NovaSecGroup(utils.NovaScenario):
|
||||
"rules_per_security_group")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def create_and_delete_secgroups(self, security_group_count,
|
||||
rules_per_security_group):
|
||||
"""Create and delete security groups.
|
||||
@ -59,7 +60,7 @@ class NovaSecGroup(utils.NovaScenario):
|
||||
"rules_per_security_group")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def create_and_list_secgroups(self, security_group_count,
|
||||
rules_per_security_group):
|
||||
"""Create and list security groups.
|
||||
@ -86,7 +87,7 @@ class NovaSecGroup(utils.NovaScenario):
|
||||
@validation.required_contexts("network")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_delete_server_with_secgroups(self, image, flavor,
|
||||
security_group_count,
|
||||
rules_per_security_group,
|
||||
@ -120,7 +121,7 @@ class NovaSecGroup(utils.NovaScenario):
|
||||
**kwargs)
|
||||
|
||||
action_name = "nova.get_attached_security_groups"
|
||||
with base.AtomicAction(self, action_name):
|
||||
with atomic.ActionTimer(self, action_name):
|
||||
attached_security_groups = server.list_security_group()
|
||||
|
||||
self._delete_server(server)
|
||||
|
@ -18,10 +18,10 @@ import jsonschema
|
||||
from rally.common import log as logging
|
||||
from rally import consts
|
||||
from rally import exceptions as rally_exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils
|
||||
from rally.plugins.openstack.scenarios.nova import utils
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import utils as task_utils
|
||||
from rally.task import validation
|
||||
@ -41,7 +41,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_list_server(self, image, flavor,
|
||||
detailed=True, **kwargs):
|
||||
"""Boot a server from an image and then list all servers.
|
||||
@ -65,7 +65,7 @@ class NovaServers(utils.NovaScenario,
|
||||
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def list_servers(self, detailed=True):
|
||||
"""List all servers.
|
||||
|
||||
@ -82,7 +82,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_delete_server(self, image, flavor,
|
||||
min_sleep=0, max_sleep=0,
|
||||
force_delete=False, **kwargs):
|
||||
@ -108,7 +108,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_delete_multiple_servers(self, image, flavor, count=2,
|
||||
min_sleep=0, max_sleep=0,
|
||||
force_delete=False, **kwargs):
|
||||
@ -135,7 +135,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova", "cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"]})
|
||||
def boot_server_from_volume_and_delete(self, image, flavor,
|
||||
volume_size,
|
||||
min_sleep=0, max_sleep=0,
|
||||
@ -168,7 +168,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_bounce_server(self, image, flavor,
|
||||
force_delete=False, actions=None, **kwargs):
|
||||
"""Boot a server and run specified actions against it.
|
||||
@ -204,7 +204,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_lock_unlock_and_delete(self, image, flavor,
|
||||
min_sleep=0, max_sleep=0,
|
||||
force_delete=False,
|
||||
@ -235,7 +235,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.GLANCE)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova", "glance"]})
|
||||
@scenario.configure(context={"cleanup": ["nova", "glance"]})
|
||||
def snapshot_server(self, image, flavor,
|
||||
force_delete=False, **kwargs):
|
||||
"""Boot a server, make its snapshot and delete both.
|
||||
@ -259,7 +259,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_server(self, image, flavor, auto_assign_nic=False, **kwargs):
|
||||
"""Boot a server.
|
||||
|
||||
@ -278,7 +278,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova", "cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"]})
|
||||
def boot_server_from_volume(self, image, flavor, volume_size,
|
||||
auto_assign_nic=False, **kwargs):
|
||||
"""Boot a server from volume.
|
||||
@ -345,7 +345,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def resize_server(self, image, flavor, to_flavor,
|
||||
force_delete=False, **kwargs):
|
||||
"""Boot a server, then resize and delete it.
|
||||
@ -374,7 +374,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def suspend_and_resume_server(self, image, flavor,
|
||||
force_delete=False, **kwargs):
|
||||
"""Create a server, suspend, resume and then delete it
|
||||
@ -394,7 +394,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def pause_and_unpause_server(self, image, flavor,
|
||||
force_delete=False, **kwargs):
|
||||
"""Create a server, pause, unpause and then delete it
|
||||
@ -414,7 +414,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def shelve_and_unshelve_server(self, image, flavor,
|
||||
force_delete=False, **kwargs):
|
||||
"""Create a server, shelve, unshelve and then delete it
|
||||
@ -434,7 +434,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_live_migrate_server(self, image,
|
||||
flavor, block_migration=False,
|
||||
disk_over_commit=False, min_sleep=0,
|
||||
@ -472,7 +472,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"cleanup": ["nova", "cinder"]})
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"]})
|
||||
def boot_server_from_volume_and_live_migrate(self, image, flavor,
|
||||
volume_size,
|
||||
block_migration=False,
|
||||
@ -520,7 +520,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"cleanup": ["cinder", "nova"]})
|
||||
@scenario.configure(context={"cleanup": ["cinder", "nova"]})
|
||||
def boot_server_attach_created_volume_and_live_migrate(
|
||||
self,
|
||||
image,
|
||||
@ -579,7 +579,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_migrate_server(self, image, flavor, **kwargs):
|
||||
"""Migrate a server.
|
||||
|
||||
@ -610,7 +610,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.image_valid_on_flavor("flavor", "to_image")
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_rebuild_server(self, from_image, to_image, flavor, **kwargs):
|
||||
"""Rebuild a server.
|
||||
|
||||
@ -632,7 +632,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(users=True)
|
||||
@validation.required_contexts("network")
|
||||
@base.scenario(context={"cleanup": ["nova"]})
|
||||
@scenario.configure(context={"cleanup": ["nova"]})
|
||||
def boot_and_associate_floating_ip(self, image, flavor, **kwargs):
|
||||
"""Boot a server and associate a floating IP to it.
|
||||
|
||||
|
@ -22,7 +22,7 @@ import six
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils
|
||||
|
||||
NOVA_BENCHMARK_OPTS = []
|
||||
@ -91,12 +91,12 @@ CONF.register_opts(NOVA_BENCHMARK_OPTS, group=benchmark_group)
|
||||
class NovaScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Nova scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("nova.list_servers")
|
||||
@atomic.action_timer("nova.list_servers")
|
||||
def _list_servers(self, detailed=True):
|
||||
"""Returns user servers list."""
|
||||
return self.clients("nova").servers.list(detailed)
|
||||
|
||||
@base.atomic_action_timer("nova.boot_server")
|
||||
@atomic.action_timer("nova.boot_server")
|
||||
def _boot_server(self, image_id, flavor_id,
|
||||
auto_assign_nic=False, name=None, **kwargs):
|
||||
"""Boot a server.
|
||||
@ -156,7 +156,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_reboot_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.soft_reboot_server")
|
||||
@atomic.action_timer("nova.soft_reboot_server")
|
||||
def _soft_reboot_server(self, server):
|
||||
"""Reboot a server with soft reboot.
|
||||
|
||||
@ -167,7 +167,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self._do_server_reboot(server, "SOFT")
|
||||
|
||||
@base.atomic_action_timer("nova.reboot_server")
|
||||
@atomic.action_timer("nova.reboot_server")
|
||||
def _reboot_server(self, server):
|
||||
"""Reboot a server with hard reboot.
|
||||
|
||||
@ -178,7 +178,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self._do_server_reboot(server, "HARD")
|
||||
|
||||
@base.atomic_action_timer("nova.rebuild_server")
|
||||
@atomic.action_timer("nova.rebuild_server")
|
||||
def _rebuild_server(self, server, image, **kwargs):
|
||||
"""Rebuild a server with a new image.
|
||||
|
||||
@ -196,7 +196,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_rebuild_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.start_server")
|
||||
@atomic.action_timer("nova.start_server")
|
||||
def _start_server(self, server):
|
||||
"""Start the given server.
|
||||
|
||||
@ -213,7 +213,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_start_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.stop_server")
|
||||
@atomic.action_timer("nova.stop_server")
|
||||
def _stop_server(self, server):
|
||||
"""Stop the given server.
|
||||
|
||||
@ -230,7 +230,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_stop_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.rescue_server")
|
||||
@atomic.action_timer("nova.rescue_server")
|
||||
def _rescue_server(self, server):
|
||||
"""Rescue the given server.
|
||||
|
||||
@ -248,7 +248,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_rescue_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.unrescue_server")
|
||||
@atomic.action_timer("nova.unrescue_server")
|
||||
def _unrescue_server(self, server):
|
||||
"""Unrescue the given server.
|
||||
|
||||
@ -265,7 +265,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_unrescue_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.suspend_server")
|
||||
@atomic.action_timer("nova.suspend_server")
|
||||
def _suspend_server(self, server):
|
||||
"""Suspends the given server.
|
||||
|
||||
@ -283,7 +283,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_suspend_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.resume_server")
|
||||
@atomic.action_timer("nova.resume_server")
|
||||
def _resume_server(self, server):
|
||||
"""Resumes the suspended server.
|
||||
|
||||
@ -301,7 +301,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_resume_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.pause_server")
|
||||
@atomic.action_timer("nova.pause_server")
|
||||
def _pause_server(self, server):
|
||||
"""Pause the live server.
|
||||
|
||||
@ -319,7 +319,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_pause_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.unpause_server")
|
||||
@atomic.action_timer("nova.unpause_server")
|
||||
def _unpause_server(self, server):
|
||||
"""Unpause the paused server.
|
||||
|
||||
@ -337,7 +337,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_unpause_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.shelve_server")
|
||||
@atomic.action_timer("nova.shelve_server")
|
||||
def _shelve_server(self, server):
|
||||
"""Shelve the given server.
|
||||
|
||||
@ -355,7 +355,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_shelve_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.unshelve_server")
|
||||
@atomic.action_timer("nova.unshelve_server")
|
||||
def _unshelve_server(self, server):
|
||||
"""Unshelve the given server.
|
||||
|
||||
@ -381,7 +381,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
:param force: If True, force_delete will be used instead of delete.
|
||||
"""
|
||||
atomic_name = ("nova.%sdelete_server") % (force and "force_" or "")
|
||||
with base.AtomicAction(self, atomic_name):
|
||||
with atomic.ActionTimer(self, atomic_name):
|
||||
if force:
|
||||
server.force_delete()
|
||||
else:
|
||||
@ -401,7 +401,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
:param force: If True, force_delete will be used instead of delete.
|
||||
"""
|
||||
atomic_name = ("nova.%sdelete_servers") % (force and "force_" or "")
|
||||
with base.AtomicAction(self, atomic_name):
|
||||
with atomic.ActionTimer(self, atomic_name):
|
||||
for server in servers:
|
||||
if force:
|
||||
server.force_delete()
|
||||
@ -417,7 +417,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
benchmark.nova_server_delete_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.delete_image")
|
||||
@atomic.action_timer("nova.delete_image")
|
||||
def _delete_image(self, image):
|
||||
"""Delete the given image.
|
||||
|
||||
@ -434,7 +434,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=check_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.create_image")
|
||||
@atomic.action_timer("nova.create_image")
|
||||
def _create_image(self, server):
|
||||
"""Create an image from the given server
|
||||
|
||||
@ -458,7 +458,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
)
|
||||
return image
|
||||
|
||||
@base.atomic_action_timer("nova.create_keypair")
|
||||
@atomic.action_timer("nova.create_keypair")
|
||||
def _create_keypair(self, **kwargs):
|
||||
"""Create a keypair
|
||||
|
||||
@ -468,12 +468,12 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
keypair = self.clients("nova").keypairs.create(keypair_name, **kwargs)
|
||||
return keypair.name
|
||||
|
||||
@base.atomic_action_timer("nova.list_keypairs")
|
||||
@atomic.action_timer("nova.list_keypairs")
|
||||
def _list_keypairs(self):
|
||||
"""Return user keypairs list."""
|
||||
return self.clients("nova").keypairs.list()
|
||||
|
||||
@base.atomic_action_timer("nova.delete_keypair")
|
||||
@atomic.action_timer("nova.delete_keypair")
|
||||
def _delete_keypair(self, keypair_name):
|
||||
"""Delete keypair
|
||||
|
||||
@ -481,7 +481,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self.clients("nova").keypairs.delete(keypair_name)
|
||||
|
||||
@base.atomic_action_timer("nova.boot_servers")
|
||||
@atomic.action_timer("nova.boot_servers")
|
||||
def _boot_servers(self, image_id, flavor_id, requests, name_prefix=None,
|
||||
instances_amount=1, **kwargs):
|
||||
"""Boot multiple servers.
|
||||
@ -522,7 +522,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
) for server in servers]
|
||||
return servers
|
||||
|
||||
@base.atomic_action_timer("nova.associate_floating_ip")
|
||||
@atomic.action_timer("nova.associate_floating_ip")
|
||||
def _associate_floating_ip(self, server, address, fixed_address=None):
|
||||
"""Add floating IP to an instance
|
||||
|
||||
@ -540,7 +540,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
# Update server data
|
||||
server.addresses = server.manager.get(server.id).addresses
|
||||
|
||||
@base.atomic_action_timer("nova.dissociate_floating_ip")
|
||||
@atomic.action_timer("nova.dissociate_floating_ip")
|
||||
def _dissociate_floating_ip(self, server, address):
|
||||
"""Remove floating IP from an instance
|
||||
|
||||
@ -568,12 +568,12 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
return not must_exist
|
||||
return _check_addr
|
||||
|
||||
@base.atomic_action_timer("nova.list_networks")
|
||||
@atomic.action_timer("nova.list_networks")
|
||||
def _list_networks(self):
|
||||
"""Return user networks list."""
|
||||
return self.clients("nova").networks.list()
|
||||
|
||||
@base.atomic_action_timer("nova.resize")
|
||||
@atomic.action_timer("nova.resize")
|
||||
def _resize(self, server, flavor):
|
||||
server.resize(flavor)
|
||||
utils.wait_for(
|
||||
@ -584,7 +584,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_server_resize_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.resize_confirm")
|
||||
@atomic.action_timer("nova.resize_confirm")
|
||||
def _resize_confirm(self, server, status="ACTIVE"):
|
||||
server.confirm_resize()
|
||||
utils.wait_for(
|
||||
@ -596,7 +596,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
CONF.benchmark.nova_server_resize_confirm_poll_interval)
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.resize_revert")
|
||||
@atomic.action_timer("nova.resize_revert")
|
||||
def _resize_revert(self, server, status="ACTIVE"):
|
||||
server.revert_resize()
|
||||
utils.wait_for(
|
||||
@ -608,7 +608,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
CONF.benchmark.nova_server_resize_revert_poll_interval)
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.attach_volume")
|
||||
@atomic.action_timer("nova.attach_volume")
|
||||
def _attach_volume(self, server, volume, device=None):
|
||||
server_id = server.id
|
||||
volume_id = volume.id
|
||||
@ -624,7 +624,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
CONF.benchmark.nova_server_resize_revert_poll_interval)
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.detach_volume")
|
||||
@atomic.action_timer("nova.detach_volume")
|
||||
def _detach_volume(self, server, volume):
|
||||
server_id = server.id
|
||||
volume_id = volume.id
|
||||
@ -638,7 +638,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
check_interval=CONF.benchmark.nova_detach_volume_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer("nova.live_migrate")
|
||||
@atomic.action_timer("nova.live_migrate")
|
||||
def _live_migrate(self, server, target_host, block_migration=False,
|
||||
disk_over_commit=False, skip_host_check=False):
|
||||
"""Run live migration of the given server.
|
||||
@ -671,7 +671,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
"Migration complete but instance did not change host: %s" %
|
||||
host_pre_migrate)
|
||||
|
||||
@base.atomic_action_timer("nova.find_host_to_migrate")
|
||||
@atomic.action_timer("nova.find_host_to_migrate")
|
||||
def _find_host_to_migrate(self, server):
|
||||
"""Find a compute node for live migration.
|
||||
|
||||
@ -695,7 +695,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
raise exceptions.InvalidHostException(
|
||||
"No valid host found to migrate")
|
||||
|
||||
@base.atomic_action_timer("nova.migrate")
|
||||
@atomic.action_timer("nova.migrate")
|
||||
def _migrate(self, server, skip_host_check=False):
|
||||
"""Run migration of the given server.
|
||||
|
||||
@ -724,8 +724,8 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
|
||||
def _create_security_groups(self, security_group_count):
|
||||
security_groups = []
|
||||
with base.AtomicAction(self, "nova.create_%s_security_groups" %
|
||||
security_group_count):
|
||||
with atomic.ActionTimer(self, "nova.create_%s_security_groups" %
|
||||
security_group_count):
|
||||
for i in range(security_group_count):
|
||||
sg_name = self._generate_random_name()
|
||||
sg = self.clients("nova").security_groups.create(sg_name,
|
||||
@ -739,7 +739,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
ip_protocol="tcp", cidr="0.0.0.0/0"):
|
||||
action_name = ("nova.create_%s_rules" % (rules_per_security_group *
|
||||
len(security_groups)))
|
||||
with base.AtomicAction(self, action_name):
|
||||
with atomic.ActionTimer(self, action_name):
|
||||
for i in range(len(security_groups)):
|
||||
for j in range(rules_per_security_group):
|
||||
self.clients("nova").security_group_rules.create(
|
||||
@ -750,22 +750,22 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
cidr=cidr)
|
||||
|
||||
def _delete_security_groups(self, security_group):
|
||||
with base.AtomicAction(self, "nova.delete_%s_security_groups" %
|
||||
len(security_group)):
|
||||
with atomic.ActionTimer(self, "nova.delete_%s_security_groups" %
|
||||
len(security_group)):
|
||||
for sg in security_group:
|
||||
self.clients("nova").security_groups.delete(sg.id)
|
||||
|
||||
def _list_security_groups(self):
|
||||
"""Return security groups list."""
|
||||
with base.AtomicAction(self, "nova.list_security_groups"):
|
||||
with atomic.ActionTimer(self, "nova.list_security_groups"):
|
||||
return self.clients("nova").security_groups.list()
|
||||
|
||||
@base.atomic_action_timer("nova.list_floating_ips_bulk")
|
||||
@atomic.action_timer("nova.list_floating_ips_bulk")
|
||||
def _list_floating_ips_bulk(self):
|
||||
"""List all floating IPs."""
|
||||
return self.admin_clients("nova").floating_ips_bulk.list()
|
||||
|
||||
@base.atomic_action_timer("nova.create_floating_ips_bulk")
|
||||
@atomic.action_timer("nova.create_floating_ips_bulk")
|
||||
def _create_floating_ips_bulk(self, ip_range, **kwargs):
|
||||
"""Create floating IPs by range."""
|
||||
ip_range = network_wrapper.generate_cidr(start_cidr=ip_range)
|
||||
@ -773,17 +773,17 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
return self.admin_clients("nova").floating_ips_bulk.create(
|
||||
ip_range=ip_range, pool=pool_name, **kwargs)
|
||||
|
||||
@base.atomic_action_timer("nova.delete_floating_ips_bulk")
|
||||
@atomic.action_timer("nova.delete_floating_ips_bulk")
|
||||
def _delete_floating_ips_bulk(self, ip_range):
|
||||
"""Delete floating IPs by range."""
|
||||
return self.admin_clients("nova").floating_ips_bulk.delete(ip_range)
|
||||
|
||||
@base.atomic_action_timer("nova.list_hypervisors")
|
||||
@atomic.action_timer("nova.list_hypervisors")
|
||||
def _list_hypervisors(self, detailed=True):
|
||||
"""List hypervisors."""
|
||||
return self.admin_clients("nova").hypervisors.list(detailed)
|
||||
|
||||
@base.atomic_action_timer("nova.lock_server")
|
||||
@atomic.action_timer("nova.lock_server")
|
||||
def _lock_server(self, server):
|
||||
"""Lock the given server.
|
||||
|
||||
@ -791,7 +791,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
server.lock()
|
||||
|
||||
@base.atomic_action_timer("nova.unlock_server")
|
||||
@atomic.action_timer("nova.unlock_server")
|
||||
def _unlock_server(self, server):
|
||||
"""Unlock the given server.
|
||||
|
||||
@ -799,7 +799,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
server.unlock()
|
||||
|
||||
@base.atomic_action_timer("nova.create_network")
|
||||
@atomic.action_timer("nova.create_network")
|
||||
def _create_network(self, ip_range, **kwargs):
|
||||
"""Create nova network.
|
||||
|
||||
@ -810,7 +810,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
return self.admin_clients("nova").networks.create(
|
||||
label=net_label, cidr=ip_range, **kwargs)
|
||||
|
||||
@base.atomic_action_timer("nova.delete_network")
|
||||
@atomic.action_timer("nova.delete_network")
|
||||
def _delete_network(self, net_id):
|
||||
"""Delete nova network.
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.quotas import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class Quotas(utils.QuotasScenario):
|
||||
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["nova.quotas"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["nova.quotas"]})
|
||||
def nova_update(self, max_quota=1024):
|
||||
"""Update quotas for Nova.
|
||||
|
||||
@ -35,7 +35,7 @@ class Quotas(utils.QuotasScenario):
|
||||
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["nova.quotas"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["nova.quotas"]})
|
||||
def nova_update_and_delete(self, max_quota=1024):
|
||||
"""Update and delete quotas for Nova.
|
||||
|
||||
@ -48,7 +48,7 @@ class Quotas(utils.QuotasScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["cinder.quotas"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["cinder.quotas"]})
|
||||
def cinder_update(self, max_quota=1024):
|
||||
"""Update quotas for Cinder.
|
||||
|
||||
@ -59,7 +59,7 @@ class Quotas(utils.QuotasScenario):
|
||||
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["cinder.quotas"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["cinder.quotas"]})
|
||||
def cinder_update_and_delete(self, max_quota=1024):
|
||||
"""Update and Delete quotas for Cinder.
|
||||
|
||||
@ -71,7 +71,7 @@ class Quotas(utils.QuotasScenario):
|
||||
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@base.scenario(context={"admin_cleanup": ["neutron.quota"]})
|
||||
@scenario.configure(context={"admin_cleanup": ["neutron.quota"]})
|
||||
def neutron_update(self, max_quota=1024):
|
||||
"""Update quotas for neutron.
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
import random
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
|
||||
class QuotasScenario(scenario.OpenStackScenario):
|
||||
"""Base class for quotas scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("quotas.update_quotas")
|
||||
@atomic.action_timer("quotas.update_quotas")
|
||||
def _update_quotas(self, component, tenant_id, max_quota=1024,
|
||||
quota_update_fn=None):
|
||||
"""Updates quotas.
|
||||
@ -42,7 +42,7 @@ class QuotasScenario(scenario.OpenStackScenario):
|
||||
return quota_update_fn(tenant_id, **quotas)
|
||||
return self.admin_clients(component).quotas.update(tenant_id, **quotas)
|
||||
|
||||
@base.atomic_action_timer("quotas.delete_quotas")
|
||||
@atomic.action_timer("quotas.delete_quotas")
|
||||
def _delete_quotas(self, component, tenant_id):
|
||||
"""Delete quotas.
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
from rally.common import log as logging
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.sahara import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -34,7 +34,7 @@ class SaharaClusters(utils.SaharaScenario):
|
||||
@validation.number("workers_count", minval=1, integer_only=True)
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
@scenario.configure(context={"cleanup": ["sahara"]})
|
||||
def create_and_delete_cluster(self, flavor, workers_count, plugin_name,
|
||||
hadoop_version, floating_ip_pool=None,
|
||||
volumes_per_node=None,
|
||||
@ -102,7 +102,7 @@ class SaharaClusters(utils.SaharaScenario):
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_contexts("users", "sahara_image")
|
||||
@validation.number("workers_count", minval=1, integer_only=True)
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
@scenario.configure(context={"cleanup": ["sahara"]})
|
||||
def create_scale_delete_cluster(self, flavor, workers_count, plugin_name,
|
||||
hadoop_version, deltas,
|
||||
floating_ip_pool=None,
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
from rally.common import log as logging
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.sahara import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -28,7 +28,7 @@ class SaharaJob(utils.SaharaScenario):
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_contexts("users", "sahara_image", "sahara_edp",
|
||||
"sahara_cluster")
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
@scenario.configure(context={"cleanup": ["sahara"]})
|
||||
def create_launch_job(self, job_type, configs, job_idx=0):
|
||||
"""Create and execute a Sahara EDP Job.
|
||||
|
||||
@ -71,7 +71,7 @@ class SaharaJob(utils.SaharaScenario):
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_contexts("users", "sahara_image", "sahara_edp",
|
||||
"sahara_cluster")
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
@scenario.configure(context={"cleanup": ["sahara"]})
|
||||
def create_launch_job_sequence(self, jobs):
|
||||
"""Create and execute a sequence of the Sahara EDP Jobs.
|
||||
|
||||
@ -88,7 +88,7 @@ class SaharaJob(utils.SaharaScenario):
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_contexts("users", "sahara_image", "sahara_edp",
|
||||
"sahara_cluster")
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
@scenario.configure(context={"cleanup": ["sahara"]})
|
||||
def create_launch_job_sequence_with_scaling(self, jobs, deltas):
|
||||
"""Create and execute Sahara EDP Jobs on a scaling Cluster.
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.sahara import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -27,7 +27,7 @@ class SaharaNodeGroupTemplates(utils.SaharaScenario):
|
||||
@validation.flavor_exists("flavor")
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
@scenario.configure(context={"cleanup": ["sahara"]})
|
||||
def create_and_list_node_group_templates(self, flavor,
|
||||
plugin_name="vanilla",
|
||||
hadoop_version="1.2.1"):
|
||||
@ -62,7 +62,7 @@ class SaharaNodeGroupTemplates(utils.SaharaScenario):
|
||||
@validation.flavor_exists("flavor")
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
@scenario.configure(context={"cleanup": ["sahara"]})
|
||||
def create_delete_node_group_templates(self, flavor,
|
||||
plugin_name="vanilla",
|
||||
hadoop_version="1.2.1"):
|
||||
|
@ -25,7 +25,7 @@ from rally import consts
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.sahara import consts as sahara_consts
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -53,12 +53,12 @@ class SaharaScenario(scenario.OpenStackScenario):
|
||||
|
||||
RESOURCE_NAME_LENGTH = 20
|
||||
|
||||
@base.atomic_action_timer("sahara.list_node_group_templates")
|
||||
@atomic.action_timer("sahara.list_node_group_templates")
|
||||
def _list_node_group_templates(self):
|
||||
"""Return user Node Group Templates list."""
|
||||
return self.clients("sahara").node_group_templates.list()
|
||||
|
||||
@base.atomic_action_timer("sahara.create_master_node_group_template")
|
||||
@atomic.action_timer("sahara.create_master_node_group_template")
|
||||
def _create_master_node_group_template(self, flavor_id, plugin_name,
|
||||
hadoop_version):
|
||||
"""Create a master Node Group Template with a random name.
|
||||
@ -79,7 +79,7 @@ class SaharaScenario(scenario.OpenStackScenario):
|
||||
node_processes=sahara_consts.NODE_PROCESSES[plugin_name]
|
||||
[hadoop_version]["master"])
|
||||
|
||||
@base.atomic_action_timer("sahara.create_worker_node_group_template")
|
||||
@atomic.action_timer("sahara.create_worker_node_group_template")
|
||||
def _create_worker_node_group_template(self, flavor_id, plugin_name,
|
||||
hadoop_version):
|
||||
"""Create a worker Node Group Template with a random name.
|
||||
@ -100,7 +100,7 @@ class SaharaScenario(scenario.OpenStackScenario):
|
||||
node_processes=sahara_consts.NODE_PROCESSES[plugin_name]
|
||||
[hadoop_version]["worker"])
|
||||
|
||||
@base.atomic_action_timer("sahara.delete_node_group_template")
|
||||
@atomic.action_timer("sahara.delete_node_group_template")
|
||||
def _delete_node_group_template(self, node_group):
|
||||
"""Delete a Node Group Template by id.
|
||||
|
||||
@ -218,7 +218,7 @@ class SaharaScenario(scenario.OpenStackScenario):
|
||||
}
|
||||
return replication_config
|
||||
|
||||
@base.atomic_action_timer("sahara.launch_cluster")
|
||||
@atomic.action_timer("sahara.launch_cluster")
|
||||
def _launch_cluster(self, plugin_name, hadoop_version, flavor_id,
|
||||
image_id, workers_count, floating_ip_pool=None,
|
||||
volumes_per_node=None,
|
||||
@ -363,7 +363,7 @@ class SaharaScenario(scenario.OpenStackScenario):
|
||||
|
||||
self._wait_active(cluster)
|
||||
|
||||
@base.atomic_action_timer("sahara.scale_up")
|
||||
@atomic.action_timer("sahara.scale_up")
|
||||
def _scale_cluster_up(self, cluster, delta):
|
||||
"""Add a given number of worker nodes to the cluster.
|
||||
|
||||
@ -373,7 +373,7 @@ class SaharaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self._scale_cluster(cluster, delta)
|
||||
|
||||
@base.atomic_action_timer("sahara.scale_down")
|
||||
@atomic.action_timer("sahara.scale_down")
|
||||
def _scale_cluster_down(self, cluster, delta):
|
||||
"""Remove a given number of worker nodes from the cluster.
|
||||
|
||||
@ -383,7 +383,7 @@ class SaharaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
self._scale_cluster(cluster, delta)
|
||||
|
||||
@base.atomic_action_timer("sahara.delete_cluster")
|
||||
@atomic.action_timer("sahara.delete_cluster")
|
||||
def _delete_cluster(self, cluster):
|
||||
"""Delete cluster.
|
||||
|
||||
@ -450,7 +450,7 @@ class SaharaScenario(scenario.OpenStackScenario):
|
||||
:param job_idx: The index of a job in a sequence
|
||||
|
||||
"""
|
||||
@base.atomic_action_timer("sahara.job_execution_%s" % job_idx)
|
||||
@atomic.action_timer("sahara.job_execution_%s" % job_idx)
|
||||
def run(self):
|
||||
job_execution = self.clients("sahara").job_executions.create(
|
||||
job_id=job_id,
|
||||
|
@ -16,8 +16,9 @@
|
||||
import tempfile
|
||||
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.swift import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -26,7 +27,7 @@ class SwiftObjects(utils.SwiftScenario):
|
||||
|
||||
@validation.required_services(consts.Service.SWIFT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["swift"]})
|
||||
@scenario.configure(context={"cleanup": ["swift"]})
|
||||
def create_container_and_object_then_list_objects(
|
||||
self, objects_per_container=1,
|
||||
object_size=1024, **kwargs):
|
||||
@ -45,7 +46,7 @@ class SwiftObjects(utils.SwiftScenario):
|
||||
# set dummy file to specified object size
|
||||
dummy_file.truncate(object_size)
|
||||
container_name = self._create_container(**kwargs)
|
||||
with base.AtomicAction(self, "swift.create_%s" % key_suffix):
|
||||
with atomic.ActionTimer(self, "swift.create_%s" % key_suffix):
|
||||
for i in range(objects_per_container):
|
||||
dummy_file.seek(0)
|
||||
self._upload_object(container_name, dummy_file,
|
||||
@ -54,7 +55,7 @@ class SwiftObjects(utils.SwiftScenario):
|
||||
|
||||
@validation.required_services(consts.Service.SWIFT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["swift"]})
|
||||
@scenario.configure(context={"cleanup": ["swift"]})
|
||||
def create_container_and_object_then_delete_all(
|
||||
self, objects_per_container=1,
|
||||
object_size=1024, **kwargs):
|
||||
@ -74,7 +75,7 @@ class SwiftObjects(utils.SwiftScenario):
|
||||
# set dummy file to specified object size
|
||||
dummy_file.truncate(object_size)
|
||||
container_name = self._create_container(**kwargs)
|
||||
with base.AtomicAction(self, "swift.create_%s" % key_suffix):
|
||||
with atomic.ActionTimer(self, "swift.create_%s" % key_suffix):
|
||||
for i in range(objects_per_container):
|
||||
dummy_file.seek(0)
|
||||
object_name = self._upload_object(container_name,
|
||||
@ -82,7 +83,7 @@ class SwiftObjects(utils.SwiftScenario):
|
||||
atomic_action=False)[1]
|
||||
objects_list.append(object_name)
|
||||
|
||||
with base.AtomicAction(self, "swift.delete_%s" % key_suffix):
|
||||
with atomic.ActionTimer(self, "swift.delete_%s" % key_suffix):
|
||||
for object_name in objects_list:
|
||||
self._delete_object(container_name, object_name,
|
||||
atomic_action=False)
|
||||
@ -90,7 +91,7 @@ class SwiftObjects(utils.SwiftScenario):
|
||||
|
||||
@validation.required_services(consts.Service.SWIFT)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["swift"]})
|
||||
@scenario.configure(context={"cleanup": ["swift"]})
|
||||
def create_container_and_object_then_download_object(
|
||||
self, objects_per_container=1,
|
||||
object_size=1024, **kwargs):
|
||||
@ -110,7 +111,7 @@ class SwiftObjects(utils.SwiftScenario):
|
||||
# set dummy file to specified object size
|
||||
dummy_file.truncate(object_size)
|
||||
container_name = self._create_container(**kwargs)
|
||||
with base.AtomicAction(self, "swift.create_%s" % key_suffix):
|
||||
with atomic.ActionTimer(self, "swift.create_%s" % key_suffix):
|
||||
for i in range(objects_per_container):
|
||||
dummy_file.seek(0)
|
||||
object_name = self._upload_object(container_name,
|
||||
@ -118,7 +119,7 @@ class SwiftObjects(utils.SwiftScenario):
|
||||
atomic_action=False)[1]
|
||||
objects_list.append(object_name)
|
||||
|
||||
with base.AtomicAction(self, "swift.download_%s" % key_suffix):
|
||||
with atomic.ActionTimer(self, "swift.download_%s" % key_suffix):
|
||||
for object_name in objects_list:
|
||||
self._download_object(container_name, object_name,
|
||||
atomic_action=False)
|
||||
|
@ -14,13 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
|
||||
class SwiftScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Swift scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("swift.list_containers")
|
||||
@atomic.action_timer("swift.list_containers")
|
||||
def _list_containers(self, full_listing=True, **kwargs):
|
||||
"""Return list of containers.
|
||||
|
||||
@ -53,7 +53,7 @@ class SwiftScenario(scenario.OpenStackScenario):
|
||||
prefix="rally_container_")
|
||||
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "swift.create_container"):
|
||||
with atomic.ActionTimer(self, "swift.create_container"):
|
||||
self.clients("swift").put_container(container_name, **kwargs)
|
||||
else:
|
||||
self.clients("swift").put_container(container_name, **kwargs)
|
||||
@ -68,7 +68,7 @@ class SwiftScenario(scenario.OpenStackScenario):
|
||||
:param kwargs: dict, other optional parameters to delete_container
|
||||
"""
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "swift.delete_container"):
|
||||
with atomic.ActionTimer(self, "swift.delete_container"):
|
||||
self.clients("swift").delete_container(container_name,
|
||||
**kwargs)
|
||||
else:
|
||||
@ -88,7 +88,7 @@ class SwiftScenario(scenario.OpenStackScenario):
|
||||
:returns: tuple, (dict of response headers, a list of objects)
|
||||
"""
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "swift.list_objects"):
|
||||
with atomic.ActionTimer(self, "swift.list_objects"):
|
||||
return self.clients("swift").get_container(
|
||||
container_name, full_listing=full_listing,
|
||||
**kwargs)
|
||||
@ -114,7 +114,7 @@ class SwiftScenario(scenario.OpenStackScenario):
|
||||
object_name = self._generate_random_name(prefix="rally_object_")
|
||||
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "swift.upload_object"):
|
||||
with atomic.ActionTimer(self, "swift.upload_object"):
|
||||
return (self.clients("swift").put_object(container_name,
|
||||
object_name, content,
|
||||
**kwargs),
|
||||
@ -138,7 +138,7 @@ class SwiftScenario(scenario.OpenStackScenario):
|
||||
:returns: tuple, (dict of response headers, the object's contents)
|
||||
"""
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "swift.download_object"):
|
||||
with atomic.ActionTimer(self, "swift.download_object"):
|
||||
return self.clients("swift").get_object(container_name,
|
||||
object_name, **kwargs)
|
||||
|
||||
@ -156,7 +156,7 @@ class SwiftScenario(scenario.OpenStackScenario):
|
||||
:param kwargs: dict, other optional parameters to delete_object
|
||||
"""
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, "swift.delete_object"):
|
||||
with atomic.ActionTimer(self, "swift.delete_object"):
|
||||
self.clients("swift").delete_object(container_name,
|
||||
object_name, **kwargs)
|
||||
else:
|
||||
|
@ -16,7 +16,6 @@
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.tempest import utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -25,7 +24,7 @@ class TempestScenario(scenario.OpenStackScenario):
|
||||
|
||||
@validation.tempest_tests_exists()
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"tempest": {}})
|
||||
@scenario.configure(context={"tempest": {}})
|
||||
@utils.tempest_log_wrapper
|
||||
def single_test(self, test_name, log_file, tempest_conf=None):
|
||||
"""Launch a single Tempest test by its name.
|
||||
@ -42,7 +41,7 @@ class TempestScenario(scenario.OpenStackScenario):
|
||||
tempest_conf=tempest_conf)
|
||||
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"tempest": {}})
|
||||
@scenario.configure(context={"tempest": {}})
|
||||
@utils.tempest_log_wrapper
|
||||
def all(self, log_file, tempest_conf=None):
|
||||
"""Launch all discovered Tempest tests by their names.
|
||||
@ -56,7 +55,7 @@ class TempestScenario(scenario.OpenStackScenario):
|
||||
|
||||
@validation.tempest_set_exists()
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"tempest": {}})
|
||||
@scenario.configure(context={"tempest": {}})
|
||||
@utils.tempest_log_wrapper
|
||||
def set(self, set_name, log_file, tempest_conf=None):
|
||||
"""Launch all Tempest tests from a given set.
|
||||
@ -78,7 +77,7 @@ class TempestScenario(scenario.OpenStackScenario):
|
||||
|
||||
@validation.tempest_tests_exists()
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"tempest": {}})
|
||||
@scenario.configure(context={"tempest": {}})
|
||||
@utils.tempest_log_wrapper
|
||||
def list_of_tests(self, test_names, log_file, tempest_conf=None):
|
||||
"""Launch all Tempest tests from a given list of their names.
|
||||
@ -92,7 +91,7 @@ class TempestScenario(scenario.OpenStackScenario):
|
||||
tempest_conf=tempest_conf)
|
||||
|
||||
@validation.required_openstack(admin=True)
|
||||
@base.scenario(context={"tempest": {}})
|
||||
@scenario.configure(context={"tempest": {}})
|
||||
@utils.tempest_log_wrapper
|
||||
def specific_regex(self, regex, log_file, tempest_conf=None):
|
||||
"""Launch Tempest tests whose names match a given regular expression.
|
||||
|
@ -26,7 +26,7 @@ from rally.common import sshutils
|
||||
from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils
|
||||
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from rally.task import utils
|
||||
from rally.task import validation
|
||||
|
||||
@ -57,7 +57,7 @@ class VMScenario(nova_utils.NovaScenario, cinder_utils.CinderScenario):
|
||||
|
||||
RESOURCE_NAME_PREFIX = "rally_vm_"
|
||||
|
||||
@base.atomic_action_timer("vm.run_command_over_ssh")
|
||||
@atomic.action_timer("vm.run_command_over_ssh")
|
||||
def _run_command_over_ssh(self, ssh, command):
|
||||
"""Run command inside an instance.
|
||||
|
||||
@ -127,7 +127,7 @@ class VMScenario(nova_utils.NovaScenario, cinder_utils.CinderScenario):
|
||||
"id": fip.get("id"),
|
||||
"is_floating": use_floating_ip}
|
||||
|
||||
@base.atomic_action_timer("vm.attach_floating_ip")
|
||||
@atomic.action_timer("vm.attach_floating_ip")
|
||||
def _attach_floating_ip(self, server, floating_network):
|
||||
internal_network = list(server.networks)[0]
|
||||
fixed_ip = server.addresses[internal_network][0]["addr"]
|
||||
@ -140,7 +140,7 @@ class VMScenario(nova_utils.NovaScenario, cinder_utils.CinderScenario):
|
||||
|
||||
return fip
|
||||
|
||||
@base.atomic_action_timer("vm.delete_floating_ip")
|
||||
@atomic.action_timer("vm.delete_floating_ip")
|
||||
def _delete_floating_ip(self, server, fip):
|
||||
with logging.ExceptionLogger(
|
||||
LOG, _("Unable to delete IP: %s") % fip["ip"]):
|
||||
@ -154,11 +154,11 @@ class VMScenario(nova_utils.NovaScenario, cinder_utils.CinderScenario):
|
||||
self._delete_floating_ip(server, fip)
|
||||
return self._delete_server(server, force=force_delete)
|
||||
|
||||
@base.atomic_action_timer("vm.wait_for_ssh")
|
||||
@atomic.action_timer("vm.wait_for_ssh")
|
||||
def _wait_for_ssh(self, ssh):
|
||||
ssh.wait()
|
||||
|
||||
@base.atomic_action_timer("vm.wait_for_ping")
|
||||
@atomic.action_timer("vm.wait_for_ping")
|
||||
def _wait_for_ping(self, server_ip):
|
||||
server_ip = netaddr.IPAddress(server_ip)
|
||||
utils.wait_for(
|
||||
|
@ -18,8 +18,8 @@ import json
|
||||
from rally.common import utils
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.vm import utils as vm_utils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
@ -42,8 +42,8 @@ class VMTasks(vm_utils.VMScenario):
|
||||
@validation.external_network_exists("floating_network")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["nova", "cinder"],
|
||||
"keypair": {}, "allow_ssh": {}})
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"],
|
||||
"keypair": {}, "allow_ssh": {}})
|
||||
def boot_runcommand_delete(self, image, flavor,
|
||||
username,
|
||||
password=None,
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
import random
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.zaqar import utils as zutils
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class ZaqarBasic(zutils.ZaqarScenario):
|
||||
"""Benchmark scenarios for Zaqar."""
|
||||
|
||||
@validation.number("name_length", minval=10)
|
||||
@base.scenario(context={"cleanup": ["zaqar"]})
|
||||
@scenario.configure(context={"cleanup": ["zaqar"]})
|
||||
def create_queue(self, name_length=10, **kwargs):
|
||||
"""Create a Zaqar queue with a random name.
|
||||
|
||||
@ -34,7 +34,7 @@ class ZaqarBasic(zutils.ZaqarScenario):
|
||||
self._queue_create(name_length=name_length, **kwargs)
|
||||
|
||||
@validation.number("name_length", minval=10)
|
||||
@base.scenario(context={"cleanup": ["zaqar"]})
|
||||
@scenario.configure(context={"cleanup": ["zaqar"]})
|
||||
def producer_consumer(self, name_length=10,
|
||||
min_msg_count=50, max_msg_count=200, **kwargs):
|
||||
"""Serial message producer/consumer.
|
||||
|
@ -13,13 +13,13 @@
|
||||
# under the License.
|
||||
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
|
||||
|
||||
class ZaqarScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Zaqar scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer("zaqar.create_queue")
|
||||
@atomic.action_timer("zaqar.create_queue")
|
||||
def _queue_create(self, name_length=10, **kwargs):
|
||||
"""Create a Zaqar queue with random name.
|
||||
|
||||
@ -31,7 +31,7 @@ class ZaqarScenario(scenario.OpenStackScenario):
|
||||
name = self._generate_random_name(length=name_length)
|
||||
return self.clients("zaqar").queue(name, **kwargs)
|
||||
|
||||
@base.atomic_action_timer("zaqar.delete_queue")
|
||||
@atomic.action_timer("zaqar.delete_queue")
|
||||
def _queue_delete(self, queue):
|
||||
"""Removes a Zaqar queue.
|
||||
|
||||
@ -48,11 +48,11 @@ class ZaqarScenario(scenario.OpenStackScenario):
|
||||
:param min_msg_count: minimum number of messages
|
||||
:param max_msg_count: maximum number of messages
|
||||
"""
|
||||
with base.AtomicAction(self, "zaqar.post_between_%s_and_%s_messages" %
|
||||
(min_msg_count, max_msg_count)):
|
||||
with atomic.ActionTimer(self, "zaqar.post_between_%s_and_%s_messages" %
|
||||
(min_msg_count, max_msg_count)):
|
||||
queue.post(messages)
|
||||
|
||||
@base.atomic_action_timer("zaqar.list_messages")
|
||||
@atomic.action_timer("zaqar.list_messages")
|
||||
def _messages_list(self, queue):
|
||||
"""Gets messages from a given Zaqar queue.
|
||||
|
||||
|
23
rally/task/atomic.py
Normal file
23
rally/task/atomic.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright 2015: Mirantis Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
from rally.task import scenario
|
||||
|
||||
# TODO(boris-42): In future we will move code from scenario to atomic action
|
||||
# to simplify migration to new code we will make just links for
|
||||
# now
|
||||
ActionTimer = scenario.AtomicAction
|
||||
action_timer = scenario.atomic_action_timer
|
@ -32,7 +32,7 @@ from rally.plugins.openstack.context.keystone import existing_users
|
||||
from rally.plugins.openstack.context.keystone import users as users_ctx
|
||||
from rally.task import context
|
||||
from rally.task import runner
|
||||
from rally.task.scenarios import base as base_scenario
|
||||
from rally.task import scenario
|
||||
from rally.task import sla
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ class BenchmarkEngine(object):
|
||||
@rutils.log_task_wrapper(LOG.info,
|
||||
_("Task validation of scenarios names."))
|
||||
def _validate_config_scenarios_name(self, config):
|
||||
available = set(base_scenario.Scenario.list_benchmark_scenarios())
|
||||
available = set(scenario.Scenario.list_benchmark_scenarios())
|
||||
specified = set(six.iterkeys(config))
|
||||
|
||||
if not specified.issubset(available):
|
||||
@ -188,7 +188,7 @@ class BenchmarkEngine(object):
|
||||
|
||||
@rutils.log_task_wrapper(LOG.info, _("Task validation of syntax."))
|
||||
def _validate_config_syntax(self, config):
|
||||
for scenario, values in six.iteritems(config):
|
||||
for scenario_name, values in six.iteritems(config):
|
||||
for pos, kw in enumerate(values):
|
||||
try:
|
||||
runner.ScenarioRunner.validate(kw.get("runner", {}))
|
||||
@ -198,7 +198,7 @@ class BenchmarkEngine(object):
|
||||
except (exceptions.RallyException,
|
||||
jsonschema.ValidationError) as e:
|
||||
raise exceptions.InvalidBenchmarkConfig(
|
||||
name=scenario,
|
||||
name=scenario_name,
|
||||
pos=pos, config=kw,
|
||||
reason=six.text_type(e)
|
||||
)
|
||||
@ -206,9 +206,8 @@ class BenchmarkEngine(object):
|
||||
def _validate_config_semantic_helper(self, admin, user, name, pos,
|
||||
deployment, kwargs):
|
||||
try:
|
||||
base_scenario.Scenario.validate(name, kwargs, admin=admin,
|
||||
users=[user],
|
||||
deployment=deployment)
|
||||
scenario.Scenario.validate(name, kwargs, admin=admin,
|
||||
users=[user], deployment=deployment)
|
||||
except exceptions.InvalidScenarioArgument as e:
|
||||
kw = {"name": name, "pos": pos,
|
||||
"config": kwargs, "reason": six.text_type(e)}
|
||||
@ -266,7 +265,7 @@ class BenchmarkEngine(object):
|
||||
return runner.ScenarioRunner.get(cfg["type"])(self.task, cfg)
|
||||
|
||||
def _prepare_context(self, ctx, name, endpoint):
|
||||
scenario_context = base_scenario.Scenario.meta(name, "context")
|
||||
scenario_context = scenario.Scenario.meta(name, "context")
|
||||
if self.existing_users and "users" not in ctx:
|
||||
scenario_context.setdefault("existing_users", self.existing_users)
|
||||
elif "users" not in ctx:
|
||||
|
@ -25,7 +25,7 @@ from rally.common.plugin import plugin
|
||||
from rally.common import utils as rutils
|
||||
from rally import consts
|
||||
from rally.task import context
|
||||
from rally.task.scenarios import base as scenario_base
|
||||
from rally.task import scenario
|
||||
from rally.task import types
|
||||
from rally.task import utils
|
||||
|
||||
@ -54,13 +54,13 @@ def _run_scenario_once(args):
|
||||
{"task": context_obj["task"]["uuid"], "iteration": iteration})
|
||||
|
||||
context_obj["iteration"] = iteration
|
||||
scenario = cls(context_obj)
|
||||
scenario_inst = cls(context_obj)
|
||||
|
||||
error = []
|
||||
scenario_output = {"errors": "", "data": {}}
|
||||
try:
|
||||
with rutils.Timer() as timer:
|
||||
scenario_output = getattr(scenario,
|
||||
scenario_output = getattr(scenario_inst,
|
||||
method_name)(**kwargs) or scenario_output
|
||||
except Exception as e:
|
||||
error = utils.format_exc(e)
|
||||
@ -72,12 +72,12 @@ def _run_scenario_once(args):
|
||||
{"task": context_obj["task"]["uuid"], "iteration": iteration,
|
||||
"status": status})
|
||||
|
||||
return {"duration": timer.duration() - scenario.idle_duration(),
|
||||
return {"duration": timer.duration() - scenario_inst.idle_duration(),
|
||||
"timestamp": timer.timestamp(),
|
||||
"idle_duration": scenario.idle_duration(),
|
||||
"idle_duration": scenario_inst.idle_duration(),
|
||||
"error": error,
|
||||
"scenario_output": scenario_output,
|
||||
"atomic_actions": scenario.atomic_actions()}
|
||||
"atomic_actions": scenario_inst.atomic_actions()}
|
||||
|
||||
|
||||
def _worker_thread(queue, args):
|
||||
@ -200,7 +200,7 @@ class ScenarioRunner(plugin.Plugin):
|
||||
|
||||
def run(self, name, context, args):
|
||||
cls_name, method_name = name.split(".", 1)
|
||||
cls = scenario_base.Scenario.get_by_name(cls_name)
|
||||
cls = scenario.Scenario.get_by_name(cls_name)
|
||||
|
||||
self.aborted.clear()
|
||||
|
||||
|
@ -31,7 +31,7 @@ from rally.task import functional
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def scenario(context=None):
|
||||
def configure(context=None):
|
||||
"""Make from plain python method benchmark.
|
||||
|
||||
It sets 2 attributes to function:
|
@ -21,7 +21,7 @@ import re
|
||||
|
||||
from rally import exceptions
|
||||
from rally import osclients
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
|
||||
|
||||
def set(**kwargs):
|
||||
@ -50,8 +50,9 @@ def preprocess(cls, method_name, context, args):
|
||||
and resource configuration
|
||||
|
||||
"""
|
||||
preprocessors = base.Scenario.meta(cls, method_name=method_name,
|
||||
attr_name="preprocessors", default={})
|
||||
preprocessors = scenario.Scenario.meta(cls, method_name=method_name,
|
||||
attr_name="preprocessors",
|
||||
default={})
|
||||
clients = osclients.Clients(context["admin"]["endpoint"])
|
||||
processed_args = copy.deepcopy(args)
|
||||
|
||||
|
@ -13,13 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
|
||||
|
||||
class FakeScenarioPlugin1(base.Scenario):
|
||||
class FakeScenarioPlugin1(scenario.Scenario):
|
||||
"""Sample fake plugin."""
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list(self):
|
||||
"""Fake scenario."""
|
||||
pass
|
||||
|
@ -13,13 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
|
||||
|
||||
class FakeScenarioPlugin2(base.Scenario):
|
||||
class FakeScenarioPlugin2(scenario.Scenario):
|
||||
"""Sample fake plugin."""
|
||||
|
||||
@base.scenario()
|
||||
@scenario.configure()
|
||||
def list(self):
|
||||
"""Fake scenario."""
|
||||
pass
|
||||
|
@ -24,12 +24,12 @@ from rally.deployment.serverprovider.providers import (
|
||||
from rally import exceptions
|
||||
from rally.plugins.common.scenarios.dummy import dummy
|
||||
from rally.plugins.common.sla import failure_rate
|
||||
from rally.task.scenarios import base as scenario_base
|
||||
from rally.task import scenario
|
||||
from rally.task import sla
|
||||
from tests.unit import test
|
||||
|
||||
|
||||
SCENARIO = "rally.cli.commands.info.scenario_base.Scenario"
|
||||
SCENARIO = "rally.cli.commands.info.scenario.Scenario"
|
||||
SLA = "rally.cli.commands.info.sla.SLA"
|
||||
ENGINE = "rally.cli.commands.info.engine.Engine"
|
||||
PROVIDER = "rally.cli.commands.info.provider.ProviderFactory"
|
||||
@ -106,7 +106,7 @@ class InfoCommandsTestCase(test.TestCase):
|
||||
@mock.patch(DISCOVER + ".itersubclasses", return_value=[dummy.Dummy])
|
||||
def test_BenchmarkScenarios(self, mock_itersubclasses):
|
||||
status = self.info.BenchmarkScenarios()
|
||||
mock_itersubclasses.assert_called_with(scenario_base.Scenario)
|
||||
mock_itersubclasses.assert_called_with(scenario.Scenario)
|
||||
self.assertIsNone(status)
|
||||
|
||||
@mock.patch(DISCOVER + ".itersubclasses",
|
||||
|
@ -21,7 +21,7 @@ import traceback
|
||||
|
||||
import yaml
|
||||
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
from rally.task import engine
|
||||
from tests.unit import test
|
||||
|
||||
@ -35,7 +35,7 @@ class TaskSampleTestCase(test.TestCase):
|
||||
@mock.patch("rally.task.engine.BenchmarkEngine"
|
||||
"._validate_config_semantic")
|
||||
def test_schema_is_valid(self,
|
||||
mock_benchmark_engine__validate_config_semantic):
|
||||
mock_benchmark_engine__validate_config_semantic):
|
||||
scenarios = set()
|
||||
|
||||
for dirname, dirnames, filenames in os.walk(self.samples_path):
|
||||
@ -62,10 +62,10 @@ class TaskSampleTestCase(test.TestCase):
|
||||
|
||||
# TODO(boris-42): We should refactor scenarios framework add "_" to
|
||||
# all non-benchmark methods.. Then this test will pass.
|
||||
missing = set(base.Scenario.list_benchmark_scenarios()) - scenarios
|
||||
missing = set(scenario.Scenario.list_benchmark_scenarios()) - scenarios
|
||||
# check missing scenario is not from plugin
|
||||
missing = [scenario for scenario in list(missing) if
|
||||
base.Scenario.get_by_name(scenario.split(".")[0]).
|
||||
missing = [s for s in list(missing)
|
||||
if scenario.Scenario.get_by_name(s.split(".")[0]).
|
||||
__module__.startswith("rally")]
|
||||
self.assertEqual(missing, [],
|
||||
"These scenarios don't have samples: %s" % missing)
|
||||
|
@ -31,7 +31,7 @@ from rally.common import objects
|
||||
from rally.common import utils as rally_utils
|
||||
from rally import consts
|
||||
from rally.task import context
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
|
||||
|
||||
def generate_uuid():
|
||||
@ -1464,7 +1464,7 @@ class FakeRunner(object):
|
||||
}
|
||||
|
||||
|
||||
class FakeScenario(base.Scenario):
|
||||
class FakeScenario(scenario.Scenario):
|
||||
|
||||
def idle_time(self):
|
||||
return 0
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from rally.plugins.openstack.scenarios.authenticate import authenticate
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import atomic
|
||||
from tests.unit import test
|
||||
|
||||
|
||||
@ -25,40 +25,45 @@ AUTHENTICATE_MODULE = (
|
||||
class AuthenticateTestCase(test.ScenarioTestCase):
|
||||
|
||||
def test_keystone(self):
|
||||
scenario = authenticate.Authenticate()
|
||||
scenario.keystone()
|
||||
scenario_inst = authenticate.Authenticate()
|
||||
scenario_inst.keystone()
|
||||
self.assertTrue(self.client_created("keystone"))
|
||||
|
||||
def test_validate_glance(self):
|
||||
scenario = authenticate.Authenticate()
|
||||
scenario_inst = authenticate.Authenticate()
|
||||
image_name = "__intentionally_non_existent_image___"
|
||||
with base.AtomicAction(scenario, "authenticate.validate_glance"):
|
||||
scenario.validate_glance(5)
|
||||
with atomic.ActionTimer(scenario_inst,
|
||||
"authenticate.validate_glance"):
|
||||
scenario_inst.validate_glance(5)
|
||||
self.clients("glance").images.list.assert_called_with(name=image_name)
|
||||
self.assertEqual(self.clients("glance").images.list.call_count, 5)
|
||||
|
||||
def test_validate_nova(self):
|
||||
scenario = authenticate.Authenticate()
|
||||
with base.AtomicAction(scenario, "authenticate.validate_nova"):
|
||||
scenario.validate_nova(5)
|
||||
scenario_inst = authenticate.Authenticate()
|
||||
with atomic.ActionTimer(scenario_inst,
|
||||
"authenticate.validate_nova"):
|
||||
scenario_inst.validate_nova(5)
|
||||
self.assertEqual(self.clients("nova").flavors.list.call_count, 5)
|
||||
|
||||
def test_validate_cinder(self):
|
||||
scenario = authenticate.Authenticate()
|
||||
with base.AtomicAction(scenario, "authenticate.validate_cinder"):
|
||||
scenario.validate_cinder(5)
|
||||
scenario_inst = authenticate.Authenticate()
|
||||
with atomic.ActionTimer(scenario_inst,
|
||||
"authenticate.validate_cinder"):
|
||||
scenario_inst.validate_cinder(5)
|
||||
self.assertEqual(self.clients("cinder").volume_types.list.call_count,
|
||||
5)
|
||||
|
||||
def test_validate_neutron(self):
|
||||
scenario = authenticate.Authenticate()
|
||||
with base.AtomicAction(scenario, "authenticate.validate_neutron"):
|
||||
scenario.validate_neutron(5)
|
||||
scenario_inst = authenticate.Authenticate()
|
||||
with atomic.ActionTimer(scenario_inst,
|
||||
"authenticate.validate_neutron"):
|
||||
scenario_inst.validate_neutron(5)
|
||||
self.assertEqual(self.clients("neutron").list_networks.call_count, 5)
|
||||
|
||||
def test_validate_heat(self):
|
||||
scenario = authenticate.Authenticate()
|
||||
with base.AtomicAction(scenario, "authenticate.validate_heat"):
|
||||
scenario.validate_heat(5)
|
||||
scenario_inst = authenticate.Authenticate()
|
||||
with atomic.ActionTimer(scenario_inst,
|
||||
"authenticate.validate_heat"):
|
||||
scenario_inst.validate_heat(5)
|
||||
self.clients("heat").stacks.list.assert_called_with(limit=0)
|
||||
self.assertEqual(self.clients("heat").stacks.list.call_count, 5)
|
||||
|
@ -103,7 +103,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
self.assertRaises(exceptions.InvalidTaskException, eng.validate)
|
||||
self.assertTrue(task.set_failed.called)
|
||||
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario")
|
||||
def test__validate_config_scenarios_name(self, mock_scenario):
|
||||
config = {
|
||||
"a": [],
|
||||
@ -113,7 +113,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
eng = engine.BenchmarkEngine(config, mock.MagicMock())
|
||||
eng._validate_config_scenarios_name(config)
|
||||
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario")
|
||||
def test__validate_config_scenarios_name_non_exsisting(self,
|
||||
mock_scenario):
|
||||
config = {
|
||||
@ -165,7 +165,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
self.assertRaises(exceptions.InvalidBenchmarkConfig,
|
||||
eng._validate_config_syntax, config)
|
||||
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario.validate")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario.validate")
|
||||
def test__validate_config_semantic_helper(self, mock_scenario_validate):
|
||||
deployment = mock.MagicMock()
|
||||
eng = engine.BenchmarkEngine(mock.MagicMock(), mock.MagicMock())
|
||||
@ -175,7 +175,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
"name", {"args": "args"}, admin="admin", users=["user"],
|
||||
deployment=deployment)
|
||||
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario.validate",
|
||||
@mock.patch("rally.task.engine.scenario.Scenario.validate",
|
||||
side_effect=exceptions.InvalidScenarioArgument)
|
||||
def test__validate_config_semanitc_helper_invalid_arg(
|
||||
self, mock_scenario_validate):
|
||||
@ -247,7 +247,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
@mock.patch("rally.task.engine.ResultConsumer")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.cleanup")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.setup")
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.runner.ScenarioRunner")
|
||||
def test_run__update_status(
|
||||
self, mock_scenario_runner, mock_scenario,
|
||||
@ -262,7 +262,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
])
|
||||
|
||||
@mock.patch("rally.task.engine.ResultConsumer")
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.runner.ScenarioRunner")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.cleanup")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.setup")
|
||||
@ -279,7 +279,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
eng.run()
|
||||
|
||||
@mock.patch("rally.task.engine.ResultConsumer")
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.runner.ScenarioRunner")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.cleanup")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.setup")
|
||||
@ -295,7 +295,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
eng.run()
|
||||
|
||||
@mock.patch("rally.task.engine.ResultConsumer")
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.runner.ScenarioRunner")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.cleanup")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.setup")
|
||||
@ -312,7 +312,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
|
||||
@mock.patch("rally.task.engine.LOG")
|
||||
@mock.patch("rally.task.engine.ResultConsumer")
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario")
|
||||
@mock.patch("rally.task.engine.runner.ScenarioRunner")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.cleanup")
|
||||
@mock.patch("rally.task.engine.context.ContextManager.setup")
|
||||
@ -333,7 +333,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
|
||||
self.assertEqual(2, mock_log.exception.call_count)
|
||||
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario.meta")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario.meta")
|
||||
def test__prepare_context(self, mock_scenario_meta):
|
||||
default_context = {"a": 1, "b": 2}
|
||||
mock_scenario_meta.return_value = default_context
|
||||
@ -358,7 +358,7 @@ class BenchmarkEngineTestCase(test.TestCase):
|
||||
self.assertEqual(result, expected_result)
|
||||
mock_scenario_meta.assert_called_once_with(name, "context")
|
||||
|
||||
@mock.patch("rally.task.engine.base_scenario.Scenario.meta")
|
||||
@mock.patch("rally.task.engine.scenario.Scenario.meta")
|
||||
def test__prepare_context_with_existing_users(self, mock_scenario_meta):
|
||||
mock_scenario_meta.return_value = {}
|
||||
task = mock.MagicMock()
|
||||
|
@ -21,7 +21,7 @@ import mock
|
||||
|
||||
from rally.plugins.common.runners import serial
|
||||
from rally.task import runner
|
||||
from rally.task.scenarios import base as scenario_base
|
||||
from rally.task import scenario
|
||||
from tests.unit import fakes
|
||||
from tests.unit import test
|
||||
|
||||
@ -186,7 +186,7 @@ class ScenarioRunnerTestCase(test.TestCase):
|
||||
self.assertEqual(list(runner_obj.result_queue), [])
|
||||
|
||||
cls_name, method_name = scenario_name.split(".", 1)
|
||||
cls = scenario_base.Scenario.get_by_name(cls_name)
|
||||
cls = scenario.Scenario.get_by_name(cls_name)
|
||||
|
||||
expected_config_kwargs = {"image": 1, "flavor": 1}
|
||||
runner_obj._run_scenario.assert_called_once_with(
|
||||
|
@ -22,7 +22,7 @@ from rally import consts
|
||||
from rally import exceptions
|
||||
from rally.plugins.common.scenarios.dummy import dummy
|
||||
from rally.task import context
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
from rally.task import validation
|
||||
from tests.unit import fakes
|
||||
from tests.unit import test
|
||||
@ -31,34 +31,34 @@ from tests.unit import test
|
||||
class ScenarioTestCase(test.TestCase):
|
||||
|
||||
def test_get_by_name(self):
|
||||
self.assertEqual(dummy.Dummy, base.Scenario.get_by_name("Dummy"))
|
||||
self.assertEqual(dummy.Dummy, scenario.Scenario.get_by_name("Dummy"))
|
||||
|
||||
def test_get_by_name_not_found(self):
|
||||
self.assertRaises(exceptions.NoSuchScenario,
|
||||
base.Scenario.get_by_name,
|
||||
scenario.Scenario.get_by_name,
|
||||
"non existing scenario")
|
||||
|
||||
def test_get_scenario_by_name(self):
|
||||
scenario_method = base.Scenario.get_scenario_by_name("Dummy.dummy")
|
||||
scenario_method = scenario.Scenario.get_scenario_by_name("Dummy.dummy")
|
||||
self.assertEqual(dummy.Dummy.dummy, scenario_method)
|
||||
|
||||
def test_get_scenario_by_name_shortened(self):
|
||||
scenario_method = base.Scenario.get_scenario_by_name("dummy")
|
||||
scenario_method = scenario.Scenario.get_scenario_by_name("dummy")
|
||||
self.assertEqual(dummy.Dummy.dummy, scenario_method)
|
||||
|
||||
def test_get_scenario_by_name_shortened_not_found(self):
|
||||
self.assertRaises(exceptions.NoSuchScenario,
|
||||
base.Scenario.get_scenario_by_name,
|
||||
scenario.Scenario.get_scenario_by_name,
|
||||
"dumy")
|
||||
|
||||
def test_get_scenario_by_name_bad_group_name(self):
|
||||
self.assertRaises(exceptions.NoSuchScenario,
|
||||
base.Scenario.get_scenario_by_name,
|
||||
scenario.Scenario.get_scenario_by_name,
|
||||
"Dumy.dummy")
|
||||
|
||||
def test_get_scenario_by_name_bad_scenario_name(self):
|
||||
self.assertRaises(exceptions.NoSuchScenario,
|
||||
base.Scenario.get_scenario_by_name,
|
||||
scenario.Scenario.get_scenario_by_name,
|
||||
"Dummy.dumy")
|
||||
|
||||
def test__validate_helper(self):
|
||||
@ -69,7 +69,8 @@ class ScenarioTestCase(test.TestCase):
|
||||
clients = mock.MagicMock()
|
||||
config = {"a": 1, "b": 2}
|
||||
deployment = mock.MagicMock()
|
||||
base.Scenario._validate_helper(validators, clients, config, deployment)
|
||||
scenario.Scenario._validate_helper(validators, clients, config,
|
||||
deployment)
|
||||
for validator in validators:
|
||||
validator.assert_called_with(config, clients=clients,
|
||||
deployment=deployment)
|
||||
@ -79,7 +80,7 @@ class ScenarioTestCase(test.TestCase):
|
||||
validator.side_effect = Exception()
|
||||
|
||||
self.assertRaises(exceptions.InvalidScenarioArgument,
|
||||
base.Scenario._validate_helper,
|
||||
scenario.Scenario._validate_helper,
|
||||
[validator], "cl", "config", "deployment")
|
||||
validator.assert_called_once_with("config", clients="cl",
|
||||
deployment="deployment")
|
||||
@ -94,10 +95,10 @@ class ScenarioTestCase(test.TestCase):
|
||||
clients = mock.MagicMock()
|
||||
args = {"a": 1, "b": 2}
|
||||
self.assertRaises(exceptions.InvalidScenarioArgument,
|
||||
base.Scenario._validate_helper,
|
||||
scenario.Scenario._validate_helper,
|
||||
validators, clients, args, "fake_uuid")
|
||||
|
||||
@mock.patch("rally.task.scenarios.base.Scenario.get_by_name")
|
||||
@mock.patch("rally.task.scenario.Scenario.get_by_name")
|
||||
def test_validate__no_validators(self, mock_scenario_get_by_name):
|
||||
|
||||
class FakeScenario(fakes.FakeScenario):
|
||||
@ -107,12 +108,12 @@ class ScenarioTestCase(test.TestCase):
|
||||
FakeScenario.do_it.validators = []
|
||||
mock_scenario_get_by_name.return_value = FakeScenario
|
||||
|
||||
base.Scenario.validate("FakeScenario.do_it", {"a": 1, "b": 2})
|
||||
scenario.Scenario.validate("FakeScenario.do_it", {"a": 1, "b": 2})
|
||||
|
||||
mock_scenario_get_by_name.assert_called_once_with("FakeScenario")
|
||||
|
||||
@mock.patch("rally.task.scenarios.base.Scenario._validate_helper")
|
||||
@mock.patch("rally.task.scenarios.base.Scenario.get_by_name")
|
||||
@mock.patch("rally.task.scenario.Scenario._validate_helper")
|
||||
@mock.patch("rally.task.scenario.Scenario.get_by_name")
|
||||
def test_validate__admin_validators(self, mock_scenario_get_by_name,
|
||||
mock_scenario__validate_helper):
|
||||
|
||||
@ -129,13 +130,13 @@ class ScenarioTestCase(test.TestCase):
|
||||
FakeScenario.do_it.validators = validators
|
||||
deployment = mock.MagicMock()
|
||||
args = {"a": 1, "b": 2}
|
||||
base.Scenario.validate(
|
||||
scenario.Scenario.validate(
|
||||
"FakeScenario.do_it", args, admin="admin", deployment=deployment)
|
||||
mock_scenario__validate_helper.assert_called_once_with(
|
||||
validators, "admin", args, deployment)
|
||||
|
||||
@mock.patch("rally.task.scenarios.base.Scenario._validate_helper")
|
||||
@mock.patch("rally.task.scenarios.base.Scenario.get_by_name")
|
||||
@mock.patch("rally.task.scenario.Scenario._validate_helper")
|
||||
@mock.patch("rally.task.scenario.Scenario.get_by_name")
|
||||
def test_validate_user_validators(self, mock_scenario_get_by_name,
|
||||
mock_scenario__validate_helper):
|
||||
|
||||
@ -151,7 +152,7 @@ class ScenarioTestCase(test.TestCase):
|
||||
|
||||
FakeScenario.do_it.validators = validators
|
||||
args = {"a": 1, "b": 2}
|
||||
base.Scenario.validate(
|
||||
scenario.Scenario.validate(
|
||||
"FakeScenario.do_it", args, users=["u1", "u2"])
|
||||
|
||||
mock_scenario__validate_helper.assert_has_calls([
|
||||
@ -168,9 +169,9 @@ class ScenarioTestCase(test.TestCase):
|
||||
preprocessors = [mock.MagicMock(), mock.MagicMock()]
|
||||
MyFakeScenario.do_it.__dict__[attr_name] = preprocessors
|
||||
|
||||
scenario = MyFakeScenario()
|
||||
self.assertEqual(scenario.meta(cls="MyFakeScenario.do_it",
|
||||
attr_name=attr_name), preprocessors)
|
||||
inst = MyFakeScenario()
|
||||
self.assertEqual(inst.meta(cls="MyFakeScenario.do_it",
|
||||
attr_name=attr_name), preprocessors)
|
||||
|
||||
def test_meta_class_returns_non_empty_list(self):
|
||||
|
||||
@ -181,83 +182,80 @@ class ScenarioTestCase(test.TestCase):
|
||||
preprocessors = [mock.MagicMock(), mock.MagicMock()]
|
||||
MyFakeScenario.do_it.__dict__[attr_name] = preprocessors
|
||||
|
||||
scenario = MyFakeScenario()
|
||||
self.assertEqual(scenario.meta(cls=fakes.FakeScenario,
|
||||
method_name="do_it",
|
||||
attr_name=attr_name), preprocessors)
|
||||
inst = MyFakeScenario()
|
||||
self.assertEqual(inst.meta(cls=fakes.FakeScenario,
|
||||
method_name="do_it",
|
||||
attr_name=attr_name), preprocessors)
|
||||
|
||||
def test_meta_string_returns_empty_list(self):
|
||||
empty_list = []
|
||||
scenario = fakes.FakeScenario()
|
||||
self.assertEqual(scenario.meta(cls="FakeScenario.do_it",
|
||||
attr_name="foo", default=empty_list),
|
||||
inst = fakes.FakeScenario()
|
||||
self.assertEqual(inst.meta(cls="FakeScenario.do_it",
|
||||
attr_name="foo", default=empty_list),
|
||||
empty_list)
|
||||
|
||||
def test_meta_class_returns_empty_list(self):
|
||||
empty_list = []
|
||||
scenario = fakes.FakeScenario()
|
||||
self.assertEqual(scenario.meta(cls=fakes.FakeScenario,
|
||||
method_name="do_it", attr_name="foo",
|
||||
default=empty_list),
|
||||
inst = fakes.FakeScenario()
|
||||
self.assertEqual(inst.meta(cls=fakes.FakeScenario,
|
||||
method_name="do_it", attr_name="foo",
|
||||
default=empty_list),
|
||||
empty_list)
|
||||
|
||||
def test_is_scenario_success(self):
|
||||
scenario = dummy.Dummy()
|
||||
self.assertTrue(base.Scenario.is_scenario(scenario, "dummy"))
|
||||
self.assertTrue(scenario.Scenario.is_scenario(dummy.Dummy(), "dummy"))
|
||||
|
||||
def test_is_scenario_not_scenario(self):
|
||||
scenario = dummy.Dummy()
|
||||
self.assertFalse(base.Scenario.is_scenario(scenario,
|
||||
"_random_fail_emitter"))
|
||||
self.assertFalse(scenario.Scenario.is_scenario(dummy.Dummy(),
|
||||
"_random_fail_emitter"))
|
||||
|
||||
def test_is_scenario_non_existing(self):
|
||||
scenario = dummy.Dummy()
|
||||
self.assertFalse(base.Scenario.is_scenario(scenario, "non_existing"))
|
||||
self.assertFalse(scenario.Scenario.is_scenario(dummy.Dummy(),
|
||||
"non_existing"))
|
||||
|
||||
def test_sleep_between_invalid_args(self):
|
||||
scenario = base.Scenario()
|
||||
self.assertRaises(exceptions.InvalidArgumentsException,
|
||||
scenario.sleep_between, 15, 5)
|
||||
scenario.Scenario().sleep_between, 15, 5)
|
||||
|
||||
self.assertRaises(exceptions.InvalidArgumentsException,
|
||||
scenario.sleep_between, -1, 0)
|
||||
scenario.Scenario().sleep_between, -1, 0)
|
||||
|
||||
self.assertRaises(exceptions.InvalidArgumentsException,
|
||||
scenario.sleep_between, 0, -2)
|
||||
scenario.Scenario().sleep_between, 0, -2)
|
||||
|
||||
def test_sleep_between(self):
|
||||
scenario = base.Scenario()
|
||||
scenario.sleep_between(0.001, 0.002)
|
||||
self.assertTrue(0.001 <= scenario.idle_duration() <= 0.002)
|
||||
scenario_inst = scenario.Scenario()
|
||||
scenario_inst.sleep_between(0.001, 0.002)
|
||||
self.assertTrue(0.001 <= scenario_inst.idle_duration() <= 0.002)
|
||||
|
||||
def test_sleep_beetween_multi(self):
|
||||
scenario = base.Scenario()
|
||||
scenario.sleep_between(0.001, 0.001)
|
||||
scenario.sleep_between(0.004, 0.004)
|
||||
self.assertEqual(scenario.idle_duration(), 0.005)
|
||||
scenario_inst = scenario.Scenario()
|
||||
scenario_inst.sleep_between(0.001, 0.001)
|
||||
scenario_inst.sleep_between(0.004, 0.004)
|
||||
self.assertEqual(scenario_inst.idle_duration(), 0.005)
|
||||
|
||||
@mock.patch("rally.task.scenarios.base.time.sleep")
|
||||
@mock.patch("rally.task.scenarios.base.random.uniform")
|
||||
@mock.patch("rally.task.scenario.time.sleep")
|
||||
@mock.patch("rally.task.scenario.random.uniform")
|
||||
def test_sleep_between_internal(self, mock_uniform, mock_sleep):
|
||||
scenario = base.Scenario()
|
||||
scenario_inst = scenario.Scenario()
|
||||
|
||||
mock_uniform.return_value = 1.5
|
||||
scenario.sleep_between(1, 2)
|
||||
scenario_inst.sleep_between(1, 2)
|
||||
|
||||
mock_sleep.assert_called_once_with(mock_uniform.return_value)
|
||||
self.assertEqual(scenario.idle_duration(), mock_uniform.return_value)
|
||||
self.assertEqual(scenario_inst.idle_duration(),
|
||||
mock_uniform.return_value)
|
||||
|
||||
def test_context(self):
|
||||
ctx = {}
|
||||
scenario = base.Scenario(context=ctx)
|
||||
self.assertEqual(ctx, scenario.context)
|
||||
ctx = mock.MagicMock()
|
||||
self.assertEqual(ctx, scenario.Scenario(context=ctx).context)
|
||||
|
||||
def test_scenario_context_are_valid(self):
|
||||
scenarios = base.Scenario.list_benchmark_scenarios()
|
||||
scenarios = scenario.Scenario.list_benchmark_scenarios()
|
||||
|
||||
for scenario in scenarios:
|
||||
cls_name, method_name = scenario.split(".", 1)
|
||||
cls = base.Scenario.get_by_name(cls_name)
|
||||
for name in scenarios:
|
||||
cls_name, method_name = name.split(".", 1)
|
||||
cls = scenario.Scenario.get_by_name(cls_name)
|
||||
ctx = getattr(cls, method_name).context
|
||||
try:
|
||||
context.ContextManager.validate(ctx)
|
||||
@ -267,12 +265,12 @@ class ScenarioTestCase(test.TestCase):
|
||||
"Scenario `%s` has wrong context" % scenario)
|
||||
|
||||
def test_RESOURCE_NAME_PREFIX(self):
|
||||
self.assertIsInstance(base.Scenario.RESOURCE_NAME_PREFIX,
|
||||
self.assertIsInstance(scenario.Scenario.RESOURCE_NAME_PREFIX,
|
||||
six.string_types)
|
||||
|
||||
def test_RESOURCE_NAME_LENGTH(self):
|
||||
self.assertIsInstance(base.Scenario.RESOURCE_NAME_LENGTH, int)
|
||||
self.assertTrue(base.Scenario.RESOURCE_NAME_LENGTH > 4)
|
||||
self.assertIsInstance(scenario.Scenario.RESOURCE_NAME_LENGTH, int)
|
||||
self.assertTrue(scenario.Scenario.RESOURCE_NAME_LENGTH > 4)
|
||||
|
||||
def test_generate_random_name(self):
|
||||
set_by_length = lambda lst: set(map(len, lst))
|
||||
@ -281,48 +279,48 @@ class ScenarioTestCase(test.TestCase):
|
||||
range_num = 50
|
||||
|
||||
# Defaults
|
||||
result = [base.Scenario._generate_random_name()
|
||||
result = [scenario.Scenario._generate_random_name()
|
||||
for i in range(range_num)]
|
||||
self.assertEqual(len(result), len(set(result)))
|
||||
self.assertEqual(
|
||||
set_by_length(result),
|
||||
set([(len(
|
||||
base.Scenario.RESOURCE_NAME_PREFIX) +
|
||||
base.Scenario.RESOURCE_NAME_LENGTH)]))
|
||||
scenario.Scenario.RESOURCE_NAME_PREFIX) +
|
||||
scenario.Scenario.RESOURCE_NAME_LENGTH)]))
|
||||
self.assertEqual(
|
||||
len_by_prefix(result, base.Scenario.RESOURCE_NAME_PREFIX),
|
||||
len_by_prefix(result, scenario.Scenario.RESOURCE_NAME_PREFIX),
|
||||
range_num)
|
||||
|
||||
# Custom prefix
|
||||
prefix = "another_prefix_"
|
||||
result = [base.Scenario._generate_random_name(prefix)
|
||||
result = [scenario.Scenario._generate_random_name(prefix)
|
||||
for i in range(range_num)]
|
||||
self.assertEqual(len(result), len(set(result)))
|
||||
self.assertEqual(
|
||||
set_by_length(result),
|
||||
set([len(prefix) + base.Scenario.RESOURCE_NAME_LENGTH]))
|
||||
set([len(prefix) + scenario.Scenario.RESOURCE_NAME_LENGTH]))
|
||||
self.assertEqual(
|
||||
len_by_prefix(result, prefix), range_num)
|
||||
|
||||
# Custom length
|
||||
name_length = 12
|
||||
result = [
|
||||
base.Scenario._generate_random_name(length=name_length)
|
||||
scenario.Scenario._generate_random_name(length=name_length)
|
||||
for i in range(range_num)]
|
||||
self.assertEqual(len(result), len(set(result)))
|
||||
self.assertEqual(
|
||||
set_by_length(result),
|
||||
set([len(
|
||||
base.Scenario.RESOURCE_NAME_PREFIX) + name_length]))
|
||||
scenario.Scenario.RESOURCE_NAME_PREFIX) + name_length]))
|
||||
self.assertEqual(
|
||||
len_by_prefix(result, base.Scenario.RESOURCE_NAME_PREFIX),
|
||||
len_by_prefix(result, scenario.Scenario.RESOURCE_NAME_PREFIX),
|
||||
range_num)
|
||||
|
||||
|
||||
class AtomicActionTestCase(test.TestCase):
|
||||
def test__init__(self):
|
||||
fake_scenario_instance = fakes.FakeScenario()
|
||||
c = base.AtomicAction(fake_scenario_instance, "asdf")
|
||||
c = scenario.AtomicAction(fake_scenario_instance, "asdf")
|
||||
self.assertEqual(c.scenario_instance, fake_scenario_instance)
|
||||
self.assertEqual(c.name, "asdf")
|
||||
|
||||
@ -331,7 +329,7 @@ class AtomicActionTestCase(test.TestCase):
|
||||
def test__exit__(self, mock_time, mock_fake_scenario__add_atomic_actions):
|
||||
fake_scenario_instance = fakes.FakeScenario()
|
||||
self.start = mock_time.time()
|
||||
with base.AtomicAction(fake_scenario_instance, "asdf"):
|
||||
with scenario.AtomicAction(fake_scenario_instance, "asdf"):
|
||||
pass
|
||||
duration = mock_time.time() - self.start
|
||||
mock_fake_scenario__add_atomic_actions.assert_called_once_with(
|
@ -334,7 +334,7 @@ class NeutronNetworkResourceTypeTestCase(test.TestCase):
|
||||
|
||||
class PreprocessTestCase(test.TestCase):
|
||||
|
||||
@mock.patch("rally.task.types.base.Scenario.meta")
|
||||
@mock.patch("rally.task.types.scenario.Scenario.meta")
|
||||
@mock.patch("rally.task.types.osclients")
|
||||
def test_preprocess(self, mock_osclients, mock_scenario_meta):
|
||||
cls = "some_class"
|
||||
|
@ -17,7 +17,7 @@ from rally.common.plugin import discover
|
||||
from rally.common import utils
|
||||
from rally.deployment import engine
|
||||
from rally.deployment.serverprovider import provider
|
||||
from rally.task.scenarios import base
|
||||
from rally.task import scenario
|
||||
from rally.task import sla
|
||||
from tests.unit import test
|
||||
|
||||
@ -42,18 +42,18 @@ class DocstringsTestCase(test.TestCase):
|
||||
|
||||
def test_all_scenarios_have_docstrings(self):
|
||||
ignored_params = ["self", "scenario_obj"]
|
||||
for scenario_group in discover.itersubclasses(base.Scenario):
|
||||
for scenario_group in discover.itersubclasses(scenario.Scenario):
|
||||
if scenario_group.__module__.startswith("tests."):
|
||||
continue
|
||||
|
||||
for method in dir(scenario_group):
|
||||
if base.Scenario.is_scenario(scenario_group, method):
|
||||
scenario = getattr(scenario_group, method)
|
||||
if scenario.Scenario.is_scenario(scenario_group, method):
|
||||
scenario_inst = getattr(scenario_group, method)
|
||||
scenario_name = scenario_group.__name__ + "." + method
|
||||
self.assertIsNotNone(scenario.__doc__,
|
||||
self.assertIsNotNone(scenario_inst.__doc__,
|
||||
"%s doensn't have a docstring." %
|
||||
scenario_name)
|
||||
doc = utils.parse_docstring(scenario.__doc__)
|
||||
doc = utils.parse_docstring(scenario_inst.__doc__)
|
||||
short_description = doc["short_description"]
|
||||
self.assertIsNotNone(short_description,
|
||||
"Docstring for %s should have "
|
||||
@ -63,8 +63,8 @@ class DocstringsTestCase(test.TestCase):
|
||||
"One-line description for %s "
|
||||
"should be declarative and not start "
|
||||
"with 'Test(s) ...'" % scenario_name)
|
||||
params_count = scenario.__code__.co_argcount
|
||||
params = scenario.__code__.co_varnames[:params_count]
|
||||
params_count = scenario_inst.__code__.co_argcount
|
||||
params = scenario_inst.__code__.co_varnames[:params_count]
|
||||
documented_params = [p["name"] for p in doc["params"]]
|
||||
for param in params:
|
||||
if param not in ignored_params:
|
||||
@ -76,7 +76,7 @@ class DocstringsTestCase(test.TestCase):
|
||||
"param": param})
|
||||
|
||||
def test_all_scenario_groups_have_docstrings(self):
|
||||
for scenario_group in discover.itersubclasses(base.Scenario):
|
||||
for scenario_group in discover.itersubclasses(scenario.Scenario):
|
||||
self._assert_class_has_docstrings(scenario_group,
|
||||
long_description=False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user