-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add ReservationDao as dependency for the Usage Server #8868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ReservationDao as dependency for the Usage Server #8868
Conversation
|
@blueorangutan package |
|
@GutoVeronezi 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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8868 +/- ##
============================================
+ Coverage 30.91% 30.95% +0.03%
- Complexity 33734 33770 +36
============================================
Files 5404 5404
Lines 380289 380289
Branches 55489 55489
============================================
+ Hits 117550 117702 +152
+ Misses 247104 246978 -126
+ Partials 15635 15609 -26
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
vishesh92
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9117 |
|
@blueorangutan test alma9 kvm-alma9 |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + kvm-alma9) has been kicked to run smoke tests |
winterhazel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I verified that Usage was indeed not initializing successfully in the latest commit from main, and that it started as expected after applying these changes.
Before
2024-04-02T21:48:52,507 INFO [db.Transaction.Transaction] (main:[]) (logid:) Using the following URI to connect to cloud database [jdbc:mysql://192.168.201.160:3306/cloud?autoReconnect=true&prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'&serverTimezone=UTC&scrollTolerantForwardOnly=true].
2024-04-02T21:48:52,524 DEBUG [utils.db.DriverLoader] (main:[]) (logid:) Successfully loaded DB driver com.mysql.cj.jdbc.Driver
2024-04-02T21:48:52,594 INFO [db.Transaction.Transaction] (main:[]) (logid:) Using the following URI to connect to usage database [jdbc:mysql://192.168.201.160:3306/cloud_usage?autoReconnect=true&serverTimezone=UTC&scrollTolerantForwardOnly=true].
2024-04-02T21:48:52,596 DEBUG [utils.db.DriverLoader] (main:[]) (logid:) DB driver com.mysql.cj.jdbc.Driver was already loaded.
2024-04-02T21:48:52,626 DEBUG [utils.db.DriverLoader] (main:[]) (logid:) DB driver com.mysql.cj.jdbc.Driver was already loaded.
2024-04-02T21:49:02,190 INFO [utils.component.ComponentContext] (main:[]) (logid:) Setup Spring Application context
2024-04-02T21:49:06,317 ERROR [utils.component.ComponentContext] (main:[]) (logid:) Could not load bean due to: [Error creating bean with name 'volumeDaoImpl': Unsatisfied dependency expressed through field 'reservationDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.cloudstack.reservation.dao.ReservationDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.inject.Inject()}]. The service will be stopped. Please investigate the cause of the error or contact your support team. org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'volumeDaoImpl': Unsatisfied dependency expressed through field 'reservationDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.cloudstack.reservation.dao.ReservationDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.inject.Inject()}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.configureBean(AbstractAutowireCapableBeanFactory.java:364)
at com.cloud.utils.component.ComponentContext.initComponentsLifeCycle(ComponentContext.java:79)
at com.cloud.usage.UsageServer.start(UsageServer.java:55)
at com.cloud.usage.UsageServer.main(UsageServer.java:42)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.cloudstack.reservation.dao.ReservationDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.inject.Inject()}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1801)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1357)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657)
... 8 more
After
2024-04-02T21:55:12,724 INFO [db.Transaction.Transaction] (main:[]) (logid:) Using the following URI to connect to cloud database [jdbc:mysql://192.168.201.160:3306/cloud?autoReconnect=true&prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'&serverTimezone=UTC&scrollTolerantForwardOnly=true].
2024-04-02T21:55:12,735 DEBUG [utils.db.DriverLoader] (main:[]) (logid:) Successfully loaded DB driver com.mysql.cj.jdbc.Driver
2024-04-02T21:55:12,778 INFO [db.Transaction.Transaction] (main:[]) (logid:) Using the following URI to connect to usage database [jdbc:mysql://192.168.201.160:3306/cloud_usage?autoReconnect=true&serverTimezone=UTC&scrollTolerantForwardOnly=true].
2024-04-02T21:55:12,780 DEBUG [utils.db.DriverLoader] (main:[]) (logid:) DB driver com.mysql.cj.jdbc.Driver was already loaded.
2024-04-02T21:55:12,791 DEBUG [utils.db.DriverLoader] (main:[]) (logid:) DB driver com.mysql.cj.jdbc.Driver was already loaded.
2024-04-02T21:55:21,496 INFO [utils.component.ComponentContext] (main:[]) (logid:) Setup Spring Application context
2024-04-02T21:55:26,164 INFO [utils.component.ComponentContext] (main:[]) (logid:) Configuring org.apache.cloudstack.framework.config.dao.ConfigurationDaoImpl_EnhancerByCloudStack_9f179332
2024-04-02T21:55:26,169 INFO [utils.component.ComponentContext] (main:[]) (logid:) Configuring com.cloud.storage.dao.SnapshotDaoImpl_EnhancerByCloudStack_f351f48c
2024-04-02T21:55:26,170 INFO [utils.component.ComponentContext] (main:[]) (logid:) Configuring org.apache.cloudstack.quota.dao.QuotaEmailConfigurationDaoImpl_EnhancerByCloudStack_1cbadb7a
2024-04-02T21:55:26,177 INFO [utils.component.ComponentContext] (main:[]) (logid:) Configuring com.cloud.usage.dao.UsageVMSnapshotDaoImpl_EnhancerByCloudStack_a94d1798
2024-04-02T21:55:26,178 INFO [utils.component.ComponentContext] (main:[]) (logid:) Configuring com.cloud.storage.dao.VolumeDaoImpl_EnhancerByCloudStack_499ac806
...
|
[SF] Trillian Build Failed (tid-9671) |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-9677)
|
Description
The Quota processing occurs on the Management Server (via API) and Usage Server (via task). It uses the class
PresetVariableHelperto retrieve data from the database and inject it into the Quota tariff's activation rules. To retrieve the data, some DAOs are mapped as dependencies for the Usage Server and injected in that class.PR #8302 injected
org.apache.cloudstack.reservation.dao.ReservationDaoincom.cloud.storage.dao.VolumeDao(which is also injected inPresetVariableHelper); however,org.apache.cloudstack.reservation.dao.ReservationDaowas not added as dependency for the Usage Server, causing errors to start the Usage Server:Logs
This PR adds the
org.apache.cloudstack.reservation.dao.ReservationDaoas dependency for the Usage Server.Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
I applied the changes and tried to start the Usage Server:
Logs