Modification of statistic_aggregation method

In this patch feching resource_id by resource's original_id was added to
statistic_aggregation method.

Closes-Bug: #1707653 
Change-Id: I70b9346146f810e2236ccdb31de4c3fedf200568
This commit is contained in:
mergalievibragim 2017-07-18 22:06:49 +03:00 committed by Alexander Chadin
parent 728acc091b
commit 4f38595e4e

View File

@ -24,6 +24,7 @@ from oslo_log import log
from watcher.common import clients
from watcher.common import exception
from watcher.common import utils as common_utils
CONF = cfg.CONF
LOG = log.getLogger(__name__)
@ -72,6 +73,17 @@ class GnocchiHelper(object):
raise exception.InvalidParameter(parameter='stop_time',
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(
metric=metric,
start=start_time,