Add image installation disk-space validation helper#4598
Open
rameshraghupathy wants to merge 1 commit into
Open
Add image installation disk-space validation helper#4598rameshraghupathy wants to merge 1 commit into
rameshraghupathy wants to merge 1 commit into
Conversation
Signed-off-by: Ramesh Raghupathy <ram@cisco.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Add reusable image installation disk-space validation helper
Problem:
SONiC image installation workflows currently do not validate free disk
space before starting installation. When disk space is insufficient,
installation may fail silently or leave the filesystem in an unstable
state resulting in unexpected behavior and hard-to-diagnose failures.
Solution:
Add a standalone reusable utility helper for validating minimum free
disk space required for image installation.
Implementation:
Add utilities_common/image_disk_space.py
Add reusable APIs for:
NPU image installation disk-space validation
DPU image installation disk-space validation
Generic image installation validation entrypoint
Read platform-specific thresholds from platform.json:
min_free_disk_in_gb_for_npu_image
min_free_disk_in_gb_for_dpu_image
Fall back to safe default values when keys are missing or invalid
Support validation for:
Regular switch NPU image installation
SmartSwitch NPU image installation
SmartSwitch single/multiple DPU image installation
Add robust validation, logging, parsing, and SSH handling
Add unit tests
This helper is intended to be reused by multiple image-installation
workflows including sonic-installer, gNOI upgrade workflows, ONIE
install workflows, and platform onboarding scripts.
What I did
Added a standalone reusable image installation disk-space validation
helper under utilities_common.
The implementation adds reusable APIs for validating minimum free disk
space required before image installation for:
The implementation also supports platform-specific minimum free disk
thresholds through platform.json using:
If the keys are missing or invalid, the helper falls back to safe
default values.
Added unit tests with high coverage for validation logic, parsing,
platform.json handling, SSH handling, and failure scenarios.
How I did it
Added utilities_common/image_disk_space.py
Added reusable helper APIs:
Added helper functions for:
Added configurable SSH options for DPU checks
Added validation and fallback handling for invalid platform.json values
Added logging for insufficient disk-space and validation failures
Added unit tests under tests/image_disk_space_test.py
How to verify it
Run unit tests:
Verify successful validation:
Verify DPU validation:
Verify platform.json override:
{ "min_free_disk_in_gb_for_npu_image": 16, "min_free_disk_in_gb_for_dpu_image": 12 }Which release branch to backport (provide reason below if selected)
Previous command output (if the output of a command-line utility has changed)
N/A
New command output (if the output of a command-line utility has changed)
N/A