Skip to content

Commit 774c104

Browse files
authored
Merge pull request #36 from stackhpc/feat/volume-backed-cluster-instances
Support volume-backed cluster instances
2 parents 215fcbc + 55910aa commit 774c104

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

roles/cluster_infra/templates/resources.tf.j2

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,23 @@ resource "openstack_compute_instance_v2" "login" {
260260
port = "${openstack_networking_port_v2.login.id}"
261261
}
262262

263+
# root device:
264+
block_device {
265+
uuid = "{{ cluster_previous_image | default(cluster_image) }}"
266+
source_type = "image"
267+
{% if cluster_use_root_volumes is defined and cluster_use_root_volumes %}
268+
volume_size = {{ cluster_root_volume_size | default("20") }}
269+
destination_type = "volume"
270+
{% if cluster_root_volume_type is defined %}
271+
volume_type = "{{ cluster_root_volume_type }}"
272+
{% endif %}
273+
{% else %}
274+
destination_type = "local"
275+
{% endif %}
276+
boot_index = 0
277+
delete_on_termination = true
278+
}
279+
263280
# Use cloud-init to inject the SSH keys
264281
user_data = <<-EOF
265282
#cloud-config
@@ -296,7 +313,15 @@ resource "openstack_compute_instance_v2" "control" {
296313
block_device {
297314
uuid = "{{ cluster_previous_image | default(cluster_image) }}"
298315
source_type = "image"
316+
{% if cluster_use_root_volumes is defined and cluster_use_root_volumes %}
317+
volume_size = {{ cluster_root_volume_size | default("20") }}
318+
destination_type = "volume"
319+
{% if cluster_root_volume_type is defined %}
320+
volume_type = "{{ cluster_root_volume_type }}"
321+
{% endif %}
322+
{% else %}
299323
destination_type = "local"
324+
{% endif %}
300325
boot_index = 0
301326
delete_on_termination = true
302327
}
@@ -360,6 +385,23 @@ resource "openstack_compute_instance_v2" "{{ partition.name }}" {
360385
port = openstack_networking_port_v2.{{ partition.name }}[count.index].id
361386
}
362387

388+
# root device:
389+
block_device {
390+
uuid = "{{ cluster_previous_image | default(cluster_image) }}"
391+
source_type = "image"
392+
{% if cluster_use_root_volumes is defined and cluster_use_root_volumes %}
393+
volume_size = {{ cluster_root_volume_size | default("20") }}
394+
destination_type = "volume"
395+
{% if cluster_root_volume_type is defined %}
396+
volume_type = "{{ cluster_root_volume_type }}"
397+
{% endif %}
398+
{% else %}
399+
destination_type = "local"
400+
{% endif %}
401+
boot_index = 0
402+
delete_on_termination = true
403+
}
404+
363405
# Use cloud-init to inject the SSH keys
364406
user_data = <<-EOF
365407
#cloud-config

0 commit comments

Comments
 (0)