apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.11k stars 1.11k forks source link

Host capacity calculation: use VM creation time if update time is null. #9662

Closed mprokopchuk closed 2 months ago

mprokopchuk commented 2 months ago

CapacityManagementImpl.updateCapacityForHost(..) use VM update time in capacity calculation.

VM update time is nullable in DB and can cause NullPointerException if record in vm_instance has defined last_host_id and undefined update_time.

Added logic to check whether update_time is null and use created time instead (which is not null).

Description

Types of changes

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

Bug Severity

Screenshots (if appropriate):

How Has This Been Tested?

Tested manually.

mprokopchuk commented 2 months ago

@blueorangutan package

blueorangutan commented 2 months ago

@mprokopchuk 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 commented 2 months ago

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

mprokopchuk commented 2 months ago

@blueorangutan test

sureshanaparti commented 2 months ago

@blueorangutan package

blueorangutan commented 2 months ago

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

codecov[bot] commented 2 months ago

Codecov Report

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

Project coverage is 15.77%. Comparing base (501d8c1) to head (90c6eed). Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...n/java/com/cloud/capacity/CapacityManagerImpl.java 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #9662 +/- ## ============================================ - Coverage 15.77% 15.77% -0.01% Complexity 12538 12538 ============================================ Files 5621 5621 Lines 491556 491557 +1 Branches 60227 62130 +1903 ============================================ Hits 77562 77562 - Misses 405537 405538 +1 Partials 8457 8457 ``` | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/9662/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/9662/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.05% <ø> (ø)` | | | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/9662/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `16.59% <0.00%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.

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

blueorangutan commented 2 months ago

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

sureshanaparti commented 2 months ago

@blueorangutan package

blueorangutan commented 2 months ago

@sureshanaparti 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 commented 2 months ago

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

rohityadavcloud commented 2 months ago

@JoaoJandre since this is a bugfix, causing NPE exception can we consider it?

kiranchavala commented 2 months ago

@blueorangutan test

blueorangutan commented 2 months ago

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

blueorangutan commented 2 months ago

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

Test Result Time (s) Test File
test_01_secure_vm_migration Error 134.14 test_vm_life_cycle.py
test_01_secure_vm_migration Error 134.14 test_vm_life_cycle.py
test_01_VPC_nics_after_destroy Error 787.03 test_vpc_router_nics.py
test_02_VPC_default_routes Error 39.51 test_vpc_router_nics.py
ContextSuite context=TestVPCNics>:teardown Error 81.67 test_vpc_router_nics.py
test_01_redundant_vpc_site2site_vpn Failure 982.35 test_vpc_vpn.py
test_01_redundant_vpc_site2site_vpn Error 982.36 test_vpc_vpn.py
ContextSuite context=TestRVPCSite2SiteVpn>:teardown Error 1027.31 test_vpc_vpn.py
test_01_vpc_site2site_vpn_multiple_options Failure 865.00 test_vpc_vpn.py
test_01_vpc_site2site_vpn_multiple_options Error 865.01 test_vpc_vpn.py
ContextSuite context=TestVPCSite2SiteVPNMultipleOptions>:teardown Error 1163.87 test_vpc_vpn.py
ContextSuite context=TestVpcRemoteAccessVpn>:setup Error 1258.69 test_vpc_vpn.py
test_01_vpc_site2site_vpn Failure 1382.50 test_vpc_vpn.py
test_01_vpc_site2site_vpn Error 1382.52 test_vpc_vpn.py
ContextSuite context=TestVpcSite2SiteVpn>:teardown Error 1421.17 test_vpc_vpn.py
all_test_webhook_delivery Skipped --- test_webhook_delivery.py
all_test_webhook_lifecycle Skipped --- test_webhook_lifecycle.py
all_test_host_maintenance Skipped --- test_host_maintenance.py
all_test_hostha_kvm Skipped --- test_hostha_kvm.py