在openstack中创建多个服务器并附加卷

在openstack中创建多个服务器并附加卷

我需要在 openstack mitaka 中使用 Heat 模板部署多台服务器,并且该服务器应该有新创建的 cinder 卷,并且它们应该在服务器创建时附加,即一台服务器应该获得一个新创建的卷,,

我已经注意到一个问题,下面的代码正在运行,但是当我尝试创建 2 个或更多服务器实例时,它会尝试将新卷附加到堆栈 id 而不是单个虚拟机 id...

heat_template_version: 2015-10-15

resources:
  nalla:
    type: OS::Heat::ResourceGroup
    properties:
      count: 2
      resource_def:
        type: OS::Nova::Server
        properties:
          name: nalla_%index%
          image: cirros
          flavor: m1.extra_tiny
          networks:
          - network: self_service

  vm_volume:
    type: OS::Cinder::Volume
    properties:
      size: 1

  volume_attachment:
    type: OS::Cinder::VolumeAttachment
    properties:
      volume_id: { get_resource: vm_volume }
      instance_uuid: { get_resource: nalla }


outputs:
  instance_ip:
    description: IP address of the instance
    value: { get_attr: [nalla, first_address] }

错误:

stack_status          | CREATE_FAILED                                                                                      |
| stack_status_reason   | Resource CREATE failed: Error: resources.volume_attachment: Failed to attach volume a9753ffb-f02e- |
|                       | 4ebd-9630-b498bb8171c8 to server 800a2b01-021d-413d-9657-10b6cc711a91 - Instance 800a2b01-021d-    |
|                       | 413d-9657-10b6cc711a91 could not be found. (HTTP 404) (Request-ID: req-c63ad056-75ae-47fe-         |
|                       | 95b3-c7118c82e2b3)          

相关内容