Skip to content

Conversation

@weizhouapache
Copy link
Member

@weizhouapache weizhouapache commented Dec 5, 2024

This fixes an issue during upgrade in edge case.

Steps to reproduce the issue

  • deploy an env with ACS 4.18
  • the env has multiple hypervisors: KVM and VMware
  • the env has multiple secondary storages: sec1 and sec2
  • register the new 4.19.1 systemvm template for VMware (systemvm-vmware-4.19.1), but mistakely as a private template.
  • the systemvm template is downloaded to sec2 (not sec1). If it is downloaded to sec1, remove it and re-register the template.
  • backup the cloudstack databases by
mysqldump -R cloud -p >cloud.db
mysqldump -R cloud_usage -p >cloud_usage.db
  • install ACS 4.19.1.2 and start mgmt server

Without this PR, got an NPE during mgmt server start

2024-10-29 12:46:53,904 ERROR [c.c.u.SystemVmTemplateRegistration] (main:null) (logid:) Failed to register template for hypervisor: VMware
java.lang.NullPointerException
        at com.cloud.upgrade.SystemVmTemplateRegistration.updateTemplateDetails(SystemVmTemplateRegistration.java:519)
        at com.cloud.upgrade.SystemVmTemplateRegistration.performTemplateRegistrationOperations(SystemVmTemplateRegistration.java:640)
        at com.cloud.upgrade.SystemVmTemplateRegistration.registerTemplate(SystemVmTemplateRegistration.java:650)
        at com.cloud.upgrade.SystemVmTemplateRegistration$4.doInTransactionWithoutResult(SystemVmTemplateRegistration.java:789)
        at com.cloud.utils.db.TransactionCallbackNoReturn.doInTransaction(TransactionCallbackNoReturn.java:25)

Description

This PR...

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?

This fixes an issue during upgrade in edge case.

Steps to reproduce the issue
- deploy an env with ACS 4.18
- the env has multiple hypervisors: KVM and VMware
- the env has multiple secondary storages: sec1 and sec2
- register the new 4.19.1 systemvm template for VMware (systemvm-vmware-4.19.1), but mistakely as a private template.
- the systemvm template is downloaded to sec2 (not sec1). If it is downloaded to sec1, remove it and re-register the template.
- backup the cloudstack databases by `mysqldump -R cloud` and `mysqldump -R cloud_usage`
- install ACS 4.19.1.2 and start mgmt server

Without this PR, got an NPE during mgmt server start
```
2024-10-29 12:46:53,904 ERROR [c.c.u.SystemVmTemplateRegistration] (main:null) (logid:) Failed to register template for hypervisor: VMware
java.lang.NullPointerException
        at com.cloud.upgrade.SystemVmTemplateRegistration.updateTemplateDetails(SystemVmTemplateRegistration.java:519)
        at com.cloud.upgrade.SystemVmTemplateRegistration.performTemplateRegistrationOperations(SystemVmTemplateRegistration.java:640)
        at com.cloud.upgrade.SystemVmTemplateRegistration.registerTemplate(SystemVmTemplateRegistration.java:650)
        at com.cloud.upgrade.SystemVmTemplateRegistration$4.doInTransactionWithoutResult(SystemVmTemplateRegistration.java:789)
        at com.cloud.utils.db.TransactionCallbackNoReturn.doInTransaction(TransactionCallbackNoReturn.java:25)
```
@weizhouapache weizhouapache added this to the 4.19.2 milestone Dec 5, 2024
@codecov
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

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

Project coverage is 15.13%. Comparing base (03bdf11) to head (e2221b0).
Report is 38 commits behind head on 4.19.

Files with missing lines Patch % Lines
...om/cloud/upgrade/SystemVmTemplateRegistration.java 0.00% 13 Missing ⚠️
...ain/java/com/cloud/storage/StorageManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19   #10046      +/-   ##
============================================
+ Coverage     15.10%   15.13%   +0.02%     
- Complexity    11220    11272      +52     
============================================
  Files          5404     5408       +4     
  Lines        473460   473960     +500     
  Branches      57728    57811      +83     
============================================
+ Hits          71525    71723     +198     
- Misses       393941   394219     +278     
- Partials       7994     8018      +24     
Flag Coverage Δ
uitests 4.30% <ø> (-0.01%) ⬇️
unittests 15.85% <0.00%> (+0.02%) ⬆️

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.

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache 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

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

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache 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

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

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@weizhouapache with or without this PR I get a result like this:
image
note that the vmware template is still marked as user.

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

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

@weizhouapache
Copy link
Member Author

@DaanHoogland
thanks for the testing
Added your changes to this PR to fix the issue e2221b0

@weizhouapache with or without this PR I get a result like this: image note that the vmware template is still marked as user.

@blueorangutan
Copy link

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

@weizhouapache
Copy link
Member Author

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

[SF] Trillian test result (tid-12065)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 51615 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10046-t12065-kvm-ol8.zip
Smoke tests completed. 132 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_list_cpvm_vm Failure 0.05 test_ssvm.py
test_04_cpvm_internals Failure 0.05 test_ssvm.py

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

code looks good and tested upgrades to 4.19 head (npe) and to this PR (good upgrade)
used two hypervisortypes - vmware and xcpng

@weizhouapache weizhouapache marked this pull request as ready for review January 10, 2025 17:34
Copy link
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 - haven’t tested it though. It would also worth verifying upgrades on single hypervisor and single secondary storage for any regressions

@blueorangutan
Copy link

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

Test Result Time (s) Test File

@DaanHoogland
Copy link
Contributor

DaanHoogland commented Jan 13, 2025

Code LGTM - haven’t tested it though. It would also worth verifying upgrades on single hypervisor and single secondary storage for any regressions

I have tested that, but 3rd party testing would be good.

err: I was the 3rd party already ;)

To be clear, I tested with xcpng+vmware and vmware+kvm and with vmware alone. All of them passed.

@DaanHoogland DaanHoogland merged commit 7adc732 into apache:4.19 Jan 13, 2025
25 of 26 checks passed
@DaanHoogland DaanHoogland deleted the 4.19-fix-upgrade-multi-hypervisors-and-secondary branch January 13, 2025 08:29
DaanHoogland added a commit that referenced this pull request Jan 13, 2025
* 4.20:
  systemvm: fix keystore is reset when patch a systemvm (#9900)
  no retrieval of null hosts (#10175)
  upgrade: consider multiple hypervisors and secondary storages (#10046)
  CheckOnHostCommand: add missing timeout setting (#9677)
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jan 16, 2025
rg9975 pushed a commit to rg9975/cloudstack that referenced this pull request Jan 31, 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.

4 participants