Merge "Fix ceilometer bug with required contexts"

This commit is contained in:
Jenkins 2016-06-03 17:31:23 +00:00 committed by Gerrit Code Review
commit a1fb05e927
5 changed files with 15 additions and 12 deletions

View File

@ -22,6 +22,7 @@ class CeilometerMeters(ceiloutils.CeilometerScenario):
"""Benchmark scenarios for Ceilometer Meters API."""
@validation.required_services(consts.Service.CEILOMETER)
@validation.required_contexts("ceilometer")
@validation.required_openstack(users=True)
@scenario.configure()
def list_meters(self, metadata_query=None, limit=None):
@ -40,6 +41,7 @@ class CeilometerMeters(ceiloutils.CeilometerScenario):
self.list_matched_meters(limit=limit)
@validation.required_services(consts.Service.CEILOMETER)
@validation.required_contexts("ceilometer")
@validation.required_openstack(users=True)
@scenario.configure()
def list_matched_meters(self, filter_by_user_id=False,

View File

@ -23,6 +23,7 @@ class CeilometerResource(ceiloutils.CeilometerScenario):
"""Benchmark scenarios for Ceilometer Resource API."""
@validation.required_services(consts.Service.CEILOMETER)
@validation.required_contexts("ceilometer")
@validation.required_openstack(users=True)
@scenario.configure()
def list_resources(self, metadata_query=None,
@ -71,6 +72,7 @@ class CeilometerResource(ceiloutils.CeilometerScenario):
self._get_resource(res_id)
@validation.required_services(consts.Service.CEILOMETER)
@validation.required_contexts("ceilometer")
@validation.required_openstack(users=True)
@scenario.configure()
def list_matched_resources(self, filter_by_user_id=False,

View File

@ -22,6 +22,7 @@ class CeilometerSamples(ceiloutils.CeilometerScenario):
"""Benchmark scenarios for Ceilometer Samples API."""
@validation.required_services(consts.Service.CEILOMETER)
@validation.required_contexts("ceilometer")
@validation.required_openstack(users=True)
@scenario.configure()
def list_matched_samples(self, filter_by_resource_id=False,
@ -43,6 +44,7 @@ class CeilometerSamples(ceiloutils.CeilometerScenario):
self._list_samples(query, limit)
@validation.required_services(consts.Service.CEILOMETER)
@validation.required_contexts("ceilometer")
@validation.required_openstack(users=True)
@scenario.configure()
def list_samples(self, metadata_query=None, limit=None):

View File

@ -39,6 +39,7 @@ class CeilometerStats(utils.CeilometerScenario):
self._get_stats(meter.counter_name)
@validation.required_services(consts.Service.CEILOMETER)
@validation.required_contexts("ceilometer")
@validation.required_openstack(users=True)
@scenario.configure()
def get_stats(self, meter_name, filter_by_user_id=False,

View File

@ -112,18 +112,14 @@ class CeilometerScenario(scenario.OpenStackScenario):
metadata_query = metadata_query or {}
if filter_by_user_id:
user_id = self.context["user"]["id"]
query.append(self._make_query_item("user_id", "eq", user_id))
if filter_by_project_id or filter_by_resource_id:
project_id = self.context["tenant"]["id"]
if filter_by_project_id:
query.append(self._make_query_item("project_id", "eq",
project_id))
if filter_by_resource_id:
resource_id = self.context["tenant"]["resources"][0]
query.append(self._make_query_item("resource_id", "eq",
resource_id))
query.append(self._make_query_item("user_id", "eq",
self.context["user"]["id"]))
if filter_by_project_id:
query.append(self._make_query_item(
"project_id", "eq", self.context["tenant"]["id"]))
if filter_by_resource_id:
query.append(self._make_query_item(
"resource_id", "eq", self.context["tenant"]["resources"][0]))
for key, value in metadata_query.items():
query.append(self._make_query_item("metadata.%s" % key,