hyperv: avoid stale VMs in case of VM setup failures#4373
Merged
anirudhrb merged 1 commit intomicrosoft:mainfrom Mar 30, 2026
Merged
hyperv: avoid stale VMs in case of VM setup failures#4373anirudhrb merged 1 commit intomicrosoft:mainfrom
anirudhrb merged 1 commit intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Hyper-V environment deployment robustness by ensuring partially created VMs are cleaned up when VM setup steps fail, preventing stale VMs from being left on the host.
Changes:
- Moves device passthrough setup and post-boot configuration steps (IP/NAT mapping, SSH connection info, partition expansion) into a guarded block.
- On any setup exception, triggers VM cleanup via
_delete_node()before re-raising the error.
8a56691 to
9293f96
Compare
Failures during initial VM setup steps such as adding NAT mapping, getting IP address, resizing partition, setting up device passthrough etc. would currently result in a stale VM left behind on the host. Catch these failures and clean up the VMs before returning/raising from _deploy_environment(). Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
9293f96 to
5fd9141
Compare
LiliDeng
approved these changes
Mar 23, 2026
Collaborator
|
LGTM |
SRIKKANTH
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Failures during initial VM setup steps such as adding NAT mapping, getting IP address, resizing partition, setting up device passthrough etc. would currently result in a stale VM left behind on the host. Catch these failures and clean up the VMs before returning/raising from _deploy_environment().
Related Issue
Type of Change
Checklist
Test Validation
Key Test Cases:
Impacted LISA Features:
Tested Azure Marketplace Images:
Test Results