summaryrefslogtreecommitdiff
path: root/heat/scaling
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2017-12-19 16:35:46 -0500
committerZane Bitter <zbitter@redhat.com>2018-01-19 15:40:37 -0500
commit42b386d8a69a60259e4803755810b945ef81b0d5 (patch)
tree293c48bf9ff0fd57090ae741bf8de689125a21a8 /heat/scaling
parent32ec5141de1a8017ccfddc5dccf114deff8271ba (diff)
downloadheat-42b386d8a69a60259e4803755810b945ef81b0d5.tar.gz
Eliminate nested stack loading in InstanceGroup/ASG scaling
Obtain the current group capacity, and the reference IDs for updating load balancers (if any) over RPC from a GroupInspector and the nested stack outputs. Fall back to grouputils (which loads the nested stack in memory) only if the output containing the reference IDs is not available. Change-Id: Ic6909e42edf709ba1cd99ba71f2d2f06570a615f Closes-Bug: #1731349
Diffstat (limited to 'heat/scaling')
-rw-r--r--heat/scaling/lbutils.py23
1 files changed, 7 insertions, 16 deletions
diff --git a/heat/scaling/lbutils.py b/heat/scaling/lbutils.py
index 1e04be617..f1c0696fb 100644
--- a/heat/scaling/lbutils.py
+++ b/heat/scaling/lbutils.py
@@ -13,38 +13,29 @@
import copy
-import six
-
from heat.common import exception
-from heat.common import grouputils
from heat.common.i18n import _
-from heat.engine import rsrc_defn
from heat.engine import scheduler
-def reload_loadbalancers(group, load_balancers, exclude=None):
+def reconfigure_loadbalancers(load_balancers, id_list):
"""Notify the LoadBalancer to reload its config.
This must be done after activation (instance in ACTIVE state), otherwise
the instances' IP addresses may not be available.
"""
- exclude = exclude or []
- id_list = grouputils.get_member_refids(group, exclude=exclude)
- for name, lb in six.iteritems(load_balancers):
- props = copy.copy(lb.properties.data)
+ for lb in load_balancers:
+ existing_defn = lb.frozen_definition()
+ props = copy.copy(existing_defn.properties(lb.properties_schema,
+ lb.context).data)
if 'Instances' in lb.properties_schema:
props['Instances'] = id_list
elif 'members' in lb.properties_schema:
props['members'] = id_list
else:
raise exception.Error(
- _("Unsupported resource '%s' in LoadBalancerNames") % name)
+ _("Unsupported resource '%s' in LoadBalancerNames") % lb.name)
- lb_defn = rsrc_defn.ResourceDefinition(
- lb.name,
- lb.type(),
- properties=props,
- metadata=lb.t.metadata(),
- deletion_policy=lb.t.deletion_policy())
+ lb_defn = existing_defn.freeze(properties=props)
scheduler.TaskRunner(lb.update, lb_defn)()