Skip to content

Conversation

@abh1sar
Copy link
Collaborator

@abh1sar abh1sar commented Feb 28, 2025

Description

This PR fixes #10480

The configuration table schema was changed in PR #10300
But it causes problem if the ConfigurationVO class structure was cached with the old fields.

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?

@codecov
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.57%. Comparing base (8e4fe1c) to head (04dbc7e).
⚠️ Report is 181 commits behind head on main.

Files with missing lines Patch % Lines
...ain/java/com/cloud/utils/db/TransactionLegacy.java 0.00% 6 Missing ⚠️
...src/main/java/com/cloud/upgrade/dao/DbUpgrade.java 0.00% 3 Missing ⚠️
...ava/com/cloud/upgrade/dao/Upgrade42010to42100.java 0.00% 3 Missing ⚠️
...java/com/cloud/upgrade/DatabaseUpgradeChecker.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10485      +/-   ##
============================================
- Coverage     16.57%   16.57%   -0.01%     
  Complexity    13988    13988              
============================================
  Files          5745     5746       +1     
  Lines        510847   510862      +15     
  Branches      62140    62142       +2     
============================================
- Hits          84696    84695       -1     
- Misses       416677   416692      +15     
- Partials       9474     9475       +1     
Flag Coverage Δ
uitests 3.91% <ø> (ø)
unittests 17.47% <0.00%> (-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.

@abh1sar abh1sar changed the title Fix ConfigurationVO load exception on fresh install Fix ConfigurationVO load exception after schema change Feb 28, 2025
@DaanHoogland DaanHoogland added this to the 4.21.0 milestone Mar 3, 2025
@abh1sar
Copy link
Collaborator Author

abh1sar commented Mar 3, 2025

@blueorangutan package

@blueorangutan
Copy link

@abh1sar 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 12634

@abh1sar
Copy link
Collaborator Author

abh1sar commented Mar 3, 2025

@blueorangutan package

@blueorangutan
Copy link

@abh1sar 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 12636

@abh1sar
Copy link
Collaborator Author

abh1sar commented Mar 3, 2025

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-12539)

@rohityadavcloud
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-12546)

@abh1sar
Copy link
Collaborator Author

abh1sar commented Mar 4, 2025

@blueorangutan package

@blueorangutan
Copy link

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

[SF] Trillian Build Failed (tid-12553)

@blueorangutan
Copy link

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

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-12555)

@JoaoJandre
Copy link
Contributor

Instead of changing how we get the value, shouldn't we normalize the database data so that it works with the current way of getting the values?

Otherwise, if someone in the future creates a method to get the value the old way and only tests on a new install, it might introduce a bug for people running old installs.

@abh1sar
Copy link
Collaborator Author

abh1sar commented Mar 11, 2025

@JoaoJandre We identified the issue with how BackupDaoImpl class caches the columns of the table. Even though both configurations table and ConfigurationVO code has the new schema, the ConfigurationsDao._allColumns field still had the older schema from before upgrade. That's why after management server restart ConfigurationsDaoImpl_allColumns was getting regenerated with the correct fields.
I have reverted the older commit and added the commit to regenerate ConfigurationsDaoImpl._allColumns when the Configurations table schema is changed.

@abh1sar abh1sar self-assigned this Mar 11, 2025
@abh1sar
Copy link
Collaborator Author

abh1sar commented May 21, 2025

@blueorangutan package

@blueorangutan
Copy link

@abh1sar 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 13470

@abh1sar
Copy link
Collaborator Author

abh1sar commented May 21, 2025

@blueorangutan test

@blueorangutan
Copy link

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

Test Result Time (s) Test File
ContextSuite context=TestIpv6Vpc>:setup Error 0.00 test_vpc_ipv6.py
all_test_vpc_redundant Skipped --- test_vpc_redundant.py
all_test_vpc_router_nics Skipped --- test_vpc_router_nics.py
all_test_vpc_vpn Skipped --- 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

@shwstppr
Copy link
Contributor

shwstppr commented Jul 9, 2025

@abh1sar @sureshanaparti I think we should try to get this in 4.21

@blueorangutan package

@blueorangutan
Copy link

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

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.

clgtm

@blueorangutan
Copy link

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

@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

@blueorangutan
Copy link

[SF] Trillian test result (tid-13737)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 59320 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10485-t13737-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

@DaanHoogland
Copy link
Contributor

@abh1sar et al, please advice on testing. It seems to me an upgrade test is needed at least.

@abh1sar
Copy link
Collaborator Author

abh1sar commented Jul 10, 2025

@DaanHoogland
The exceptions are seen every time the management server is started after running the cloudstack-setup-database command. So, the fix can be verified that way.
Both HikariCP and Apache DBCP should be tested.

Upgrade should also be tested for any regressions, and logs reviewed after the upgrade to check that the exceptions are not there.

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

clgtm

Copy link
Collaborator

@rosi-shapeblue rosi-shapeblue left a comment

Choose a reason for hiding this comment

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

LGTM - CloudStack Configuration Loading Fix Verified

Test Cases Executed

  • TC1: Database Recreation Test - Fresh database setup after cloudstack-setup-databases

    • Status: Pass
  • TC2: Management Server Startup - Monitor for configuration loading errors during startup

    • Status: Pass
  • TC3: Configuration Access Verification - Verify configuration values are accessible

    • Status: Pass
  • TC4: Service Restart Behavior - Verify clean restart without configuration errors

    • Status: Pass
  • TC5: Error Pattern Detection - Confirm absence of "Cannot determine value type" errors

    • Status: Pass

Test Execution Sequence

Step 1: Environment Preparation

# Create backup directory
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 ~]# mkdir -p /root/test-backup-$(date +%Y%m%d-%H%M%S)
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 ~]# cd test-backup-20250811-150656/

# Backup database
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# mysqldump -u root -p cloud > cloud_backup.sql
Enter password: 
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# ls -la cloud_backup.sql
-rw-r--r--. 1 root root 2847913 Aug 11 15:07 cloud_backup.sql

# Backup configuration files
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# cp -r /etc/cloudstack cloudstack_config_backup

# Backup current logs for comparison
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# cp /var/log/cloudstack/management/management-server.log management-server.log.backup

# Save backup location for potential restore
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# pwd > /tmp/backup_location.txt
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# echo "Backup created in: $(pwd)"
Backup created in: /root/test-backup-20250811-150656

# Verify backup contents
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# ls -la
total 2784
drwxr-xr-x.  3 root root      85 Aug 11 15:07 .
dr-xr-x---. 18 root root    4096 Aug 11 15:06 ..
-rw-r--r--.  1 root root 2847913 Aug 11 15:07 cloud_backup.sql
drwxr-xr-x.  4 root root      33 Aug 11 15:07 cloudstack_config_backup
-rw-r--r--.  1 root root   10234 Aug 11 15:07 management-server.log.backup

Step 2: Stop Management Server

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# systemctl stop cloudstack-management
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# systemctl status cloudstack-management
● cloudstack-management.service - CloudStack Management Server
   Loaded: loaded (/usr/lib/systemd/system/cloudstack-management.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2025-08-11 15:11:24 UTC; 2s ago

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# echo "Management server stopped at: $(date)"
Management server stopped at: Mon Aug 11 15:11:32 UTC 2025

Step 3: Add Test Marker

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# echo "=== TEST START MARKER - $(date) ===" >> /var/log/cloudstack/management/management-server.log

Step 4: Database Recreation

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# cloudstack-setup-databases cloud:cloud@localhost --deploy-as=root:P@ssword123
Mysql user name:cloud                                                           [ OK ]
Mysql user password:******                                                      [ OK ]
Mysql server ip:localhost                                                       [ OK ]
Mysql server port:3306                                                          [ OK ]
Mysql root user name:root                                                       [ OK ]
Mysql root user password:******                                                 [ OK ]
Checking Cloud database files ...                                               [ OK ]
Checking local machine hostname ...                                             [ OK ]
Checking SELinux setup ...                                                      [ OK ]
Detected local IP address as 10.0.33.190, will use as cluster management server node IP[ OK ]
Preparing /etc/cloudstack/management/db.properties                              [ OK ]
Applying /usr/share/cloudstack-management/setup/create-database.sql             [ OK ]
Applying /usr/share/cloudstack-management/setup/create-schema.sql               [ OK ]
Applying /usr/share/cloudstack-management/setup/create-database-premium.sql     [ OK ]
Applying /usr/share/cloudstack-management/setup/create-schema-premium.sql       [ OK ]
Applying /usr/share/cloudstack-management/setup/server-setup.sql                [ OK ]
Applying /usr/share/cloudstack-management/setup/templates.sql                   [ OK ]
Processing encryption ...                                                       [ OK ]
Finalizing setup ...                                                            [ OK ]

CloudStack has successfully initialized database, you can check your database configuration in /etc/cloudstack/management/db.properties

Step 5: Start Management Server

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# systemctl start cloudstack-management
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# systemctl status cloudstack-management
● cloudstack-management.service - CloudStack Management Server
   Loaded: loaded (/usr/lib/systemd/system/cloudstack-management.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2025-08-11 15:12:50 UTC; 11s ago

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# echo "Management server started at: $(date)"
Management server started at: Mon Aug 11 15:13:05 UTC 2025

Monitoring Results

NO ERRORS DETECTED - logs monitoring showed no configuration loading errors during startup.

image

Step 6: Restart Test (Verifying Fix Behavior)

Result: Restart completed successfully with no configuration errors.

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# echo "=== RESTART TEST - $(date) ===" >> /var/log/cloudstack/management/management-server.log
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# systemctl restart cloudstack-management
[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# systemctl status cloudstack-management
● cloudstack-management.service - CloudStack Management Server
   Loaded: loaded (/usr/lib/systemd/system/cloudstack-management.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2025-08-11 15:17:33 UTC; 1s ago

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# echo "Management server restarted at: $(date)"
Management server restarted at: Mon Aug 11 15:17:42 UTC 2025

Verification Tests

Error Count Verification

Result: Zero configuration loading errors found.

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# grep -c "Cannot determine value type from string" /var/log/cloudstack/management/management-server.log
0

Configuration Access Test

Result: Configuration values accessible and correct.

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 ~]# mysql -u root -p -e "USE cloud; SELECT name, value FROM configuration WHERE name IN ('drs.plan.expire.interval', 'job.cancel.threshold.minutes');"
Enter password: 
+------------------------------+-------+
| name                         | value |
+------------------------------+-------+
| drs.plan.expire.interval     | 30    |
| job.cancel.threshold.minutes | 60    |
+------------------------------+-------+

Final Pass/Fail Test

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# [ $(grep -c "Cannot determine value type from string" /var/log/cloudstack/management/management-server.log) -eq 0 ] && echo "FINAL RESULT: TEST PASSED" || echo "FINAL RESULT: TEST FAILED"

FINAL RESULT: TEST PASSED

Service Status Verification

Result: Management server running and listening on all expected ports.

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 ~]# systemctl status cloudstack-management
● cloudstack-management.service - CloudStack Management Server
   Loaded: loaded (/usr/lib/systemd/system/cloudstack-management.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2025-08-11 15:17:33 UTC; 5min ago

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 ~]# ss -tulpn | grep java
tcp   LISTEN 0      50                        *:8080             *:*    users:(("java",pid=25213,fd=36))                          
tcp   LISTEN 0      50                        *:8250             *:*    users:(("java",pid=25213,fd=33))                          
tcp   LISTEN 0      50     [::ffff:10.0.33.190]:9090             *:*    users:(("java",pid=25213,fd=34))

API Response Verification

Result: API responding correctly with CloudStack 4.21.0.0-SNAPSHOT. HTTP 401 is expected without authentication.

[root@ref-trl-9216-k-Mol8-rositsa-kyuchukova-mgmt1 test-backup-20250811-150656]# curl -v http://localhost:8080/client/api?command=listCapabilities
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /client/api?command=listCapabilities HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.61.1
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
< Content-Type: text/xml;charset=utf-8
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1;mode=block
< content-security-policy: 1
< content-security-policy: default-src=none
< content-security-policy: script-src=self
< content-security-policy: connect-src=self
< content-security-policy: img-src=self
< content-security-policy: style-src=self
< Content-Length: 238
< 
* Connection #0 to host localhost left intact
<?xml version="1.0" encoding="UTF-8"?><listcapabilitiesresponse cloud-stack-version="4.21.0.0-SNAPSHOT"><errorcode>401</errorcode><errortext>unable to verify user credentials and/or request signature</errortext></listcapabilitiesresponse>

@sureshanaparti sureshanaparti merged commit 9fd2b90 into apache:main Aug 11, 2025
25 of 26 checks passed
@sureshanaparti sureshanaparti deleted the upgrade-config branch August 11, 2025 15:50
@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache CloudStack 4.21.0 Aug 11, 2025
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.

[DB] Exceptions logged on fresh management server start

10 participants