Openstack HEAT-如何为实例添加动态数量的网络接口?

时间:2019-01-21 17:46:54

标签: networking interface openstack heat

我正在尝试为实例添加动态数量的网络接口。到目前为止,我有一个模板,该模板使用OS :: Neutron :: Port如下添加一个网络接口。

# Create a port on the external public network
extPort:
    type: OS::Neutron::Port
    properties:
        network: { get_param: extPublicNetwork }
        port_security_enabled: false

# Create a single signaling server
signalingServer:
    type: OS::Nova::Server
    depends_on: [ extPort ]
    properties:
        image: { get_param: image }
        flavor: { get_param: flavor }
        name:  { get_param: [ vmNames, get_param: index ] }

        networks:
            - port: { get_resource: extPort }

现在我有一个要求,根据通过环境文件的输入,我需要添加许多相同的网络接口。我已经尝试过:

            environment file:
            # Network name is ext-public
            networklist: ext-public,ext-public,ext-public

            Template file:              
            # Create a port on the external public network
            extPort:
                type: OS::Neutron::Port
                properties:
                    network: { get_param: extPublicNetwork }
                    port_security_enabled: false


            # Create a single signaling server
            signalingServer:
                type: OS::Nova::Server
                depends_on: [ extPort ]
                properties:
                    image: { get_param: image }
                    flavor: { get_param: flavor }

                    networks:
                        repeat:
                            for_each:
                                <%port%>: { get_param: networklist }      
                            template:
                                port: { get_resource: <%port%> }

此代码给出以下错误:

错误:验证失败:验证失败:resources [0]:指定的引用“ <%port%>”(在signalingServer.Properties.networks.repeat.template.port中)不正确

如何通过OS :: Neutron :: Port资源实现动态数量的接口?

谢谢, Subeesh

0 个答案:

没有答案