cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Refactor of Allocator classes

Open BryanMLima opened this issue 1 year ago • 46 comments

Description

This PR refactors some *Allocator classes, improving modularity and code legibility. This PR also made some changes to logs across these classes.

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)
  • [x] Cleanup (Code refactoring and cleanup, that may add test cases)
  • [ ] build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [x] Minor

How Has This Been Tested?

I tested the allocation process in my personal lab, using both the RandomAllocator and FirstFitAllocator allocators. I tried some variation of tags and offerings, and everything looks good. Furthermore, I also added a lot of unit tests for the methods that I refactored.

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

BryanMLima avatar May 10 '24 20:05 BryanMLima

Codecov Report

Attention: Patch coverage is 68.89764% with 79 lines in your changes missing coverage. Please review.

Project coverage is 15.85%. Comparing base (1d4700a) to head (b93e998).

Files with missing lines Patch % Lines
...gent/manager/allocator/impl/FirstFitAllocator.java 60.26% 58 Missing and 2 partials :warning:
.../agent/manager/allocator/impl/RandomAllocator.java 84.48% 9 Missing :warning:
...agent/manager/allocator/impl/TestingAllocator.java 0.00% 3 Missing :warning:
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 3 Missing :warning:
.../src/main/java/com/cloud/host/dao/HostDaoImpl.java 0.00% 2 Missing :warning:
...i/command/admin/host/FindHostsForMigrationCmd.java 0.00% 1 Missing :warning:
...loudstack/api/command/admin/host/ListHostsCmd.java 0.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9074      +/-   ##
============================================
+ Coverage     15.81%   15.85%   +0.04%     
- Complexity    12554    12601      +47     
============================================
  Files          5629     5630       +1     
  Lines        492029   491963      -66     
  Branches      62293    63884    +1591     
============================================
+ Hits          77811    77999     +188     
+ Misses       405894   405642     -252     
+ Partials       8324     8322       -2     
Flag Coverage Δ
uitests 4.48% <ø> (ø)
unittests 16.64% <68.89%> (+0.04%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 10 '24 20:05 codecov[bot]

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

github-actions[bot] avatar Jun 19 '24 04:06 github-actions[bot]

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

github-actions[bot] avatar Jul 12 '24 08:07 github-actions[bot]

@blueorangutan package

DaanHoogland avatar Aug 26 '24 08:08 DaanHoogland

@DaanHoogland 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 avatar Aug 26 '24 08:08 blueorangutan

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

blueorangutan avatar Aug 26 '24 09:08 blueorangutan

@blueorangutan LLtest

DaanHoogland avatar Aug 26 '24 13:08 DaanHoogland

@DaanHoogland a [LL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

blueorangutan avatar Aug 26 '24 13:08 blueorangutan

@DaanHoogland a [LL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@DaanHoogland, could you trigger the smoke tests again? They never reported the results back for this one.

BryanMLima avatar Sep 06 '24 11:09 BryanMLima

@blueorangutan package

DaanHoogland avatar Sep 06 '24 11:09 DaanHoogland

@DaanHoogland 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 avatar Sep 06 '24 11:09 blueorangutan

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

blueorangutan avatar Sep 06 '24 12:09 blueorangutan

@blueorangutan test

DaanHoogland avatar Sep 09 '24 06:09 DaanHoogland

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

blueorangutan avatar Sep 09 '24 06:09 blueorangutan

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

Test Result Time (s) Test File
test_01_isolate_network_FW_PF_default_routes_egress_true Failure 110.59 test_routers_network_ops.py
test_02_restore_vm_strict_tags_failure Failure 58.19 test_vm_strict_host_tags.py
test_02_scale_vm_strict_tags_failure Failure 60.31 test_vm_strict_host_tags.py
test_06_deploy_vm_on_any_host_with_strict_tags_failure Failure 5.54 test_vm_strict_host_tags.py
test_hostha_enable_ha_when_host_disabled Error 3.93 test_hostha_kvm.py
test_hostha_enable_ha_when_host_in_maintenance Error 302.07 test_hostha_kvm.py

blueorangutan avatar Sep 09 '24 23:09 blueorangutan

@blueorangutan package

BryanMLima avatar Sep 10 '24 13:09 BryanMLima

@BryanMLima 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 avatar Sep 10 '24 13:09 blueorangutan

@DaanHoogland, could you trigger the smoke tests again? The failed tests in test_vm_strict_host_tags.py were related to the exception message, it should be fixed now. The others do not seem to be related to this PR.

BryanMLima avatar Sep 10 '24 13:09 BryanMLima

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

blueorangutan avatar Sep 10 '24 15:09 blueorangutan

@blueorangutan test

DaanHoogland avatar Sep 11 '24 07:09 DaanHoogland

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

blueorangutan avatar Sep 11 '24 07:09 blueorangutan

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

Test Result Time (s) Test File
test_02_restore_vm_strict_tags_failure Failure 52.04 test_vm_strict_host_tags.py
test_02_scale_vm_strict_tags_failure Failure 55.24 test_vm_strict_host_tags.py

blueorangutan avatar Sep 11 '24 22:09 blueorangutan

@blueorangutan package

BryanMLima avatar Sep 16 '24 13:09 BryanMLima

@BryanMLima 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 avatar Sep 16 '24 13:09 blueorangutan

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

blueorangutan avatar Sep 16 '24 14:09 blueorangutan