Refactoring of scenario plugin base

* Moved rally.task.scenarios.base -> rally.task.scenario

  - Shorter imports and simpler structure of tree
  - Unified with other plugin bases

* Add rally.task.atomic module

  - We will use atomic actions in both scenarios and context
    this is first step of unification

  - Module has only links to method and atomic action context
    with new names. So we will change all plugins but won't
    touch atomic actions at this patch (to reduce amount of
    LOC in this patch)

  - Next step is to move and unify atomic action code for
    scenarios and contexts

* Rename rally.task.scenario.scenario to rally.task.scenario.configure

  scenario.scenario is unclear and not aligned with other plugin
  types where configure() method is used for the same purpose

* Add shortcut rally.plugins.openstack.scenario.configure

  so there is no need to import rally.plugins.openstack.scenario
  and rally.task.scenario modules

* Fix all unit tests & docs

Change-Id: I388bd1c1af951670c6a1d043cfeb2a6753a085b0
This commit is contained in:
Boris Pavlovic 2015-08-13 15:42:32 -07:00
parent 8686f4487d
commit 95dce53197
57 changed files with 484 additions and 470 deletions

View File

@ -17,24 +17,25 @@
import random import random
import time 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 # This is used to test relative import
from test_relative_import import zzz from test_relative_import import zzz
class FakePlugin(base.Scenario): class FakePlugin(scenario.Scenario):
"""Fake plugin with a scenario.""" """Fake plugin with a scenario."""
@base.atomic_action_timer("test1") @atomic.action_timer("test1")
def _test1(self, factor): def _test1(self, factor):
time.sleep(random.random() * 0.1) time.sleep(random.random() * 0.1)
@base.atomic_action_timer("test2") @atomic.action_timer("test2")
def _test2(self, factor): def _test2(self, factor):
time.sleep(random.random() * factor) time.sleep(random.random() * factor)
@base.scenario() @scenario.configure()
def testplugin(self, factor=1): def testplugin(self, factor=1):
"""Fake scenario. """Fake scenario.

View File

@ -19,7 +19,7 @@ from rally import consts
from rally.plugins.openstack.context.cleanup import manager as resource_manager from rally.plugins.openstack.context.cleanup import manager as resource_manager
from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils
from rally.task import context from rally.task import context
from rally.task.scenarios import base as scenario_base from rally.task import scenario
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -60,7 +60,7 @@ class VolumeGenerator(context.Context):
self.context["tenants"][tenant_id].setdefault("volumes", []) self.context["tenants"][tenant_id].setdefault("volumes", [])
cinder_util = cinder_utils.CinderScenario({"user": user}) cinder_util = cinder_utils.CinderScenario({"user": user})
for i in range(volumes_per_tenant): 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_") prefix="ctx_rally_volume_")
vol = cinder_util._create_volume(size, display_name=rnd_name) vol = cinder_util._create_volume(size, display_name=rnd_name)
self.context["tenants"][tenant_id]["volumes"].append(vol._info) self.context["tenants"][tenant_id]["volumes"].append(vol._info)

View File

@ -14,10 +14,14 @@
# under the License. # under the License.
from rally import osclients 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.""" """Base class for all OpenStack scenarios."""
def __init__(self, context=None, admin_clients=None, clients=None): def __init__(self, context=None, admin_clients=None, clients=None):

View File

@ -13,7 +13,7 @@
# under the License. # under the License.
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
from rally.task import validation from rally.task import validation
@ -25,14 +25,14 @@ class Authenticate(scenario.OpenStackScenario):
""" """
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def keystone(self): def keystone(self):
"""Check Keystone Client.""" """Check Keystone Client."""
self.clients("keystone") self.clients("keystone")
@validation.number("repetitions", minval=1) @validation.number("repetitions", minval=1)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def validate_glance(self, repetitions): def validate_glance(self, repetitions):
"""Check Glance Client to ensure validation of token. """Check Glance Client to ensure validation of token.
@ -45,12 +45,12 @@ class Authenticate(scenario.OpenStackScenario):
glance_client = self.clients("glance") glance_client = self.clients("glance")
image_name = "__intentionally_non_existent_image___" image_name = "__intentionally_non_existent_image___"
for i in range(repetitions): 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)) list(glance_client.images.list(name=image_name))
@validation.number("repetitions", minval=1) @validation.number("repetitions", minval=1)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def validate_nova(self, repetitions): def validate_nova(self, repetitions):
"""Check Nova Client to ensure validation of token. """Check Nova Client to ensure validation of token.
@ -61,12 +61,12 @@ class Authenticate(scenario.OpenStackScenario):
""" """
nova_client = self.clients("nova") nova_client = self.clients("nova")
for i in range(repetitions): for i in range(repetitions):
with base.AtomicAction(self, "authenticate.validate_nova"): with atomic.ActionTimer(self, "authenticate.validate_nova"):
nova_client.flavors.list() nova_client.flavors.list()
@validation.number("repetitions", minval=1) @validation.number("repetitions", minval=1)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def validate_cinder(self, repetitions): def validate_cinder(self, repetitions):
"""Check Cinder Client to ensure validation of token. """Check Cinder Client to ensure validation of token.
@ -77,12 +77,12 @@ class Authenticate(scenario.OpenStackScenario):
""" """
cinder_client = self.clients("cinder") cinder_client = self.clients("cinder")
for i in range(repetitions): for i in range(repetitions):
with base.AtomicAction(self, "authenticate.validate_cinder"): with atomic.ActionTimer(self, "authenticate.validate_cinder"):
cinder_client.volume_types.list() cinder_client.volume_types.list()
@validation.number("repetitions", minval=1) @validation.number("repetitions", minval=1)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def validate_neutron(self, repetitions): def validate_neutron(self, repetitions):
"""Check Neutron Client to ensure validation of token. """Check Neutron Client to ensure validation of token.
@ -93,12 +93,12 @@ class Authenticate(scenario.OpenStackScenario):
""" """
neutron_client = self.clients("neutron") neutron_client = self.clients("neutron")
for i in range(repetitions): for i in range(repetitions):
with base.AtomicAction(self, "authenticate.validate_neutron"): with atomic.ActionTimer(self, "authenticate.validate_neutron"):
neutron_client.list_networks() neutron_client.list_networks()
@validation.number("repetitions", minval=1) @validation.number("repetitions", minval=1)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def validate_heat(self, repetitions): def validate_heat(self, repetitions):
"""Check Heat Client to ensure validation of token. """Check Heat Client to ensure validation of token.
@ -109,5 +109,5 @@ class Authenticate(scenario.OpenStackScenario):
""" """
heat_client = self.clients("heat") heat_client = self.clients("heat")
for i in range(repetitions): 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)) list(heat_client.stacks.list(limit=0))

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -23,7 +23,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["ceilometer"]}) @scenario.configure(context={"cleanup": ["ceilometer"]})
def create_alarm(self, meter_name, threshold, **kwargs): def create_alarm(self, meter_name, threshold, **kwargs):
"""Create an alarm. """Create an alarm.
@ -40,7 +40,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def list_alarms(self): def list_alarms(self):
"""Fetch all alarms. """Fetch all alarms.
@ -50,7 +50,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @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): def create_and_list_alarm(self, meter_name, threshold, **kwargs):
"""Create and get the newly created alarm. """Create and get the newly created alarm.
@ -70,7 +70,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @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): def create_and_update_alarm(self, meter_name, threshold, **kwargs):
"""Create and update the newly created alarm. """Create and update the newly created alarm.
@ -90,7 +90,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @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): def create_and_delete_alarm(self, meter_name, threshold, **kwargs):
"""Create and delete the newly created alarm. """Create and delete the newly created alarm.
@ -109,7 +109,7 @@ class CeilometerAlarms(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @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, def create_alarm_and_get_history(self, meter_name, threshold, state,
timeout=60, **kwargs): timeout=60, **kwargs):
"""Create an alarm, get and set the state and get the alarm history. """Create an alarm, get and set the state and get the alarm history.

View File

@ -13,9 +13,9 @@
# under the License. # under the License.
from rally import consts 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.ceilometer import utils as cutils
from rally.plugins.openstack.scenarios.keystone import utils as kutils from rally.plugins.openstack.scenarios.keystone import utils as kutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -29,8 +29,8 @@ class CeilometerEvents(cutils.CeilometerScenario, kutils.KeystoneScenario):
@validation.required_services(consts.Service.CEILOMETER, @validation.required_services(consts.Service.CEILOMETER,
consts.Service.KEYSTONE) consts.Service.KEYSTONE)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["keystone"], @scenario.configure(context={"admin_cleanup": ["keystone"],
"cleanup": ["ceilometer"]}) "cleanup": ["ceilometer"]})
def create_user_and_list_events(self): def create_user_and_list_events(self):
"""Fetch all events. """Fetch all events.
@ -43,8 +43,8 @@ class CeilometerEvents(cutils.CeilometerScenario, kutils.KeystoneScenario):
@validation.required_services(consts.Service.CEILOMETER, @validation.required_services(consts.Service.CEILOMETER,
consts.Service.KEYSTONE) consts.Service.KEYSTONE)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["keystone"], @scenario.configure(context={"admin_cleanup": ["keystone"],
"cleanup": ["ceilometer"]}) "cleanup": ["ceilometer"]})
def create_user_and_list_event_types(self): def create_user_and_list_event_types(self):
"""Fetch all event types. """Fetch all event types.
@ -57,8 +57,8 @@ class CeilometerEvents(cutils.CeilometerScenario, kutils.KeystoneScenario):
@validation.required_services(consts.Service.CEILOMETER, @validation.required_services(consts.Service.CEILOMETER,
consts.Service.KEYSTONE) consts.Service.KEYSTONE)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["keystone"], @scenario.configure(context={"admin_cleanup": ["keystone"],
"cleanup": ["ceilometer"]}) "cleanup": ["ceilometer"]})
def create_user_and_get_event(self): def create_user_and_get_event(self):
"""Get event. """Get event.

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -23,7 +23,7 @@ class CeilometerMeters(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def list_meters(self): def list_meters(self):
"""Fetch user's meters.""" """Fetch user's meters."""
self._list_meters() self._list_meters()

View File

@ -15,8 +15,8 @@
import json import json
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -25,7 +25,7 @@ class CeilometerQueries(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @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, def create_and_query_alarms(self, meter_name, threshold, filter=None,
orderby=None, limit=None, **kwargs): orderby=None, limit=None, **kwargs):
"""Create an alarm and then query it with specific parameters. """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_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @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, def create_and_query_alarm_history(self, meter_name, threshold,
orderby=None, limit=None, **kwargs): orderby=None, limit=None, **kwargs):
"""Create an alarm and then query for its history. """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_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @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, def create_and_query_samples(self, counter_name, counter_type,
counter_unit, counter_volume, resource_id, counter_unit, counter_volume, resource_id,
filter=None, orderby=None, limit=None, filter=None, orderby=None, limit=None,

View File

@ -14,8 +14,8 @@
from rally import consts from rally import consts
from rally import exceptions from rally import exceptions
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -24,7 +24,7 @@ class CeilometerResource(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def list_resources(self): def list_resources(self):
"""Fetch all resources. """Fetch all resources.
@ -34,7 +34,7 @@ class CeilometerResource(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def get_tenant_resources(self): def get_tenant_resources(self):
"""Get all tenant resources. """Get all tenant resources.

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -23,7 +23,7 @@ class CeilometerSamples(ceiloutils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def list_samples(self): def list_samples(self):
"""Fetch all samples. """Fetch all samples.

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.ceilometer import utils from rally.plugins.openstack.scenarios.ceilometer import utils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -23,7 +23,7 @@ class CeilometerStats(utils.CeilometerScenario):
@validation.required_services(consts.Service.CEILOMETER) @validation.required_services(consts.Service.CEILOMETER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["ceilometer"]}) @scenario.configure(context={"cleanup": ["ceilometer"]})
def create_meter_and_get_stats(self, **kwargs): def create_meter_and_get_stats(self, **kwargs):
"""Create a meter and fetch its statistics. """Create a meter and fetch its statistics.

View File

@ -13,9 +13,9 @@
# under the License. # under the License.
from rally import consts 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.ceilometer import utils as cutils
from rally.plugins.openstack.scenarios.keystone import utils as kutils from rally.plugins.openstack.scenarios.keystone import utils as kutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -29,8 +29,8 @@ class CeilometerTraits(cutils.CeilometerScenario, kutils.KeystoneScenario):
@validation.required_services(consts.Service.CEILOMETER, @validation.required_services(consts.Service.CEILOMETER,
consts.Service.KEYSTONE) consts.Service.KEYSTONE)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["keystone"], @scenario.configure(context={"admin_cleanup": ["keystone"],
"cleanup": ["ceilometer"]}) "cleanup": ["ceilometer"]})
def create_user_and_list_traits(self): def create_user_and_list_traits(self):
"""Fetch all events traits. """Fetch all events traits.
@ -47,8 +47,8 @@ class CeilometerTraits(cutils.CeilometerScenario, kutils.KeystoneScenario):
@validation.required_services(consts.Service.CEILOMETER, @validation.required_services(consts.Service.CEILOMETER,
consts.Service.KEYSTONE) consts.Service.KEYSTONE)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["keystone"], @scenario.configure(context={"admin_cleanup": ["keystone"],
"cleanup": ["ceilometer"]}) "cleanup": ["ceilometer"]})
def create_user_and_list_trait_descriptions(self): def create_user_and_list_trait_descriptions(self):
"""Fetch all trait descriptions. """Fetch all trait descriptions.

View File

@ -13,7 +13,7 @@
# under the License. # under the License.
from rally.plugins.openstack import scenario 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 from rally.task import utils as bench_utils
@ -36,7 +36,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
alarm.update(kwargs) alarm.update(kwargs)
return alarm return alarm
@base.atomic_action_timer("ceilometer.list_alarms") @atomic.action_timer("ceilometer.list_alarms")
def _list_alarms(self, alarm_id=None): def _list_alarms(self, alarm_id=None):
"""List alarms. """List alarms.
@ -51,7 +51,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
else: else:
return self.clients("ceilometer").alarms.list() 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): def _create_alarm(self, meter_name, threshold, kwargs):
"""Create an alarm. """Create an alarm.
@ -66,7 +66,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
alarm = self.clients("ceilometer").alarms.create(**alarm_dict) alarm = self.clients("ceilometer").alarms.create(**alarm_dict)
return alarm return alarm
@base.atomic_action_timer("ceilometer.delete_alarm") @atomic.action_timer("ceilometer.delete_alarm")
def _delete_alarm(self, alarm_id): def _delete_alarm(self, alarm_id):
"""Delete an alarm. """Delete an alarm.
@ -74,7 +74,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
self.clients("ceilometer").alarms.delete(alarm_id) 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): def _update_alarm(self, alarm_id, alarm_dict_delta):
"""Update an alarm. """Update an alarm.
@ -83,7 +83,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
self.clients("ceilometer").alarms.update(alarm_id, **alarm_dict_delta) 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): def _get_alarm_history(self, alarm_id):
"""Assemble the alarm history requested. """Assemble the alarm history requested.
@ -92,7 +92,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
return self.clients("ceilometer").alarms.get_history(alarm_id) 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): def _get_alarm_state(self, alarm_id):
"""Get the state of the alarm. """Get the state of the alarm.
@ -101,7 +101,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
return self.clients("ceilometer").alarms.get_state(alarm_id) 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): def _set_alarm_state(self, alarm, state, timeout):
"""Set the state of the alarm. """Set the state of the alarm.
@ -118,7 +118,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
.get_from_manager(), .get_from_manager(),
timeout=timeout, check_interval=1) timeout=timeout, check_interval=1)
@base.atomic_action_timer("ceilometer.list_events") @atomic.action_timer("ceilometer.list_events")
def _list_events(self): def _list_events(self):
"""Get list of user's events. """Get list of user's events.
@ -127,7 +127,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
return self.admin_clients("ceilometer").events.list() 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): def _get_event(self, event_id):
"""Get event with specific id. """Get event with specific id.
@ -138,7 +138,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
return self.admin_clients("ceilometer").events.get(event_id) 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): def _list_event_types(self):
"""Get list of all event types. """Get list of all event types.
@ -146,7 +146,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
return self.admin_clients("ceilometer").event_types.list() 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): def _list_event_traits(self, event_type, trait_name):
"""Get list of event traits. """Get list of event traits.
@ -157,7 +157,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
return self.admin_clients("ceilometer").traits.list(event_type, return self.admin_clients("ceilometer").traits.list(event_type,
trait_name) 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): def _list_event_trait_descriptions(self, event_type):
"""Get list of event trait descriptions. """Get list of event trait descriptions.
@ -167,12 +167,12 @@ class CeilometerScenario(scenario.OpenStackScenario):
return self.admin_clients("ceilometer").trait_descriptions.list( return self.admin_clients("ceilometer").trait_descriptions.list(
event_type) event_type)
@base.atomic_action_timer("ceilometer.list_meters") @atomic.action_timer("ceilometer.list_meters")
def _list_meters(self): def _list_meters(self):
"""Get list of user's meters.""" """Get list of user's meters."""
return self.clients("ceilometer").meters.list() return self.clients("ceilometer").meters.list()
@base.atomic_action_timer("ceilometer.list_resources") @atomic.action_timer("ceilometer.list_resources")
def _list_resources(self): def _list_resources(self):
"""List all resources. """List all resources.
@ -180,7 +180,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
return self.clients("ceilometer").resources.list() return self.clients("ceilometer").resources.list()
@base.atomic_action_timer("ceilometer.list_samples") @atomic.action_timer("ceilometer.list_samples")
def _list_samples(self): def _list_samples(self):
"""List all Samples. """List all Samples.
@ -188,12 +188,12 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
return self.clients("ceilometer").samples.list() 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): def _get_resource(self, resource_id):
"""Retrieve details about one resource.""" """Retrieve details about one resource."""
return self.clients("ceilometer").resources.get(resource_id) 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): def _get_stats(self, meter_name):
"""Get stats for a specific meter. """Get stats for a specific meter.
@ -201,7 +201,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
""" """
return self.clients("ceilometer").statistics.list(meter_name) 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): def _create_meter(self, **kwargs):
"""Create a new meter. """Create a new meter.
@ -214,7 +214,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
counter_name=name, **kwargs) counter_name=name, **kwargs)
return samples[0] return samples[0]
@base.atomic_action_timer("ceilometer.query_alarms") @atomic.action_timer("ceilometer.query_alarms")
def _query_alarms(self, filter, orderby, limit): def _query_alarms(self, filter, orderby, limit):
"""Query alarms with specific parameters. """Query alarms with specific parameters.
@ -229,7 +229,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
return self.clients("ceilometer").query_alarms.query( return self.clients("ceilometer").query_alarms.query(
filter, orderby, limit) 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): def _query_alarm_history(self, filter, orderby, limit):
"""Query history of an alarm. """Query history of an alarm.
@ -244,7 +244,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
return self.clients("ceilometer").query_alarm_history.query( return self.clients("ceilometer").query_alarm_history.query(
filter, orderby, limit) 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, def _create_sample(self, counter_name, counter_type, counter_unit,
counter_volume, resource_id=None, **kwargs): counter_volume, resource_id=None, **kwargs):
"""Create a Sample with specified parameters. """Create a Sample with specified parameters.
@ -266,7 +266,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
prefix="rally_resource_")}) prefix="rally_resource_")})
return self.clients("ceilometer").samples.create(**kwargs) 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): def _query_samples(self, filter, orderby, limit):
"""Query samples with specified parameters. """Query samples with specified parameters.

View File

@ -20,7 +20,7 @@ from oslo_config import cfg
from rally import exceptions from rally import exceptions
from rally.plugins.openstack import scenario 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 from rally.task import utils as bench_utils
CINDER_BENCHMARK_OPTS = [ CINDER_BENCHMARK_OPTS = [
@ -54,13 +54,13 @@ class CinderScenario(scenario.OpenStackScenario):
RESOURCE_NAME_PREFIX = "rally_volume_" RESOURCE_NAME_PREFIX = "rally_volume_"
@base.atomic_action_timer("cinder.list_volumes") @atomic.action_timer("cinder.list_volumes")
def _list_volumes(self, detailed=True): def _list_volumes(self, detailed=True):
"""Returns user volumes list.""" """Returns user volumes list."""
return self.clients("cinder").volumes.list(detailed) 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): def _list_snapshots(self, detailed=True):
"""Returns user snapshots list.""" """Returns user snapshots list."""
@ -75,7 +75,7 @@ class CinderScenario(scenario.OpenStackScenario):
:returns: A list of keys that were set :returns: A list of keys that were set
""" """
key = "cinder.set_%s_metadatas_%s_times" % (set_size, sets) key = "cinder.set_%s_metadatas_%s_times" % (set_size, sets)
with base.AtomicAction(self, key): with atomic.ActionTimer(self, key):
keys = [] keys = []
for i in range(sets): for i in range(sets):
metadata = {} metadata = {}
@ -110,12 +110,12 @@ class CinderScenario(scenario.OpenStackScenario):
random.shuffle(keys) random.shuffle(keys)
action_name = "cinder.delete_%s_metadatas_%s_times" % (delete_size, action_name = "cinder.delete_%s_metadatas_%s_times" % (delete_size,
deletes) deletes)
with base.AtomicAction(self, action_name): with atomic.ActionTimer(self, action_name):
for i in range(deletes): for i in range(deletes):
to_del = keys[i * delete_size:(i + 1) * delete_size] to_del = keys[i * delete_size:(i + 1) * delete_size]
self.clients("cinder").volumes.delete_metadata(volume, to_del) 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): def _create_volume(self, size, **kwargs):
"""Create one volume. """Create one volume.
@ -148,7 +148,7 @@ class CinderScenario(scenario.OpenStackScenario):
) )
return volume return volume
@base.atomic_action_timer("cinder.delete_volume") @atomic.action_timer("cinder.delete_volume")
def _delete_volume(self, volume): def _delete_volume(self, volume):
"""Delete the given volume. """Delete the given volume.
@ -164,7 +164,7 @@ class CinderScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval 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): def _extend_volume(self, volume, new_size):
"""Extend the given volume. """Extend the given volume.
@ -190,7 +190,7 @@ class CinderScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.cinder_volume_create_poll_interval 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, def _upload_volume_to_image(self, volume, force=False,
container_format="bare", disk_format="raw"): container_format="bare", disk_format="raw"):
"""Upload the given volume to image. """Upload the given volume to image.
@ -230,7 +230,7 @@ class CinderScenario(scenario.OpenStackScenario):
return image return image
@base.atomic_action_timer("cinder.create_snapshot") @atomic.action_timer("cinder.create_snapshot")
def _create_snapshot(self, volume_id, force=False, **kwargs): def _create_snapshot(self, volume_id, force=False, **kwargs):
"""Create one snapshot. """Create one snapshot.
@ -258,7 +258,7 @@ class CinderScenario(scenario.OpenStackScenario):
) )
return snapshot return snapshot
@base.atomic_action_timer("cinder.delete_snapshot") @atomic.action_timer("cinder.delete_snapshot")
def _delete_snapshot(self, snapshot): def _delete_snapshot(self, snapshot):
"""Delete the given snapshot. """Delete the given snapshot.
@ -274,7 +274,7 @@ class CinderScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval 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): def _create_backup(self, volume_id, **kwargs):
"""Create a volume backup of the given volume. """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 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): def _delete_backup(self, backup):
"""Delete the given backup. """Delete the given backup.
@ -306,7 +306,7 @@ class CinderScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval 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): def _restore_backup(self, backup_id, volume_id=None):
"""Restore the given backup. """Restore the given backup.
@ -323,7 +323,7 @@ class CinderScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.cinder_volume_create_poll_interval 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): def _list_backups(self, detailed=True):
"""Return user volume backups list. """Return user volume backups list.

View File

@ -18,10 +18,10 @@ import random
from rally.common import log as logging from rally.common import log as logging
from rally import consts from rally import consts
from rally import exceptions from rally import exceptions
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.cinder import utils from rally.plugins.openstack.scenarios.cinder import utils
from rally.plugins.openstack.scenarios.glance import utils as glance_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.plugins.openstack.scenarios.nova import utils as nova_utils
from rally.task.scenarios import base
from rally.task import types from rally.task import types
from rally.task import validation from rally.task import validation
@ -37,7 +37,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.image_exists("image", nullable=True) @validation.image_exists("image", nullable=True)
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["cinder"]}) @scenario.configure(context={"cleanup": ["cinder"]})
def create_and_list_volume(self, size, detailed=True, def create_and_list_volume(self, size, detailed=True,
image=None, **kwargs): image=None, **kwargs):
"""Create a volume and list all volumes. """Create a volume and list all volumes.
@ -67,7 +67,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["cinder"]}) @scenario.configure(context={"cleanup": ["cinder"]})
def list_volumes(self, detailed=True): def list_volumes(self, detailed=True):
"""List all volumes. """List all volumes.
@ -84,7 +84,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.image_exists("image", nullable=True) @validation.image_exists("image", nullable=True)
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["cinder"]}) @scenario.configure(context={"cleanup": ["cinder"]})
def create_and_delete_volume(self, size, image=None, def create_and_delete_volume(self, size, image=None,
min_sleep=0, max_sleep=0, min_sleep=0, max_sleep=0,
**kwargs): **kwargs):
@ -117,7 +117,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.image_exists("image", nullable=True) @validation.image_exists("image", nullable=True)
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["cinder"]}) @scenario.configure(context={"cleanup": ["cinder"]})
def create_volume(self, size, image=None, **kwargs): def create_volume(self, size, image=None, **kwargs):
"""Create a volume. """Create a volume.
@ -139,7 +139,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@validation.required_contexts("volumes") @validation.required_contexts("volumes")
@base.scenario(context={"cleanup": ["cinder"]}) @scenario.configure(context={"cleanup": ["cinder"]})
def modify_volume_metadata(self, sets=10, set_size=3, def modify_volume_metadata(self, sets=10, set_size=3,
deletes=5, delete_size=3): deletes=5, delete_size=3):
"""Modify a volume's metadata. """Modify a volume's metadata.
@ -168,7 +168,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @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, def create_and_extend_volume(self, size, new_size, min_sleep=0,
max_sleep=0, **kwargs): max_sleep=0, **kwargs):
"""Create and extend a volume and then delete it. """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_services(consts.Service.CINDER)
@validation.required_contexts("volumes") @validation.required_contexts("volumes")
@validation.required_openstack(users=True) @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, def create_from_volume_and_delete_volume(self, size, min_sleep=0,
max_sleep=0, **kwargs): max_sleep=0, **kwargs):
"""Create volume from volume and then delete it. """Create volume from volume and then delete it.
@ -228,7 +228,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_contexts("volumes") @validation.required_contexts("volumes")
@validation.required_openstack(users=True) @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, def create_and_delete_snapshot(self, force=False, min_sleep=0,
max_sleep=0, **kwargs): max_sleep=0, **kwargs):
"""Create and then delete a volume-snapshot. """Create and then delete a volume-snapshot.
@ -255,7 +255,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER) @validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
@validation.required_openstack(users=True) @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): def create_and_attach_volume(self, size, image, flavor, **kwargs):
"""Create a VM and attach a volume to it. """Create a VM and attach a volume to it.
@ -283,7 +283,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.volume_type_exists("volume_type") @validation.volume_type_exists("volume_type")
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER) @validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
@validation.required_openstack(users=True) @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, def create_snapshot_and_attach_volume(self, volume_type=False,
size=None, **kwargs): size=None, **kwargs):
@ -325,7 +325,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER) @validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
@validation.required_openstack(users=True) @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, def create_nested_snapshots_and_attach_volume(self,
size=None, size=None,
nested_level=None, nested_level=None,
@ -388,7 +388,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_contexts("volumes") @validation.required_contexts("volumes")
@validation.required_openstack(users=True) @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): def create_and_list_snapshots(self, force=False, detailed=True, **kwargs):
"""Create and then list a volume-snapshot. """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_services(consts.Service.CINDER, consts.Service.GLANCE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@validation.required_parameters("size") @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, def create_and_upload_volume_to_image(self, size, force=False,
container_format="bare", container_format="bare",
disk_format="raw", disk_format="raw",
@ -436,7 +436,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_cinder_services("cinder-backup") @validation.required_cinder_services("cinder-backup")
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["cinder"]}) @scenario.configure(context={"cleanup": ["cinder"]})
def create_volume_backup(self, size, do_delete=True, def create_volume_backup(self, size, do_delete=True,
create_volume_kwargs=None, create_volume_kwargs=None,
create_backup_kwargs=None): create_backup_kwargs=None):
@ -461,7 +461,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_cinder_services("cinder-backup") @validation.required_cinder_services("cinder-backup")
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @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, def create_and_restore_volume_backup(self, size, do_delete=True,
create_volume_kwargs=None, create_volume_kwargs=None,
create_backup_kwargs=None): create_backup_kwargs=None):
@ -487,7 +487,7 @@ class CinderVolumes(utils.CinderScenario,
@validation.required_cinder_services("cinder-backup") @validation.required_cinder_services("cinder-backup")
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(users=True) @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, def create_and_list_volume_backups(self, size, detailed=True,
do_delete=True, do_delete=True,
create_volume_kwargs=None, create_volume_kwargs=None,

View File

@ -15,8 +15,9 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.designate import utils from rally.plugins.openstack.scenarios.designate import utils
from rally.task.scenarios import base from rally.task import atomic
from rally.task import validation from rally.task import validation
@ -25,7 +26,7 @@ class DesignateBasic(utils.DesignateScenario):
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["designate"]}) @scenario.configure(context={"cleanup": ["designate"]})
def create_and_list_domains(self): def create_and_list_domains(self):
"""Create a domain and list all domains. """Create a domain and list all domains.
@ -42,7 +43,7 @@ class DesignateBasic(utils.DesignateScenario):
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["designate"]}) @scenario.configure(context={"cleanup": ["designate"]})
def list_domains(self): def list_domains(self):
"""List Designate domains. """List Designate domains.
@ -58,7 +59,7 @@ class DesignateBasic(utils.DesignateScenario):
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["designate"]}) @scenario.configure(context={"cleanup": ["designate"]})
def create_and_delete_domain(self): def create_and_delete_domain(self):
"""Add and then delete a domain. """Add and then delete a domain.
@ -70,7 +71,7 @@ class DesignateBasic(utils.DesignateScenario):
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(users=True) @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): def create_and_delete_records(self, records_per_domain=5):
"""Add and then delete records. """Add and then delete records.
@ -84,20 +85,20 @@ class DesignateBasic(utils.DesignateScenario):
records = [] records = []
key = "designate.create_%s_records" % records_per_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): for i in range(records_per_domain):
record = self._create_record(domain, atomic_action=False) record = self._create_record(domain, atomic_action=False)
records.append(record) records.append(record)
key = "designate.delete_%s_records" % records_per_domain key = "designate.delete_%s_records" % records_per_domain
with base.AtomicAction(self, key): with atomic.ActionTimer(self, key):
for record in records: for record in records:
self._delete_record( self._delete_record(
domain["id"], record["id"], atomic_action=False) domain["id"], record["id"], atomic_action=False)
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["designate"]}) @scenario.configure(context={"cleanup": ["designate"]})
def list_records(self, domain_id): def list_records(self, domain_id):
"""List Designate records. """List Designate records.
@ -115,7 +116,7 @@ class DesignateBasic(utils.DesignateScenario):
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(users=True) @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): def create_and_list_records(self, records_per_domain=5):
"""Add and then list records. """Add and then list records.
@ -130,7 +131,7 @@ class DesignateBasic(utils.DesignateScenario):
domain = self._create_domain() domain = self._create_domain()
key = "designate.create_%s_records" % records_per_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): for i in range(records_per_domain):
self._create_record(domain, atomic_action=False) self._create_record(domain, atomic_action=False)
@ -138,7 +139,7 @@ class DesignateBasic(utils.DesignateScenario):
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"cleanup": ["designate"]}) @scenario.configure(context={"cleanup": ["designate"]})
def create_and_list_servers(self): def create_and_list_servers(self):
"""Create a Designate server and list all servers. """Create a Designate server and list all servers.
@ -153,7 +154,7 @@ class DesignateBasic(utils.DesignateScenario):
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"cleanup": ["designate"]}) @scenario.configure(context={"cleanup": ["designate"]})
def create_and_delete_server(self): def create_and_delete_server(self):
"""Add and then delete a server. """Add and then delete a server.
@ -165,7 +166,7 @@ class DesignateBasic(utils.DesignateScenario):
@validation.required_services(consts.Service.DESIGNATE) @validation.required_services(consts.Service.DESIGNATE)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"cleanup": ["designate"]}) @scenario.configure(context={"cleanup": ["designate"]})
def list_servers(self): def list_servers(self):
"""List Designate servers. """List Designate servers.

View File

@ -15,7 +15,7 @@
# under the License. # under the License.
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
class DesignateScenario(scenario.OpenStackScenario): class DesignateScenario(scenario.OpenStackScenario):
@ -23,7 +23,7 @@ class DesignateScenario(scenario.OpenStackScenario):
RESOURCE_NAME_PREFIX = "rally_" RESOURCE_NAME_PREFIX = "rally_"
@base.atomic_action_timer("designate.create_domain") @atomic.action_timer("designate.create_domain")
def _create_domain(self, domain=None): def _create_domain(self, domain=None):
"""Create domain. """Create domain.
@ -36,12 +36,12 @@ class DesignateScenario(scenario.OpenStackScenario):
domain.setdefault("name", "%s.name." % self._generate_random_name()) domain.setdefault("name", "%s.name." % self._generate_random_name())
return self.clients("designate").domains.create(domain) return self.clients("designate").domains.create(domain)
@base.atomic_action_timer("designate.list_domains") @atomic.action_timer("designate.list_domains")
def _list_domains(self): def _list_domains(self):
"""Return user domain list.""" """Return user domain list."""
return self.clients("designate").domains.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): def _delete_domain(self, domain_id):
"""Delete designate zone. """Delete designate zone.
@ -67,12 +67,12 @@ class DesignateScenario(scenario.OpenStackScenario):
client = self.clients("designate") client = self.clients("designate")
if atomic_action: 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)
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): def _list_records(self, domain_id):
"""List domain records. """List domain records.
@ -92,12 +92,12 @@ class DesignateScenario(scenario.OpenStackScenario):
client = self.clients("designate") client = self.clients("designate")
if atomic_action: if atomic_action:
with base.AtomicAction(self, "designate.delete_record"): with atomic.ActionTimer(self, "designate.delete_record"):
client.records.delete(domain_id, record_id) client.records.delete(domain_id, record_id)
else: else:
client.records.delete(domain_id, record_id) 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): def _create_server(self, server=None):
"""Create server. """Create server.
@ -109,12 +109,12 @@ class DesignateScenario(scenario.OpenStackScenario):
server.setdefault("name", "name.%s." % self._generate_random_name()) server.setdefault("name", "name.%s." % self._generate_random_name())
return self.admin_clients("designate").servers.create(server) 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): def _list_servers(self):
"""Return user server list.""" """Return user server list."""
return self.admin_clients("designate").servers.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): def _delete_server(self, server_id):
"""Delete Server. """Delete Server.

View File

@ -14,8 +14,8 @@
from rally.common import log as logging from rally.common import log as logging
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.ec2 import utils from rally.plugins.openstack.scenarios.ec2 import utils
from rally.task.scenarios import base
from rally.task import types from rally.task import types
from rally.task import validation from rally.task import validation
@ -28,7 +28,7 @@ class EC2Servers(utils.EC2Scenario):
@validation.required_services(consts.Service.EC2) @validation.required_services(consts.Service.EC2)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["ec2"]}) @scenario.configure(context={"cleanup": ["ec2"]})
def list_servers(self): def list_servers(self):
"""List all servers. """List all servers.
@ -42,7 +42,7 @@ class EC2Servers(utils.EC2Scenario):
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.EC2) @validation.required_services(consts.Service.EC2)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["ec2"]}) @scenario.configure(context={"cleanup": ["ec2"]})
def boot_server(self, image, flavor, **kwargs): def boot_server(self, image, flavor, **kwargs):
"""Boot a server. """Boot a server.

View File

@ -17,7 +17,7 @@ import time
from oslo_config import cfg from oslo_config import cfg
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
from rally.task import utils from rally.task import utils
@ -48,12 +48,12 @@ CONF.register_opts(EC2_BENCHMARK_OPTS, group=benchmark_group)
class EC2Scenario(scenario.OpenStackScenario): class EC2Scenario(scenario.OpenStackScenario):
"""Base class for EC2 scenarios with basic atomic actions.""" """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): def _list_servers(self):
"""Returns user servers list.""" """Returns user servers list."""
return self.clients("ec2").get_only_instances() 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, def _boot_servers(self, image_id, flavor_name,
instance_num=1, **kwargs): instance_num=1, **kwargs):
"""Boot multiple servers. """Boot multiple servers.

View File

@ -14,9 +14,9 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.glance import utils from rally.plugins.openstack.scenarios.glance import utils
from rally.plugins.openstack.scenarios.nova import utils as nova_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 types
from rally.task import validation from rally.task import validation
@ -29,7 +29,7 @@ class GlanceImages(utils.GlanceScenario, nova_utils.NovaScenario):
@validation.required_services(consts.Service.GLANCE) @validation.required_services(consts.Service.GLANCE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["glance"]}) @scenario.configure(context={"cleanup": ["glance"]})
def create_and_list_image(self, container_format, def create_and_list_image(self, container_format,
image_location, disk_format, **kwargs): image_location, disk_format, **kwargs):
"""Add an image and then list all images. """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_services(consts.Service.GLANCE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["glance"]}) @scenario.configure(context={"cleanup": ["glance"]})
def list_images(self): def list_images(self):
"""List all images. """List all images.
@ -73,7 +73,7 @@ class GlanceImages(utils.GlanceScenario, nova_utils.NovaScenario):
@validation.required_services(consts.Service.GLANCE) @validation.required_services(consts.Service.GLANCE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["glance"]}) @scenario.configure(context={"cleanup": ["glance"]})
def create_and_delete_image(self, container_format, def create_and_delete_image(self, container_format,
image_location, disk_format, **kwargs): image_location, disk_format, **kwargs):
"""Add and then delete an image. """Add and then delete an image.
@ -95,7 +95,7 @@ class GlanceImages(utils.GlanceScenario, nova_utils.NovaScenario):
@validation.flavor_exists("flavor") @validation.flavor_exists("flavor")
@validation.required_services(consts.Service.GLANCE, consts.Service.NOVA) @validation.required_services(consts.Service.GLANCE, consts.Service.NOVA)
@validation.required_openstack(users=True) @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, def create_image_and_boot_instances(self, container_format,
image_location, disk_format, image_location, disk_format,
flavor, number_instances, flavor, number_instances,

View File

@ -19,7 +19,7 @@ import time
from oslo_config import cfg from oslo_config import cfg
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
from rally.task import utils from rally.task import utils
@ -53,12 +53,12 @@ CONF.register_opts(GLANCE_BENCHMARK_OPTS, group=benchmark_group)
class GlanceScenario(scenario.OpenStackScenario): class GlanceScenario(scenario.OpenStackScenario):
"""Base class for Glance scenarios with basic atomic actions.""" """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): def _list_images(self):
"""Returns user images list.""" """Returns user images list."""
return list(self.clients("glance").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, def _create_image(self, container_format, image_location, disk_format,
name=None, prefix=None, length=None, **kwargs): name=None, prefix=None, length=None, **kwargs):
"""Create a new image. """Create a new image.
@ -110,7 +110,7 @@ class GlanceScenario(scenario.OpenStackScenario):
return image return image
@base.atomic_action_timer("glance.delete_image") @atomic.action_timer("glance.delete_image")
def _delete_image(self, image): def _delete_image(self, image):
"""Deletes given image. """Deletes given image.

View File

@ -14,8 +14,9 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.heat import utils 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 types
from rally.task import validation from rally.task import validation
@ -29,7 +30,7 @@ class HeatStacks(utils.HeatScenario):
@types.set(template_path=types.FileType, files=types.FileTypeDict) @types.set(template_path=types.FileType, files=types.FileTypeDict)
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @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, def create_and_list_stack(self, template_path, parameters=None,
files=None, environment=None): files=None, environment=None):
"""Add a stack and then list all stacks. """Add a stack and then list all stacks.
@ -47,12 +48,12 @@ class HeatStacks(utils.HeatScenario):
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def list_stacks_and_resources(self): def list_stacks_and_resources(self):
"""List all resources from tenant stacks.""" """List all resources from tenant stacks."""
stacks = self._list_stacks() stacks = self._list_stacks()
with base.AtomicAction( with atomic.ActionTimer(
self, "heat.list_resources_of_%s_stacks" % len(stacks)): self, "heat.list_resources_of_%s_stacks" % len(stacks)):
for stack in stacks: for stack in stacks:
self.clients("heat").resources.list(stack.id) self.clients("heat").resources.list(stack.id)
@ -60,7 +61,7 @@ class HeatStacks(utils.HeatScenario):
@types.set(template_path=types.FileType, files=types.FileTypeDict) @types.set(template_path=types.FileType, files=types.FileTypeDict)
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @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, def create_and_delete_stack(self, template_path, parameters=None,
files=None, environment=None): files=None, environment=None):
"""Add and then delete a stack. """Add and then delete a stack.
@ -81,7 +82,7 @@ class HeatStacks(utils.HeatScenario):
@types.set(template_path=types.FileType, files=types.FileTypeDict) @types.set(template_path=types.FileType, files=types.FileTypeDict)
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @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, def create_check_delete_stack(self, template_path, parameters=None,
files=None, environment=None): files=None, environment=None):
"""Create, check and delete a stack. """Create, check and delete a stack.
@ -108,7 +109,7 @@ class HeatStacks(utils.HeatScenario):
updated_files=types.FileTypeDict) updated_files=types.FileTypeDict)
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["heat"]}) @scenario.configure(context={"cleanup": ["heat"]})
def create_update_delete_stack(self, template_path, def create_update_delete_stack(self, template_path,
updated_template_path, updated_template_path,
parameters=None, updated_parameters=None, parameters=None, updated_parameters=None,
@ -143,7 +144,7 @@ class HeatStacks(utils.HeatScenario):
@types.set(template_path=types.FileType, files=types.FileTypeDict) @types.set(template_path=types.FileType, files=types.FileTypeDict)
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @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, def create_stack_and_scale(self, template_path, output_key, delta,
parameters=None, files=None, parameters=None, files=None,
environment=None): environment=None):
@ -180,7 +181,7 @@ class HeatStacks(utils.HeatScenario):
@types.set(template_path=types.FileType, files=types.FileTypeDict) @types.set(template_path=types.FileType, files=types.FileTypeDict)
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["heat"]}) @scenario.configure(context={"cleanup": ["heat"]})
def create_suspend_resume_delete_stack(self, template_path, def create_suspend_resume_delete_stack(self, template_path,
parameters=None, files=None, parameters=None, files=None,
environment=None): environment=None):
@ -205,12 +206,12 @@ class HeatStacks(utils.HeatScenario):
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def list_stacks_and_events(self): def list_stacks_and_events(self):
"""List events from tenant stacks.""" """List events from tenant stacks."""
stacks = self._list_stacks() stacks = self._list_stacks()
with base.AtomicAction( with atomic.ActionTimer(
self, "heat.list_events_of_%s_stacks" % len(stacks)): self, "heat.list_events_of_%s_stacks" % len(stacks)):
for stack in stacks: for stack in stacks:
self.clients("heat").events.list(stack.id) self.clients("heat").events.list(stack.id)
@ -218,7 +219,7 @@ class HeatStacks(utils.HeatScenario):
@types.set(template_path=types.FileType, files=types.FileTypeDict) @types.set(template_path=types.FileType, files=types.FileTypeDict)
@validation.required_services(consts.Service.HEAT) @validation.required_services(consts.Service.HEAT)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["heat"]}) @scenario.configure(context={"cleanup": ["heat"]})
def create_snapshot_restore_delete_stack(self, template_path, def create_snapshot_restore_delete_stack(self, template_path,
parameters=None, files=None, parameters=None, files=None,
environment=None): environment=None):

View File

@ -21,7 +21,7 @@ import requests
from rally.common import log as logging from rally.common import log as logging
from rally import exceptions from rally import exceptions
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
from rally.task import utils from rally.task import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -110,13 +110,13 @@ CONF.register_opts(HEAT_BENCHMARK_OPTS, group=benchmark_group)
class HeatScenario(scenario.OpenStackScenario): class HeatScenario(scenario.OpenStackScenario):
"""Base class for Heat scenarios with basic atomic actions.""" """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): def _list_stacks(self):
"""Return user stack list.""" """Return user stack list."""
return list(self.clients("heat").stacks.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, def _create_stack(self, template, parameters=None,
files=None, environment=None): files=None, environment=None):
"""Create a new stack. """Create a new stack.
@ -154,7 +154,7 @@ class HeatScenario(scenario.OpenStackScenario):
return stack return stack
@base.atomic_action_timer("heat.update_stack") @atomic.action_timer("heat.update_stack")
def _update_stack(self, stack, template, parameters=None, def _update_stack(self, stack, template, parameters=None,
files=None, environment=None): files=None, environment=None):
"""Update an existing stack """Update an existing stack
@ -187,7 +187,7 @@ class HeatScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.heat_stack_update_poll_interval) check_interval=CONF.benchmark.heat_stack_update_poll_interval)
return stack return stack
@base.atomic_action_timer("heat.check_stack") @atomic.action_timer("heat.check_stack")
def _check_stack(self, stack): def _check_stack(self, stack):
"""Check given stack. """Check given stack.
@ -203,7 +203,7 @@ class HeatScenario(scenario.OpenStackScenario):
timeout=CONF.benchmark.heat_stack_check_timeout, timeout=CONF.benchmark.heat_stack_check_timeout,
check_interval=CONF.benchmark.heat_stack_check_poll_interval) 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): def _delete_stack(self, stack):
"""Delete given stack. """Delete given stack.
@ -218,7 +218,7 @@ class HeatScenario(scenario.OpenStackScenario):
timeout=CONF.benchmark.heat_stack_delete_timeout, timeout=CONF.benchmark.heat_stack_delete_timeout,
check_interval=CONF.benchmark.heat_stack_delete_poll_interval) 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): def _suspend_stack(self, stack):
"""Suspend given stack. """Suspend given stack.
@ -234,7 +234,7 @@ class HeatScenario(scenario.OpenStackScenario):
timeout=CONF.benchmark.heat_stack_suspend_timeout, timeout=CONF.benchmark.heat_stack_suspend_timeout,
check_interval=CONF.benchmark.heat_stack_suspend_poll_interval) 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): def _resume_stack(self, stack):
"""Resume given stack. """Resume given stack.
@ -250,7 +250,7 @@ class HeatScenario(scenario.OpenStackScenario):
timeout=CONF.benchmark.heat_stack_resume_timeout, timeout=CONF.benchmark.heat_stack_resume_timeout,
check_interval=CONF.benchmark.heat_stack_resume_poll_interval) 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): def _snapshot_stack(self, stack):
"""Creates a snapshot for given stack. """Creates a snapshot for given stack.
@ -268,7 +268,7 @@ class HeatScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.heat_stack_snapshot_poll_interval) check_interval=CONF.benchmark.heat_stack_snapshot_poll_interval)
return snapshot return snapshot
@base.atomic_action_timer("heat.restore_stack") @atomic.action_timer("heat.restore_stack")
def _restore_stack(self, stack, snapshot_id): def _restore_stack(self, stack, snapshot_id):
"""Restores stack from given snapshot. """Restores stack from given snapshot.
@ -311,7 +311,7 @@ class HeatScenario(scenario.OpenStackScenario):
expected_instances = num_instances + delta expected_instances = num_instances + delta
LOG.debug("Scaling stack %s from %s to %s instances with %s" % LOG.debug("Scaling stack %s from %s to %s instances with %s" %
(stack.id, num_instances, expected_instances, output_key)) (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) self._stack_webhook(stack, output_key)
utils.wait_for( utils.wait_for(
stack, stack,
@ -341,5 +341,5 @@ class HeatScenario(scenario.OpenStackScenario):
"No output key %(key)s found in stack %(id)s" % "No output key %(key)s found in stack %(id)s" %
{"key": output_key, "id": stack.id}) {"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() requests.post(url).raise_for_status()

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.ironic import utils from rally.plugins.openstack.scenarios.ironic import utils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -25,7 +25,7 @@ class IronicNodes(utils.IronicScenario):
@validation.required_parameters("driver") @validation.required_parameters("driver")
@validation.required_services(consts.Service.IRONIC) @validation.required_services(consts.Service.IRONIC)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["ironic"]}) @scenario.configure(context={"admin_cleanup": ["ironic"]})
def create_and_list_node( def create_and_list_node(
self, associated=None, maintenance=None, self, associated=None, maintenance=None,
marker=None, limit=None, detail=False, sort_key=None, marker=None, limit=None, detail=False, sort_key=None,
@ -68,7 +68,7 @@ class IronicNodes(utils.IronicScenario):
@validation.required_parameters("driver") @validation.required_parameters("driver")
@validation.required_services(consts.Service.IRONIC) @validation.required_services(consts.Service.IRONIC)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["ironic"]}) @scenario.configure(context={"admin_cleanup": ["ironic"]})
def create_and_delete_node(self, **kwargs): def create_and_delete_node(self, **kwargs):
"""Create and delete node. """Create and delete node.

View File

@ -20,7 +20,7 @@ from oslo_config import cfg
from rally.common import utils from rally.common import utils
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
IRONIC_BENCHMARK_OPTS = [ IRONIC_BENCHMARK_OPTS = [
@ -38,7 +38,7 @@ CONF.register_opts(IRONIC_BENCHMARK_OPTS, group=benchmark_group)
class IronicScenario(scenario.OpenStackScenario): class IronicScenario(scenario.OpenStackScenario):
"""Base class for Ironic scenarios with basic atomic actions.""" """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): def _create_node(self, **kwargs):
"""Create node immediately. """Create node immediately.
@ -58,7 +58,7 @@ class IronicScenario(scenario.OpenStackScenario):
return self.admin_clients("ironic").node.create(**kwargs) 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, def _list_nodes(self, associated=None, maintenance=None, marker=None,
limit=None, detail=False, sort_key=None, sort_dir=None): limit=None, detail=False, sort_key=None, sort_dir=None):
"""Return list of nodes. """Return list of nodes.
@ -93,7 +93,7 @@ class IronicScenario(scenario.OpenStackScenario):
associated=associated, maintenance=maintenance, marker=marker, associated=associated, maintenance=maintenance, marker=marker,
limit=limit, detail=detail, sort_key=sort_key, sort_dir=sort_dir) 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): def _delete_node(self, node_id):
"""Delete the node with specific id. """Delete the node with specific id.

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
from rally.common import utils from rally.common import utils
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.keystone import utils as kutils from rally.plugins.openstack.scenarios.keystone import utils as kutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -24,7 +24,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
@validation.number("name_length", minval=10) @validation.number("name_length", minval=10)
@validation.required_openstack(admin=True) @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): def create_user(self, name_length=10, **kwargs):
"""Create a keystone user with random name. """Create a keystone user with random name.
@ -36,7 +36,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
@validation.number("name_length", minval=10) @validation.number("name_length", minval=10)
@validation.required_openstack(admin=True) @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): def create_delete_user(self, name_length=10, **kwargs):
"""Create a keystone user with random name and then delete it. """Create a keystone user with random name and then delete it.
@ -48,7 +48,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
self._resource_delete(user) self._resource_delete(user)
@validation.required_openstack(admin=True) @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): def create_user_set_enabled_and_delete(self, enabled=True, **kwargs):
"""Create a keystone user, enable or disable it, and delete it. """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.number("name_length", minval=10)
@validation.required_openstack(admin=True) @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): def create_tenant(self, name_length=10, **kwargs):
"""Create a keystone tenant with random name. """Create a keystone tenant with random name.
@ -75,7 +75,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
@validation.number("name_length", minval=10) @validation.number("name_length", minval=10)
@validation.number("users_per_tenant", minval=1) @validation.number("users_per_tenant", minval=1)
@validation.required_openstack(admin=True) @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, def create_tenant_with_users(self, users_per_tenant, name_length=10,
**kwargs): **kwargs):
"""Create a keystone tenant and several users belonging to it. """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.number("name_length", minval=10)
@validation.required_openstack(admin=True) @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): def create_and_list_users(self, name_length=10, **kwargs):
"""Create a keystone user with random name and list all users. """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.number("name_length", minval=10)
@validation.required_openstack(admin=True) @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): def create_and_list_tenants(self, name_length=10, **kwargs):
"""Create a keystone tenant with random name and list all tenants. """Create a keystone tenant with random name and list all tenants.
@ -115,7 +115,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
self._list_tenants() self._list_tenants()
@validation.required_openstack(admin=True, users=True) @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): def add_and_remove_user_role(self):
"""Create a user role add to a user and disassociate.""" """Create a user role add to a user and disassociate."""
tenant_id = self.context["tenant"]["id"] tenant_id = self.context["tenant"]["id"]
@ -125,14 +125,14 @@ class KeystoneBasic(kutils.KeystoneScenario):
self._role_remove(user_id, role, tenant_id) self._role_remove(user_id, role, tenant_id)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["keystone"]}) @scenario.configure(context={"admin_cleanup": ["keystone"]})
def create_and_delete_role(self): def create_and_delete_role(self):
"""Create a user role and delete it.""" """Create a user role and delete it."""
role = self._role_create() role = self._role_create()
self._resource_delete(role) self._resource_delete(role)
@validation.required_openstack(admin=True, users=True) @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): def create_add_and_list_user_roles(self):
"""Create user role, add it and list user roles for given user.""" """Create user role, add it and list user roles for given user."""
tenant_id = self.context["tenant"]["id"] tenant_id = self.context["tenant"]["id"]
@ -142,7 +142,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
self._list_roles_for_user(user_id, tenant_id) self._list_roles_for_user(user_id, tenant_id)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario(context={"admin_cleanup": ["keystone"]}) @scenario.configure(context={"admin_cleanup": ["keystone"]})
def get_entities(self, service_name="keystone"): def get_entities(self, service_name="keystone"):
"""Get instance of a tenant, user, role and service by id's. """Get instance of a tenant, user, role and service by id's.
@ -173,7 +173,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
@utils.log_deprecated_args( @utils.log_deprecated_args(
"The 'name' argument to create_and_delete_service will be ignored", "The 'name' argument to create_and_delete_service will be ignored",
"0.0.5", ["name"]) "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, def create_and_delete_service(self, name=None, service_type=None,
description=None): description=None):
"""Create and delete service. """Create and delete service.
@ -186,7 +186,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
@validation.number("name_length", minval=10) @validation.number("name_length", minval=10)
@validation.required_openstack(admin=True) @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): def create_update_and_delete_tenant(self, name_length=10, **kwargs):
"""Create, update and delete tenant. """Create, update and delete tenant.
@ -200,7 +200,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
@validation.number("password_length", minval=10) @validation.number("password_length", minval=10)
@validation.number("name_length", minval=10) @validation.number("name_length", minval=10)
@validation.required_openstack(admin=True) @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): def create_user_update_password(self, name_length=10, password_length=10):
"""Create user and update password for that user. """Create user and update password for that user.
@ -215,7 +215,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
@utils.log_deprecated_args( @utils.log_deprecated_args(
"The 'name' argument to create_and_list_services will be ignored", "The 'name' argument to create_and_list_services will be ignored",
"0.0.5", ["name"]) "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, def create_and_list_services(self, name=None, service_type=None,
description=None): description=None):
"""Create and list services. """Create and list services.
@ -227,7 +227,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
self._list_services() self._list_services()
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"admin_cleanup": ["keystone"]}) @scenario.configure(context={"admin_cleanup": ["keystone"]})
def create_and_list_ec2credentials(self): def create_and_list_ec2credentials(self):
"""Create and List all keystone ec2-credentials.""" """Create and List all keystone ec2-credentials."""
self._create_ec2credentials(self.context["user"]["id"], self._create_ec2credentials(self.context["user"]["id"],
@ -235,7 +235,7 @@ class KeystoneBasic(kutils.KeystoneScenario):
self._list_ec2credentials(self.context["user"]["id"]) self._list_ec2credentials(self.context["user"]["id"])
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"admin_cleanup": ["keystone"]}) @scenario.configure(context={"admin_cleanup": ["keystone"]})
def create_and_delete_ec2credential(self): def create_and_delete_ec2credential(self):
"""Create and delete keystone ec2-credential.""" """Create and delete keystone ec2-credential."""
creds = self._create_ec2credentials(self.context["user"]["id"], creds = self._create_ec2credentials(self.context["user"]["id"],

View File

@ -16,7 +16,7 @@
import uuid import uuid
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
def is_temporary(resource): def is_temporary(resource):
@ -28,7 +28,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
RESOURCE_NAME_PREFIX = "rally_keystone_" 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): def _user_create(self, name_length=10, email=None, **kwargs):
"""Creates keystone user with random name. """Creates keystone user with random name.
@ -46,7 +46,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
return self.admin_clients("keystone").users.create( return self.admin_clients("keystone").users.create(
name, password=password, email=email, **kwargs) 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): def _update_user_enabled(self, user, enabled):
"""Enable or disable a user. """Enable or disable a user.
@ -59,10 +59,10 @@ class KeystoneScenario(scenario.OpenStackScenario):
def _resource_delete(self, resource): def _resource_delete(self, resource):
""""Delete keystone resource.""" """"Delete keystone resource."""
r = "keystone.delete_%s" % resource.__class__.__name__.lower() r = "keystone.delete_%s" % resource.__class__.__name__.lower()
with base.AtomicAction(self, r): with atomic.ActionTimer(self, r):
resource.delete() resource.delete()
@base.atomic_action_timer("keystone.create_tenant") @atomic.action_timer("keystone.create_tenant")
def _tenant_create(self, name_length=10, **kwargs): def _tenant_create(self, name_length=10, **kwargs):
"""Creates keystone tenant with random name. """Creates keystone tenant with random name.
@ -73,7 +73,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
name = self._generate_random_name(length=name_length) name = self._generate_random_name(length=name_length)
return self.admin_clients("keystone").tenants.create(name, **kwargs) 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", def _service_create(self, service_type="rally_test_type",
description=None): description=None):
"""Creates keystone service with random name. """Creates keystone service with random name.
@ -89,7 +89,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
self._generate_random_name(), self._generate_random_name(),
service_type, description) 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): def _users_create(self, tenant, users_per_tenant, name_length=10):
"""Adds users to a tenant. """Adds users to a tenant.
@ -104,7 +104,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
self.admin_clients("keystone").users.create( self.admin_clients("keystone").users.create(
name, password=password, email=email, tenant_id=tenant.id) 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): def _role_create(self, name_length=5):
"""Creates keystone user role with random name. """Creates keystone user role with random name.
@ -115,22 +115,22 @@ class KeystoneScenario(scenario.OpenStackScenario):
self._generate_random_name(length=name_length)) self._generate_random_name(length=name_length))
return role return role
@base.atomic_action_timer("keystone.list_users") @atomic.action_timer("keystone.list_users")
def _list_users(self): def _list_users(self):
"""List users.""" """List users."""
return self.admin_clients("keystone").users.list() return self.admin_clients("keystone").users.list()
@base.atomic_action_timer("keystone.list_tenants") @atomic.action_timer("keystone.list_tenants")
def _list_tenants(self): def _list_tenants(self):
"""List tenants.""" """List tenants."""
return self.admin_clients("keystone").tenants.list() return self.admin_clients("keystone").tenants.list()
@base.atomic_action_timer("keystone.service_list") @atomic.action_timer("keystone.service_list")
def _list_services(self): def _list_services(self):
"""List services.""" """List services."""
return self.admin_clients("keystone").services.list() 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): def _list_roles_for_user(self, user, tenant):
"""List user roles. """List user roles.
@ -140,7 +140,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
return self.admin_clients("keystone").roles.roles_for_user( return self.admin_clients("keystone").roles.roles_for_user(
user, tenant) user, tenant)
@base.atomic_action_timer("keystone.add_role") @atomic.action_timer("keystone.add_role")
def _role_add(self, user, role, tenant): def _role_add(self, user, role, tenant):
"""Add role to a given user on a 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) 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): def _role_remove(self, user, role, tenant):
"""Dissociate user with role. """Dissociate user with role.
@ -161,7 +161,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
self.admin_clients("keystone").roles.remove_user_role(user, self.admin_clients("keystone").roles.remove_user_role(user,
role, tenant) role, tenant)
@base.atomic_action_timer("keystone.get_tenant") @atomic.action_timer("keystone.get_tenant")
def _get_tenant(self, tenant_id): def _get_tenant(self, tenant_id):
"""Get given tenant. """Get given tenant.
@ -169,7 +169,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
""" """
return self.admin_clients("keystone").tenants.get(tenant_id) 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): def _get_user(self, user_id):
"""Get given user. """Get given user.
@ -177,7 +177,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
""" """
return self.admin_clients("keystone").users.get(user_id) 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): def _get_role(self, role_id):
"""Get given user role. """Get given user role.
@ -185,7 +185,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
""" """
return self.admin_clients("keystone").roles.get(role_id) 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): def _get_service(self, service_id):
"""Get service with given service id. """Get service with given service id.
@ -198,7 +198,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
if i.name == name: if i.name == name:
return i return i
@base.atomic_action_timer("keystone.delete_service") @atomic.action_timer("keystone.delete_service")
def _delete_service(self, service_id): def _delete_service(self, service_id):
"""Delete service. """Delete service.
@ -206,7 +206,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
""" """
self.admin_clients("keystone").services.delete(service_id) 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): def _update_tenant(self, tenant, name=None, description=None):
"""Update tenant name and description. """Update tenant name and description.
@ -219,7 +219,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
self.admin_clients("keystone").tenants.update(tenant.id, self.admin_clients("keystone").tenants.update(tenant.id,
name, description) 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): def _update_user_password(self, user_id, password):
"""Update user password. """Update user password.
@ -232,7 +232,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
else: else:
admin_clients.users.update_password(user_id, password) 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): def _create_ec2credentials(self, user_id, tenant_id):
"""Create ec2credentials. """Create ec2credentials.
@ -243,7 +243,7 @@ class KeystoneScenario(scenario.OpenStackScenario):
""" """
return self.clients("keystone").ec2.create(user_id, tenant_id) 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): def _list_ec2credentials(self, user_id):
"""List of access/secret pairs for a 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) 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): def _delete_ec2credential(self, user_id, access):
"""Delete ec2credential. """Delete ec2credential.

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.manila import utils from rally.plugins.openstack.scenarios.manila import utils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -25,7 +25,7 @@ class ManilaShares(utils.ManilaScenario):
@validation.validate_share_proto() @validation.validate_share_proto()
@validation.required_services(consts.Service.MANILA) @validation.required_services(consts.Service.MANILA)
@validation.required_openstack(users=True) @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, def create_and_delete_share(self, share_proto, size=1, min_sleep=0,
max_sleep=0, **kwargs): max_sleep=0, **kwargs):
"""Create and delete a share. """Create and delete a share.
@ -50,7 +50,7 @@ class ManilaShares(utils.ManilaScenario):
@validation.required_services(consts.Service.MANILA) @validation.required_services(consts.Service.MANILA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario() @scenario.configure()
def list_shares(self, detailed=True, search_opts=None): def list_shares(self, detailed=True, search_opts=None):
"""Basic scenario for 'share list' operation. """Basic scenario for 'share list' operation.
@ -63,7 +63,7 @@ class ManilaShares(utils.ManilaScenario):
@validation.required_services(consts.Service.MANILA) @validation.required_services(consts.Service.MANILA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["manila"]}) @scenario.configure(context={"cleanup": ["manila"]})
def create_share_network_and_delete(self, def create_share_network_and_delete(self,
neutron_net_id=None, neutron_net_id=None,
neutron_subnet_id=None, neutron_subnet_id=None,
@ -89,7 +89,7 @@ class ManilaShares(utils.ManilaScenario):
@validation.required_services(consts.Service.MANILA) @validation.required_services(consts.Service.MANILA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["manila"]}) @scenario.configure(context={"cleanup": ["manila"]})
def create_share_network_and_list(self, def create_share_network_and_list(self,
neutron_net_id=None, neutron_net_id=None,
neutron_subnet_id=None, neutron_subnet_id=None,
@ -124,7 +124,7 @@ class ManilaShares(utils.ManilaScenario):
@validation.required_services(consts.Service.MANILA) @validation.required_services(consts.Service.MANILA)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario() @scenario.configure()
def list_share_servers(self, search_opts=None): def list_share_servers(self, search_opts=None):
"""Lists share servers. """Lists share servers.
@ -137,7 +137,7 @@ class ManilaShares(utils.ManilaScenario):
@validation.required_services(consts.Service.MANILA) @validation.required_services(consts.Service.MANILA)
@validation.required_openstack(users=True) @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, def create_security_service_and_delete(self, security_service_type,
dns_ip=None, server=None, dns_ip=None, server=None,
domain=None, user=None, domain=None, user=None,
@ -169,7 +169,7 @@ class ManilaShares(utils.ManilaScenario):
@validation.required_services(consts.Service.MANILA) @validation.required_services(consts.Service.MANILA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["manila"]}) @scenario.configure(context={"cleanup": ["manila"]})
def attach_security_service_to_share_network(self, def attach_security_service_to_share_network(self,
security_service_type="ldap"): security_service_type="ldap"):
"""Attaches security service to share network. """Attaches security service to share network.

View File

@ -18,7 +18,7 @@ import time
from oslo_config import cfg from oslo_config import cfg
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
from rally.task import utils from rally.task import utils
@ -56,7 +56,7 @@ CONF.register_opts(MANILA_BENCHMARK_OPTS, group=benchmark_group)
class ManilaScenario(scenario.OpenStackScenario): class ManilaScenario(scenario.OpenStackScenario):
"""Base class for Manila scenarios with basic atomic actions.""" """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): def _create_share(self, share_proto, size=1, **kwargs):
"""Create a share. """Create a share.
@ -87,7 +87,7 @@ class ManilaScenario(scenario.OpenStackScenario):
) )
return share return share
@base.atomic_action_timer("manila.delete_share") @atomic.action_timer("manila.delete_share")
def _delete_share(self, share): def _delete_share(self, share):
"""Delete the given share. """Delete the given share.
@ -101,7 +101,7 @@ class ManilaScenario(scenario.OpenStackScenario):
timeout=CONF.benchmark.manila_share_delete_timeout, timeout=CONF.benchmark.manila_share_delete_timeout,
check_interval=CONF.benchmark.manila_share_delete_poll_interval) 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): def _list_shares(self, detailed=True, search_opts=None):
"""Returns user shares list. """Returns user shares list.
@ -113,7 +113,7 @@ class ManilaScenario(scenario.OpenStackScenario):
return self.clients("manila").shares.list( return self.clients("manila").shares.list(
detailed=detailed, search_opts=search_opts) 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, def _create_share_network(self, neutron_net_id=None,
neutron_subnet_id=None, neutron_subnet_id=None,
nova_net_id=None, name=None, description=None): nova_net_id=None, name=None, description=None):
@ -135,7 +135,7 @@ class ManilaScenario(scenario.OpenStackScenario):
description=description) description=description)
return share_network 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): def _delete_share_network(self, share_network):
"""Delete share network. """Delete share network.
@ -148,7 +148,7 @@ class ManilaScenario(scenario.OpenStackScenario):
timeout=CONF.benchmark.manila_share_delete_timeout, timeout=CONF.benchmark.manila_share_delete_timeout,
check_interval=CONF.benchmark.manila_share_delete_poll_interval) 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): def _list_share_networks(self, detailed=True, search_opts=None):
"""List share networks. """List share networks.
@ -162,7 +162,7 @@ class ManilaScenario(scenario.OpenStackScenario):
detailed=detailed, search_opts=search_opts) detailed=detailed, search_opts=search_opts)
return share_networks 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): def _list_share_servers(self, search_opts=None):
"""List share servers. Admin only. """List share servers. Admin only.
@ -174,7 +174,7 @@ class ManilaScenario(scenario.OpenStackScenario):
search_opts=search_opts) search_opts=search_opts)
return share_servers 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, def _create_security_service(self, security_service_type, dns_ip=None,
server=None, domain=None, user=None, server=None, domain=None, user=None,
password=None, name=None, description=None): password=None, name=None, description=None):
@ -206,7 +206,7 @@ class ManilaScenario(scenario.OpenStackScenario):
description=description) description=description)
return security_service 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): def _delete_security_service(self, security_service):
"""Delete security service. """Delete security service.
@ -219,7 +219,7 @@ class ManilaScenario(scenario.OpenStackScenario):
timeout=CONF.benchmark.manila_share_delete_timeout, timeout=CONF.benchmark.manila_share_delete_timeout,
check_interval=CONF.benchmark.manila_share_delete_poll_interval) 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, def _add_security_service_to_share_network(self, share_network,
security_service): security_service):
"""Associate given security service with a share network. """Associate given security service with a share network.

View File

@ -16,18 +16,18 @@
import yaml import yaml
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
class MistralScenario(scenario.OpenStackScenario): class MistralScenario(scenario.OpenStackScenario):
"""Base class for Mistral scenarios with basic atomic actions.""" """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): def _list_workbooks(self):
"""Gets list of existing workbooks.""" """Gets list of existing workbooks."""
return self.clients("mistral").workbooks.list() return self.clients("mistral").workbooks.list()
@base.atomic_action_timer("mistral.create_workbook") @atomic.action_timer("mistral.create_workbook")
def _create_workbook(self, definition): def _create_workbook(self, definition):
"""Create a new workbook. """Create a new workbook.
@ -41,7 +41,7 @@ class MistralScenario(scenario.OpenStackScenario):
return self.clients("mistral").workbooks.create(definition) 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): def _delete_workbook(self, wb_name):
"""Delete the given workbook. """Delete the given workbook.

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.mistral import utils from rally.plugins.openstack.scenarios.mistral import utils
from rally.task.scenarios import base
from rally.task import types from rally.task import types
from rally.task import validation from rally.task import validation
@ -26,7 +26,7 @@ class MistralWorkbooks(utils.MistralScenario):
@validation.required_clients("mistral") @validation.required_clients("mistral")
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@validation.required_services(consts.Service.MISTRAL) @validation.required_services(consts.Service.MISTRAL)
@base.scenario() @scenario.configure()
def list_workbooks(self): def list_workbooks(self):
"""Scenario test mistral workbook-list command. """Scenario test mistral workbook-list command.
@ -41,7 +41,7 @@ class MistralWorkbooks(utils.MistralScenario):
@validation.required_clients("mistral") @validation.required_clients("mistral")
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@validation.required_services(consts.Service.MISTRAL) @validation.required_services(consts.Service.MISTRAL)
@base.scenario(context={"cleanup": ["mistral"]}) @scenario.configure(context={"cleanup": ["mistral"]})
def create_workbook(self, definition, do_delete=False): def create_workbook(self, definition, do_delete=False):
"""Scenario tests workbook creation and deletion. """Scenario tests workbook creation and deletion.

View File

@ -15,8 +15,9 @@
from rally.common import log as logging from rally.common import log as logging
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.murano import utils from rally.plugins.openstack.scenarios.murano import utils
from rally.task.scenarios import base from rally.task import atomic
from rally.task import validation from rally.task import validation
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -26,7 +27,7 @@ class MuranoEnvironments(utils.MuranoScenario):
"""Benchmark scenarios for Murano environments.""" """Benchmark scenarios for Murano environments."""
@validation.required_clients("murano") @validation.required_clients("murano")
@validation.required_services(consts.Service.MURANO) @validation.required_services(consts.Service.MURANO)
@base.scenario(context={"cleanup": ["murano.environments"]}) @scenario.configure(context={"cleanup": ["murano.environments"]})
def list_environments(self): def list_environments(self):
"""List the murano environments. """List the murano environments.
@ -36,7 +37,7 @@ class MuranoEnvironments(utils.MuranoScenario):
@validation.required_clients("murano") @validation.required_clients("murano")
@validation.required_services(consts.Service.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): def create_and_delete_environment(self):
"""Create environment, session and delete environment.""" """Create environment, session and delete environment."""
environment = self._create_environment() environment = self._create_environment()
@ -47,7 +48,7 @@ class MuranoEnvironments(utils.MuranoScenario):
@validation.required_clients("murano") @validation.required_clients("murano")
@validation.required_services(consts.Service.MURANO) @validation.required_services(consts.Service.MURANO)
@validation.required_contexts("murano_packages") @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): def create_and_deploy_environment(self, packages_per_env=1):
"""Create environment, session and deploy environment. """Create environment, session and deploy environment.
@ -60,7 +61,7 @@ class MuranoEnvironments(utils.MuranoScenario):
session = self._create_session(environment.id) session = self._create_session(environment.id)
package = self.context["tenant"]["packages"][0] 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): for i in range(packages_per_env):
self._create_service(environment, session, self._create_service(environment, session,
package.fully_qualified_name, package.fully_qualified_name,

View File

@ -18,7 +18,7 @@ import uuid
from oslo_config import cfg from oslo_config import cfg
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
from rally.task import utils from rally.task import utils
CONF = cfg.CONF CONF = cfg.CONF
@ -41,12 +41,12 @@ CONF.register_opts(MURANO_TIMEOUT_OPTS, group=benchmark_group)
class MuranoScenario(scenario.OpenStackScenario): class MuranoScenario(scenario.OpenStackScenario):
"""Base class for Murano scenarios with basic atomic actions.""" """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): def _list_environments(self):
"""Return environments list.""" """Return environments list."""
return self.clients("murano").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): def _create_environment(self, env_name=None):
"""Create environment. """Create environment.
@ -57,7 +57,7 @@ class MuranoScenario(scenario.OpenStackScenario):
env_name = env_name or self._generate_random_name() env_name = env_name or self._generate_random_name()
return self.clients("murano").environments.create({"name": env_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): def _delete_environment(self, environment):
"""Delete given environment. """Delete given environment.
@ -73,7 +73,7 @@ class MuranoScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.delete_environment_check_interval 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): def _create_session(self, environment_id):
"""Create session for environment with specific id """Create session for environment with specific id
@ -101,7 +101,7 @@ class MuranoScenario(scenario.OpenStackScenario):
"name": self._generate_random_name("rally_")} "name": self._generate_random_name("rally_")}
if atomic_action: if atomic_action:
with base.AtomicAction(self, "murano.create_service"): with atomic.ActionTimer(self, "murano.create_service"):
return self.clients("murano").services.post( return self.clients("murano").services.post(
environment_id=environment.id, path="/", data=data, environment_id=environment.id, path="/", data=data,
session_id=session.id) session_id=session.id)
@ -110,7 +110,7 @@ class MuranoScenario(scenario.OpenStackScenario):
environment_id=environment.id, path="/", data=data, environment_id=environment.id, path="/", data=data,
session_id=session.id) session_id=session.id)
@base.atomic_action_timer("murano.deploy_environment") @atomic.action_timer("murano.deploy_environment")
def _deploy_environment(self, environment, session): def _deploy_environment(self, environment, session):
"""Deploy environment. """Deploy environment.

View File

@ -11,8 +11,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.neutron import utils from rally.plugins.openstack.scenarios.neutron import utils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -24,7 +24,7 @@ class NeutronLoadbalancerV1(utils.NeutronScenario):
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@validation.required_contexts("network") @validation.required_contexts("network")
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_list_pools(self, pool_create_args=None): def create_and_list_pools(self, pool_create_args=None):
"""Create a pool(v1) and then list pools(v1). """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_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@validation.required_contexts("network") @validation.required_contexts("network")
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_delete_pools(self, pool_create_args=None): def create_and_delete_pools(self, pool_create_args=None):
"""Create pools(v1) and delete pools(v1). """Create pools(v1) and delete pools(v1).
@ -64,7 +64,7 @@ class NeutronLoadbalancerV1(utils.NeutronScenario):
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@validation.required_contexts("network") @validation.required_contexts("network")
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_update_pools(self, pool_update_args=None, def create_and_update_pools(self, pool_update_args=None,
pool_create_args=None): pool_create_args=None):
"""Create pools(v1) and update pools(v1). """Create pools(v1) and update pools(v1).

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.neutron import utils from rally.plugins.openstack.scenarios.neutron import utils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -24,7 +24,7 @@ class NeutronNetworks(utils.NeutronScenario):
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @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): def create_and_list_networks(self, network_create_args=None):
"""Create a network and then list all networks. """Create a network and then list all networks.
@ -43,7 +43,7 @@ class NeutronNetworks(utils.NeutronScenario):
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_update_networks(self, def create_and_update_networks(self,
network_update_args, network_update_args,
network_create_args=None): network_create_args=None):
@ -58,7 +58,7 @@ class NeutronNetworks(utils.NeutronScenario):
self._update_network(network, network_update_args) self._update_network(network, network_update_args)
@validation.required_services(consts.Service.NEUTRON) @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): def create_and_delete_networks(self, network_create_args=None):
"""Create and delete a network. """Create and delete a network.
@ -72,7 +72,7 @@ class NeutronNetworks(utils.NeutronScenario):
@validation.number("subnets_per_network", minval=1, integer_only=True) @validation.number("subnets_per_network", minval=1, integer_only=True)
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_list_subnets(self, def create_and_list_subnets(self,
network_create_args=None, network_create_args=None,
subnet_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.number("subnets_per_network", minval=1, integer_only=True)
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_update_subnets(self, def create_and_update_subnets(self,
subnet_update_args, subnet_update_args,
network_create_args=None, network_create_args=None,
@ -127,7 +127,7 @@ class NeutronNetworks(utils.NeutronScenario):
@validation.required_parameters("subnets_per_network") @validation.required_parameters("subnets_per_network")
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_delete_subnets(self, def create_and_delete_subnets(self,
network_create_args=None, network_create_args=None,
subnet_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.number("subnets_per_network", minval=1, integer_only=True)
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_list_routers(self, def create_and_list_routers(self,
network_create_args=None, network_create_args=None,
subnet_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.number("subnets_per_network", minval=1, integer_only=True)
@validation.required_parameters("subnets_per_network") @validation.required_parameters("subnets_per_network")
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_update_routers(self, def create_and_update_routers(self,
router_update_args, router_update_args,
network_create_args=None, network_create_args=None,
@ -223,9 +223,9 @@ class NeutronNetworks(utils.NeutronScenario):
{"subnet_id": subnet["subnet"]["id"]}) {"subnet_id": subnet["subnet"]["id"]})
self._update_router(router, router_update_args) self._update_router(router, router_update_args)
@base.scenario(context={"cleanup": ["neutron"]})
@validation.required_parameters("subnets_per_network") @validation.required_parameters("subnets_per_network")
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@scenario.configure(context={"cleanup": ["neutron"]})
def create_and_delete_routers(self, def create_and_delete_routers(self,
network_create_args=None, network_create_args=None,
subnet_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.number("ports_per_network", minval=1, integer_only=True)
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_list_ports(self, def create_and_list_ports(self,
network_create_args=None, network_create_args=None,
port_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.number("ports_per_network", minval=1, integer_only=True)
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_update_ports(self, def create_and_update_ports(self,
port_update_args, port_update_args,
network_create_args=None, network_create_args=None,
@ -311,7 +311,7 @@ class NeutronNetworks(utils.NeutronScenario):
@validation.required_parameters("ports_per_network") @validation.required_parameters("ports_per_network")
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@base.scenario(context={"cleanup": ["neutron"]}) @scenario.configure(context={"cleanup": ["neutron"]})
def create_and_delete_ports(self, def create_and_delete_ports(self,
network_create_args=None, network_create_args=None,
port_create_args=None, port_create_args=None,

View File

@ -17,7 +17,7 @@ from rally.common.i18n import _
from rally.common import log as logging from rally.common import log as logging
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.plugins.openstack.wrappers import network as network_wrapper 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__) LOG = logging.getLogger(__name__)
@ -62,7 +62,7 @@ class NeutronScenario(scenario.OpenStackScenario):
"id": list(resource.values())[0]["id"], "id": list(resource.values())[0]["id"],
"name": kwargs["name"]}) "name": kwargs["name"]})
@base.atomic_action_timer("neutron.create_network") @atomic.action_timer("neutron.create_network")
def _create_network(self, network_create_args): def _create_network(self, network_create_args):
"""Create neutron network. """Create neutron network.
@ -73,12 +73,12 @@ class NeutronScenario(scenario.OpenStackScenario):
return self.clients("neutron").create_network( return self.clients("neutron").create_network(
{"network": network_create_args}) {"network": network_create_args})
@base.atomic_action_timer("neutron.list_networks") @atomic.action_timer("neutron.list_networks")
def _list_networks(self): def _list_networks(self):
"""Return user networks list.""" """Return user networks list."""
return self.clients("neutron").list_networks()["networks"] 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): def _update_network(self, network, network_update_args):
"""Update the network. """Update the network.
@ -93,7 +93,7 @@ class NeutronScenario(scenario.OpenStackScenario):
return self.clients("neutron").update_network( return self.clients("neutron").update_network(
network["network"]["id"], body) network["network"]["id"], body)
@base.atomic_action_timer("neutron.delete_network") @atomic.action_timer("neutron.delete_network")
def _delete_network(self, network): def _delete_network(self, network):
"""Delete neutron network. """Delete neutron network.
@ -101,7 +101,7 @@ class NeutronScenario(scenario.OpenStackScenario):
""" """
self.clients("neutron").delete_network(network["id"]) 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): def _create_subnet(self, network, subnet_create_args, start_cidr=None):
"""Create neutron subnet. """Create neutron subnet.
@ -124,12 +124,12 @@ class NeutronScenario(scenario.OpenStackScenario):
return self.clients("neutron").create_subnet( return self.clients("neutron").create_subnet(
{"subnet": subnet_create_args}) {"subnet": subnet_create_args})
@base.atomic_action_timer("neutron.list_subnets") @atomic.action_timer("neutron.list_subnets")
def _list_subnets(self): def _list_subnets(self):
"""Returns user subnetworks list.""" """Returns user subnetworks list."""
return self.clients("neutron").list_subnets()["subnets"] 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): def _update_subnet(self, subnet, subnet_update_args):
"""Update the neutron subnet. """Update the neutron subnet.
@ -144,7 +144,7 @@ class NeutronScenario(scenario.OpenStackScenario):
return self.clients("neutron").update_subnet( return self.clients("neutron").update_subnet(
subnet["subnet"]["id"], body) subnet["subnet"]["id"], body)
@base.atomic_action_timer("neutron.delete_subnet") @atomic.action_timer("neutron.delete_subnet")
def _delete_subnet(self, subnet): def _delete_subnet(self, subnet):
"""Delete neutron subnet """Delete neutron subnet
@ -152,7 +152,7 @@ class NeutronScenario(scenario.OpenStackScenario):
""" """
self.clients("neutron").delete_subnet(subnet["subnet"]["id"]) 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): def _create_router(self, router_create_args, external_gw=False):
"""Create neutron router. """Create neutron router.
@ -174,12 +174,12 @@ class NeutronScenario(scenario.OpenStackScenario):
return self.clients("neutron").create_router( return self.clients("neutron").create_router(
{"router": router_create_args}) {"router": router_create_args})
@base.atomic_action_timer("neutron.list_routers") @atomic.action_timer("neutron.list_routers")
def _list_routers(self): def _list_routers(self):
"""Returns user routers list.""" """Returns user routers list."""
return self.clients("neutron").list_routers()["routers"] 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): def _delete_router(self, router):
"""Delete neutron router """Delete neutron router
@ -187,7 +187,7 @@ class NeutronScenario(scenario.OpenStackScenario):
""" """
self.clients("neutron").delete_router(router["router"]["id"]) 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): def _update_router(self, router, router_update_args):
"""Update the neutron router. """Update the neutron router.
@ -202,7 +202,7 @@ class NeutronScenario(scenario.OpenStackScenario):
return self.clients("neutron").update_router( return self.clients("neutron").update_router(
router["router"]["id"], body) 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): def _create_port(self, network, port_create_args):
"""Create neutron port. """Create neutron port.
@ -215,12 +215,12 @@ class NeutronScenario(scenario.OpenStackScenario):
"name", self._generate_random_name("rally_port_")) "name", self._generate_random_name("rally_port_"))
return self.clients("neutron").create_port({"port": port_create_args}) 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): def _list_ports(self):
"""Return user ports list.""" """Return user ports list."""
return self.clients("neutron").list_ports()["ports"] 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): def _update_port(self, port, port_update_args):
"""Update the neutron port. """Update the neutron port.
@ -234,7 +234,7 @@ class NeutronScenario(scenario.OpenStackScenario):
body = {"port": port_update_args} body = {"port": port_update_args}
return self.clients("neutron").update_port(port["port"]["id"], body) 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): def _delete_port(self, port):
"""Delete neutron port. """Delete neutron port.
@ -264,7 +264,7 @@ class NeutronScenario(scenario.OpenStackScenario):
subnets.append(subnet) subnets.append(subnet)
return network, subnets 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): def _add_interface_router(self, subnet, router):
"""Connect subnet to router. """Connect subnet to router.
@ -274,7 +274,7 @@ class NeutronScenario(scenario.OpenStackScenario):
self.clients("neutron").add_interface_router( self.clients("neutron").add_interface_router(
router["id"], {"subnet_id": subnet["id"]}) 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): def _remove_interface_router(self, subnet, router):
"""Remove subnet from router """Remove subnet from router
@ -299,7 +299,7 @@ class NeutronScenario(scenario.OpenStackScenario):
"subnet_id": subnet_id} "subnet_id": subnet_id}
args.update(pool_create_args) args.update(pool_create_args)
if atomic_action: 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})
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 = [] pools = []
for net in networks: for net in networks:
subnets.extend(net.get("subnets", [])) subnets.extend(net.get("subnets", []))
with base.AtomicAction(self, "neutron.create_%s_pools" % with atomic.ActionTimer(self, "neutron.create_%s_pools" %
len(subnets)): len(subnets)):
for subnet_id in subnets: for subnet_id in subnets:
pools.append(self._create_lb_pool( pools.append(self._create_lb_pool(
subnet_id, atomic_action=False, **pool_create_args)) subnet_id, atomic_action=False, **pool_create_args))
return pools return pools
@base.atomic_action_timer("neutron.list_pools") @atomic.action_timer("neutron.list_pools")
def _list_v1_pools(self, **kwargs): def _list_v1_pools(self, **kwargs):
"""Return user lb pool list(v1).""" """Return user lb pool list(v1)."""
return self.clients("neutron").list_pools(**kwargs) 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): def _delete_v1_pool(self, pool):
"""Delete neutron pool. """Delete neutron pool.
@ -334,7 +334,7 @@ class NeutronScenario(scenario.OpenStackScenario):
""" """
self.clients("neutron").delete_pool(pool["id"]) 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): def _update_v1_pool(self, pool, **pool_update_args):
"""Update pool. """Update pool.

View File

@ -15,8 +15,8 @@
from rally.common import log as logging from rally.common import log as logging
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.nova import utils from rally.plugins.openstack.scenarios.nova import utils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -28,7 +28,7 @@ class NovaHypervisors(utils.NovaScenario):
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(admin=True) @validation.required_openstack(admin=True)
@base.scenario() @scenario.configure()
def list_hypervisors(self, detailed=True): def list_hypervisors(self, detailed=True):
"""List hypervisors. """List hypervisors.

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.nova import utils from rally.plugins.openstack.scenarios.nova import utils
from rally.task.scenarios import base
from rally.task import types from rally.task import types
from rally.task import validation from rally.task import validation
@ -25,7 +25,7 @@ class NovaKeypair(utils.NovaScenario):
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def create_and_list_keypairs(self, **kwargs): def create_and_list_keypairs(self, **kwargs):
"""Create a keypair with random name and list keypairs. """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_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def create_and_delete_keypair(self, **kwargs): def create_and_delete_keypair(self, **kwargs):
"""Create a keypair with random name and delete keypair. """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.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @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, def boot_and_delete_server_with_keypair(self, image, flavor,
**kwargs): **kwargs):
"""Boot and delete server with keypair. """Boot and delete server with keypair.

View File

@ -18,10 +18,10 @@ import jsonschema
from rally.common import log as logging from rally.common import log as logging
from rally import consts from rally import consts
from rally import exceptions as rally_exceptions 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.cinder import utils as cinder_utils
from rally.plugins.openstack.scenarios.nova import utils from rally.plugins.openstack.scenarios.nova import utils
from rally.plugins.openstack.wrappers import network as network_wrapper 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 types
from rally.task import utils as task_utils from rally.task import utils as task_utils
from rally.task import validation from rally.task import validation
@ -41,7 +41,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def boot_and_list_server(self, image, flavor, def boot_and_list_server(self, image, flavor,
detailed=True, **kwargs): detailed=True, **kwargs):
"""Boot a server from an image and then list all servers. """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_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def list_servers(self, detailed=True): def list_servers(self, detailed=True):
"""List all servers. """List all servers.
@ -82,7 +82,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def boot_and_delete_server(self, image, flavor, def boot_and_delete_server(self, image, flavor,
min_sleep=0, max_sleep=0, min_sleep=0, max_sleep=0,
force_delete=False, **kwargs): force_delete=False, **kwargs):
@ -108,7 +108,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(admin=True, users=True) @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, def boot_and_delete_multiple_servers(self, image, flavor, count=2,
min_sleep=0, max_sleep=0, min_sleep=0, max_sleep=0,
force_delete=False, **kwargs): force_delete=False, **kwargs):
@ -135,7 +135,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER) @validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
@validation.required_openstack(users=True) @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, def boot_server_from_volume_and_delete(self, image, flavor,
volume_size, volume_size,
min_sleep=0, max_sleep=0, min_sleep=0, max_sleep=0,
@ -168,7 +168,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def boot_and_bounce_server(self, image, flavor, def boot_and_bounce_server(self, image, flavor,
force_delete=False, actions=None, **kwargs): force_delete=False, actions=None, **kwargs):
"""Boot a server and run specified actions against it. """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.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def boot_lock_unlock_and_delete(self, image, flavor, def boot_lock_unlock_and_delete(self, image, flavor,
min_sleep=0, max_sleep=0, min_sleep=0, max_sleep=0,
force_delete=False, force_delete=False,
@ -235,7 +235,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA, consts.Service.GLANCE) @validation.required_services(consts.Service.NOVA, consts.Service.GLANCE)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova", "glance"]}) @scenario.configure(context={"cleanup": ["nova", "glance"]})
def snapshot_server(self, image, flavor, def snapshot_server(self, image, flavor,
force_delete=False, **kwargs): force_delete=False, **kwargs):
"""Boot a server, make its snapshot and delete both. """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.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @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): def boot_server(self, image, flavor, auto_assign_nic=False, **kwargs):
"""Boot a server. """Boot a server.
@ -278,7 +278,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER) @validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
@validation.required_openstack(users=True) @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, def boot_server_from_volume(self, image, flavor, volume_size,
auto_assign_nic=False, **kwargs): auto_assign_nic=False, **kwargs):
"""Boot a server from volume. """Boot a server from volume.
@ -345,7 +345,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def resize_server(self, image, flavor, to_flavor, def resize_server(self, image, flavor, to_flavor,
force_delete=False, **kwargs): force_delete=False, **kwargs):
"""Boot a server, then resize and delete it. """Boot a server, then resize and delete it.
@ -374,7 +374,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def suspend_and_resume_server(self, image, flavor, def suspend_and_resume_server(self, image, flavor,
force_delete=False, **kwargs): force_delete=False, **kwargs):
"""Create a server, suspend, resume and then delete it """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.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def pause_and_unpause_server(self, image, flavor, def pause_and_unpause_server(self, image, flavor,
force_delete=False, **kwargs): force_delete=False, **kwargs):
"""Create a server, pause, unpause and then delete it """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.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def shelve_and_unshelve_server(self, image, flavor, def shelve_and_unshelve_server(self, image, flavor,
force_delete=False, **kwargs): force_delete=False, **kwargs):
"""Create a server, shelve, unshelve and then delete it """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.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(admin=True, users=True) @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, def boot_and_live_migrate_server(self, image,
flavor, block_migration=False, flavor, block_migration=False,
disk_over_commit=False, min_sleep=0, disk_over_commit=False, min_sleep=0,
@ -472,7 +472,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER) @validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
@validation.required_openstack(admin=True, users=True) @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, def boot_server_from_volume_and_live_migrate(self, image, flavor,
volume_size, volume_size,
block_migration=False, block_migration=False,
@ -520,7 +520,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER) @validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
@validation.required_openstack(admin=True, users=True) @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( def boot_server_attach_created_volume_and_live_migrate(
self, self,
image, image,
@ -579,7 +579,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "image") @validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(admin=True, users=True) @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): def boot_and_migrate_server(self, image, flavor, **kwargs):
"""Migrate a server. """Migrate a server.
@ -610,7 +610,7 @@ class NovaServers(utils.NovaScenario,
@validation.image_valid_on_flavor("flavor", "to_image") @validation.image_valid_on_flavor("flavor", "to_image")
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(admin=True, users=True) @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): def boot_and_rebuild_server(self, from_image, to_image, flavor, **kwargs):
"""Rebuild a server. """Rebuild a server.
@ -632,7 +632,7 @@ class NovaServers(utils.NovaScenario,
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@validation.required_contexts("network") @validation.required_contexts("network")
@base.scenario(context={"cleanup": ["nova"]}) @scenario.configure(context={"cleanup": ["nova"]})
def boot_and_associate_floating_ip(self, image, flavor, **kwargs): def boot_and_associate_floating_ip(self, image, flavor, **kwargs):
"""Boot a server and associate a floating IP to it. """Boot a server and associate a floating IP to it.

View File

@ -22,7 +22,7 @@ import six
from rally import exceptions from rally import exceptions
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.plugins.openstack.wrappers import network as network_wrapper 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 utils
NOVA_BENCHMARK_OPTS = [] NOVA_BENCHMARK_OPTS = []
@ -91,12 +91,12 @@ CONF.register_opts(NOVA_BENCHMARK_OPTS, group=benchmark_group)
class NovaScenario(scenario.OpenStackScenario): class NovaScenario(scenario.OpenStackScenario):
"""Base class for Nova scenarios with basic atomic actions.""" """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): def _list_servers(self, detailed=True):
"""Returns user servers list.""" """Returns user servers list."""
return self.clients("nova").servers.list(detailed) 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, def _boot_server(self, image_id, flavor_id,
auto_assign_nic=False, name=None, **kwargs): auto_assign_nic=False, name=None, **kwargs):
"""Boot a server. """Boot a server.
@ -156,7 +156,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_reboot_poll_interval 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): def _soft_reboot_server(self, server):
"""Reboot a server with soft reboot. """Reboot a server with soft reboot.
@ -167,7 +167,7 @@ class NovaScenario(scenario.OpenStackScenario):
""" """
self._do_server_reboot(server, "SOFT") self._do_server_reboot(server, "SOFT")
@base.atomic_action_timer("nova.reboot_server") @atomic.action_timer("nova.reboot_server")
def _reboot_server(self, server): def _reboot_server(self, server):
"""Reboot a server with hard reboot. """Reboot a server with hard reboot.
@ -178,7 +178,7 @@ class NovaScenario(scenario.OpenStackScenario):
""" """
self._do_server_reboot(server, "HARD") 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): def _rebuild_server(self, server, image, **kwargs):
"""Rebuild a server with a new image. """Rebuild a server with a new image.
@ -196,7 +196,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_rebuild_poll_interval 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): def _start_server(self, server):
"""Start the given server. """Start the given server.
@ -213,7 +213,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_start_poll_interval 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): def _stop_server(self, server):
"""Stop the given server. """Stop the given server.
@ -230,7 +230,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_stop_poll_interval 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): def _rescue_server(self, server):
"""Rescue the given server. """Rescue the given server.
@ -248,7 +248,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_rescue_poll_interval 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): def _unrescue_server(self, server):
"""Unrescue the given server. """Unrescue the given server.
@ -265,7 +265,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_unrescue_poll_interval 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): def _suspend_server(self, server):
"""Suspends the given server. """Suspends the given server.
@ -283,7 +283,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_suspend_poll_interval 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): def _resume_server(self, server):
"""Resumes the suspended server. """Resumes the suspended server.
@ -301,7 +301,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_resume_poll_interval 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): def _pause_server(self, server):
"""Pause the live server. """Pause the live server.
@ -319,7 +319,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_pause_poll_interval 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): def _unpause_server(self, server):
"""Unpause the paused server. """Unpause the paused server.
@ -337,7 +337,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_unpause_poll_interval 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): def _shelve_server(self, server):
"""Shelve the given server. """Shelve the given server.
@ -355,7 +355,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_shelve_poll_interval 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): def _unshelve_server(self, server):
"""Unshelve the given 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. :param force: If True, force_delete will be used instead of delete.
""" """
atomic_name = ("nova.%sdelete_server") % (force and "force_" or "") atomic_name = ("nova.%sdelete_server") % (force and "force_" or "")
with base.AtomicAction(self, atomic_name): with atomic.ActionTimer(self, atomic_name):
if force: if force:
server.force_delete() server.force_delete()
else: else:
@ -401,7 +401,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param force: If True, force_delete will be used instead of delete. :param force: If True, force_delete will be used instead of delete.
""" """
atomic_name = ("nova.%sdelete_servers") % (force and "force_" or "") 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: for server in servers:
if force: if force:
server.force_delete() server.force_delete()
@ -417,7 +417,7 @@ class NovaScenario(scenario.OpenStackScenario):
benchmark.nova_server_delete_poll_interval benchmark.nova_server_delete_poll_interval
) )
@base.atomic_action_timer("nova.delete_image") @atomic.action_timer("nova.delete_image")
def _delete_image(self, image): def _delete_image(self, image):
"""Delete the given image. """Delete the given image.
@ -434,7 +434,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=check_interval check_interval=check_interval
) )
@base.atomic_action_timer("nova.create_image") @atomic.action_timer("nova.create_image")
def _create_image(self, server): def _create_image(self, server):
"""Create an image from the given server """Create an image from the given server
@ -458,7 +458,7 @@ class NovaScenario(scenario.OpenStackScenario):
) )
return image return image
@base.atomic_action_timer("nova.create_keypair") @atomic.action_timer("nova.create_keypair")
def _create_keypair(self, **kwargs): def _create_keypair(self, **kwargs):
"""Create a keypair """Create a keypair
@ -468,12 +468,12 @@ class NovaScenario(scenario.OpenStackScenario):
keypair = self.clients("nova").keypairs.create(keypair_name, **kwargs) keypair = self.clients("nova").keypairs.create(keypair_name, **kwargs)
return keypair.name return keypair.name
@base.atomic_action_timer("nova.list_keypairs") @atomic.action_timer("nova.list_keypairs")
def _list_keypairs(self): def _list_keypairs(self):
"""Return user keypairs list.""" """Return user keypairs list."""
return self.clients("nova").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): def _delete_keypair(self, keypair_name):
"""Delete keypair """Delete keypair
@ -481,7 +481,7 @@ class NovaScenario(scenario.OpenStackScenario):
""" """
self.clients("nova").keypairs.delete(keypair_name) 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, def _boot_servers(self, image_id, flavor_id, requests, name_prefix=None,
instances_amount=1, **kwargs): instances_amount=1, **kwargs):
"""Boot multiple servers. """Boot multiple servers.
@ -522,7 +522,7 @@ class NovaScenario(scenario.OpenStackScenario):
) for server in servers] ) for server in servers]
return 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): def _associate_floating_ip(self, server, address, fixed_address=None):
"""Add floating IP to an instance """Add floating IP to an instance
@ -540,7 +540,7 @@ class NovaScenario(scenario.OpenStackScenario):
# Update server data # Update server data
server.addresses = server.manager.get(server.id).addresses 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): def _dissociate_floating_ip(self, server, address):
"""Remove floating IP from an instance """Remove floating IP from an instance
@ -568,12 +568,12 @@ class NovaScenario(scenario.OpenStackScenario):
return not must_exist return not must_exist
return _check_addr return _check_addr
@base.atomic_action_timer("nova.list_networks") @atomic.action_timer("nova.list_networks")
def _list_networks(self): def _list_networks(self):
"""Return user networks list.""" """Return user networks list."""
return self.clients("nova").networks.list() return self.clients("nova").networks.list()
@base.atomic_action_timer("nova.resize") @atomic.action_timer("nova.resize")
def _resize(self, server, flavor): def _resize(self, server, flavor):
server.resize(flavor) server.resize(flavor)
utils.wait_for( utils.wait_for(
@ -584,7 +584,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_server_resize_poll_interval 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"): def _resize_confirm(self, server, status="ACTIVE"):
server.confirm_resize() server.confirm_resize()
utils.wait_for( utils.wait_for(
@ -596,7 +596,7 @@ class NovaScenario(scenario.OpenStackScenario):
CONF.benchmark.nova_server_resize_confirm_poll_interval) 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"): def _resize_revert(self, server, status="ACTIVE"):
server.revert_resize() server.revert_resize()
utils.wait_for( utils.wait_for(
@ -608,7 +608,7 @@ class NovaScenario(scenario.OpenStackScenario):
CONF.benchmark.nova_server_resize_revert_poll_interval) 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): def _attach_volume(self, server, volume, device=None):
server_id = server.id server_id = server.id
volume_id = volume.id volume_id = volume.id
@ -624,7 +624,7 @@ class NovaScenario(scenario.OpenStackScenario):
CONF.benchmark.nova_server_resize_revert_poll_interval) 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): def _detach_volume(self, server, volume):
server_id = server.id server_id = server.id
volume_id = volume.id volume_id = volume.id
@ -638,7 +638,7 @@ class NovaScenario(scenario.OpenStackScenario):
check_interval=CONF.benchmark.nova_detach_volume_poll_interval 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, def _live_migrate(self, server, target_host, block_migration=False,
disk_over_commit=False, skip_host_check=False): disk_over_commit=False, skip_host_check=False):
"""Run live migration of the given server. """Run live migration of the given server.
@ -671,7 +671,7 @@ class NovaScenario(scenario.OpenStackScenario):
"Migration complete but instance did not change host: %s" % "Migration complete but instance did not change host: %s" %
host_pre_migrate) 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): def _find_host_to_migrate(self, server):
"""Find a compute node for live migration. """Find a compute node for live migration.
@ -695,7 +695,7 @@ class NovaScenario(scenario.OpenStackScenario):
raise exceptions.InvalidHostException( raise exceptions.InvalidHostException(
"No valid host found to migrate") "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): def _migrate(self, server, skip_host_check=False):
"""Run migration of the given server. """Run migration of the given server.
@ -724,8 +724,8 @@ class NovaScenario(scenario.OpenStackScenario):
def _create_security_groups(self, security_group_count): def _create_security_groups(self, security_group_count):
security_groups = [] security_groups = []
with base.AtomicAction(self, "nova.create_%s_security_groups" % with atomic.ActionTimer(self, "nova.create_%s_security_groups" %
security_group_count): security_group_count):
for i in range(security_group_count): for i in range(security_group_count):
sg_name = self._generate_random_name() sg_name = self._generate_random_name()
sg = self.clients("nova").security_groups.create(sg_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"): ip_protocol="tcp", cidr="0.0.0.0/0"):
action_name = ("nova.create_%s_rules" % (rules_per_security_group * action_name = ("nova.create_%s_rules" % (rules_per_security_group *
len(security_groups))) len(security_groups)))
with base.AtomicAction(self, action_name): with atomic.ActionTimer(self, action_name):
for i in range(len(security_groups)): for i in range(len(security_groups)):
for j in range(rules_per_security_group): for j in range(rules_per_security_group):
self.clients("nova").security_group_rules.create( self.clients("nova").security_group_rules.create(
@ -750,22 +750,22 @@ class NovaScenario(scenario.OpenStackScenario):
cidr=cidr) cidr=cidr)
def _delete_security_groups(self, security_group): def _delete_security_groups(self, security_group):
with base.AtomicAction(self, "nova.delete_%s_security_groups" % with atomic.ActionTimer(self, "nova.delete_%s_security_groups" %
len(security_group)): len(security_group)):
for sg in security_group: for sg in security_group:
self.clients("nova").security_groups.delete(sg.id) self.clients("nova").security_groups.delete(sg.id)
def _list_security_groups(self): def _list_security_groups(self):
"""Return security groups list.""" """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() 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): def _list_floating_ips_bulk(self):
"""List all floating IPs.""" """List all floating IPs."""
return self.admin_clients("nova").floating_ips_bulk.list() 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): def _create_floating_ips_bulk(self, ip_range, **kwargs):
"""Create floating IPs by range.""" """Create floating IPs by range."""
ip_range = network_wrapper.generate_cidr(start_cidr=ip_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( return self.admin_clients("nova").floating_ips_bulk.create(
ip_range=ip_range, pool=pool_name, **kwargs) 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): def _delete_floating_ips_bulk(self, ip_range):
"""Delete floating IPs by range.""" """Delete floating IPs by range."""
return self.admin_clients("nova").floating_ips_bulk.delete(ip_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): def _list_hypervisors(self, detailed=True):
"""List hypervisors.""" """List hypervisors."""
return self.admin_clients("nova").hypervisors.list(detailed) 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): def _lock_server(self, server):
"""Lock the given server. """Lock the given server.
@ -791,7 +791,7 @@ class NovaScenario(scenario.OpenStackScenario):
""" """
server.lock() server.lock()
@base.atomic_action_timer("nova.unlock_server") @atomic.action_timer("nova.unlock_server")
def _unlock_server(self, server): def _unlock_server(self, server):
"""Unlock the given server. """Unlock the given server.
@ -799,7 +799,7 @@ class NovaScenario(scenario.OpenStackScenario):
""" """
server.unlock() server.unlock()
@base.atomic_action_timer("nova.create_network") @atomic.action_timer("nova.create_network")
def _create_network(self, ip_range, **kwargs): def _create_network(self, ip_range, **kwargs):
"""Create nova network. """Create nova network.
@ -810,7 +810,7 @@ class NovaScenario(scenario.OpenStackScenario):
return self.admin_clients("nova").networks.create( return self.admin_clients("nova").networks.create(
label=net_label, cidr=ip_range, **kwargs) 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): def _delete_network(self, net_id):
"""Delete nova network. """Delete nova network.

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.quotas import utils from rally.plugins.openstack.scenarios.quotas import utils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -24,7 +24,7 @@ class Quotas(utils.QuotasScenario):
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(admin=True, users=True) @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): def nova_update(self, max_quota=1024):
"""Update quotas for Nova. """Update quotas for Nova.
@ -35,7 +35,7 @@ class Quotas(utils.QuotasScenario):
@validation.required_services(consts.Service.NOVA) @validation.required_services(consts.Service.NOVA)
@validation.required_openstack(admin=True, users=True) @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): def nova_update_and_delete(self, max_quota=1024):
"""Update and delete quotas for Nova. """Update and delete quotas for Nova.
@ -48,7 +48,7 @@ class Quotas(utils.QuotasScenario):
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(admin=True, users=True) @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): def cinder_update(self, max_quota=1024):
"""Update quotas for Cinder. """Update quotas for Cinder.
@ -59,7 +59,7 @@ class Quotas(utils.QuotasScenario):
@validation.required_services(consts.Service.CINDER) @validation.required_services(consts.Service.CINDER)
@validation.required_openstack(admin=True, users=True) @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): def cinder_update_and_delete(self, max_quota=1024):
"""Update and Delete quotas for Cinder. """Update and Delete quotas for Cinder.
@ -71,7 +71,7 @@ class Quotas(utils.QuotasScenario):
@validation.required_services(consts.Service.NEUTRON) @validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(admin=True, users=True) @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): def neutron_update(self, max_quota=1024):
"""Update quotas for neutron. """Update quotas for neutron.

View File

@ -16,13 +16,13 @@
import random import random
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
class QuotasScenario(scenario.OpenStackScenario): class QuotasScenario(scenario.OpenStackScenario):
"""Base class for quotas scenarios with basic atomic actions.""" """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, def _update_quotas(self, component, tenant_id, max_quota=1024,
quota_update_fn=None): quota_update_fn=None):
"""Updates quotas. """Updates quotas.
@ -42,7 +42,7 @@ class QuotasScenario(scenario.OpenStackScenario):
return quota_update_fn(tenant_id, **quotas) return quota_update_fn(tenant_id, **quotas)
return self.admin_clients(component).quotas.update(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): def _delete_quotas(self, component, tenant_id):
"""Delete quotas. """Delete quotas.

View File

@ -15,8 +15,8 @@
from rally.common import log as logging from rally.common import log as logging
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.sahara import utils from rally.plugins.openstack.scenarios.sahara import utils
from rally.task.scenarios import base
from rally.task import types from rally.task import types
from rally.task import validation from rally.task import validation
@ -34,7 +34,7 @@ class SaharaClusters(utils.SaharaScenario):
@validation.number("workers_count", minval=1, integer_only=True) @validation.number("workers_count", minval=1, integer_only=True)
@validation.required_services(consts.Service.SAHARA) @validation.required_services(consts.Service.SAHARA)
@validation.required_openstack(users=True) @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, def create_and_delete_cluster(self, flavor, workers_count, plugin_name,
hadoop_version, floating_ip_pool=None, hadoop_version, floating_ip_pool=None,
volumes_per_node=None, volumes_per_node=None,
@ -102,7 +102,7 @@ class SaharaClusters(utils.SaharaScenario):
@validation.required_services(consts.Service.SAHARA) @validation.required_services(consts.Service.SAHARA)
@validation.required_contexts("users", "sahara_image") @validation.required_contexts("users", "sahara_image")
@validation.number("workers_count", minval=1, integer_only=True) @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, def create_scale_delete_cluster(self, flavor, workers_count, plugin_name,
hadoop_version, deltas, hadoop_version, deltas,
floating_ip_pool=None, floating_ip_pool=None,

View File

@ -15,8 +15,8 @@
from rally.common import log as logging from rally.common import log as logging
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.sahara import utils from rally.plugins.openstack.scenarios.sahara import utils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -28,7 +28,7 @@ class SaharaJob(utils.SaharaScenario):
@validation.required_services(consts.Service.SAHARA) @validation.required_services(consts.Service.SAHARA)
@validation.required_contexts("users", "sahara_image", "sahara_edp", @validation.required_contexts("users", "sahara_image", "sahara_edp",
"sahara_cluster") "sahara_cluster")
@base.scenario(context={"cleanup": ["sahara"]}) @scenario.configure(context={"cleanup": ["sahara"]})
def create_launch_job(self, job_type, configs, job_idx=0): def create_launch_job(self, job_type, configs, job_idx=0):
"""Create and execute a Sahara EDP Job. """Create and execute a Sahara EDP Job.
@ -71,7 +71,7 @@ class SaharaJob(utils.SaharaScenario):
@validation.required_services(consts.Service.SAHARA) @validation.required_services(consts.Service.SAHARA)
@validation.required_contexts("users", "sahara_image", "sahara_edp", @validation.required_contexts("users", "sahara_image", "sahara_edp",
"sahara_cluster") "sahara_cluster")
@base.scenario(context={"cleanup": ["sahara"]}) @scenario.configure(context={"cleanup": ["sahara"]})
def create_launch_job_sequence(self, jobs): def create_launch_job_sequence(self, jobs):
"""Create and execute a sequence of the Sahara EDP 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_services(consts.Service.SAHARA)
@validation.required_contexts("users", "sahara_image", "sahara_edp", @validation.required_contexts("users", "sahara_image", "sahara_edp",
"sahara_cluster") "sahara_cluster")
@base.scenario(context={"cleanup": ["sahara"]}) @scenario.configure(context={"cleanup": ["sahara"]})
def create_launch_job_sequence_with_scaling(self, jobs, deltas): def create_launch_job_sequence_with_scaling(self, jobs, deltas):
"""Create and execute Sahara EDP Jobs on a scaling Cluster. """Create and execute Sahara EDP Jobs on a scaling Cluster.

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.sahara import utils from rally.plugins.openstack.scenarios.sahara import utils
from rally.task.scenarios import base
from rally.task import types from rally.task import types
from rally.task import validation from rally.task import validation
@ -27,7 +27,7 @@ class SaharaNodeGroupTemplates(utils.SaharaScenario):
@validation.flavor_exists("flavor") @validation.flavor_exists("flavor")
@validation.required_services(consts.Service.SAHARA) @validation.required_services(consts.Service.SAHARA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["sahara"]}) @scenario.configure(context={"cleanup": ["sahara"]})
def create_and_list_node_group_templates(self, flavor, def create_and_list_node_group_templates(self, flavor,
plugin_name="vanilla", plugin_name="vanilla",
hadoop_version="1.2.1"): hadoop_version="1.2.1"):
@ -62,7 +62,7 @@ class SaharaNodeGroupTemplates(utils.SaharaScenario):
@validation.flavor_exists("flavor") @validation.flavor_exists("flavor")
@validation.required_services(consts.Service.SAHARA) @validation.required_services(consts.Service.SAHARA)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["sahara"]}) @scenario.configure(context={"cleanup": ["sahara"]})
def create_delete_node_group_templates(self, flavor, def create_delete_node_group_templates(self, flavor,
plugin_name="vanilla", plugin_name="vanilla",
hadoop_version="1.2.1"): hadoop_version="1.2.1"):

View File

@ -25,7 +25,7 @@ from rally import consts
from rally import exceptions from rally import exceptions
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.sahara import consts as sahara_consts 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 from rally.task import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -53,12 +53,12 @@ class SaharaScenario(scenario.OpenStackScenario):
RESOURCE_NAME_LENGTH = 20 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): def _list_node_group_templates(self):
"""Return user Node Group Templates list.""" """Return user Node Group Templates list."""
return self.clients("sahara").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, def _create_master_node_group_template(self, flavor_id, plugin_name,
hadoop_version): hadoop_version):
"""Create a master Node Group Template with a random name. """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] node_processes=sahara_consts.NODE_PROCESSES[plugin_name]
[hadoop_version]["master"]) [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, def _create_worker_node_group_template(self, flavor_id, plugin_name,
hadoop_version): hadoop_version):
"""Create a worker Node Group Template with a random name. """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] node_processes=sahara_consts.NODE_PROCESSES[plugin_name]
[hadoop_version]["worker"]) [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): def _delete_node_group_template(self, node_group):
"""Delete a Node Group Template by id. """Delete a Node Group Template by id.
@ -218,7 +218,7 @@ class SaharaScenario(scenario.OpenStackScenario):
} }
return replication_config 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, def _launch_cluster(self, plugin_name, hadoop_version, flavor_id,
image_id, workers_count, floating_ip_pool=None, image_id, workers_count, floating_ip_pool=None,
volumes_per_node=None, volumes_per_node=None,
@ -363,7 +363,7 @@ class SaharaScenario(scenario.OpenStackScenario):
self._wait_active(cluster) self._wait_active(cluster)
@base.atomic_action_timer("sahara.scale_up") @atomic.action_timer("sahara.scale_up")
def _scale_cluster_up(self, cluster, delta): def _scale_cluster_up(self, cluster, delta):
"""Add a given number of worker nodes to the cluster. """Add a given number of worker nodes to the cluster.
@ -373,7 +373,7 @@ class SaharaScenario(scenario.OpenStackScenario):
""" """
self._scale_cluster(cluster, delta) 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): def _scale_cluster_down(self, cluster, delta):
"""Remove a given number of worker nodes from the cluster. """Remove a given number of worker nodes from the cluster.
@ -383,7 +383,7 @@ class SaharaScenario(scenario.OpenStackScenario):
""" """
self._scale_cluster(cluster, delta) self._scale_cluster(cluster, delta)
@base.atomic_action_timer("sahara.delete_cluster") @atomic.action_timer("sahara.delete_cluster")
def _delete_cluster(self, cluster): def _delete_cluster(self, cluster):
"""Delete cluster. """Delete cluster.
@ -450,7 +450,7 @@ class SaharaScenario(scenario.OpenStackScenario):
:param job_idx: The index of a job in a sequence :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): def run(self):
job_execution = self.clients("sahara").job_executions.create( job_execution = self.clients("sahara").job_executions.create(
job_id=job_id, job_id=job_id,

View File

@ -16,8 +16,9 @@
import tempfile import tempfile
from rally import consts from rally import consts
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.swift import utils from rally.plugins.openstack.scenarios.swift import utils
from rally.task.scenarios import base from rally.task import atomic
from rally.task import validation from rally.task import validation
@ -26,7 +27,7 @@ class SwiftObjects(utils.SwiftScenario):
@validation.required_services(consts.Service.SWIFT) @validation.required_services(consts.Service.SWIFT)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["swift"]}) @scenario.configure(context={"cleanup": ["swift"]})
def create_container_and_object_then_list_objects( def create_container_and_object_then_list_objects(
self, objects_per_container=1, self, objects_per_container=1,
object_size=1024, **kwargs): object_size=1024, **kwargs):
@ -45,7 +46,7 @@ class SwiftObjects(utils.SwiftScenario):
# set dummy file to specified object size # set dummy file to specified object size
dummy_file.truncate(object_size) dummy_file.truncate(object_size)
container_name = self._create_container(**kwargs) 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): for i in range(objects_per_container):
dummy_file.seek(0) dummy_file.seek(0)
self._upload_object(container_name, dummy_file, self._upload_object(container_name, dummy_file,
@ -54,7 +55,7 @@ class SwiftObjects(utils.SwiftScenario):
@validation.required_services(consts.Service.SWIFT) @validation.required_services(consts.Service.SWIFT)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["swift"]}) @scenario.configure(context={"cleanup": ["swift"]})
def create_container_and_object_then_delete_all( def create_container_and_object_then_delete_all(
self, objects_per_container=1, self, objects_per_container=1,
object_size=1024, **kwargs): object_size=1024, **kwargs):
@ -74,7 +75,7 @@ class SwiftObjects(utils.SwiftScenario):
# set dummy file to specified object size # set dummy file to specified object size
dummy_file.truncate(object_size) dummy_file.truncate(object_size)
container_name = self._create_container(**kwargs) 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): for i in range(objects_per_container):
dummy_file.seek(0) dummy_file.seek(0)
object_name = self._upload_object(container_name, object_name = self._upload_object(container_name,
@ -82,7 +83,7 @@ class SwiftObjects(utils.SwiftScenario):
atomic_action=False)[1] atomic_action=False)[1]
objects_list.append(object_name) 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: for object_name in objects_list:
self._delete_object(container_name, object_name, self._delete_object(container_name, object_name,
atomic_action=False) atomic_action=False)
@ -90,7 +91,7 @@ class SwiftObjects(utils.SwiftScenario):
@validation.required_services(consts.Service.SWIFT) @validation.required_services(consts.Service.SWIFT)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["swift"]}) @scenario.configure(context={"cleanup": ["swift"]})
def create_container_and_object_then_download_object( def create_container_and_object_then_download_object(
self, objects_per_container=1, self, objects_per_container=1,
object_size=1024, **kwargs): object_size=1024, **kwargs):
@ -110,7 +111,7 @@ class SwiftObjects(utils.SwiftScenario):
# set dummy file to specified object size # set dummy file to specified object size
dummy_file.truncate(object_size) dummy_file.truncate(object_size)
container_name = self._create_container(**kwargs) 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): for i in range(objects_per_container):
dummy_file.seek(0) dummy_file.seek(0)
object_name = self._upload_object(container_name, object_name = self._upload_object(container_name,
@ -118,7 +119,7 @@ class SwiftObjects(utils.SwiftScenario):
atomic_action=False)[1] atomic_action=False)[1]
objects_list.append(object_name) 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: for object_name in objects_list:
self._download_object(container_name, object_name, self._download_object(container_name, object_name,
atomic_action=False) atomic_action=False)

View File

@ -14,13 +14,13 @@
# under the License. # under the License.
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
class SwiftScenario(scenario.OpenStackScenario): class SwiftScenario(scenario.OpenStackScenario):
"""Base class for Swift scenarios with basic atomic actions.""" """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): def _list_containers(self, full_listing=True, **kwargs):
"""Return list of containers. """Return list of containers.
@ -53,7 +53,7 @@ class SwiftScenario(scenario.OpenStackScenario):
prefix="rally_container_") prefix="rally_container_")
if atomic_action: 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) self.clients("swift").put_container(container_name, **kwargs)
else: else:
self.clients("swift").put_container(container_name, **kwargs) 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 :param kwargs: dict, other optional parameters to delete_container
""" """
if atomic_action: if atomic_action:
with base.AtomicAction(self, "swift.delete_container"): with atomic.ActionTimer(self, "swift.delete_container"):
self.clients("swift").delete_container(container_name, self.clients("swift").delete_container(container_name,
**kwargs) **kwargs)
else: else:
@ -88,7 +88,7 @@ class SwiftScenario(scenario.OpenStackScenario):
:returns: tuple, (dict of response headers, a list of objects) :returns: tuple, (dict of response headers, a list of objects)
""" """
if atomic_action: if atomic_action:
with base.AtomicAction(self, "swift.list_objects"): with atomic.ActionTimer(self, "swift.list_objects"):
return self.clients("swift").get_container( return self.clients("swift").get_container(
container_name, full_listing=full_listing, container_name, full_listing=full_listing,
**kwargs) **kwargs)
@ -114,7 +114,7 @@ class SwiftScenario(scenario.OpenStackScenario):
object_name = self._generate_random_name(prefix="rally_object_") object_name = self._generate_random_name(prefix="rally_object_")
if atomic_action: 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, return (self.clients("swift").put_object(container_name,
object_name, content, object_name, content,
**kwargs), **kwargs),
@ -138,7 +138,7 @@ class SwiftScenario(scenario.OpenStackScenario):
:returns: tuple, (dict of response headers, the object's contents) :returns: tuple, (dict of response headers, the object's contents)
""" """
if atomic_action: 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, return self.clients("swift").get_object(container_name,
object_name, **kwargs) object_name, **kwargs)
@ -156,7 +156,7 @@ class SwiftScenario(scenario.OpenStackScenario):
:param kwargs: dict, other optional parameters to delete_object :param kwargs: dict, other optional parameters to delete_object
""" """
if atomic_action: if atomic_action:
with base.AtomicAction(self, "swift.delete_object"): with atomic.ActionTimer(self, "swift.delete_object"):
self.clients("swift").delete_object(container_name, self.clients("swift").delete_object(container_name,
object_name, **kwargs) object_name, **kwargs)
else: else:

View File

@ -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.cinder import utils as cinder_utils
from rally.plugins.openstack.scenarios.nova import utils as nova_utils from rally.plugins.openstack.scenarios.nova import utils as nova_utils
from rally.plugins.openstack.wrappers import network as network_wrapper 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 utils
from rally.task import validation from rally.task import validation
@ -57,7 +57,7 @@ class VMScenario(nova_utils.NovaScenario, cinder_utils.CinderScenario):
RESOURCE_NAME_PREFIX = "rally_vm_" 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): def _run_command_over_ssh(self, ssh, command):
"""Run command inside an instance. """Run command inside an instance.
@ -127,7 +127,7 @@ class VMScenario(nova_utils.NovaScenario, cinder_utils.CinderScenario):
"id": fip.get("id"), "id": fip.get("id"),
"is_floating": use_floating_ip} "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): def _attach_floating_ip(self, server, floating_network):
internal_network = list(server.networks)[0] internal_network = list(server.networks)[0]
fixed_ip = server.addresses[internal_network][0]["addr"] fixed_ip = server.addresses[internal_network][0]["addr"]
@ -140,7 +140,7 @@ class VMScenario(nova_utils.NovaScenario, cinder_utils.CinderScenario):
return fip return fip
@base.atomic_action_timer("vm.delete_floating_ip") @atomic.action_timer("vm.delete_floating_ip")
def _delete_floating_ip(self, server, fip): def _delete_floating_ip(self, server, fip):
with logging.ExceptionLogger( with logging.ExceptionLogger(
LOG, _("Unable to delete IP: %s") % fip["ip"]): 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) self._delete_floating_ip(server, fip)
return self._delete_server(server, force=force_delete) 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): def _wait_for_ssh(self, ssh):
ssh.wait() ssh.wait()
@base.atomic_action_timer("vm.wait_for_ping") @atomic.action_timer("vm.wait_for_ping")
def _wait_for_ping(self, server_ip): def _wait_for_ping(self, server_ip):
server_ip = netaddr.IPAddress(server_ip) server_ip = netaddr.IPAddress(server_ip)
utils.wait_for( utils.wait_for(

View File

@ -18,8 +18,8 @@ import json
from rally.common import utils from rally.common import utils
from rally import consts from rally import consts
from rally import exceptions from rally import exceptions
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.vm import utils as vm_utils 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 types
from rally.task import validation from rally.task import validation
@ -42,8 +42,8 @@ class VMTasks(vm_utils.VMScenario):
@validation.external_network_exists("floating_network") @validation.external_network_exists("floating_network")
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER) @validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
@validation.required_openstack(users=True) @validation.required_openstack(users=True)
@base.scenario(context={"cleanup": ["nova", "cinder"], @scenario.configure(context={"cleanup": ["nova", "cinder"],
"keypair": {}, "allow_ssh": {}}) "keypair": {}, "allow_ssh": {}})
def boot_runcommand_delete(self, image, flavor, def boot_runcommand_delete(self, image, flavor,
username, username,
password=None, password=None,

View File

@ -14,8 +14,8 @@
import random import random
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.zaqar import utils as zutils from rally.plugins.openstack.scenarios.zaqar import utils as zutils
from rally.task.scenarios import base
from rally.task import validation from rally.task import validation
@ -23,7 +23,7 @@ class ZaqarBasic(zutils.ZaqarScenario):
"""Benchmark scenarios for Zaqar.""" """Benchmark scenarios for Zaqar."""
@validation.number("name_length", minval=10) @validation.number("name_length", minval=10)
@base.scenario(context={"cleanup": ["zaqar"]}) @scenario.configure(context={"cleanup": ["zaqar"]})
def create_queue(self, name_length=10, **kwargs): def create_queue(self, name_length=10, **kwargs):
"""Create a Zaqar queue with a random name. """Create a Zaqar queue with a random name.
@ -34,7 +34,7 @@ class ZaqarBasic(zutils.ZaqarScenario):
self._queue_create(name_length=name_length, **kwargs) self._queue_create(name_length=name_length, **kwargs)
@validation.number("name_length", minval=10) @validation.number("name_length", minval=10)
@base.scenario(context={"cleanup": ["zaqar"]}) @scenario.configure(context={"cleanup": ["zaqar"]})
def producer_consumer(self, name_length=10, def producer_consumer(self, name_length=10,
min_msg_count=50, max_msg_count=200, **kwargs): min_msg_count=50, max_msg_count=200, **kwargs):
"""Serial message producer/consumer. """Serial message producer/consumer.

View File

@ -13,13 +13,13 @@
# under the License. # under the License.
from rally.plugins.openstack import scenario from rally.plugins.openstack import scenario
from rally.task.scenarios import base from rally.task import atomic
class ZaqarScenario(scenario.OpenStackScenario): class ZaqarScenario(scenario.OpenStackScenario):
"""Base class for Zaqar scenarios with basic atomic actions.""" """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): def _queue_create(self, name_length=10, **kwargs):
"""Create a Zaqar queue with random name. """Create a Zaqar queue with random name.
@ -31,7 +31,7 @@ class ZaqarScenario(scenario.OpenStackScenario):
name = self._generate_random_name(length=name_length) name = self._generate_random_name(length=name_length)
return self.clients("zaqar").queue(name, **kwargs) 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): def _queue_delete(self, queue):
"""Removes a Zaqar queue. """Removes a Zaqar queue.
@ -48,11 +48,11 @@ class ZaqarScenario(scenario.OpenStackScenario):
:param min_msg_count: minimum number of messages :param min_msg_count: minimum number of messages
:param max_msg_count: maximum number of messages :param max_msg_count: maximum number of messages
""" """
with base.AtomicAction(self, "zaqar.post_between_%s_and_%s_messages" % with atomic.ActionTimer(self, "zaqar.post_between_%s_and_%s_messages" %
(min_msg_count, max_msg_count)): (min_msg_count, max_msg_count)):
queue.post(messages) queue.post(messages)
@base.atomic_action_timer("zaqar.list_messages") @atomic.action_timer("zaqar.list_messages")
def _messages_list(self, queue): def _messages_list(self, queue):
"""Gets messages from a given Zaqar queue. """Gets messages from a given Zaqar queue.

View File

@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # 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.""" """Sample fake plugin."""
@base.scenario() @scenario.configure()
def list(self): def list(self):
"""Fake scenario.""" """Fake scenario."""
pass pass

View File

@ -13,13 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # 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.""" """Sample fake plugin."""
@base.scenario() @scenario.configure()
def list(self): def list(self):
"""Fake scenario.""" """Fake scenario."""
pass pass

View File

@ -21,7 +21,7 @@ import traceback
import yaml import yaml
from rally.task.scenarios import base from rally.task import scenario
from rally.task import engine from rally.task import engine
from tests.unit import test from tests.unit import test
@ -35,7 +35,7 @@ class TaskSampleTestCase(test.TestCase):
@mock.patch("rally.task.engine.BenchmarkEngine" @mock.patch("rally.task.engine.BenchmarkEngine"
"._validate_config_semantic") "._validate_config_semantic")
def test_schema_is_valid(self, def test_schema_is_valid(self,
mock_benchmark_engine__validate_config_semantic): mock_benchmark_engine__validate_config_semantic):
scenarios = set() scenarios = set()
for dirname, dirnames, filenames in os.walk(self.samples_path): 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 # TODO(boris-42): We should refactor scenarios framework add "_" to
# all non-benchmark methods.. Then this test will pass. # 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 # check missing scenario is not from plugin
missing = [scenario for scenario in list(missing) if missing = [s for s in list(missing)
base.Scenario.get_by_name(scenario.split(".")[0]). if scenario.Scenario.get_by_name(s.split(".")[0]).
__module__.startswith("rally")] __module__.startswith("rally")]
self.assertEqual(missing, [], self.assertEqual(missing, [],
"These scenarios don't have samples: %s" % missing) "These scenarios don't have samples: %s" % missing)

View File

@ -31,7 +31,7 @@ from rally.common import objects
from rally.common import utils as rally_utils from rally.common import utils as rally_utils
from rally import consts from rally import consts
from rally.task import context from rally.task import context
from rally.task.scenarios import base from rally.task import scenario
def generate_uuid(): def generate_uuid():
@ -1464,7 +1464,7 @@ class FakeRunner(object):
} }
class FakeScenario(base.Scenario): class FakeScenario(scenario.Scenario):
def idle_time(self): def idle_time(self):
return 0 return 0

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
from rally.plugins.openstack.scenarios.authenticate import authenticate from rally.plugins.openstack.scenarios.authenticate import authenticate
from rally.task.scenarios import base from rally.task import atomic
from tests.unit import test from tests.unit import test
@ -25,40 +25,45 @@ AUTHENTICATE_MODULE = (
class AuthenticateTestCase(test.ScenarioTestCase): class AuthenticateTestCase(test.ScenarioTestCase):
def test_keystone(self): def test_keystone(self):
scenario = authenticate.Authenticate() scenario_inst = authenticate.Authenticate()
scenario.keystone() scenario_inst.keystone()
self.assertTrue(self.client_created("keystone")) self.assertTrue(self.client_created("keystone"))
def test_validate_glance(self): def test_validate_glance(self):
scenario = authenticate.Authenticate() scenario_inst = authenticate.Authenticate()
image_name = "__intentionally_non_existent_image___" image_name = "__intentionally_non_existent_image___"
with base.AtomicAction(scenario, "authenticate.validate_glance"): with atomic.ActionTimer(scenario_inst,
scenario.validate_glance(5) "authenticate.validate_glance"):
scenario_inst.validate_glance(5)
self.clients("glance").images.list.assert_called_with(name=image_name) self.clients("glance").images.list.assert_called_with(name=image_name)
self.assertEqual(self.clients("glance").images.list.call_count, 5) self.assertEqual(self.clients("glance").images.list.call_count, 5)
def test_validate_nova(self): def test_validate_nova(self):
scenario = authenticate.Authenticate() scenario_inst = authenticate.Authenticate()
with base.AtomicAction(scenario, "authenticate.validate_nova"): with atomic.ActionTimer(scenario_inst,
scenario.validate_nova(5) "authenticate.validate_nova"):
scenario_inst.validate_nova(5)
self.assertEqual(self.clients("nova").flavors.list.call_count, 5) self.assertEqual(self.clients("nova").flavors.list.call_count, 5)
def test_validate_cinder(self): def test_validate_cinder(self):
scenario = authenticate.Authenticate() scenario_inst = authenticate.Authenticate()
with base.AtomicAction(scenario, "authenticate.validate_cinder"): with atomic.ActionTimer(scenario_inst,
scenario.validate_cinder(5) "authenticate.validate_cinder"):
scenario_inst.validate_cinder(5)
self.assertEqual(self.clients("cinder").volume_types.list.call_count, self.assertEqual(self.clients("cinder").volume_types.list.call_count,
5) 5)
def test_validate_neutron(self): def test_validate_neutron(self):
scenario = authenticate.Authenticate() scenario_inst = authenticate.Authenticate()
with base.AtomicAction(scenario, "authenticate.validate_neutron"): with atomic.ActionTimer(scenario_inst,
scenario.validate_neutron(5) "authenticate.validate_neutron"):
scenario_inst.validate_neutron(5)
self.assertEqual(self.clients("neutron").list_networks.call_count, 5) self.assertEqual(self.clients("neutron").list_networks.call_count, 5)
def test_validate_heat(self): def test_validate_heat(self):
scenario = authenticate.Authenticate() scenario_inst = authenticate.Authenticate()
with base.AtomicAction(scenario, "authenticate.validate_heat"): with atomic.ActionTimer(scenario_inst,
scenario.validate_heat(5) "authenticate.validate_heat"):
scenario_inst.validate_heat(5)
self.clients("heat").stacks.list.assert_called_with(limit=0) self.clients("heat").stacks.list.assert_called_with(limit=0)
self.assertEqual(self.clients("heat").stacks.list.call_count, 5) self.assertEqual(self.clients("heat").stacks.list.call_count, 5)