0

我正在使用带有 Juno 版本的 Openstack Heat,但我遇到了问题。

我想使用 AutoScalingGroup 将在特定子网中自动创建一些实例。我的网络拓扑是一个具有许多子网的网络(每一层都在自己的子网上)。

但这在 Juno 版本中似乎是不可能的,因为我们无法在 OS::Nova::Server / 网络中指定子网参数。文档在这里:http : //docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Nova::Server-prop-networks- *-subnet

我想知道是否有人在 Juno 中有解决此限制的方法。

创建独立服务器时,可以指定 OS::Neutron::Port 并引用子网。但我找不到如何使用 AutoScaling 做到这一点。

提前谢谢了,

杰米

编辑:当前堆栈。它仅适用于一台服务器,因为端口是在 OS:Heat::AutoScalingGroup 之外创建的

resources:
  instance_port:
   type: OS::Neutron::Port
   properties:
     name: { get_param : portName }
     network_id: { get_param: networkId }
     fixed_ips:
       - subnet_id: { get_param: subnetId }
     security_groups: { get_param: securityGroups }

  asg_group:
    depends_on: [ instance_port ]
    type: OS::Heat::AutoScalingGroup
    properties:
      ...
      resource:
        type: OS::Nova::Server
        properties:
          name: { get_param: asgName }
          ....
          networks:
            # TODO assign direct IP to the right subnet by decommenting this line. Will be available in Liberty
            #- subnet: { get_param: subnetId }  /!\ doesn't work in Juno
            - port: { get_resource : instance-port }  /!\ Works only with one server
4

1 回答 1

0

一种解决方案是使用具有此处描述的功能的嵌套堆栈:http: //docs.openstack.org/developer/heat/template_guide/composition.html#define-a-new-resource-type

您有一个带有端口和服务器的嵌套堆栈,并将此堆栈引用到主堆栈中。示例:主堆栈

resources:

  asg_group:
    type: OS::Heat::AutoScalingGroup
    properties:
      min_size: { get_param: min }
      desired_capacity: { get_param: desired }
      max_size: { get_param: max }
      rolling_updates: {"max_batch_size": 1, "min_in_service": 2, "pause_time": 60}
      resource:
        type: "lib::AsgInstance"
        properties:
          appli: { get_param: appli }

嵌套堆栈:

resources:
  instance-port:
   type: OS::Neutron::Port
   properties:
     name: { get_param : portName }
     network_id: { get_param: networkId }
     fixed_ips:
       - subnet_id: { get_param: subnetId }
     security_groups: { get_param: securityGroups }

  instance:
    type: OS::Nova::Server
    properties:
      name: { get_param: instanceName }
      key_name: { get_param: keyName }
      image: { get_param: imageName }
      flavor: { get_param: flavorName }
      networks:
        # TODO assign direct IP to the right subnet by decommenting this line. Will be available in Liberty
        #- subnet: { get_param: subnetId }
        - port: { get_resource : instance-port }

和环境文件:

resource_registry:
  "lib::AsgInstance": lib/nestedstack.yaml
于 2016-02-16T10:57:03.347 回答