The resource sequence in raw_template table of heat DB is not consistent with the template file input while creating stack

Asked by Yingzhe Zeng

Create a stack by a template file as follow:

heat_template_version: 2013-05-23
description: create cinder volume
resources:
    myres1:
        type: OS::Cinder::Volume
        properties:
            name: vol1
            size: 1
    myres2:
        type: OS::Cinder::Volume
        properties:
            name: vol2
            size: 1
    myres3:
        type: OS::Cinder::Volume
        properties:
            name: vol3
            size: 1
    myres4:
        type: OS::Cinder::Volume
        properties:
            name: vol4
            size: 1

After creation complete, the template field of raw_template table is:

{"heat_template_version": "2013-05-23", "description": "create cinder volume", "resources": {"myres2": {"type": "OS::Cinder::Volume", "properties": {"name": "vol2", "size": 1}}, "myres3": {"type": "OS::Cinder::Volume", "properties": {"name": "vol3", "size": 1}}, "myres1": {"type": "OS::Cinder::Volume", "properties": {"name": "vol1", "size": 1}}, "myres4": {"type": "OS::Cinder::Volume", "properties": {"name": "vol4", "size": 1}}}}

Apparently the resource sequence is different from the input template file.
The resource sequence in template file is myres1->myres2->myres3->myres4,
but in DB the sequence is changed to myres2->myres3->myres1->myres4.

I found out that the resource sequence of parsed template at heatclient is already changed before sending request to heat service,
and the template file content is parsed by yaml_loader.
Why yaml_loader doesn't parse the template file as it configured?
Is this a bug of yaml analyzer or it's just implemented like this?

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu heat Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Yingzhe Zeng (zengyingzhe) said :
#1

Seems this's about dict.
yaml parses a template, and convert it to a dict.
But python doesn't guarantee the order of members of dict while iterating.
Perhaps this's the reason.

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.