[AI Generated] BugFix: Skip resource disk readme check when cloud-init manages the disk#4417
Conversation
…t manages the disk
There was a problem hiding this comment.
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_filewhen the README is absent and cloud-init is enabled, instead of asserting.
| 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() |
There was a problem hiding this comment.
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.
| Ubuntu, | ||
| ) | ||
| from lisa.sut_orchestrator import AZURE, HYPERV, QEMU, READY | ||
| from lisa.sut_orchestrator.azure.common import is_cloud_init_enabled |
There was a problem hiding this comment.
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.
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
Summary
When cloud-init manages the resource disk (e.g. on Debian 12, SUSE), it does not create the
DATALOSS_WARNING_README.txtfile — only waagent does. This causedverify_resource_disk_readme_fileto 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