Skip to content

Fix/cloud init shutdown support#5038

Open
deepakshirkem wants to merge 3 commits into
canonical:mainfrom
deepakshirkem:fix/cloud-init-shutdown-support
Open

Fix/cloud init shutdown support#5038
deepakshirkem wants to merge 3 commits into
canonical:mainfrom
deepakshirkem:fix/cloud-init-shutdown-support

Conversation

@deepakshirkem

Copy link
Copy Markdown
Contributor

This PR replaces #4695, which was automatically closed after I accidentally deleted my fork repository.

The changes are the same as in the original PR. Recreating the PR so @tobe2098 can pull the changes into another branch as requested.

Detect when cloud-init uses power_state mode poweroff/halt and treat
as successful launch instead of timeout.

Created expects_shutdown_from_cloud_init() helper function.
Implemented in all backend constructors and detect_aborted_start.
Handles intentional shutdown in wait functions.
Fixes VirtualBox current_state to detect stopped state immediately.

Fixes canonical#4456

[daemon] Move parsing to backend constructors

[backends] Add shutdown detection to all
Created expects_shutdown_from_cloud_init() helper function.
Implemented in all backend constructors and detect_aborted_start.
Handles intentional shutdown in wait functions.

[review] Address review feedback

- Restore missing 'starting' state check in VirtualBox current_state
- Fix VirtualBox current_state to detect stopped state immediately
- Remove duplicate TODO comment in wait_for_cloud_init
- Remove extra newline in wait_for_cloud_init
- Add if constexpr check to only treat IntentionalShutdownException
  as success for LaunchRequest, not StartRequest

[review] Fix whitespace and test failure

- Remove trailing whitespace (per GIT9)
- Add expected_shutdown check to detect_aborted_start
- Fixes BaseVM.waitForCloudInitVMDownReconnects test
- Remove early return for intentional shutdown during launch
- Save mount configuration even when VM is stopped
- Skip mount activation if VM not running
- Fix missing braces in detect_aborted_start
- Apply clang-format to all modified files

Ensures mounts are ready when VM starts later.
All tests passing including BaseVM.waitForCloudInitVMDownReconnects.
Add extra current_state() call expectation to match
additional state check in wait_for_cloud_init.
@tobe2098

tobe2098 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Done

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.

2 participants