Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
af7021c
Changed pylustrequota to a generic python lustreclient extension
Martin-Rehr Nov 25, 2025
437a6a7
Changed lustre quota from cron job to grid daemon
Martin-Rehr Nov 25, 2025
fabce46
Updated unit tests to match new grid quota daemon setup
Martin-Rehr Nov 25, 2025
b6c56f1
Added 'quota_update_interval' option to generateconfs
Martin-Rehr Nov 25, 2025
5261194
Addwed missing 'user_quota_log' entry to configuration
Martin-Rehr Nov 25, 2025
375f634
Added missing 'update_interval' to MiGserver-template.conf
Martin-Rehr Nov 25, 2025
9c9e976
Added 'update_interval' to MiGserver.conf fixture
Martin-Rehr Nov 25, 2025
aa83180
Minor comment corrections thanks to @jonasbardino
Martin-Rehr Nov 27, 2025
1132a2d
Added 'lustreclient' to 'c-ext-sanity-check' ignore paths as it depen…
Martin-Rehr Dec 1, 2025
be7f1bc
Added check for 'lustreclient' module import
Martin-Rehr Dec 2, 2025
d5a9d3c
Added log error message if requested 'quota' backend is unsupported
Martin-Rehr Dec 2, 2025
3933cd8
Removed trailing whitespace
Martin-Rehr Dec 2, 2025
8312ebd
Restrict 'lustreclient.lfs' import exception to 'ImportError' to sati…
Martin-Rehr Dec 2, 2025
9dba870
Removed absolete 'import sys'
Martin-Rehr Dec 2, 2025
559f60c
lustrequota: Added check for 'psutil' module
Martin-Rehr Dec 2, 2025
17f4194
Added quota unittest
Martin-Rehr Dec 2, 2025
f888463
python-c-ext-sanity-check: Added support for skipping paths specified…
Martin-Rehr Dec 11, 2025
72655fd
python-c-ext-sanity-check: Removed double 'env'
Martin-Rehr Dec 11, 2025
7dd5ed4
python-c-ext-sanity-check: Added missing 'filter'
Martin-Rehr Dec 11, 2025
af450ff
python-c-ext-sanity-check: Changed 'env.skip' to 'env.paths-ignore-sp…
Martin-Rehr Dec 11, 2025
1a90bbd
python-c-ext-sanity-check: Test
Martin-Rehr Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/python-c-ext-sanity-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
name: Python C-Extension Sanity Checks

on:
# env.paths-ignore-splint: Don't run 'splint' on these paths
# Format: PATH1|PATH2|PATH3
env:
- paths-ignore-splint: "mig/src/lustreclient/.*$"

# Triggers the workflow on push or pull request events but only for this git branch
push:
paths-ignore:
Expand All @@ -24,6 +29,7 @@ on:
- 'mig/apache/**'
- 'mig/bin/**'
- 'mig/java-bin/**'
- 'mig/src/lustreclient/**'
- '**/*.py'
- '**/*.js'
branches:
Expand Down Expand Up @@ -52,6 +58,7 @@ on:
- 'mig/apache/**'
- 'mig/bin/**'
- 'mig/java-bin/**'
- 'mig/src/lustreclient/**'
- '**/*.py'
- '**/*.js'
branches:
Expand Down Expand Up @@ -90,9 +97,9 @@ jobs:
run: |
# NOTE: we only run splint error check for changed C files to limit noise
# NOTE: point splint to Ubuntu's custom /usr/include/python3.x for Python.h
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$')"
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -Ev '${{ env.paths-ignore-splint }}' | grep -E '\.c$')"
# NOTE: show splint warnings but don't fail unless it found critical errors
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list $(python3-config --includes) &> splint.log || true
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -Ev '${{ env.paths-ignore-splint }}' | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list $(python3-config --includes) &> splint.log || true
[ ! -e splint.log ] || cat splint.log
[ ! -e splint.log ] || ! grep -q ' Cannot continue' splint.log

Expand All @@ -116,10 +123,10 @@ jobs:
run: |
# NOTE: we only run splint error check for changed C files to limit noise
# NOTE: point splint to Ubuntu's custom /usr/include/python3.x for Python.h
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$')"
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -Ev '${{ env.paths-ignore-splint }}' | grep -E '\.c$')"
# NOTE: splint complains about NATIVE_TSS_KEY_T in system header here
# NOTE: show splint warnings but don't fail unless it found critical errors
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list -DNATIVE_TSS_KEY_T=char $(python3-config --includes) &> splint.log || true
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -Ev '${{ env.paths-ignore-splint }}' | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list -DNATIVE_TSS_KEY_T=char $(python3-config --includes) &> splint.log || true
[ ! -e splint.log ] || cat splint.log
[ ! -e splint.log ] || ! grep -q ' Cannot continue' splint.log

Expand Down Expand Up @@ -156,10 +163,10 @@ jobs:
# NOTE: perms are not right inside container so repeat what checkout module does.
git config --global --add safe.directory "$PWD"
# NOTE: we only run splint error check for changed C files to limit noise
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$')"
echo "Lint changed code files: $(git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -Ev '${{ env.paths-ignore-splint }}' | grep -E '\.c$')"
echo "with splint from $(which splint)"
ls -l /bin/splint
# NOTE: show splint warnings but don't fail unless it found critical errors
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list &> splint.log || true
git diff --diff-filter=ACMRTB --name-only HEAD^1 -- | grep -Ev '${{ env.paths-ignore-splint }}' | grep -E '\.c$' | xargs -r splint +posixlib -D__gnuc_va_list=va_list &> splint.log || true
[ ! -e splint.log ] || cat splint.log
[ ! -e splint.log ] || ! grep -q ' Cannot continue' splint.log
1 change: 1 addition & 0 deletions mig/install/MiGserver-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ default_mount_re = SSHFS-2.X-1

[QUOTA]
backend = __QUOTA_BACKEND__
update_interval = __QUOTA_UPDATE_INTERVAL__
user_limit = __QUOTA_USER_LIMIT__
vgrid_limit = __QUOTA_VGRID_LIMIT__

Expand Down
1 change: 1 addition & 0 deletions mig/install/generateconfs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
Expand All @@ -20,7 +20,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Check warning on line 23 in mig/install/generateconfs.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
#
# -- END_HEADER ---
#
Expand Down Expand Up @@ -252,6 +252,7 @@
'seafile_seafhttp_port',
'seafile_client_port',
'seafile_quota',
'quota_update_interval',
'quota_user_limit',
'quota_vgrid_limit',
'wwwserve_max_bytes',
Expand Down
62 changes: 0 additions & 62 deletions mig/install/miglustrequota-template.sh.cronjob

This file was deleted.

56 changes: 54 additions & 2 deletions mig/install/migrid-init.d-deb-template
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ if [ -z "$PYTHONPATH" ]; then
else
PYTHONPATH=${MIG_PATH}:$PYTHONPATH
fi
# Make sure '/usr/local/(s)bin' is in path and force lookup order
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# you probably do not want to modify these...
PID_DIR=${PID_DIR:-/var/run}
MIG_LOG=${MIG_STATE}/log
Expand All @@ -62,13 +65,14 @@ MIG_FTPS=${MIG_CODE}/server/grid_ftps.py
MIG_NOTIFY=${MIG_CODE}/server/grid_notify.py
MIG_IMNOTIFY=${MIG_CODE}/server/grid_imnotify.py
MIG_VMPROXY=${MIG_CODE}/server/grid_vmproxy.py
MIG_QUOTA=${MIG_CODE}/server/grid_quota.py
MIG_CHKUSERROOT=${MIG_CODE}/server/chkuserroot.py
MIG_CHKSIDROOT=${MIG_CODE}/server/chksidroot.py

show_usage() {
echo "Usage: migrid {start|stop|status|restart|reload}[daemon DAEMON]"
echo "where daemon is left out for all or given along with DAEMON as one of the following"
echo "(script|monitor|sshmux|events|cron|janitor|transfers|openid|sftp|sftpsubsys|webdavs|ftps|notify|imnotify|vmproxy|all)"
echo "(script|monitor|sshmux|events|cron|janitor|transfers|openid|sftp|sftpsubsys|webdavs|ftps|notify|imnotify|vmproxy|quota|all)"
}

check_enabled() {
Expand Down Expand Up @@ -264,6 +268,18 @@ start_vmproxy() {
log_end_msg 1 || true
fi
}
start_quota() {
check_enabled "quota" || return 0
DAEMON_PATH=${MIG_QUOTA}
SHORT_NAME=$(basename ${DAEMON_PATH})
PID_FILE="$PID_DIR/${SHORT_NAME}.pid"
log_daemon_msg "Starting MiG quota daemon" ${SHORT_NAME} || true
if start-stop-daemon --start --quiet --oknodo --pidfile ${PID_FILE} --make-pidfile --user root --chuid root --background --name ${SHORT_NAME} --startas ${DAEMON_PATH} ; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
}
start_sftpsubsys() {
check_enabled "sftp_subsys" || return 0
DAEMON_PATH=${MIG_SFTPSUBSYS}
Expand Down Expand Up @@ -292,6 +308,7 @@ start_all() {
start_notify
start_imnotify
start_vmproxy
start_quota
return 0
}

Expand Down Expand Up @@ -524,6 +541,19 @@ stop_vmproxy() {
log_end_msg 1 || true
fi
}
stop_quota() {
check_enabled "quota" || return 0
DAEMON_PATH=${MIG_QUOTA}
SHORT_NAME=$(basename ${DAEMON_PATH})
PID_FILE="$PID_DIR/${SHORT_NAME}.pid"
log_daemon_msg "Stopping MiG quota" ${SHORT_NAME} || true
if start-stop-daemon --stop --quiet --oknodo --pidfile ${PID_FILE} ; then
rm -f ${PID_FILE}
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
}
stop_sftpsubsys_workers() {
DAEMON_PATH=${MIG_SFTPSUBSYS_WORKER}
SHORT_NAME=$(basename ${DAEMON_PATH})
Expand Down Expand Up @@ -563,6 +593,7 @@ stop_all() {
stop_notify
stop_imnotify
stop_vmproxy
stop_quota
return 0
}

Expand Down Expand Up @@ -735,6 +766,18 @@ reload_vmproxy() {
log_end_msg 1 || true
fi
}
reload_quota() {
check_enabled "quota" || return 0
DAEMON_PATH=${MIG_QUOTA}
SHORT_NAME=$(basename ${DAEMON_PATH})
PID_FILE="$PID_DIR/${SHORT_NAME}.pid"
log_daemon_msg "Reloading MiG quota" ${SHORT_NAME} || true
if start-stop-daemon --stop --signal HUP --quiet --oknodo --pidfile ${PID_FILE} ; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
}
reload_sftpsubsys_workers() {
DAEMON_PATH=${MIG_SFTPSUBSYS_WORKER}
SHORT_NAME=$(basename ${DAEMON_PATH})
Expand Down Expand Up @@ -787,6 +830,7 @@ reload_all() {
reload_notify
reload_imnotify
reload_vmproxy
reload_quota
# Apache helpers to verify proper chrooting
reload_chkuserroot
reload_chksidroot
Expand Down Expand Up @@ -891,6 +935,13 @@ status_vmproxy() {
PID_FILE="$PID_DIR/${SHORT_NAME}.pid"
status_of_proc -p ${PID_FILE} ${DAEMON_PATH} ${SHORT_NAME}
}
status_quota() {
check_enabled "quota" || return 0
DAEMON_PATH=${MIG_QUOTA}
SHORT_NAME=$(basename ${DAEMON_PATH})
PID_FILE="$PID_DIR/${SHORT_NAME}.pid"
status_of_proc -p ${PID_FILE} ${DAEMON_PATH} ${SHORT_NAME}
}
status_sftpsubsys_workers() {
DAEMON_PATH=${MIG_SFTPSUBSYS_WORKER}
SHORT_NAME=$(basename ${DAEMON_PATH})
Expand Down Expand Up @@ -929,6 +980,7 @@ status_all() {
status_notify
status_imnotify
status_vmproxy
status_quota
return 0
}

Expand All @@ -940,7 +992,7 @@ test -f ${MIG_SCRIPT} || exit 0

# Force valid target
case "$2" in
script|monitor|sshmux|events|cron|janitor|transfers|openid|sftp|sftpsubsys|webdavs|ftps|notify|imnotify|vmproxy|all)
script|monitor|sshmux|events|cron|janitor|transfers|openid|sftp|sftpsubsys|webdavs|ftps|notify|imnotify|vmproxy|quota|all)
TARGET="$2"
;;
'')
Expand Down
Loading