[openstack-dev] [heat] Stack adopt after handle_create
Dimitri Mazmanov
dimitri.mazmanov at ericsson.com
Fri Jul 18 10:02:06 UTC 2014
On 18/07/14 11:20, "Steven Hardy" <shardy at redhat.com> wrote:
>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 ;)
Doh :)
>
>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.
I should have clarified this part. Heat creates only the custom resource
(my_res). The r1/r2/r3 set is created as a consequence, not by Heat. So
Heat has no idea what’s happening in the background.
Why would it end up in a buggy mess? Heat creates a stack and then calls
stack adopt on a few resources. If not this, what is the proper usage of
stack adopt operation then?
>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.
The goal is to keep the create and adopt operations in a single call to
make the flow look like normal stack deployment (the user clicks Deploy)
without having to perform heat calls manually.
>
>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 :)
I have a custom neutron port. When neutron creates this port it also
creates several networks associated with this port. As the result the
created networks theoretically belong to the created stack, but in reality
are not related to it until the stack adopts them.
-
Dimitri
>
>Steve
>
>_______________________________________________
>OpenStack-dev mailing list
>OpenStack-dev at lists.openstack.org
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
More information about the OpenStack-dev
mailing list