Repository navigation
Config helper - #236
Open
rountree wants to merge 8 commits into
Open
Config helper#236rountree wants to merge 8 commits into
rountree wants to merge 8 commits into
Conversation
Fixes case where all candidate commpaths were added to localprefix prior to vetting.
The "long" tests were not compiled with `-rpath`, which led to errors about missing libmodules. This fix allows cray compilers to be used without putting the fortran library location in LD_LIBRARY_PATH.
● Add spindle-config-helper utility (milestone 1)
Introduces a new tool to help users generate and validate Spindle
configuration files. This milestone implements the foundational
parse-and-output functionality.
Features:
- Parses configuration from command line, environment variables, and
config files using existing config_mgr.cc infrastructure
- Outputs merged configuration in spindle.conf format
- Supports all 62 Spindle configuration options
- Command-line help: -h/--help, -V/--version, --usage
- Application argument is optional (auto-supplies dummy if needed)
- Man page: spindle-config-helper(1)
Architecture:
- New binary: src/config_helper/spindle-config-helper
- Private static library: src/fe/startup/libconfigparse.a
Contains config_mgr.cc, config_parser.cc, parseargs.cc, and
supporting utilities. Library is not installed (noinst_LIBRARIES)
to avoid distribution complexity in sidecar scenarios.
- Integrated into autotools build system
Future milestones will add environment probing (detecting local mount
points, resource managers, security subsystems) and configuration
validation.
Co-Authored-By: Claude <noreply@anthropic.com>
Add filesystem analysis and path validation to spindle-config-helper (milestone 2)
Enhances spindle-config-helper to analyze and validate configured paths,
helping users identify problematic configurations before runtime.
Features:
- Analyzes each path in commpaths, cachepaths, and localprefix
- Detects and warns about remote filesystems (NFS, Lustre, GPFS, etc.)
- Validates environment variable expansion
- Detects undefined variables ($BADVAR)
- Detects empty variables creating double-slashes (/var/$EMPTY/dir)
- Shows both original and expanded paths
- Checks parent directory permissions for non-existent paths
- Resolves relative paths and symlinks to show real locations
- Hardcodes kernel filesystem paths (/proc, /sys, /dev) as local
- Treats overlay filesystems as local (container backing storage)
Output format provides per-path analysis with status (OK/WARNING),
original path, resolved path, filesystem type, and specific warnings:
commpaths analysis:
OK: $TMPDIR -> /var/tmp/rountree (tmpfs, 250GB)
WARNING: /var/$EMPTY/dir -> /var//dir
Path contains empty segment (variable may be empty)
Parent directory (/var) is not writable
WARNING: /nfs/cache -> /nfs/cache (nfs4)
Path is on REMOTE filesystem (nfs4)
This detailed feedback helps users and administrators diagnose
configuration issues by showing exactly what each path expands to,
where it resolves, and why it might not work.
Technical details:
- Uses wordexp(3) with WRDE_UNDEF for variable expansion
- Uses realpath(3) for symlink/relative path resolution
- Parses /proc/mounts with 1GB minimum space threshold
- Checks write permission on nearest existing parent directory
- Filters duplicate mounts and system/virtual filesystems
Co-Authored-By: Claude <noreply@anthropic.com>
Adds a lightweight integration test suite to validate spindle-config-helper
functionality and catch regressions.
Test coverage (10 tests, all passing):
- Basic execution (smoke test)
- Command-line flags (--help, --version)
- Local filesystem detection (/dev/shm, /tmp)
- Variable handling (undefined, empty)
- Multiple colon-separated paths
- Kernel filesystem recognition (/proc, /sys, /dev)
- Parent directory permission checking
- Relative path resolution
Structure:
testsuite/config_helper/
├── run_tests.sh Test runner script
├── README.md Documentation
├── sample_mounts/ Example /proc/mounts files
│ ├── simple.mounts Basic NFS + local
│ ├── hpc.mounts Lustre + GPFS + local
│ └── container.mounts Overlay + tmpfs
└── expected/ (Reserved for golden files)
Design philosophy:
- Simple integration tests that run the actual binary
- Use real filesystem operations where possible
- No heavy mocking - trust implementation, catch regressions
- Fast execution (~1 second)
- Easy to extend with new test functions
Sample mount files are provided for future enhancements if we add
deterministic testing against various filesystem configurations.
Usage:
cd testsuite/config_helper
./run_tests.sh /path/to/spindle-config-helper
Exit codes: 0 (all passed), 1 (one or more failed)
Co-Authored-By: Claude <noreply@anthropic.com>
Commit Message 1: Python Prefix Validation
Add pythonprefix validation to spindle-config-helper
Validates that pythonprefix paths point to valid Python installations.
Background:
Spindle uses pythonprefix for prefix matching on file paths. The default
is "/usr/lib/python:/usr/lib64/python" which matches paths like:
/usr/lib/python3.11/site-packages/numpy/__init__.py
/usr/lib/python3.11/lib-dynload/_ctypes.so
The prefix should be the Python installation root (e.g., /usr/tce or
/opt/cray/pe/python/3.12.12), NOT the lib subdirectory.
Validation rules:
- Path must exist (no point in intercepting files that don't exist)
- No undefined variables (catches $PYTHON_HOME when unset)
- Must contain bin/python or bin/python3 (validates it's a Python install)
Example output:
pythonprefix analysis:
OK: /usr/tce -> /usr/tce
WARNING: /tmp -> /tmp
No bin/python or bin/python3 found (not a Python installation?)
WARNING: $PYTHON_HOME -> (empty)
Variable is not set
This helps users catch common mistakes like:
- Setting prefix to a non-existent path
- Using /usr/lib/python/3.11 instead of /usr/lib/python
- Pointing to a non-Python directory
- Relying on undefined environment variables
Co-Authored-By: Claude <noreply@anthropic.com>
Commit Message 2: Test Suite Updates
Add pythonprefix tests to spindle-config-helper test suite
Adds 3 new tests for pythonprefix validation (13 tests total, all passing):
11. test_11_pythonprefix_valid - Valid Python installation
Uses /usr/tce if available, skips gracefully otherwise
12. test_12_pythonprefix_invalid - Path without Python binaries
Tests /tmp which exists but has no bin/python
13. test_13_pythonprefix_undefined_var - Undefined variable detection
Tests $PYTHON_HOME when unset
Also fixes test_09_permissions which broke when pythonprefix validation
changed path-doesn't-exist behavior from OK to WARNING.
All tests are portable:
- Test 11 skips on systems without /usr/tce
- Tests 12 and 13 work on any system
- No searching, no external dependencies
- Fast execution
Co-Authored-By: Claude <noreply@anthropic.com>
Implements comprehensive security validation including:
- Detection of compiled security mode and current runtime setting
- Mode-specific validation:
* none: warns about insecure connections
* keyfile: validates keydir is on shared filesystem
* launchmon: warns about deprecated mode
* munge: verifies daemon availability
- Sandbox-aware munge testing (detects SANDBOX_ENGINE env var)
- Always recommends munge when available
New helper function get_sec_keydir_path() in keyfile.c exposes
SEC_KEYDIR compile-time constant for keyfile validation.
Test suite expanded with tests 14-17 covering security mode
detection, warnings, and munge availability checks.
All 17 tests passing.
Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
Author
|
The design philosophy is to validate those runtime parameters, issue warnings and validation where needed, and then dump all parameters and their current values to stdout. The user can redirect the output to their Here's a snapshot of current functionality: |
This branch is waiting to be deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Separate binary that creates/validates Spindle config files. Work in progress.