【问题标题】:How is the OpenStack nested template implemented via Openstack APIOpenStack 嵌套模板是如何通过 Openstack API 实现的
【发布时间】:2017-02-14 05:21:51
【问题描述】:

我们想使用 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}

在“类型”字段中,包含另一个模板。但是如何通过 API 使用呢?

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

【问题讨论】:

    标签: templates nested openstack-heat


    【解决方案1】:

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

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

    关于 ResourceGroup 的使用,http://hardysteven.blogspot.com/2014/09/using-heat-resourcegroup-resources.html 有一篇很好的帖子

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多