@@ -154,7 +154,7 @@ public void checkQuota(Message msg, String currentAccountUuid, String targetAcco
154154 return ;
155155 }
156156
157- if (AccountConstant .isAdminPermission (targetAccountUuid )) {
157+ if (AccountConstant .isAdminPermission (targetAccountUuid ) || isAdminAccount ( targetAccountUuid ) ) {
158158 return ;
159159 }
160160
@@ -217,11 +217,18 @@ private void checkFunctionalSizeRequest(Message msg,
217217 return ;
218218 }
219219
220+ Quota .QuotaPair pair = pairs .get (requiredRequest .getQuotaName ());
221+ if (pair == null ) {
222+ logger .warn (String .format ("quota[name: %s] not defined for account[uuid: %s], skip check" ,
223+ requiredRequest .getQuotaName (), targetAccountUuid ));
224+ return ;
225+ }
226+
220227 QuotaUtil .QuotaCompareInfo quotaCompareInfo = new QuotaUtil .QuotaCompareInfo ();
221228 quotaCompareInfo .currentAccountUuid = currentAccountUuid ;
222229 quotaCompareInfo .resourceTargetOwnerAccountUuid = targetAccountUuid ;
223230 quotaCompareInfo .quotaName = requiredRequest .getQuotaName ();
224- quotaCompareInfo .quotaValue = pairs . get ( requiredRequest . getQuotaName ()) .getValue ();
231+ quotaCompareInfo .quotaValue = pair .getValue ();
225232 quotaCompareInfo .currentUsed = used ;
226233 quotaCompareInfo .request = asked ;
227234 CheckQuota (quotaCompareInfo );
@@ -235,13 +242,19 @@ private void checkFixedSizeRequest(FixedSizeRequiredRequest fixedSizeRequiredReq
235242 return ;
236243 }
237244
245+ Quota .QuotaPair pair = pairs .get (fixedSizeRequiredRequest .getQuotaName ());
246+ if (pair == null ) {
247+ logger .warn (String .format ("quota[name: %s] not defined for account[uuid: %s], skip check" ,
248+ fixedSizeRequiredRequest .getQuotaName (), targetAccountUuid ));
249+ return ;
250+ }
251+
238252 QuotaUtil .QuotaCompareInfo quotaCompareInfo = new QuotaUtil .QuotaCompareInfo ();
239253 quotaCompareInfo .currentAccountUuid = currentAccountUuid ;
240254 quotaCompareInfo .resourceTargetOwnerAccountUuid = targetAccountUuid ;
241255 quotaCompareInfo .quotaName = fixedSizeRequiredRequest .getQuotaName ();
242- Quota .QuotaPair pair = pairs .get (fixedSizeRequiredRequest .getQuotaName ());
243256 logger .debug ("get quota pair of " + fixedSizeRequiredRequest .getQuotaName () + ":\n " + JSONObjectUtil .toJsonString (pair ));
244- quotaCompareInfo .quotaValue = pairs . get ( fixedSizeRequiredRequest . getQuotaName ()) .getValue ();
257+ quotaCompareInfo .quotaValue = pair .getValue ();
245258 quotaCompareInfo .currentUsed = used ;
246259 quotaCompareInfo .request = asked ;
247260 CheckQuota (quotaCompareInfo );
0 commit comments