OpenStack嵌套模板是如何通过Openstack实现的API

How is the OpenStack nested template implemented via Openstack API

我们想使用 OpenStack API 来启动堆栈。 但是模板文件会嵌套另一个模板文件。 有什么办法可以实现吗?

主模板文件中有问题的部分如下:

  node_vlan_group:
    type: OS::Heat::ResourceGroup
    depends_on: [node_sp_net]
    properties:
      count: {get_param: node_vlan_count}
      resource_def:
        type: node_vlan_template.yaml
        properties:
          vlan_index: '%index%'
          vlan_names: {get_param: node_vlan_names}
          vlan_cidrs4: {get_param: node_cidrs_ipv4}
          vlan_gateways4: {get_param: node_gateways_ipv4}

在 "type" 字段中,包含另一个模板。但是如何通过API使用它?

(当在 heat 客户端上使用 CLI 命令时,我可以将此模板和内联 node_vlan_template.yaml 放在同一个文件夹中,它可以工作。 但是通过 API,我需要一种方法来提供此 node_vlan_template.yaml 的内容。 )

已通过将嵌套文件内容添加到 POST 正文中以创建堆栈来解决此问题。它看起来像文件:{"node_vlan_template.yaml": "content of node_vlan_template.yaml"}

另一件需要注意的事情是内容应该是从文件中转储的字符串,而不是 python 字典对象。

关于ResourceGroup的使用,在http://hardysteven.blogspot.com/2014/09/using-heat-resourcegroup-resources.html

上面有很好的post