Skip to content

Commit 87e5343

Browse files
committed
add volumes for control node persistent state
1 parent adbfcfd commit 87e5343

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

group_vars/control.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Define path for persistent state on control node volume:
2+
appliances_state_dir: /var/lib/state

group_vars/openstack.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ terraform_project_path: "{{ playbook_dir }}/terraform"
1616

1717
terraform_state: "{{ cluster_state | default('present') }}"
1818
cluster_ssh_user: rocky
19+
20+
state_volume_size: 150 # GB

roles/cluster_infra/templates/resources.tf.j2

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@ resource "openstack_networking_secgroup_rule_v2" "secgroup_slurm_login_rule_ingr
6969
security_group_id = "${openstack_networking_secgroup_v2.secgroup_slurm_login.id}"
7070
}
7171

72+
#####
73+
##### Volumes
74+
#####
75+
resource "openstack_blockstorage_volume_v3" "state" {
76+
name = "{{ cluster_name }}-state"
77+
description = "State for control node"
78+
size = "{{ state_volume_size }}"
79+
}
80+
81+
resource "openstack_blockstorage_volume_v3" "home" {
82+
name = "{{ cluster_name }}-home"
83+
description = "Home for control node"
84+
size = "{{ home_volme_size }}"
85+
}
86+
87+
7288
#####
7389
##### Cluster nodes
7490
#####
@@ -111,12 +127,50 @@ resource "openstack_compute_instance_v2" "control" {
111127
name = "{{ cluster_network }}"
112128
}
113129
security_groups = ["${openstack_networking_secgroup_v2.secgroup_slurm_cluster.name}"]
114-
# Use cloud-init to inject the SSH keys
130+
131+
# root device:
132+
block_device {
133+
uuid = "{{ cluster_image }}"
134+
source_type = "image"
135+
destination_type = "local"
136+
boot_index = 0
137+
delete_on_termination = true
138+
}
139+
140+
# state volume:
141+
block_device {
142+
destination_type = "volume"
143+
source_type = "volume"
144+
boot_index = -1
145+
uuid = openstack_blockstorage_volume_v3.state.id
146+
}
147+
148+
# home volume:
149+
block_device {
150+
destination_type = "volume"
151+
source_type = "volume"
152+
boot_index = -1
153+
uuid = openstack_blockstorage_volume_v3.home.id
154+
}
155+
156+
# Use cloud-init to a) inject SSH keys b) configure volumes
115157
user_data = <<-EOF
116158
#cloud-config
117159
ssh_authorized_keys:
118160
- {{ cluster_deploy_ssh_public_key }}
119161
- {{ cluster_user_ssh_public_key }}
162+
fs_setup:
163+
- label: state
164+
filesystem: ext4
165+
device: /dev/vdb
166+
partition: auto
167+
- label: home
168+
filesystem: ext4
169+
device: /dev/vdc
170+
partition: auto
171+
mounts:
172+
- [LABEL=state, /var/lib/state]
173+
- [LABEL=home, /exports/home, auto, "x-systemd.required-by=nfs-server.service,x-systemd.before=nfs-server.service"]
120174
EOF
121175
}
122176

ui-meta/slurm-infra.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ parameters:
2828
options:
2929
min_ram: 2048
3030
min_disk: 10
31+
32+
- name: home_volme_size
33+
label: Home volume size
34+
description: The size in GB of the volume to use for home directories
35+
kind: integer
36+
immutable: true
37+
options:
38+
min: 1
39+
default: 100
3140

3241
- name: cluster_run_validation
3342
label: Post-configuration validation

0 commit comments

Comments
 (0)