Skip to content

Conversation

@peppi-lotta
Copy link
Member

This PR introduces a script ipa_debug_tools.sh that provides a set of utilities to assist with debugging and comparing IPA (ironic-python-agent) initramfs builds. The script is particularly useful for identifying differences between locally built IPA images and the official master images.

This tool is meant especially for situations where built IPA size get over a certain limit limit and two file systems need to be compared.


🛠️ What's Included

  • set_up_debug_dirs

    • Sets up a local debug environment under /tmp/debug-initramfs
    • Builds the local IPA using jenkins/scripts/dynamic_worker_workflow/build_ipa.sh
    • Downloads and extracts the master IPA image from upstream
  • compare_dir_sizes [path]

    • Compares sizes of files/directories between the local build and master IPA
    • Provides a colored, sorted table of size differences
    • Highlights large discrepancies (10MB+, 1MB+, etc.)
    • Lists files exclusive to either initramfs tree
image
  • compare_rpm_packages
    • Extracts and compares installed RPMs between local and master IPA environments
    • Outputs side-by-side view of mismatched or missing packages
    • Helps identify unintended package changes
image
  • clean_up_debug_dirs
    • Deletes all temporary directories and files created during debugging

@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 29, 2025
@peppi-lotta peppi-lotta force-pushed the peppi-lotta/add-ipa-debug-tool branch 2 times, most recently from 4c2b687 to 9e9d4b4 Compare July 30, 2025 06:15
Copy link
Member

@Rozzii Rozzii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general LGTM,
It is a very useful tool as I have mentioned offline.
I have one improvement proposal but it can be a later addition if you don't feel like implementing it now.

sudo mkdir -p /tmp/debug-initramfs/master-ipa-initramfs
cd /tmp/debug-initramfs || exit
sudo wget https://tarballs.opendev.org/openstack/ironic-python-agent/dib/ipa-centos9-master.tar.gz
sudo tar -xzf ipa-centos9-master.tar.gz
Copy link
Member

@Rozzii Rozzii Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if the upstream IPA URI and tar file name could be customized same as in IPA downloader, you could actually use IPA downloader here instead of your own download logic to keep it simple .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For debug tool, it might be good enough to be able to supply the URL. get-resource.sh vs one-liner... I'd go for the latter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine either way, but the url and the name of the tar file has to be customizable because otherwise only a specific master on a specific base image can be tested. I suggested to use the downloader because that has all the customization options implemented but I am fine with doing it with the one liners too.

@Rozzii
Copy link
Member

Rozzii commented Jul 31, 2025

/override metal3-ubuntu-e2e-integration-test-main
This is a hacktool for manual testing, not used in CI jet.

@metal3-io-bot
Copy link
Collaborator

@Rozzii: Overrode contexts on behalf of Rozzii: metal3-ubuntu-e2e-integration-test-main

Details

In response to this:

/override metal3-ubuntu-e2e-integration-test-main
This is a hacktool for manual testing, not used in CI jet.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Rozzii Rozzii moved this to MISC WIP in Metal3 - Roadmap Jul 31, 2025
Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great addition to debug tools, thanks @peppi-lotta.

Some cleanup to do, some minor syntax things to fix and some suggestions to make it more readable and maintainable.

sudo mkdir -p /tmp/debug-initramfs/master-ipa-initramfs
cd /tmp/debug-initramfs || exit
sudo wget https://tarballs.opendev.org/openstack/ironic-python-agent/dib/ipa-centos9-master.tar.gz
sudo tar -xzf ipa-centos9-master.tar.gz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For debug tool, it might be good enough to be able to supply the URL. get-resource.sh vs one-liner... I'd go for the latter.

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/add-ipa-debug-tool branch 2 times, most recently from 00054eb to 7a7af56 Compare September 29, 2025 09:51
# -----------------------------------------------------------------------------
clean_up_debug_dirs() {
# Clean up debug directories
sudo rm -rf "${BASE_DEBUG_DIR}" /tmp/dib ipa-file-injector.service 2> /dev/null
Copy link
Member

@Rozzii Rozzii Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get "${BASE_DEBUG_DIR}" and /tmp/dib but how does ipa-file-injector.service end up here?
I don't see any other reference to that file, and AFAIK that is the systemd unit file of the similarly named DIB module. It could be that I am missing something here but looks like this is some leftover reference maybe.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipa-file-injector.service appears in the /tmp directory after running the build-ip.sh. That is why I've added that to the clean up as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, that might be then some sort of residue from the template rendering process. I might remove it later, but then it is fine to remove it here.

Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO colors are fine, but emojis not.

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/add-ipa-debug-tool branch from 7a7af56 to 27494cb Compare October 3, 2025 07:16
Copy link
Member

@Rozzii Rozzii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 7, 2025
@peppi-lotta
Copy link
Member Author

@tuminoid I've addressed all comment can you approve and override test?

@tuminoid
Copy link
Member

It doesn't work?

2025-10-20 07:35:48.405 | + diskimage_builder/lib/common-functions:tmpfs_check:29                            :   return 0
2025-10-20 07:35:48.409 | + diskimage_builder/lib/common-functions:cleanup_image_dir:236                     :   timeout 120 sh -c 'while ! sudo umount -f /tmp/dib_image.Jc5gaKZ3; do sleep 1; done'
2025-10-20 07:35:48.426 | + diskimage_builder/lib/common-functions:cleanup_image_dir:241                     :   rm -rf --one-file-system /tmp/dib_image.Jc5gaKZ3
2025-10-20 07:35:48.431 | + diskimage_builder/lib/img-functions:trap_cleanup:37                              :   exit 1
Command '['disk-image-create', '-o', 'ironic-python-agent', 'ironic-python-agent-ramdisk', 'centos', 'dynamic-login', 'journal-to-console', 'devuser', 'openssh-server', 'extra-hardware', 'ipa-module-autoload', 'ipa-add-buildinfo', 'ipa-cleanup-dracut', 'simple-init', 'override-simple-init', 'ipa-file-injector', 'cleanup-package', '-x']' returned non-zero exit status 1.
build_ipa.sh failed, will check for artifact...
Required file '/tmp/dib/ironic-python-agent.initramfs' not created, exiting.

Running the test with using default options (centos10 master, opendev dib url).

Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly fond of that it just asks for sudo password and then goes and installs stuff on the system. Installing anything should be another "subcommand" that user must run explicitly.

The sudo usage in general is also very liberal (please don't run sudo wget and sudo tar .... Making a temporary directory with sudo is not typical either.

Sudo chroot also is not needed.

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/add-ipa-debug-tool branch from 27494cb to 7aa7038 Compare December 10, 2025 12:31
@metal3-io-bot
Copy link
Collaborator

New changes are detected. LGTM label has been removed.

@metal3-io-bot metal3-io-bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 10, 2025
@peppi-lotta peppi-lotta force-pushed the peppi-lotta/add-ipa-debug-tool branch from 7aa7038 to aba76fb Compare December 10, 2025 12:36
@tuminoid tuminoid requested a review from Copilot December 12, 2025 06:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a comprehensive debugging tool ipa_debug_tools.sh to help developers compare locally built IPA (ironic-python-agent) initramfs images against official master images, particularly useful when troubleshooting size limit issues.

Key changes:

  • New shell script with four main functions for IPA initramfs comparison and debugging
  • Automated environment setup that builds local IPA and downloads master image
  • Visual comparison utilities with color-coded output for size differences and RPM package variations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# set_up_debug_dirs [file] [url]
#
# This ceates a minimal set up in /tmp/debug-initramfs directory for
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'ceates' to 'creates'.

Suggested change
# This ceates a minimal set up in /tmp/debug-initramfs directory for
# This creates a minimal set up in /tmp/debug-initramfs directory for

Copilot uses AI. Check for mistakes.
# ./ipa_debug_tools.sh set_up_debug_dirs ipa-centos10-master.tar.gz
# ./ipa_debug_tools.sh set_up_debug_dirs ipa-centos10-master.tar.gz https://tarballs.opendev.org/openstack/ironic-python-agent/dib/
#
# - [file]: Name of tar file o be downloaded [default: ipa-centos10-master.tar.gz]
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'o' to 'to'.

Suggested change
# - [file]: Name of tar file o be downloaded [default: ipa-centos10-master.tar.gz]
# - [file]: Name of tar file to be downloaded [default: ipa-centos10-master.tar.gz]

Copilot uses AI. Check for mistakes.
Comment on lines 20 to 21
# ./ipa_debug_tools.sh set_up_debug_dirs ipa-centos10-master.tar.gz
# ./ipa_debug_tools.sh set_up_debug_dirs ipa-centos10-master.tar.gz https://tarballs.opendev.org/openstack/ironic-python-agent/dib/
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation examples reference 'ipa-centos10-master.tar.gz', but line 27 uses 'ipa-centos9-master.tar.gz' as the default value. This inconsistency could confuse users. Consider either updating the examples to match the default or updating the default to match the examples.

Copilot uses AI. Check for mistakes.
export TEST_IN_CI="false"

# Build ipa with build_ipa.sh. Search for the script in a path that is
# relative to this files location.
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'files' to 'file's'.

Suggested change
# relative to this files location.
# relative to this file's location.

Copilot uses AI. Check for mistakes.

# After debugging and comparison operations, temporary directories can be cleaned up.
# This function removes the build and master filesystems. If this operation is run
# the set_up_debug_dirs needs to be run again to create the compareble filesystems.
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'compareble' to 'comparable'.

Suggested change
# the set_up_debug_dirs needs to be run again to create the compareble filesystems.
# the set_up_debug_dirs needs to be run again to create the comparable filesystems.

Copilot uses AI. Check for mistakes.
}

# Print a rpm package list. The print omits packages that are identical in both
#the built ipa and master.
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after comment marker '#'. Add a space for consistency with other comments in the file.

Suggested change
#the built ipa and master.
# the built ipa and master.

Copilot uses AI. Check for mistakes.
Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fix the typo nits by the bot.

/approve
/hold

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 12, 2025
@metal3-io-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tuminoid

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2025
@peppi-lotta peppi-lotta force-pushed the peppi-lotta/add-ipa-debug-tool branch from aba76fb to 46501da Compare December 16, 2025 14:04
@tuminoid
Copy link
Member

/override metal3-ubuntu-e2e-integration-test-main
/cc @Rozzii

@metal3-io-bot metal3-io-bot requested a review from Rozzii December 16, 2025 14:20
@metal3-io-bot
Copy link
Collaborator

@tuminoid: Overrode contexts on behalf of tuminoid: metal3-ubuntu-e2e-integration-test-main

Details

In response to this:

/override metal3-ubuntu-e2e-integration-test-main
/cc @Rozzii

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: MISC WIP

Development

Successfully merging this pull request may close these issues.

4 participants