Merge "Modification of statistic_aggregation method"

This commit is contained in:
Jenkins 2017-08-01 08:12:33 +00:00 committed by Gerrit Code Review
commit bce87b3d05

View File

@ -24,6 +24,7 @@ from oslo_log import log
from watcher.common import clients from watcher.common import clients
from watcher.common import exception from watcher.common import exception
from watcher.common import utils as common_utils
CONF = cfg.CONF CONF = cfg.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -72,6 +73,17 @@ class GnocchiHelper(object):
raise exception.InvalidParameter(parameter='stop_time', raise exception.InvalidParameter(parameter='stop_time',
parameter_type=datetime) parameter_type=datetime)
if not common_utils.is_uuid_like(resource_id):
kwargs = dict(query={"=": {"original_resource_id": resource_id}},
limit=1)
resources = self.query_retry(
f=self.gnocchi.resource.search, **kwargs)
if not resources:
raise exception.ResourceNotFound(name=resource_id)
resource_id = resources[0]['id']
raw_kwargs = dict( raw_kwargs = dict(
metric=metric, metric=metric,
start=start_time, start=start_time,