Skip to content

Fix VMWare leftovers when deleting VM without root disk#9735

Merged
DaanHoogland merged 2 commits intoapache:4.19from
scclouds:main-cleanup-vmware-zombies
Feb 9, 2025
Merged

Fix VMWare leftovers when deleting VM without root disk#9735
DaanHoogland merged 2 commits intoapache:4.19from
scclouds:main-cleanup-vmware-zombies

Conversation

@gp-santos
Copy link
Copy Markdown
Contributor

Description

The MS sends the destroy/delete command of a VM to vCenter when cleaning up its volumes. If the VM does not have a root volume, the VM with its folder and metadata files remain in vCenter.

To reproduce, deploy a VM, detach its volume, and delete the VM. Then, check vCenter and the VM will still be there.

This PR fixes it by implementing finalizeExpunge for VMWareGuru, which queues a Cleanup Command that, if the VM still exists, sends a destroy command to vCenter to cleanup whatever remained.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Deploy VM Destroy VM Before PR After PR
Without data disks, detach root disk. With expunge VM remains on vCenter ❌ VM gone from vCenter ✅
Without data disks, detach root disk. Without expunge VM remains on vCenter ✅ VM remains on vCenter ✅
Without data disks, detach nothing With expunge VM gone from vCenter ✅ VM gone from vCenter ✅
With a data disk, detach root disk With expunge, without selecting data disk VM remains on vCenter ❌ VM gone from vCenter ✅
With a data disk, detach root disk With expunge, selecting the data disk VM remains on vCenter ❌ VM gone from vCenter ✅
With a data disk, detach nothing With expunge, without selecting the data disk VM gone from vCenter ✅ VM gone from vCenter ✅

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 31 lines in your changes missing coverage. Please review.

Project coverage is 15.08%. Comparing base (89482a2) to head (14fd10e).
Report is 147 commits behind head on 4.19.

Files with missing lines Patch % Lines
...ain/java/com/cloud/agent/api/CleanupVMCommand.java 0.00% 13 Missing ⚠️
...oud/hypervisor/vmware/resource/VmwareResource.java 0.00% 11 Missing and 1 partial ⚠️
...ain/java/com/cloud/hypervisor/guru/VMwareGuru.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              4.19    #9735       +/-   ##
============================================
+ Coverage     4.76%   15.08%   +10.31%     
- Complexity       0    11188    +11188     
============================================
  Files          366     5403     +5037     
  Lines        29525   473174   +443649     
  Branches      5167    59662    +54495     
============================================
+ Hits          1408    71379    +69971     
- Misses       28111   393852   +365741     
- Partials         6     7943     +7937     
Flag Coverage Δ
uitests 4.30% <ø> (-0.47%) ⬇️
unittests 15.80% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm, needs testing.

Copy link
Copy Markdown
Contributor

@nvazquez nvazquez left a comment

Choose a reason for hiding this comment

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

Code LGTM

@vladimirpetrov
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@vladimirpetrov a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11557

@vladimirpetrov vladimirpetrov removed their assignment Dec 11, 2024
@DaanHoogland DaanHoogland self-assigned this Jan 31, 2025
@apache apache deleted a comment from blueorangutan Feb 7, 2025
Copy link
Copy Markdown
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

@apache apache deleted a comment from blueorangutan Feb 7, 2025
@DaanHoogland DaanHoogland removed their assignment Feb 9, 2025
@DaanHoogland DaanHoogland merged commit 58a63f6 into apache:4.19 Feb 9, 2025
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jun 19, 2025
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.

7 participants