Skip to content

[AI Generated] BugFix: Skip resource disk readme check when cloud-init manages the disk#4417

Open
johnsongeorge-w wants to merge 1 commit intomainfrom
bugfix/resource-disk-readme-cloud-init_140426_235050
Open

[AI Generated] BugFix: Skip resource disk readme check when cloud-init manages the disk#4417
johnsongeorge-w wants to merge 1 commit intomainfrom
bugfix/resource-disk-readme-cloud-init_140426_235050

Conversation

@johnsongeorge-w
Copy link
Copy Markdown
Collaborator

Summary

When cloud-init manages the resource disk (e.g. on Debian 12, SUSE), it does not create the DATALOSS_WARNING_README.txt file — only waagent does. This caused verify_resource_disk_readme_file to fail with an assertion error on cloud-init managed distros.

The fix checks whether the readme file is absent and cloud-init is managing the resource disk. If so, the test is skipped with a descriptive message instead of failing.

Validation Results

Image Result
Debian debian-12 12 latest SKIPPED (expected — cloud-init managed)
Canonical ubuntu-24_04-lts server latest PASSED

Copilot AI review requested due to automatic review settings April 15, 2026 07:08
Copy link
Copy Markdown
Contributor

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

Note

Copilot was unable to run its full agentic suite in this review.

Updates the Azure image standard test to avoid failing when DATALOSS_WARNING_README.txt is missing on distros where cloud-init (not waagent) manages the resource disk.

Changes:

  • Import and use a cloud-init detection helper.
  • Skip verify_resource_disk_readme_file when the README is absent and cloud-init is enabled, instead of asserting.

Comment on lines 1470 to 1477
file_exists = node.tools[Ls].path_exists(file_path, sudo=True)
if not file_exists and is_cloud_init_enabled(node):
raise SkippedException(
f"{file_path} is not present. DATALOSS_WARNING_README.txt is"
" created by waagent, not cloud-init. Skipping on cloud-init"
" managed resource disk."
)
assert_that(file_exists, f"{file_path} should be present").is_true()
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

is_cloud_init_enabled(node) is likely broader than "cloud-init manages the resource disk" (cloud-init can be enabled while waagent still manages/initializes the resource disk). This can cause false skips and hide regressions where the README should exist. Suggest tightening the condition to specifically detect resource-disk management (e.g., check waagent config/state that resource disk handling is delegated/disabled, or a cloud-init setting indicating it owns the resource disk) and only skip in that case.

Copilot uses AI. Check for mistakes.
Ubuntu,
)
from lisa.sut_orchestrator import AZURE, HYPERV, QEMU, READY
from lisa.sut_orchestrator.azure.common import is_cloud_init_enabled
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

Importing is_cloud_init_enabled from the Azure orchestrator layer couples this test suite logic to orchestrator internals. If this check is OS/tool-level (cloud-init presence/config), consider exposing it via a tool (e.g., node.tools[CloudInit]) or a testsuite-local helper to reduce cross-layer dependencies and make the check reusable outside Azure-orchestrator contexts.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

1 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Count
✅ Passed 1
❌ Failed 0
⏭️ Skipped 0
Total 1
Test case details
Test Case Status Time (s) Message
verify_resource_disk_readme_file (lisa_0_0) ✅ PASSED 15.591

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants