Don't load nested stack to get ResourceGroup blacklist
In ResourceGroup, we (unwisely in retrospect) allow blacklisting of
resources by reference ID (i.e. physical resource ID in most cases). In
order to both determine whether a removal policy entry was an existing
resource name and (if not) to find the resource by physical ID, we would
always load the nested stack into memory.
To avoid this, unconditionally create an output in the nested stack that
returns a mapping of all the resource reference IDs and use it for finding
a resource with a matching reference ID. Only if the output is not
available (because the nested stack hasn't been updated since prior to the
output being defined), fall back to the old way of doing it.
Avoid looking up IDs for names that already appear in the blacklist
(because they were blacklisted in a previous update and have been removed
from the stack.)
Since this is more expensive in time (though hopefully cheaper in space),
update the blacklist only once on resource creation and whenever it
actually changes during an update. This is accomplished by moving the
update to a separate function that is called explicitly, rather than making
it a side-effect of getting the current blacklist (which occurs up to 4
times in each create/update).
Reviewed: https:/ /review. openstack. org/531931 /git.openstack. org/cgit/ openstack/ heat/commit/ ?id=32ec5141de1 a8017ccfddc5dcc f114deff8271ba
Committed: https:/
Submitter: Zuul
Branch: master
commit 32ec5141de1a801 7ccfddc5dccf114 deff8271ba
Author: Zane Bitter <email address hidden>
Date: Mon Jan 8 17:23:12 2018 -0500
Don't load nested stack to get ResourceGroup blacklist
In ResourceGroup, we (unwisely in retrospect) allow blacklisting of
resources by reference ID (i.e. physical resource ID in most cases). In
order to both determine whether a removal policy entry was an existing
resource name and (if not) to find the resource by physical ID, we would
always load the nested stack into memory.
To avoid this, unconditionally create an output in the nested stack that
returns a mapping of all the resource reference IDs and use it for finding
a resource with a matching reference ID. Only if the output is not
available (because the nested stack hasn't been updated since prior to the
output being defined), fall back to the old way of doing it.
Avoid looking up IDs for names that already appear in the blacklist
(because they were blacklisted in a previous update and have been removed
from the stack.)
Since this is more expensive in time (though hopefully cheaper in space),
update the blacklist only once on resource creation and whenever it
actually changes during an update. This is accomplished by moving the
update to a separate function that is called explicitly, rather than making
it a side-effect of getting the current blacklist (which occurs up to 4
times in each create/update).
Change-Id: Ic32d7d99bad06f 92b3d2919d58cd1 f9128bcfe83
Partial-Bug: #1731349