Skip to content

Allow removing VMs from instance groups - #14395

Open
nvazquez wants to merge 2 commits into
apache:4.22from
shapeblue:422-fix-instance-groups
Open

nvazquez wants to merge 2 commits into
apache:4.22from
shapeblue:422-fix-instance-groups

Conversation

@nvazquez

Copy link
Copy Markdown
Contributor

Description

This PR fixes a limitation on the instance groups functionality. Once a VM was added to an instance group, it was not possible to remove it from the group (the workaround was updating the instance_group_vm_map table or removing the VM)

This fix allows passing an empty group parameter on the updateVirtualMachine API to remove the VM from its current instance group

Screenshot 2026-10-13 at 11 14 46 AM

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?

Tested updating VM group via UI to existing instance groups and to the empty field to remove the VM from its current group.

How did you try to break this feature and the system with this change?

@nvazquez

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@nvazquez 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 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19538

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.02%. Comparing base (dfff32e) to head (d8c8dea).
⚠️ Report is 1 commits behind head on 4.22.

Files with missing lines Patch % Lines
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 33.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #14395   +/-   ##
=========================================
  Coverage     18.01%   18.02%           
- Complexity    16265    16274    +9     
=========================================
  Files          5936     5936           
  Lines        536395   536401    +6     
  Branches      65701    65704    +3     
=========================================
+ Hits          96658    96708   +50     
+ Misses       428710   428664   -46     
- Partials      11027    11029    +2     
Flag Coverage Δ
uitests 4.04% <ø> (-0.01%) ⬇️
unittests 19.10% <33.33%> (+<0.01%) ⬆️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

addInstanceToGroup(id, group);
} else if (group != null) {
// Allow removing an instance from its group when passing an empty group on update
removeInstanceFromInstanceGroup(vm.getId());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should the api doc for group say an empty value takes the instance out of its group? cmk and terraform users wont find it otherwise

addInstanceToGroup(id, group);
} else if (group != null) {
// Allow removing an instance from its group when passing an empty group on update
removeInstanceFromInstanceGroup(vm.getId());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we add a unit test for the empty group case? this new path isnt covered

@nvazquez

Copy link
Copy Markdown
Contributor Author

Thanks @Damans227 - review comments addressed

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@nvazquez 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 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19541

@nvazquez

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

This branch has not been deployed

No deployments
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.

3 participants