diff -Nru aodh-5.1.0/debian/changelog aodh-5.1.0/debian/changelog --- aodh-5.1.0/debian/changelog 2018-03-23 05:54:23.000000000 +0900 +++ aodh-5.1.0/debian/changelog 2018-07-19 14:42:37.000000000 +0900 @@ -1,3 +1,10 @@ +aodh (5.1.0-0ubuntu1~cloud1) xenial-pike; urgency=medium + + * d/p/0001-Support-same-projects-in-different-domain.patch + - Support same projects in different domain (LP: #1776375) + + -- Seyeong Kim Thu, 19 Jul 2018 14:38:53 +0900 + aodh (5.1.0-0ubuntu1~cloud0) xenial-pike; urgency=medium * New upstream release for the Ubuntu Cloud Archive. diff -Nru aodh-5.1.0/debian/patches/0001-Support-same-projects-in-different-domain.patch aodh-5.1.0/debian/patches/0001-Support-same-projects-in-different-domain.patch --- aodh-5.1.0/debian/patches/0001-Support-same-projects-in-different-domain.patch 1970-01-01 09:00:00.000000000 +0900 +++ aodh-5.1.0/debian/patches/0001-Support-same-projects-in-different-domain.patch 2018-07-19 14:42:07.000000000 +0900 @@ -0,0 +1,88 @@ +From 59e31c466738bdb6de9c47a6fe932049c73a8dd1 Mon Sep 17 00:00:00 2001 +From: Seyeong Kim +Date: Fri, 15 Jun 2018 13:50:09 +0900 +Subject: [PATCH] Support same projects in different domain + +Getting 500 error when there are same project name +in different domain. +Selecting one domain from service_credentials. +e.g. services(or service) projects are in default and service_domain +having differrent id. so this selects default's services project +instead of service_domain's services project + +This is backported from e923493e4feec239c9fe9b58736960a40e373bee + +Change-Id: I3f12811684a49794bca87c4a10b18d45879da773 +Closes-Bug: #1776375 +--- + aodh/api/controllers/v2/alarm_rules/gnocchi.py | 17 ++++++++++++++++- + aodh/tests/functional/api/v2/test_alarm_scenarios.py | 3 +++ + 2 files changed, 19 insertions(+), 1 deletion(-) + +Bug: upstream, https://github.com/openstack/aodh/commit/e923493e4feec239c9fe9b58736960a40e373bee +Bug-Ubuntu: https://bugs.launchpad.net/aodh/+bug/1776375 +Index: aodh-5.1.0/aodh/api/controllers/v2/alarm_rules/gnocchi.py +=================================================================== +--- aodh-5.1.0.orig/aodh/api/controllers/v2/alarm_rules/gnocchi.py ++++ aodh-5.1.0/aodh/api/controllers/v2/alarm_rules/gnocchi.py +@@ -20,6 +20,7 @@ from gnocchiclient import client + from gnocchiclient import exceptions + from keystoneauth1 import exceptions as ka_exceptions + from oslo_config import cfg ++from oslo_log import log + from oslo_serialization import jsonutils + import pecan + import wsme +@@ -29,12 +30,17 @@ from aodh.api.controllers.v2 import base + from aodh.api.controllers.v2 import utils as v2_utils + from aodh import keystone_client + ++LOG = log.getLogger(__name__) + + GNOCCHI_OPTS = [ + cfg.StrOpt('gnocchi_external_project_owner', + default="service", + help='Project name of resources creator in Gnocchi. ' + '(For example the Ceilometer project name'), ++ cfg.StrOpt('gnocchi_external_domain_name', ++ default="Default", ++ help='Domain name of resources creator in Gnocchi. ' ++ '(For example, default or service_domain'), + ] + + +@@ -140,10 +146,19 @@ class AggregationMetricByResourcesLookup + def get_external_project_owner(): + kc = keystone_client.get_client(pecan.request.cfg) + project_name = pecan.request.cfg.api.gnocchi_external_project_owner ++ domain_name = pecan.request.cfg.api.gnocchi_external_domain_name + try: +- project = kc.projects.find(name=project_name) ++ domains = kc.domains.list(name=domain_name) ++ project = kc.projects.find( ++ name=project_name, ++ domain_id=domains[0].id) + return project.id + except ka_exceptions.NotFound: ++ LOG.warning("Unable to get domain or project information. " ++ "domain_name : %(domain_name)s, " ++ "project_name : %(project_name)s", ++ {'domain_name': domain_name, ++ 'project_name': project_name}) + return None + + @classmethod +Index: aodh-5.1.0/aodh/tests/functional/api/v2/test_alarm_scenarios.py +=================================================================== +--- aodh-5.1.0.orig/aodh/tests/functional/api/v2/test_alarm_scenarios.py ++++ aodh-5.1.0/aodh/tests/functional/api/v2/test_alarm_scenarios.py +@@ -2707,6 +2707,9 @@ class TestAlarmsRuleGnocchi(TestAlarmsBa + ]} + + ks_client = mock.Mock() ++ ks_client.domains.list.return_value = [mock.Mock( ++ id='', ++ name='Default')] + ks_client.projects.find.return_value = mock.Mock(id='') + get_client.return_value = ks_client + diff -Nru aodh-5.1.0/debian/patches/series aodh-5.1.0/debian/patches/series --- aodh-5.1.0/debian/patches/series 2018-03-22 21:40:55.000000000 +0900 +++ aodh-5.1.0/debian/patches/series 2018-07-19 14:38:44.000000000 +0900 @@ -1 +1,2 @@ drop-openstackdoctheme.patch +0001-Support-same-projects-in-different-domain.patch