Gilad Chaplik has posted comments on this change.

Change subject: core: Quota Monitors - backend
......................................................................


Patch Set 1: I would prefer that you didn't submit this

(6 inline comments)

locking issues in search.

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetQuotasByAdElementIdQuery.java
Line 12: public class GetQuotasByAdElementIdQuery<P extends 
GetQuotasByAdElementIdQueryParameters> extends QueriesCommandBase<P> {
Line 13:     public GetQuotasByAdElementIdQuery(P parameters) {
Line 14:         super(parameters);
Line 15:     }
Line 16: 
IMHO this should be separated into 2 queries.
Line 17:     @Override
Line 18:     protected void executeQueryCommand() {
Line 19:         if (getParameters().isIncludeUsageData()) {
Line 20:             List<Guid> ids = new ArrayList<Guid>();


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
Line 745:         return quota;
Line 746:     }
Line 747: 
Line 748:     /**
Line 749:      * REturn a list of QuotaPerUserUsageEntity representing the 
status of all the quotas in quotaIdsList
a void method... how it can return? please update comment
Line 750:      *
Line 751:      * @param quotaList
Line 752:      *            quota list
Line 753:      * @return - list of QuotaPerUserUsageEntity


Line 752:      *            quota list
Line 753:      * @return - list of QuotaPerUserUsageEntity
Line 754:      */
Line 755:     public void updateUsage(List<Quota> quotaList) {
Line 756:         lock.writeLock().lock();
don't like this lock at all!!! this method is called each search- for each 
engine user. 
please change.
Line 757:         try {
Line 758:             for (Quota quotaExternal : quotaList) {
Line 759:                 Quota quota = null;
Line 760:                 // look for the quota in the cache


Line 830:      */
Line 831:     public List<QuotaPerUserUsageEntity> 
getPerUserUsageReport(List<Quota> quotaIdsList, List<VM> vms) {
Line 832:         Map<Guid, QuotaPerUserUsageEntity> quotaPerUserUsageEntityMap 
= new HashMap<Guid, QuotaPerUserUsageEntity>();
Line 833: 
Line 834:         lock.writeLock().lock();
write lock for public getter? odd.
Line 835:         try {
Line 836:             for (Quota externalQuota : quotaIdsList) {
Line 837:                 Guid quotaId = externalQuota.getId();
Line 838:                 Quota quota = null;


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SearchQuery.java
Line 252:         return genericSearch(getDbFacade().getStorageDomainDao(), 
true, null);
Line 253:     }
Line 254: 
Line 255:     private List<Quota> searchQuota() {
Line 256:         List<Quota> quotaList = 
genericSearch(getDbFacade().getQuotaDao(), true, null);
-1
write lock on every search?
Line 257:         QuotaManager.getInstance().updateUsage(quotaList);
Line 258:         return quotaList;
Line 259:     }
Line 260: 


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/GetQuotasByAdElementIdQueryParameters.java
Line 11:      * Auto generated serial id.
Line 12:      */
Line 13:     private static final long serialVersionUID = 4072642442090555682L;
Line 14:     private Guid adElementId;
Line 15:     private Guid storagePoolId;
no need to add the boolean member (since the separating into 2 queries)
Line 16:     private boolean includeUsageData;
Line 17:     private List<VM> vms;
Line 18: 
Line 19:     public void setAdElementId(Guid adElementId) {


--
To view, visit http://gerrit.ovirt.org/10120
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I67770aefec191832d0c5bb69fbaba82cd0e6febb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: ofri masad <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to