4242import javax .naming .ConfigurationException ;
4343import javax .persistence .EntityExistsException ;
4444
45- import org .apache .cloudstack .framework .config .dao .ConfigurationDao ;
4645import org .apache .cloudstack .managed .context .ManagedContextRunnable ;
4746import org .apache .cloudstack .quota .QuotaAlertManager ;
4847import org .apache .cloudstack .quota .QuotaManager ;
4948import org .apache .cloudstack .quota .QuotaStatement ;
49+ import org .apache .cloudstack .quota .constant .QuotaConfig ;
5050import org .apache .cloudstack .usage .UsageService ;
5151import org .apache .cloudstack .usage .UsageTypes ;
5252import org .apache .cloudstack .utils .usage .UsageUtils ;
9292import com .cloud .utils .db .QueryBuilder ;
9393import com .cloud .utils .db .SearchCriteria ;
9494import com .cloud .utils .db .TransactionLegacy ;
95- import com .cloud .utils .exception .CloudRuntimeException ;
9695
9796@ Component
9897public class UsageManagerImpl extends ManagerBase implements UsageManager , Runnable {
@@ -144,8 +143,6 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
144143 @ Inject
145144 protected UsageEventDetailsDao _usageEventDetailsDao ;
146145 @ Inject
147- ConfigurationDao _configDao ;
148- @ Inject
149146 private UsageVMSnapshotDao _usageVMSnapshotDao ;
150147 @ Inject
151148 private UsageVMSnapshotOnPrimaryDao _usageSnapshotOnPrimaryDao ;
@@ -195,12 +192,6 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
195192 public UsageManagerImpl () {
196193 }
197194
198- private void mergeConfigs (Map <String , String > dbParams , Map <String , Object > xmlParams ) {
199- for (Map .Entry <String , Object > param : xmlParams .entrySet ()) {
200- dbParams .put (param .getKey (), (String )param .getValue ());
201- }
202- }
203-
204195 @ Override
205196 public boolean configure (String name , Map <String , Object > params ) throws ConfigurationException {
206197 final String run = "usage.vmops.pid" ;
@@ -217,27 +208,13 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
217208 logger .info ("Implementation Version is " + _version );
218209 }
219210
220- Map <String , String > configs ;
221- try {
222- configs = _configDao .getConfiguration (params );
223-
224- if (params != null ) {
225- mergeConfigs (configs , params );
226- logger .info ("configs = " + configs );
227- }
228- } catch (CloudRuntimeException e ) {
229- logger .error ("Unhandled configuration exception: " + e .getMessage ());
230- throw new CloudRuntimeException ("Unhandled configuration exception" , e );
231- }
232-
233211 String execTime = UsageService .UsageStatsJobExecTime .value ();
234212 Integer aggregationRange = UsageService .UsageStatsJobAggregationRange .value ();
235213 String execTimeZone = UsageService .UsageExecutionTimezone .value ();
236214 String aggregationTimeZone = UsageService .UsageAggregationTimezone .value ();
237215 Integer sanityCheckInterval = UsageService .UsageSanityCheckInterval .value ();
238- String quotaEnable = configs .get ("quota.enable.service" );
239- _runQuota = Boolean .valueOf (quotaEnable == null ? "false" : quotaEnable );
240- usageSnapshotSelection = Boolean .valueOf (configs .get ("usage.snapshot.virtualsize.select" ));
216+ _runQuota = QuotaConfig .QuotaPluginEnabled .value ();
217+ usageSnapshotSelection = UsageService .UsageSnapshotVirtualSizeSelect .value ();
241218 if (sanityCheckInterval != null ) {
242219 _sanityCheckInterval = sanityCheckInterval ;
243220 }
0 commit comments