[openstack-dev] [heat] issue of ResourceGroup in Heat template

Duan, Li-Gong (Gary, HPServers-Core-OE-PSC) li-gong.duan at hpe.com
Mon Mar 14 10:04:37 UTC 2016


Hi Sergey,

Thanks a lot. 
What I am using is Liberty release of Heat in a devstack environment.

I'll provide my trace log later.

Regards,
Gary

-----Original Message-----
From: Sergey Kraynev [mailto:skraynev at mirantis.com] 
Sent: Friday, March 11, 2016 10:23 PM
To: OpenStack Development Mailing List (not for usage questions) <openstack-dev at lists.openstack.org>
Subject: Re: [openstack-dev] [heat] issue of ResourceGroup in Heat template

Hi Gary,

I have tried your template and it works for me correctly. Note, that I used private network (because my servers have not any public IP in template).

So your issue looks like a strange bug, because I can not reproduce it.
Could you share traceback if your error and also provide information about Heat version. Please create new bug with all this data and ping us to review it.

On 11 March 2016 at 08:25, Duan, Li-Gong (Gary, HPServers-Core-OE-PSC) <li-gong.duan at hpe.com> wrote:
> Hi Sergey,
>
> Thanks for your reply.
>
> Thanks for your pointing out that "depends_on" is not needed when we have already used "get_attr".

So as Zane pointed, when we use get_attr it's expected, that we start create rg_b, when rg_a will be finally completed/created , because all information (in your case it's attributes) will be available after creation of rg_a.

In heat we have two types of dependencies explicit and implicit. So implicit dependencies will be created with using some Heat intrinsic functions. Depends_on add explicit dependency. All these dependencies work in the same way, depended resource will be created, when all his dependencies be resolved (created).

>
>>you create in rg_a some Server and probably it goes to active state 
>>before ip address becomes available for get_attr. It is necessary to 
>>check, but if it's try to add wait condition for this resource, then 
>>you will get created rg_a with fully available resources and I suppose 
>>IP will be available
>
> Do you mean that with "depends_on" functionalities, Heat will launch another resource group(in my case, "rg_b") as soon as the server in "rg_a" becomes "active" state?
> Actually, in my real program code, there is  a wait condition, but it is located in the server template, not Resource group(in my case, it is "b.yaml), which is like:
> ------------------
> rg_a_wc_notify:
>     type: OS::Heat::SoftwareConfig
>     properties:
>       group: ungrouped
>       config:
>         str_replace:
>           template: |
>             #!/bin/bash -v
>             wc_notify --data-binary '{"status": "SUCCESS"}'
>           params:
>             wc_notify: {get_attr: [master_wait_handle, curl_cli]}
> ------------------
> Is it the wait condition which you mentioned in " but if it's try to add wait condition for this resource"? or you want this wait condition to be added to "a.yaml"(the template declaring resource group)?
>
> And as per my observation, only after Heat receives the signal of "SUCCESS", then it try to begin launch "rg_b"(my another server in another resource group).
>
> I am wondering whether there is a chance that, the "IP" information is available but Heat doesn't try to get it until the creation of the 2 resource groups(rg_a and rg_b) is completed?



>
> Regards,
> Gary
>
> -----Original Message-----
> From: Sergey Kraynev [mailto:skraynev at mirantis.com]
> Sent: Wednesday, March 09, 2016 6:42 PM
> To: OpenStack Development Mailing List (not for usage questions)
> Subject: Re: [openstack-dev] [heat] issue of ResourceGroup in Heat 
> template
>
> Hi Gary,
>
>
> First of all you don't need to use "depends_on", because using "get_attr" already create implicit dependency from rg_a.
> About getting Null instead of real Ip address:
> It sounds like a bug, but IMO, it's expected behavior, because I suppose it happens due to:
>  - you create in rg_a some Server and probably it goes to active state before ip address becomes available for get_attr. It is necessary to check, but if it's try to add wait condition for this resource, then you will get created rg_a with fully available resources and I suppose IP will be available.
>
> On 9 March 2016 at 13:14, Duan, Li-Gong (Gary, HPServers-Core-OE-PSC) <li-gong.duan at hpe.com> wrote:
>> Hi,
>>
>>
>>
>> I have 3 Heat templates using ResourceGroup. There are 2 resource 
>> groups(rg_a and rg_b) and rg_b depends on rg_a.  and rg_b requires 
>> the IP address of rg_a as the paremeter of rg_b. I use “rg_a_public_ip: {get_attr:
>> [rg_a, rg_a_public_ip]}” to get the IP address of rg_a both in the 
>> section of rg_b parameters (rg_b/properties/resource_def/properties)
>> and the section of outputs.
>>
>> As per my observation,  rg_a_public_ip shows “null” in the parameter 
>> section of rg_b. while rg_a_public_ip shows the correct IP address in 
>> the outputs section of the yaml file.
>>
>>
>>
>> My questions are:
>>
>> 1)      Does this behavior is expected as designed or this is a bug?
>>
>> 2)      What is the alternative solution for the above case(user want to get
>> the run-time information of the instance when creating the second 
>> resource
>> group)  if this behavior is expected?
>>
>>
>>
>> ------- a.yaml -------------------
>>
>> resources:
>>
>> rg_a:
>>
>>   type: OS::Heat::ResourceGroup
>>
>>   properties:
>>
>>       count: 1
>>
>>       resource_def:
>>
>>           type: b.yaml
>>
>>           properties:
>>
>>>>
>>
>>
>> rg_b:
>>
>> type: OS::Heat::ResourceGroup
>>
>> depends_on:
>>
>>         -rg_a
>>
>> properties:
>>
>>     count: 2
>>
>>     resource_def:
>>
>>         type: c.yaml
>>
>>         properties:
>>
>>             rg_a_public_ip: {get_attr: [rg_a, rg_a_public_ip]}
>> --------------------  the value is “null”
>>
>>>>
>>
>>
>> outputs:
>>
>>    rg_a_public_ip: {get_attr: [rg_a, rg_a_public_ip]}
>> ---------------------  the value is correct.
>>
>> --------------------------
>>
>>
>>
>> ------b.yaml  --------------------
>>
>>>>
>> resources:
>>
>>     rg_a:
>>
>> type: OS::Nova::Server
>>
>> properties:
>>
>>>>
>> outputs:
>>
>>      rg_a_public_ip:
>>
>>          value: {get_attr: [rg_a, networks, public, 0]}
>>
>> --------------------------
>>
>>
>>
>> ---------- c.yaml --------------------
>>
>> parameters:
>>
>> rg_a_public_ip:
>>
>>      type: string
>>
>>      description: IP of rg_a
>>
>>>>
>> resources:
>>
>> rg_b:
>>
>>     type: OS::Nova::Server
>>
>>     properties:
>>
>>>>
>>     outputs:
>>
>>>>
>> ---------------------------------------
>>
>>
>>
>> Regards,
>>
>> Gary
>>
>>
>>
>>
>> _____________________________________________________________________
>> _ ____ OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe:
>> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>
>
>
> --
> Regards,
> Sergey.
>
> ______________________________________________________________________
> ____ OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: 
> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> ______________________________________________________________________
> ____ OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: 
> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



--
Regards,
Sergey.

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


More information about the OpenStack-dev mailing list