From: Steven Hardy Date: Thu, 15 Nov 2012 10:03:46 +0000 (+0000) Subject: heat workaround for HA/Autoscaling regression X-Git-Tag: 2014.1~1213 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ad1e45573ece5bb5ca5d6b2273d0d3ab8faba806;p=openstack-build%2Fheat-build.git heat workaround for HA/Autoscaling regression Interim workaround for HA/Autoscaling regression, caused by change of scope for stack_get_by_name to be per-tenant, meaning we need to do a brute-force lookup to find the stack entry when using the stored admin context. A better, more comprehensive (but more intrusive) fix is in-progress but this at least returns us to the same functionality we had before Note this means that all stacks using WatchRule still need to have names unique accross all tenants. bug 1078779 Change-Id: Iad1830d38262d1afb63cee16a3e366d9fd09acb4 Signed-off-by: Steven Hardy --- diff --git a/heat/engine/watchrule.py b/heat/engine/watchrule.py index 3a5854ad..69b86fa5 100644 --- a/heat/engine/watchrule.py +++ b/heat/engine/watchrule.py @@ -228,7 +228,24 @@ class WatchRule(object): new_state) actioned = True else: - s = db_api.stack_get_by_name(self.context, self.stack_name) + # FIXME : hack workaround for new stack_get_by_name tenant + # scoping, this is the simplest possible solution to the + # HA/Autoscaling regression described in bug/1078779 + # Further work in-progress here (shardy) as this + # breaks when stack_name is not unique accross tenants + sl = [x for x in + db_api.stack_get_all(self.context) + if x.name == self.stack_name] + s = None + if len(sl) == 1: + s = sl[0] + elif len(sl) > 1: + logger.error("stack %s name not unique, " % self.stack_name + + "cannot action watch rule") + else: + logger.error("stack %s name could not be found, " % + self.stack_name + "cannot action watch rule") + if s and s.status in (parser.Stack.CREATE_COMPLETE, parser.Stack.UPDATE_COMPLETE): user_creds = db_api.user_creds_get(s.user_creds_id)