Skip to content

Commit

Permalink
Block device mapping for heat templates
Browse files Browse the repository at this point in the history
Change-Id: I918b342680224d131a3b4bb46c9a80c950e0e363
  • Loading branch information
9seconds committed Apr 27, 2017
1 parent 9f9dbcb commit acdf427
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 62 deletions.
14 changes: 3 additions & 11 deletions whale_templates/heat-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,10 @@ parameters:
- m1.small
- m1.medium
- m1.large
image:
image_id:
type: string
label: Image
description: Image to use for VMs (should be Ubuntu Xenial)
volumes_per_instance:
type: number
label: Volume count
description: Amount of volumes to attach per instance
default: 5
constraints:
- range: {min: 1, max: 1024}
description: Image ID to use for VMs (should be Ubuntu Xenial)
volume_size:
type: number
label: Volume Size
Expand Down Expand Up @@ -58,9 +51,8 @@ resources:
type: server_with_volumes.yaml
properties:
volume_size: {get_param: volume_size}
volumes_per_instance: {get_param: volumes_per_instance}
volume_type: {get_param: volume_type}
image: {get_param: image}
image_id: {get_param: image_id}
instance_type: {get_param: instance_type}
network: {get_param: network}
floating_network: {get_param: floating_network}
Expand Down
3 changes: 1 addition & 2 deletions whale_templates/parameters.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
parameters:
instance_type: m1.small
image: xenial-server-cloudimg-amd64-disk1
volumes_per_instance: 10
image_id: b7b8c4b4-64af-48aa-8d9e-d82540f9a278
volume_size: 2
instance_count: 5
network: jenkins_ci_internal
Expand Down
110 changes: 91 additions & 19 deletions whale_templates/server_with_volumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,10 @@ parameters:
- m1.small
- m1.medium
- m1.large
image:
image_id:
type: string
label: Image
description: Image to use for VMs (should be Ubuntu Xenial)
volumes_per_instance:
type: number
label: Volume count
description: Amount of volumes to attach per instance
default: 5
constraints:
- range: {min: 1, max: 1024}
description: Image ID to use for VMs (should be Ubuntu Xenial)
volume_type:
type: string
label: Type of volume
Expand Down Expand Up @@ -54,22 +47,101 @@ resources:
ceph_host:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: instance_type}
networks:
- network: {get_param: network}
block_device_mapping:
- device_name: vda
volume_id: {get_resource: volume_vda}
delete_on_termination: true
- device_name: vdb
volume_id: {get_resource: volume_vdb}
delete_on_termination: true
- device_name: vdc
volume_id: {get_resource: volume_vdc}
delete_on_termination: true
- device_name: vdd
volume_id: {get_resource: volume_vdd}
delete_on_termination: true
- device_name: vde
volume_id: {get_resource: volume_vde}
delete_on_termination: true
- device_name: vdf
volume_id: {get_resource: volume_vdf}
delete_on_termination: true
- device_name: vdg
volume_id: {get_resource: volume_vdg}
delete_on_termination: true
- device_name: vdh
volume_id: {get_resource: volume_vdh}
delete_on_termination: true
- device_name: vdi
volume_id: {get_resource: volume_vdi}
delete_on_termination: true
- device_name: vdj
volume_id: {get_resource: volume_vdj}
delete_on_termination: true
- device_name: vdk
volume_id: {get_resource: volume_vdk}
delete_on_termination: true
user_data: {get_file: 'user-data.txt'}
user_data_format: RAW
ceph_volumes:
type: OS::Heat::ResourceGroup
volume_vda:
type: OS::Cinder::Volume
properties:
size: 15
image: {get_param: image_id}
volume_type: {get_param: volume_type}
volume_vdb:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vdc:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vdd:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vde:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vdf:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vdg:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vdh:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vdi:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vdj:
type: OS::Cinder::Volume
properties:
size: {get_param: volume_size}
volume_type: {get_param: volume_type}
volume_vdk:
type: OS::Cinder::Volume
properties:
count: {get_param: volumes_per_instance}
resource_def:
type: volume_with_attachment.yaml
properties:
volume_size: {get_param: volume_size}
volume_type: {get_param: volume_type}
instance_id: {get_resource: ceph_host}
size: {get_param: volume_size}
volume_type: {get_param: volume_type}

outputs:
host_ip:
Expand Down
30 changes: 0 additions & 30 deletions whale_templates/volume_with_attachment.yaml

This file was deleted.

0 comments on commit acdf427

Please sign in to comment.