From 47f4987cb72dbfa3f78529309e80f1f82fbd4c46 Mon Sep 17 00:00:00 2001 From: astaroverov Date: Wed, 14 Sep 2016 18:04:48 +0300 Subject: [PATCH] Update of docstrings to support common-style scenarios Supports blueprint class-based-scenarios Contains update of docstrings for following scenarios: Dummy HttpRequests Ceilometer/Events Ceilometer/Queries Quotas Change-Id: I7e49203b858aa99a80e238f85c836651c6258e76 --- .../openstack/scenarios/ceilometer/events.py | 9 +++-- .../openstack/scenarios/ceilometer/queries.py | 6 ++-- .../openstack/scenarios/quotas/quotas.py | 36 +++++++++++++------ 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/rally/plugins/openstack/scenarios/ceilometer/events.py b/rally/plugins/openstack/scenarios/ceilometer/events.py index 13becca0..27c348c2 100644 --- a/rally/plugins/openstack/scenarios/ceilometer/events.py +++ b/rally/plugins/openstack/scenarios/ceilometer/events.py @@ -20,6 +20,9 @@ from rally.plugins.openstack.scenarios.keystone import utils as kutils from rally.task import validation +"""Scenarios for Ceilometer Events API.""" + + # NOTE(idegtiarov): to work with event we need to create it, there are # no other way except emit suitable notification from one of services, # for example create new user in keystone. @@ -32,7 +35,7 @@ from rally.task import validation name="CeilometerEvents.create_user_and_list_events") class CeilometerEventsCreateUserAndListEvents(cutils.CeilometerScenario, kutils.KeystoneScenario): - """Benchmark scenarios for Ceilometer Events API.""" + def run(self): """Create user and fetch all events. @@ -55,7 +58,7 @@ class CeilometerEventsCreateUserAndListEvents(cutils.CeilometerScenario, name="CeilometerEvents.create_user_and_list_event_types") class CeilometerEventsCreateUserAndListEventTypes(cutils.CeilometerScenario, kutils.KeystoneScenario): - """Benchmark scenarios for Ceilometer Events API.""" + def run(self): """Create user and fetch all event types. @@ -78,7 +81,7 @@ class CeilometerEventsCreateUserAndListEventTypes(cutils.CeilometerScenario, name="CeilometerEvents.create_user_and_get_event") class CeilometerEventsCreateUserAndGetEvent(cutils.CeilometerScenario, kutils.KeystoneScenario): - """Benchmark scenarios for Ceilometer Events API.""" + def run(self): """Create user and gets event. diff --git a/rally/plugins/openstack/scenarios/ceilometer/queries.py b/rally/plugins/openstack/scenarios/ceilometer/queries.py index 28ea566a..d58dca3f 100644 --- a/rally/plugins/openstack/scenarios/ceilometer/queries.py +++ b/rally/plugins/openstack/scenarios/ceilometer/queries.py @@ -20,12 +20,14 @@ from rally.plugins.openstack.scenarios.ceilometer import utils as ceiloutils from rally.task import validation +"""Scenarios for Ceilometer Queries API.""" + + @validation.required_services(consts.Service.CEILOMETER) @validation.required_openstack(users=True) @scenario.configure(context={"cleanup": ["ceilometer"]}, name="CeilometerQueries.create_and_query_alarms") class CeilometerQueriesCreateAndQueryAlarms(ceiloutils.CeilometerScenario): - """Benchmark scenarios for Ceilometer Queries API.""" def run(self, meter_name, threshold, filter=None, orderby=None, limit=None, **kwargs): @@ -54,7 +56,6 @@ class CeilometerQueriesCreateAndQueryAlarms(ceiloutils.CeilometerScenario): name="CeilometerQueries.create_and_query_alarm_history") class CeilometerQueriesCreateAndQueryAlarmHistory(ceiloutils .CeilometerScenario): - """Benchmark scenarios for Ceilometer Queries API.""" def run(self, meter_name, threshold, orderby=None, limit=None, **kwargs): """Create an alarm and then query for its history. @@ -79,7 +80,6 @@ class CeilometerQueriesCreateAndQueryAlarmHistory(ceiloutils @scenario.configure(context={"cleanup": ["ceilometer"]}, name="CeilometerQueries.create_and_query_samples") class CeilometerQueriesCreateAndQuerySamples(ceiloutils.CeilometerScenario): - """Benchmark scenarios for Ceilometer Queries API.""" def run(self, counter_name, counter_type, counter_unit, counter_volume, resource_id, filter=None, orderby=None, limit=None, **kwargs): diff --git a/rally/plugins/openstack/scenarios/quotas/quotas.py b/rally/plugins/openstack/scenarios/quotas/quotas.py index 6e698e6f..4c34d486 100644 --- a/rally/plugins/openstack/scenarios/quotas/quotas.py +++ b/rally/plugins/openstack/scenarios/quotas/quotas.py @@ -18,7 +18,7 @@ from rally.plugins.openstack import scenario from rally.plugins.openstack.scenarios.quotas import utils from rally.task import validation -"""Benchmark scenarios for quotas.""" +"""Scenarios for quotas.""" @validation.required_services(consts.Service.NOVA) @@ -26,10 +26,13 @@ from rally.task import validation @scenario.configure(context={"admin_cleanup": ["nova.quotas"]}, name="Quotas.nova_update") class NovaUpdate(utils.QuotasScenario): - """Update quotas for Nova.""" def run(self, max_quota=1024): - """:param max_quota: Max value to be updated for quota.""" + """Update quotas for Nova. + + :param max_quota: Max value to be updated for quota. + """ + self._update_quotas("nova", self.context["tenant"]["id"], max_quota) @@ -39,10 +42,12 @@ class NovaUpdate(utils.QuotasScenario): @scenario.configure(context={"admin_cleanup": ["nova.quotas"]}, name="Quotas.nova_update_and_delete") class NovaUpdateAndDelete(utils.QuotasScenario): - """Update and delete quotas for Nova.""" def run(self, max_quota=1024): - """:param max_quota: Max value to be updated for quota.""" + """Update and delete quotas for Nova. + + :param max_quota: Max value to be updated for quota. + """ self._update_quotas("nova", self.context["tenant"]["id"], max_quota) @@ -54,10 +59,13 @@ class NovaUpdateAndDelete(utils.QuotasScenario): @scenario.configure(context={"admin_cleanup": ["cinder.quotas"]}, name="Quotas.cinder_update") class CinderUpdate(utils.QuotasScenario): - """Update quotas for Cinder.""" def run(self, max_quota=1024): - """:param max_quota: Max value to be updated for quota.""" + """Update quotas for Cinder. + + :param max_quota: Max value to be updated for quota. + """ + self._update_quotas("cinder", self.context["tenant"]["id"], max_quota) @@ -67,10 +75,13 @@ class CinderUpdate(utils.QuotasScenario): @scenario.configure(context={"admin_cleanup": ["cinder.quotas"]}, name="Quotas.cinder_update_and_delete") class CinderUpdateAndDelete(utils.QuotasScenario): - """Update and Delete quotas for Cinder.""" def run(self, max_quota=1024): - """:param max_quota: Max value to be updated for quota.""" + """Update and Delete quotas for Cinder. + + :param max_quota: Max value to be updated for quota. + """ + self._update_quotas("cinder", self.context["tenant"]["id"], max_quota) self._delete_quotas("cinder", self.context["tenant"]["id"]) @@ -81,10 +92,13 @@ class CinderUpdateAndDelete(utils.QuotasScenario): @scenario.configure(context={"admin_cleanup": ["neutron.quota"]}, name="Quotas.neutron_update") class NeutronUpdate(utils.QuotasScenario): - """Update quotas for neutron.""" def run(self, max_quota=1024): - """:param max_quota: Max value to be updated for quota.""" + """Update quotas for neutron. + + :param max_quota: Max value to be updated for quota. + """ + quota_update_fn = self.admin_clients("neutron").update_quota self._update_quotas("neutron", self.context["tenant"]["id"], max_quota, quota_update_fn) \ No newline at end of file