-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
ISSUE TYPE
- Bug Report
COMPONENT NAME
Database encryption engine migration script
CLOUDSTACK VERSION
4.18.2.3
CONFIGURATION
Database with legacy cryptographic cipher (MD5/DES)
OS / ENVIRONMENT
Centos 7
SUMMARY
When migrating from the old database encryption scheme (MD5/DES 56-bit) to the new one (AES-GCM 256-bit) using the supplied script (/usr/bin/cloudstack-migrate-databases) from any of the managers; the migration process starts, but suddenly, when working on on the 'user_vm_deploy_as_is_details' table, we get an error and the process fails.
STEPS TO REPRODUCE
# systemctl stop cloudstack-management cloudstack-usage
# /usr/bin/cloudstack-migrate-databases -d oldDBKey -m oldMSKey -e newDBKey -n newMSKey -v V2
...
...
Data Migration failed. Reverting db.properties
EXPECTED RESULTS
The script should end without error. The database content is migrated using the new cipher and the configuration files are updated as needed.
ACTUAL RESULTS
The database and configuration files remains untouched, the migration script fails with the following error:
Unable to update user_vm_deploy_as_is_details values due to: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'vm_instance.id = 20850 AND template_deploy_as_is_details.name = 'property-timezo' at line 1
Error during data migration
com.cloud.utils.exception.CloudRuntimeException: Unable to update user_vm_deploy_as_is_details values
at com.cloud.utils.crypt.EncryptionSecretKeyChanger.throwCloudRuntimeException(EncryptionSecretKeyChanger.java:794)
at com.cloud.utils.crypt.EncryptionSecretKeyChanger.migrateTemplateDeployAsIsDetails(EncryptionSecretKeyChanger.java:663)
at com.cloud.utils.crypt.EncryptionSecretKeyChanger.migrateData(EncryptionSecretKeyChanger.java:485)
at com.cloud.utils.crypt.EncryptionSecretKeyChanger.migratePropertiesAndDatabase(EncryptionSecretKeyChanger.java:343)
at com.cloud.utils.crypt.EncryptionSecretKeyChanger.main(EncryptionSecretKeyChanger.java:142)
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'vm_instance.id = 20850 AND template_deploy_as_is_details.name = 'property-timezo' at line 1
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)
at com.cloud.utils.crypt.EncryptionSecretKeyChanger.migrateTemplateDeployAsIsDetails(EncryptionSecretKeyChanger.java:649)
... 3 more
Data Migration failed. Reverting db.properties