-
Notifications
You must be signed in to change notification settings - Fork 211
Azure : Added unmanaged VHD cleanup while deleting resource group #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
71c4d25
to
f0ecfe1
Compare
@iamshital Thanks for implementing this, I have a tested, seems it only delete the VM in the RG. |
@iamshital @LiliDeng @lizzha please review and sign off |
@juhlee-microsoft , I'm blocked actually for this PR. |
A new approach has been implemented. I've done the basic testing. It is working. |
05e7d01
to
5e6591f
Compare
Removed the DO NOT MERGE. PR is ready to review. |
PR is still under test. Will PR review with the result. |
|
||
[void] RunTestCleanup() { | ||
# Wait till all the cleanup background jobs successfully started cleanup of resource groups. | ||
$DeleteResourceGroupJobs = Get-Job | Where-Object { $_.Name -imatch "DeleteResourceGroup" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember we had a discussion that we don't want to wait for the jobs to complete, to save the execution time.
Can we just leave the jobs running, and don't wait for them to complete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lizzha , Yes I've considered this.
In case of managed disks, there will not be any jobs waiting.
In case of unmanaged disks, We wait till the VMs + Disks are deleted. After that, resource group cleanup starts, and LISAv2 continues...
If we don't wait, then job may get terminated, and VHD's will not be removed.
And, This block of code executes at the end of LISAv2 only.
Till now, I've observed that it may wait upto 2 minutes.
Libraries/Azure.psm1
Outdated
|
||
# Give at least 30 seconds to start all the VM cleanup operations. | ||
# Timeout is adjusted based on number of VMs. | ||
$MaxAttempts = 10 + $VMs.Count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how long does it usually take to start all the cleanup operations? We don't want it to increase the execution time too much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It usually takes less than 15 seconds.
Works well, segment of log from pipeline
segment of log from local
|
87f005c
to
850d94a
Compare
Scenario 1 - Delete 2 VMs with unmanaged VHDs
Total VM Clenaup time : 15 seconds. (VHD cleanup continues in background after this) Scenario 2 - Delete 32 VMs with unmanaged VHDs
Total VM Clenaup time : 23 seconds. (VHD cleanup continues in background after this) Scenario 3 : Delete VMs with managed disks (No change in execution time)
|
In recent change -
|
Logs from latest changes -
|
@juhlee-microsoft @LiliDeng Can you review and approve? |
This PR addresses the issues of - "Unmanaged VHDs are left behind, after Resource group deletion"
Now, LISAv2 will immediately remove all unmanaged VHDs (OSDisks and DataDisks) immediately without needing to rely on external cleanup job.