KT: Add Centos7 and fixups - #81
Open
PlaidCat wants to merge 5 commits into
Open
Conversation
Validate required keys on config load and exit with an example config when any are missing. Default the user field from $USER when not explicitly set.
Replace dist-git-tree-cbr/dist-git-tree-lts references with a single public dist-git-tree repo. Private repos and per-kernel overrides (branches, repos, depot channels) are now loaded from .private_repos.yaml kernel_overrides section. List-kernels shows whether each kernel uses default or overridden config.
CentOS 7 does not support virtiofs, so VMs with os_variant=centos7 use NFS mounts instead. A dedicated cloud-init template handles CentOS vault repo fixes, yum-based package installs, and yum for depot. virt-install skips --filesystem and --memorybacking flags when use_nfs is set. VM startup now polls for running state instead of a fixed sleep, with automatic start attempt if the VM is shut off after cloud-init reboot.
Depot channels are CIQ-internal and belong in .private_repos.yaml kernel_overrides, not in the public kernels.yaml. Update KT.md with setup steps for config file, private repos, and depot channels. Add README pointer to KT.md for kt setup directions.
There was a problem hiding this comment.
Pull request overview
This PR updates the KT (Kernel Tools) workflow to support CentOS 7.9 VM provisioning and introduces “private config” support for per-kernel overrides (e.g., dist-git root/branch and related VM knobs), with accompanying test and documentation updates.
Changes:
- Add CentOS 7.9 kernel entry and VM provisioning support (CentOS-specific cloud-init template + NFS/virt-install adjustments).
- Load private repo config with kernel overrides and surface whether a kernel was overridden.
- Strengthen config and kernels parsing tests; update docs to reflect the new override mechanism.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/kt/ktlib/test_kernels.py | Updates repo naming and adds tests for per-kernel override behavior. |
| tests/kt/ktlib/test_config.py | Adds/updates tests for config loading, missing keys handling, and path validation. |
| README.md | Adds KT overview section (currently has incorrect path casing/locations). |
| kt/ktlib/vm.py | Adds CentOS7 handling (cloud-init selection, pkg manager selection), os_variant/use_nfs plumbing, and VM startup polling. |
| kt/ktlib/virt.py | Switches virt-install to accept explicit os_variant and makes virtiofs optional for NFS workflows. |
| kt/ktlib/util.py | Adds libvirt host IP and polling constants used by VM startup logic. |
| kt/ktlib/kernels.py | Loads private config (repos + kernel overrides) and marks overridden kernels. |
| kt/ktlib/config.py | Adds required-key validation and defaults user from environment (currently exits process on invalid config). |
| kt/KT.md | Expands setup/private repo docs (currently mismatched override key name and has spelling/grammar issues). |
| kt/data/kernels.yaml | Adds CentOS 7.9 kernel and updates dist-git roots/branches to the new layout. |
| kt/data/cloud_init_centos7.yaml | Introduces CentOS 7 cloud-init template (currently duplicates yum update behavior with vm.py injection). |
| kt/commands/list_kernels/impl.py | Changes list-kernels output to include (default) / (override) labeling. |
| kernel_install_dep.sh | Makes optional package install failures non-fatal. |
Suppressed comments (1)
kt/KT.md:64
- Same as above: the example YAML key should match what the code loads (
kernel_overrides).
kernel_override:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+7
to
+11
| In this repo there is a directory called `KT` which contains a "kernel tools" | ||
| python package that should be installed into your python environment. Its purpose | ||
| is to consolidate all of the one off or single purpose scripts to share more | ||
| common code and functionality. Please see the KT directions in KT/kt.md for | ||
| setup directions. |
Comment on lines
+26
to
+28
| There is a default one in kt/data/config.json but you can create your own by | ||
| defining the KTOOLS_CONFIG_FILE enviroment varriable to point to your own config | ||
| file. |
Comment on lines
+43
to
+44
| user defaults to $USER, set this if you wish for your user on the vms to be | ||
| different then define. |
| private_repos: | ||
| dist-git-tree-lts: <gitlab_private_repo_url> | ||
|
|
||
| kernel_override: |
Comment on lines
63
to
+65
| with open(private_repos_path) as f: | ||
| data = yaml.safe_load(f) | ||
| return data.get("private_repos", {}) | ||
| return data.get("private_repos", {}), data.get("kernel_overrides", {}) |
Comment on lines
+51
to
+57
| missing = cls.REQUIRED_KEYS - data.keys() | ||
| if missing: | ||
| example = json.dumps(cls.DEFAULT, indent=2) | ||
| sys.exit( | ||
| f"Error: config is missing required keys:\n\t{', '.join(sorted(missing))}" | ||
| f"\n\nExample config (note user is optional):\n{example}" | ||
| ) |
Comment on lines
+11
to
+12
| label = f"{k.name} (override)" if k.overridden else f"{k.name} (default)" | ||
| print(label) |
Comment on lines
+207
to
+208
| def _is_centos7(self): | ||
| return self.os_variant and self.os_variant.startswith("centos7") |
Comment on lines
+335
to
+339
| try: | ||
| VmCommand.start(vm_name=self.name) | ||
| attempted_start = True | ||
| except RuntimeError: | ||
| pass |
| - sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/CentOS-*.repo | ||
| - [sudo, yum, install, -y, mock, git, vim] | ||
| - [sudo, yum, install, -y, ncurses-devel, make, gcc, bc, bison, flex, elfutils-libelf-devel, openssl-devel] | ||
| - [sudo, yum, update, -y] |
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.
Bunch of changes to enable CentOS7.9
FLAG DAY NOTICE
Depot Channels are now a part of the
.private_repo.yamloverrides as described in the KT readme.This will require moving content that was once in the
kt/data/kernels.yamlotherwise you'll only ever get the VAULT Pinned repos.Testing
Coverage Report