forked from fgci-org/ansible-role-lustre_client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For Warewulf, create IPoIB devices for IB partitions, mount Lustre
Warewulf doesn't handle IB partitions (or Eth VLAN's), see warewulf/warewulf3#166 Instead create a script to generate the ifcfg- files for the IB partitions, bring them up, and mount Lustre.
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
# tasks file for ansible-role-lustre_client | ||
|
||
- name: Script for creating and bringing up IB partition ipoib devices | ||
template: | ||
src: ifcfg-ibpart-create.sh.j2 | ||
dest: /usr/local/sbin/ifcfg-ibpart-create.sh | ||
mode: 0744 | ||
owner: root | ||
group: root | ||
|
||
- name: Run the script from rc.local | ||
lineinfile: | ||
path: /etc/rc.d/rc.local | ||
line: '/usr/local/sbin/ifcfg-ibpart-create.sh' | ||
|
||
- name: Make sure rc.local is executable | ||
file: | ||
path: /etc/rc.d/rc.local | ||
mode: 0744 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# Warewulf doesn't support IB partitions (or eth VLAN's), | ||
# https://github.com/warewulf/warewulf3/issues/166 | ||
# So create the ifcfg- files and bring up the Lustre networks here | ||
# instead, and launch from rc.local. | ||
|
||
{% for dev in lustre_network_devices %} | ||
|
||
parent={{ dev.split('.')[0] }} | ||
|
||
parent_ip=$(ip a show dev ${parent} scope global | awk '{if ($1 == "inet") {print $2}}' | awk -F/ '{print $1}') | ||
|
||
# Device IP | ||
dip=$(echo $parent_ip | awk 'BEGIN {FS="."; OFS="."} {print $1, $2 + {{ loop.index }}, $3, $4}') | ||
pkey="0x{{ dev.split('.')[1] }}" | ||
|
||
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-{{ dev }} | ||
DEVICE={{ dev }} | ||
NAME={{ dev }} | ||
PHYSDEV=${parent} | ||
BOOTPROTO=none | ||
TYPE=InfiniBand | ||
IPADDR=${dip} | ||
ONBOOT=yes | ||
NETMASK=255.255.0.0 | ||
PKEY=yes | ||
PKEY_ID=${pkey} | ||
IPV6INIT=no | ||
MTU=65520 | ||
CONNECTED_MODE=yes | ||
NM_CONTROLLED=no | ||
EOF | ||
|
||
echo ${pkey} > /sys/class/net/${parent}/create_child | ||
ifup {{ dev }} | ||
|
||
{% endfor %} | ||
|
||
# Separate loop here to allow parallel initialization of devices | ||
{% for dev in lustre_network_devices %} | ||
while ! dmesg | grep '{{ dev }}: link becomes ready' | ||
do | ||
sleep 1 | ||
done | ||
{% endfor %} | ||
|
||
modprobe lustre | ||
mount /scratch |