Skip to content

Commit

Permalink
Azure use lun path instead of device paths (#497)
Browse files Browse the repository at this point in the history
* Add devdiscover to act on lun ids

* Make the lun index from zero
  • Loading branch information
sasikeda authored Mar 23, 2024
1 parent 5891af9 commit 4446dd1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
4 changes: 2 additions & 2 deletions azure_scale_templates/sub_modules/instance_template/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ locals {
disk["name"] => {
fs_name = disk["fs_name"]
pool = disk["pool"]
device_name = element(local.block_device_names, jdx)
device_name = format("disk/azure/scsi1/lun%s", jdx)
}
})
}
Expand Down Expand Up @@ -322,7 +322,7 @@ locals {
disk["name"] => {
fs_name = disk["fs_name"]
pool = disk["pool"]
device_name = element(local.block_device_names, jdx)
device_name = "disk/azure/scsi1/lun0"
}
})
}
Expand Down
29 changes: 25 additions & 4 deletions resources/azure/compute/vm_multiple_disk/vm_multiple_disk.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,21 @@ systemctl restart NetworkManager
EOF
}

# Gets Azure ssh keypair data
data "azurerm_ssh_public_key" "itself" {
name = var.user_key_pair
resource_group_name = var.resource_group_name
data "template_file" "lun_discover" {
template = <<EOF
#!/usr/bin/env bash
if [ ! -d "/var/mmfs/etc" ]; then
mkdir -p "/var/mmfs/etc"
fi
echo "#!/bin/ksh" > "/var/mmfs/etc/nsddevices"
echo "# Generated by IBM Storage Scale deployment." >> "/var/mmfs/etc/nsddevices"
%{for i in range(0, 17)~}
echo "echo \"disk/azure/scsi1/lun${i} generic\"" >> "/var/mmfs/etc/nsddevices"
%{endfor~}
echo "# Bypass the NSD device discovery" >> "/var/mmfs/etc/nsddevices"
echo "return 0" >> "/var/mmfs/etc/nsddevices"
chmod u+x "/var/mmfs/etc/nsddevices"
EOF
}

data "template_cloudinit_config" "user_data64" {
Expand All @@ -47,6 +58,16 @@ data "template_cloudinit_config" "user_data64" {
content_type = "text/x-shellscript"
content = data.template_file.user_data.rendered
}
part {
content_type = "text/x-shellscript"
content = data.template_file.lun_discover.rendered
}
}

# Gets Azure ssh keypair data
data "azurerm_ssh_public_key" "itself" {
name = var.user_key_pair
resource_group_name = var.resource_group_name
}

resource "azurerm_network_interface" "itself" {
Expand Down

0 comments on commit 4446dd1

Please sign in to comment.