[openstack-dev] [heat] Stack adopt after handle_create

Steven Hardy shardy at redhat.com
Fri Jul 18 09:20:56 UTC 2014


On Fri, Jul 18, 2014 at 09:02:33AM +0000, Dimitri Mazmanov wrote:
> Hi,
> I¹m working on the following use-case:
> I have a stack template containing a custom resource - my_res - that upon
> handle_create invokes creation of another set of resources [r1, r2, r3,
> ...] (not expressed in the template). These newly created resources are
> not associated with the stack. The goal is to include them into the
> existing stack.
> 
> My idea was to perform stack adopt on r1, r2, r3, etc inside handle_create
> of my_res.
> 
> handle_create 
>   create my_res
>   find r1, r2, ...
>   for each r in [r1, r2, Š]
>      my_res.stack.adopt r
> 
> Is this ok or a terrible, terrible idea?

Pretty much sounds like a terrible idea to me ;)

More information is needed to fully understand what you're trying to do,
but IMO having a hidden nested stack created like this is highly likely to
end up in a buggy mess, and having heat create resources not defined in any
template is basically always the wrong thing to do.

If you want to create a stack which contains some existing resources, I'd
do something like create a stack containing everything except r1/r2/r3,
then abandon it, modify the abandon data to add the existing resources you
want to adopt, then adopt the stack using the modified data.

Of course it's much better to just create everything via a heat template,
but if you have to adopt these existing resources, that may be one way to
do it.  More information on the specifics of what you're trying to achieve
would help us advise more :)

Steve



More information about the OpenStack-dev mailing list