如何使用openstack上的当前环境附加浮动IP

dub*_*bis 5 openstack-nova openstack-neutron

我是openstack热文件的新手.我做了搜索,但没有找到我的问题的相关答案.这里我的模板加热yaml文件:

heat_template_version: newton

description: Simple template to deploy a single compute instance with an attached volume

resources:   
   my_instance:
    type: OS::Nova::Server
    properties:
      name: instance-name
      flavor: std.cpu1ram1
      block_device_mapping_v2:
        - device_name: vda
          image: RHEL-7.4
          volume_size: 30
          delete_on_termination: true
      networks:
        - network: network-name.admin-network
      security_group: 
        - security_group: [security-name.group-sec-default]

  my_volume:
    type: OS::Cinder::Volume
    properties:
      size: 10

  my_attachment:
      type: OS::Cinder::VolumeAttachment
      properties:
        instance_uuid:  { get_resource: my_instance }
        volume_id: { get_resource: my_volume }
        mountpoint: /dev/vdb
Run Code Online (Sandbox Code Playgroud)

这个加热文件有效,但我不知道如何将浮动IP附加到"my_instance".我能够在Horizo​​n内部完成它并且它在没有PB的情况下工作.在Horizo​​n界面下,我选择"Router_dmz"作为创建并允许浮动IP的池.据我所知,浮动IP地址应与"network-name.admin-network"相关联.我读了很多文档,我不知道是否要使用操作系统:Neutron :: FloatingIPAssociation资源或OS :: Nova :: FloatingIPAssociation.我试过了,我没有问题.

dub*_*bis 3

我发现这对我有用:

heat_template_version: newton

description: Simple template to deploy a single compute instance 

resources:
  floating_ip:
    type: OS::Nova::FloatingIP
    properties:
      pool: string_of_pool_of_public_network

  my_instance:
    type: OS::Nova::Server
    properties:
      name: instance-name
      flavor: std.cpu1ram1
      block_device_mapping_v2:
        - device_name: vda
          image: RHEL-7.4
          volume_size: 30
          delete_on_termination: true
      networks:
        - network: network-name.admin-network
      security_group: 
        - security_group: [security-name.group-sec-default]

  association:
    type: OS::Nova::FloatingIPAssociation
    properties:
      floating_ip: { get_resource: floating_ip }
      server_id: { get_resource: my_instance }
Run Code Online (Sandbox Code Playgroud)

但这个解决方案已被弃用我对 Neutron 没有任何问题