Skip to content

Conversation

@bprasadv
Copy link

@bprasadv bprasadv commented Dec 16, 2025

@yanqzhan Please review the changes.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed conditional logic in migration cleanup for external TPM setups so the correct restoration path runs.
    • Expanded cleanup to restore additional TPM-related components (including the TPM helper binary), improving migration reliability and system state consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

Walkthrough

This change modifies the cleanup_test function in the migration vTPM test file. The conditional that controlled execution of restorecon commands is inverted from if image_mode to if not image_mode, changing which path runs the restoration steps. In the non-image-mode path an additional restorecon call for /usr/bin/swtpm is added (invoked via process.run), so SELinux context restoration now targets both the swtpm binary and the existing setup binary in that branch.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the inverted image_mode condition matches intended test semantics and is consistent with other uses of image_mode.
  • Confirm the added process.run call restoring /usr/bin/swtpm is correct, necessary for the environment, and does not introduce permission or path assumptions.
  • Check for any missing error handling or logging around the new process.run invocation.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: fixing a label issue in migration_with_external_tpm by correcting the image_mode condition.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf1959d and 560261e.

📒 Files selected for processing (1)
  • libvirt/tests/src/migration/migration_with_vtpm/migration_with_external_tpm.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libvirt/tests/src/migration/migration_with_vtpm/migration_with_external_tpm.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bprasadv bprasadv changed the title changes added in the if block of cleanup function migration_with_external_tpm: fix label issue The auto cases under migration_with_external_tpm are failing because correct label is not getting attached to it due to image_mode condition, changing if condition to not image_mode sets the /usr/bin/swtpm_setup correct label, which fixes the failed cases. Dec 16, 2025
@bprasadv bprasadv changed the title migration_with_external_tpm: fix label issue The auto cases under migration_with_external_tpm are failing because correct label is not getting attached to it due to image_mode condition, changing if condition to not image_mode sets the /usr/bin/swtpm_setup correct label, which fixes the failed cases. migration_with_external_tpm: fix label issue Dec 16, 2025
@bprasadv
Copy link
Author

     The auto cases under migration_with_external_tpm are failing because correct label is not getting attached to it due to image_mode condition, changing if condition to not image_mode sets the /usr/bin/swtpm_setup correct label, which fixes the failed cases.

    The auto cases under migration_with_external_tpm are failing because correct label is not getting attached to it due to image_mode condition,
    changing if condition to not image_mode sets the /usr/bin/swtpm_setup correct label, which fixes the failed cases.
Copy link
Contributor

@yanqzhan yanqzhan left a comment

Choose a reason for hiding this comment

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

LGTM. thanks for fixing this logic issue.

Copy link
Contributor

@chunfuwen chunfuwen left a comment

Choose a reason for hiding this comment

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

lgtm

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants