Skip to content

packaging: add pre-check.sh#11135

Merged
weizhouapache merged 2 commits intoapache:mainfrom
weizhouapache:4.21-add-pre-check
Sep 1, 2025
Merged

packaging: add pre-check.sh#11135
weizhouapache merged 2 commits intoapache:mainfrom
weizhouapache:4.21-add-pre-check

Conversation

@weizhouapache
Copy link
Copy Markdown
Member

@weizhouapache weizhouapache commented Jul 3, 2025

Description

This PR add pre-check to cloudstack-management, cloudstack-agent and cloudstack-usage services

it checks the Java version on the server

  • java11 and java17 are supported
  • java17 is recommended
  • other versions are not supported for now (including java21)

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?

Install openjdk 11, 17 and 21 on the management server

[root@mgmt1 ~]# update-alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           java-17-openjdk.x86_64 (/usr/lib/jvm/java-17-openjdk-17.0.15.0.6-2.0.1.el8.x86_64/bin/java)
   2           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.25.0.9-2.el8.x86_64/bin/java)
 + 3           java-21-openjdk.x86_64 (/usr/lib/jvm/java-21-openjdk-21.0.7.0.6-2.el8.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 
  • Selection 1 (java-17)

this works

[root@mgmt1 ~]# systemctl restart cloudstack-management
[root@mgmt1 ~]# 
  • Selection 2 (java-11)

this works as well

[root@mgmt1 ~]# systemctl restart cloudstack-management
[root@mgmt1 ~]# 

However, in /var/log/cloudstack/management/management-server.out, it has log

WARNING: JAVA version is 11. JAVA 17 is recommended.
  • Selection 3 (java-21)

it does not work

[root@mgmt1 ~]# systemctl restart cloudstack-management
Job for cloudstack-management.service failed because the control process exited with error code.
See "systemctl status cloudstack-management.service" and "journalctl -xe" for details.

in /var/log/cloudstack/management/management-server.out, it has log

ERROR: JAVA 21 is not supported. Currently only JAVA 17 and JAVA 11 are supported.

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

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.35%. Comparing base (3c4f458) to head (a444e0b).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #11135   +/-   ##
=========================================
  Coverage     17.35%   17.35%           
- Complexity    15232    15236    +4     
=========================================
  Files          5888     5888           
  Lines        525733   525733           
  Branches      64164    64164           
=========================================
+ Hits          91255    91266   +11     
+ Misses       424178   424168   -10     
+ Partials      10300    10299    -1     
Flag Coverage Δ
uitests 3.63% <ø> (ø)
unittests 18.39% <ø> (+<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.

Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

lgtm

@sureshanaparti
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@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
Copy link
Copy Markdown

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

@weizhouapache
Copy link
Copy Markdown
Member Author

@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-13684)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 56115 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11135-t13684-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Copy link
Copy Markdown
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.

clgtm

@weizhouapache weizhouapache marked this pull request as ready for review July 7, 2025 11:34
@weizhouapache
Copy link
Copy Markdown
Member Author

@sureshanaparti @DaanHoogland
Updated the test results in description

note, the error/warning is not printed on the screen, but in /var/log/cloudstack/management/management-server.out which is the standard output of cloudstack-management service (defined by systemd)

@sureshanaparti
Copy link
Copy Markdown
Contributor

sureshanaparti commented Jul 16, 2025

@weizhouapache can we see the error/warn message in"systemctl status cloudstack-management.service" or "journalctl -xe" ?

@weizhouapache
Copy link
Copy Markdown
Member Author

@weizhouapache can we see the error/warn message in"systemctl status cloudstack-management.service" or "journalctl -xe" ?

I tried with some options.
still cannot make it

@DaanHoogland
Copy link
Copy Markdown
Contributor

@weizhouapache can we see the error/warn message in"systemctl status cloudstack-management.service" or "journalctl -xe" ?

I tried with some options. still cannot make it

I think you’ll need a syslog facility for that.

@DaanHoogland
Copy link
Copy Markdown
Contributor

@sureshanaparti (cc @weizhouapache ) I did a dry-run and the script works.

[root@pr11135-t13792-kvm-ol8-mgmt1 management]# alternatives --set java /usr/lib/jvm/java-11-openjdk-11.0.25.0.9-2.0.1.el8.x86_64/bin/java
[root@pr11135-t13792-kvm-ol8-mgmt1 management]# /usr/share/cloudstack-common/scripts/installer/pre-check.sh
WARNING: JAVA version is 11. JAVA 17 is recommended.
[root@pr11135-t13792-kvm-ol8-mgmt1 management]# alternatives --set java /usr/lib/jvm/java-21-openjdk-21.0.8.0.9-1.0.1.el8.x86_64/bin/java
[root@pr11135-t13792-kvm-ol8-mgmt1 management]# /usr/share/cloudstack-common/scripts/installer/pre-check.sh
ERROR: JAVA 21 is not supported. Currently only JAVA 17 and JAVA 11 are supported.
[root@pr11135-t13792-kvm-ol8-mgmt1 management]# ln -sf /bin/true /usr/bin/java 
[root@pr11135-t13792-kvm-ol8-mgmt1 management]# /usr/share/cloudstack-common/scripts/installer/pre-check.sh
ERROR: JAVA 8 is not supported. Currently only JAVA 17 and JAVA 11 are supported.
[root@pr11135-t13792-kvm-ol8-mgmt1 management]# rm /usr/bin/java 
rm: remove symbolic link '/usr/bin/java'? y
[root@pr11135-t13792-kvm-ol8-mgmt1 management]# /usr/share/cloudstack-common/scripts/installer/pre-check.sh
ERROR: /usr/bin/java does not exist

@sureshanaparti
Copy link
Copy Markdown
Contributor

@weizhouapache can we see the error/warn message in"systemctl status cloudstack-management.service" or "journalctl -xe" ?

I tried with some options. still cannot make it

@weizhouapache are you still working this, any further changes in this PR?

@weizhouapache
Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@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
Copy Markdown

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

@weizhouapache
Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@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
Copy Markdown

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

@weizhouapache
Copy link
Copy Markdown
Member Author

@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-14152)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 56004 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11135-t14152-kvm-ol8.zip
Smoke tests completed. 145 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_04_rvpc_network_garbage_collector_nics Failure 1443.32 test_vpc_redundant.py

@weizhouapache
Copy link
Copy Markdown
Member Author

Merging based on approvals and manual check by @DaanHoogland

@weizhouapache weizhouapache merged commit ba42d25 into apache:main Sep 1, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache CloudStack 4.22.0 Sep 1, 2025
@weizhouapache weizhouapache deleted the 4.21-add-pre-check branch September 1, 2025 08:41
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants