Skip to content

Consider Instance in Starting state as well for allocation algorithm - #11751

Merged
weizhouapache merged 2 commits into
apache:4.20from
shapeblue:considerStartingAllocate
Oct 2, 2025
Merged

Consider Instance in Starting state as well for allocation algorithm#11751
weizhouapache merged 2 commits into
apache:4.20from
shapeblue:considerStartingAllocate

Conversation

@sudo87

Copy link
Copy Markdown
Contributor

Description

This PR fixes#11606

With this change, allocation algorithm will take Instance in starting state as well for allocation.

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?

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

@sudo87
sudo87 changed the base branch from main to 4.20September 29, 2025 10:54
@codecov

codecovBot commented Sep 29, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.17%. Comparing base (5dfeb79) to head (5a27bd6).
⚠️ Report is 4 commits behind head on 4.20.

Additional details and impacted files
@@ Coverage Diff @@## 4.20 #11751 +/- ##
============================================
- Coverage 16.17% 16.17% -0.01% 
Complexity 13296 13296 ============================================
Files 5656 5656 Lines 498223 498240 +17 Branches 60454 60457 +3 ============================================
Hits 80577 80577 - Misses 408676 408693 +17 
Partials 8970 8970 
FlagCoverage Δ
uitests4.00% <ø> (-0.01%)⬇️
unittests17.02% <ø> (-0.01%)⬇️

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.

🚀 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.

@weizhouapacheweizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

@sudo87

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@sudo87 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 15222

@sudo87

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@harikrishna-patnalaharikrishna-patnala added this to the 4.20.2 milestone Sep 30, 2025

@shwstpprshwstppr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

code lgtm

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-14477)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 59326 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11751-t14477-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File

Comment threadengine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java Outdated
@sudo87

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@sudo87 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.

@weizhouapacheweizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

@blueorangutan

Copy link
Copy Markdown

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

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-14489)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 29406 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11751-t14489-kvm-ol8.zip
Smoke tests completed. 108 look OK, 0 have errors, 33 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
all_test_routersSkipped---test_routers.py
all_test_safe_shutdownSkipped---test_safe_shutdown.py
all_test_scale_vmSkipped---test_scale_vm.py
all_test_secondary_storageSkipped---test_secondary_storage.py
all_test_service_offeringsSkipped---test_service_offerings.py
all_test_set_sourcenatSkipped---test_set_sourcenat.py
all_test_sharedfs_lifecycleSkipped---test_sharedfs_lifecycle.py
all_test_snapshotsSkipped---test_snapshots.py
all_test_ssvmSkipped---test_ssvm.py
all_test_staticrolesSkipped---test_staticroles.py
all_test_storage_policySkipped---test_storage_policy.py
all_test_templatesSkipped---test_templates.py
all_test_update_security_groupSkipped---test_update_security_group.py
all_test_usage_eventsSkipped---test_usage_events.py
all_test_usageSkipped---test_usage.py
all_test_vm_autoscalingSkipped---test_vm_autoscaling.py
all_test_vm_deployment_plannerSkipped---test_vm_deployment_planner.py
all_test_vm_life_cycleSkipped---test_vm_life_cycle.py
all_test_vm_lifecycle_unmanage_importSkipped---test_vm_lifecycle_unmanage_import.py
all_test_vm_scheduleSkipped---test_vm_schedule.py
all_test_vm_snapshot_kvmSkipped---test_vm_snapshot_kvm.py
all_test_vm_snapshotsSkipped---test_vm_snapshots.py
all_test_vm_strict_host_tagsSkipped---test_vm_strict_host_tags.py
all_test_vnf_templatesSkipped---test_vnf_templates.py
all_test_volumesSkipped---test_volumes.py
all_test_vpc_ipv6Skipped---test_vpc_ipv6.py
all_test_vpc_redundantSkipped---test_vpc_redundant.py
all_test_vpc_router_nicsSkipped---test_vpc_router_nics.py
all_test_vpc_vpnSkipped---test_vpc_vpn.py
all_test_webhook_deliverySkipped---test_webhook_delivery.py
all_test_webhook_lifecycleSkipped---test_webhook_lifecycle.py
all_test_host_maintenanceSkipped---test_host_maintenance.py
all_test_hostha_kvmSkipped---test_hostha_kvm.py

@sudo87

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@weizhouapache

Copy link
Copy Markdown
Member

this PR makes sense to me, however it is difficult to validate
I think we can merge if there is no regression.
what do you think ? @shwstppr@DaanHoogland

@sudo87

sudo87 commented Oct 1, 2025

Copy link
Copy Markdown
ContributorAuthor

@weizhouapache, agreed. It needs testing with larger env. That said, I did a basic validation (suggested in the issue) by spinning off 4 instances in 2 different envs running 4.20, one with this change and other without. Both were configured with userdispersing vm allocation algo.

for i in {01..4}; do cloudstack deployVirtualMachine serviceofferingid=XXX templateid=YYY zoneid=ZZZ name=test-${i} & done

Results:

  • With this change: Instances were evenly distributed across 2 hosts (2-2)
  • w/o: 3 were placed on host1, 1 on host2

@weizhouapache

Copy link
Copy Markdown
Member

@weizhouapache, agreed. It needs testing with larger env. That said, I did a basic validation (suggested in the issue) by spinning off 4 instances in 2 different envs running 4.20, one with this change and other without. Both were configured with userdispersing vm allocation algo.

for i in {01..4}; do cloudstack deployVirtualMachine serviceofferingid=XXX templateid=YYY zoneid=ZZZ name=test-${i} & done

Results:

  • With this change: Instances were evenly distributed across 2 hosts (2-2)
  • w/o: 3 were placed on host1, 1 on host2

@sudo87
can you deploy more (e.g. 20) instances with smaller memory ?

@sudo87

Copy link
Copy Markdown
ContributorAuthor

@weizhouapache, agreed. It needs testing with larger env. That said, I did a basic validation (suggested in the issue) by spinning off 4 instances in 2 different envs running 4.20, one with this change and other without. Both were configured with userdispersing vm allocation algo.

for i in {01..4}; do cloudstack deployVirtualMachine serviceofferingid=XXX templateid=YYY zoneid=ZZZ name=test-${i} & done

Results:

  • With this change: Instances were evenly distributed across 2 hosts (2-2)
  • w/o: 3 were placed on host1, 1 on host2

@sudo87 can you deploy more (e.g. 20) instances with smaller memory ?

End result is same for both envs, each host has 10 instances running. Transition from Initialize -> Starting -> Running is small for a lean image.

@weizhouapache

Copy link
Copy Markdown
Member

End result is same for both envs, each host has 10 instances running. Transition from Initialize -> Starting -> Running is small for a lean image.

ok, so it may happen only if starting vms take a bit long time than usual

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-14491)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 56552 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11751-t14491-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File

@weizhouapache
weizhouapache merged commit ca7138b into apache:4.20Oct 2, 2025
26 checks passed
@DaanHoogland
DaanHoogland deleted the considerStartingAllocate branch October 3, 2025 06:39
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Oct 17, 2025
…gorithm (apache#11751)
* Consider Instance in Starting state as well for allocation algorithm
* use IN instead of OR statement
sandeeplocharla pushed a commit to NetApp/cloudstack that referenced this pull request Oct 21, 2025
…gorithm (apache#11751)
* Consider Instance in Starting state as well for allocation algorithm
* use IN instead of OR statement
Sign up for freeto 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.

Userdispersing algorithm does not consider VMs in starting state

5 participants

@sudo87@blueorangutan@weizhouapache@shwstppr@harikrishna-patnala