Skip to content

Commit

Permalink
Merge pull request #3125 from harshthakkar01/ps-reboot
Browse files Browse the repository at this point in the history
Add mount parallelstore service to mount parallelstore for every reboot
  • Loading branch information
harshthakkar01 authored Oct 16, 2024
2 parents 4f4c356 + 6f2bc8a commit c0d3004
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
25 changes: 24 additions & 1 deletion modules/file-system/parallelstore/scripts/mount-daos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if { [ "${OS_ID}" = "rocky" ] || [ "${OS_ID}" = "rhel" ]; } && { [ "${OS_VERSION
mkdir -p /var/log/daos_agent
chown daos_agent:daos_agent /var/log/daos_agent
sed -i "s/#.*log_file:.*/log_file: \/var\/log\/daos_agent\/daos_agent.log/g" $daos_config
systemctl enable daos_agent.service
systemctl start daos_agent.service
elif { [ "${OS_ID}" = "ubuntu" ] && [ "${OS_VERSION}" = "22.04" ]; } || { [ "${OS_ID}" = "debian" ] && [ "${OS_VERSION_MAJOR}" = "12" ]; }; then
mkdir -p /var/run/daos_agent
Expand All @@ -73,12 +74,34 @@ for i in {1..10}; do
# shellcheck disable=SC2086
dfuse -m "$local_mount" --pool default-pool --container default-container --multi-user $mount_options && break

echo "dfuse failed, retrying in 1 seconds (attempt $i/5)..."
echo "dfuse failed, retrying in 1 seconds (attempt $i/10)..."
sleep 1
done

if ! mountpoint -q "$local_mount"; then
exit 1
fi

# Store the mounting logic in a variable
mount_command='for i in {1..10}; do /bin/dfuse -m '$local_mount' --pool default-pool --container default-container --multi-user '$mount_options' --foreground && break; echo \"dfuse, failed, retrying in 1 second (attempt '$i'/10)\"; sleep 1; done'

# --- Begin: Add systemd service creation ---
cat >/usr/lib/systemd/system/mount_parallelstore.service <<EOF
[Unit]
Description=DAOS Mount Service
After=network-online.target daos_agent.service
[Service]
Type=oneshot
User=root
Group=root
ExecStart=/bin/bash -c '$mount_command'
[Install]
WantedBy=multi-user.target
EOF

systemctl enable mount_parallelstore.service
# --- End: Add systemd service creation ---

exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if { [ "${OS_ID}" = "rocky" ] || [ "${OS_ID}" = "rhel" ]; } && { [ "${OS_VERSION
mkdir -p /var/log/daos_agent
chown daos_agent:daos_agent /var/log/daos_agent
sed -i "s/#.*log_file:.*/log_file: \/var\/log\/daos_agent\/daos_agent.log/g" $daos_config
systemctl enable daos_agent.service
systemctl start daos_agent.service
elif { [ "${OS_ID}" = "ubuntu" ] && [ "${OS_VERSION}" = "22.04" ]; } || { [ "${OS_ID}" = "debian" ] && [ "${OS_VERSION_MAJOR}" = "12" ]; }; then
mkdir -p /var/run/daos_agent
Expand All @@ -73,12 +74,34 @@ for i in {1..10}; do
# shellcheck disable=SC2086
dfuse -m "$local_mount" --pool default-pool --container default-container --multi-user $mount_options && break

echo "dfuse failed, retrying in 1 seconds (attempt $i/5)..."
echo "dfuse failed, retrying in 1 seconds (attempt $i/10)..."
sleep 1
done

if ! mountpoint -q "$local_mount"; then
exit 1
fi

# Store the mounting logic in a variable
mount_command='for i in {1..10}; do /bin/dfuse -m '$local_mount' --pool default-pool --container default-container --multi-user '$mount_options' --foreground && break; echo \"dfuse, failed, retrying in 1 second (attempt '$i'/10)\"; sleep 1; done'

# --- Begin: Add systemd service creation ---
cat >/usr/lib/systemd/system/mount_parallelstore.service <<EOF
[Unit]
Description=DAOS Mount Service
After=network-online.target daos_agent.service
[Service]
Type=oneshot
User=root
Group=root
ExecStart=/bin/bash -c '$mount_command'
[Install]
WantedBy=multi-user.target
EOF

systemctl enable mount_parallelstore.service
# --- End: Add systemd service creation ---

exit 0

0 comments on commit c0d3004

Please sign in to comment.