Files
heat/heat/scaling/lbutils.py
T
Zane Bitter 42b386d8a6 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
2018-01-19 15:40:37 -05:00

42 lines
1.5 KiB
Python

#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
from heat.common import exception
from heat.common.i18n import _
from heat.engine import scheduler
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.
"""
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") % lb.name)
lb_defn = existing_defn.freeze(properties=props)
scheduler.TaskRunner(lb.update, lb_defn)()