Yair Zaslavsky has posted comments on this change.

Change subject: engine: Refresh gluster data periodically
......................................................................


Patch Set 16: (6 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterManager.java
Line 524:             }
Line 525: 
Line 526:             @Override
Line 527:             public Map<String, String> getCustomValues() {
Line 528:                 Map<String, String> customValues = new 
HashMap<String, String>();
Please use Collections.singletonMap here.
Line 529:                 if (entityName != null && entityValue != null) {
Line 530:                     customValues.put(entityName, entityValue);
Line 531:                 }
Line 532:                 return customValues;


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java
Line 125:         }
Line 126: 
Line 127:         GlusterBrickEntity brick = (GlusterBrickEntity) obj;
Line 128:         return (getId().equals(brick.getId())
Line 129:                 && GlusterCoreUtil.objectsEqual(volumeId, 
brick.getVolumeId())
I don't like GlusterCoreUtil.ObjectsEqual that much -
a. Such utility (if needed) might be generic enough for both virt and gluster, 
and should be moved to a package (and renamed) accordingly.
b. Regarding this method - you can consider using -
http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/builder/EqualsBuilder.html
Line 130:                 && GlusterCoreUtil.objectsEqual(serverId, 
brick.getServerId())
Line 131:                 && GlusterCoreUtil.objectsEqual(brickDirectory, 
brick.getBrickDirectory())
Line 132:                 && GlusterCoreUtil.objectsEqual(brickOrder, 
brick.getBrickOrder())
Line 133:                 && status == brick.getStatus());


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/gluster/GlusterCoreUtil.java
Line 36:      *
Line 37:      * @param oldList
Line 38:      * @param newList
Line 39:      * @return collection of elements that are not present in 
<code>oldList</code>, but present in <code>newList</code>
Line 40:      */
See previous comment about GlusterCoreUtills.
Line 41:     public static <T> Collection<T> getAddedElements(Collection<T> 
oldList, Collection<T> newList) {
Line 42:         List<T> addedElements = new ArrayList<T>();
Line 43:         for (T element : newList) {
Line 44:             if (!oldList.contains(element)) {


Line 38:      * @param newList
Line 39:      * @return collection of elements that are not present in 
<code>oldList</code>, but present in <code>newList</code>
Line 40:      */
Line 41:     public static <T> Collection<T> getAddedElements(Collection<T> 
oldList, Collection<T> newList) {
Line 42:         List<T> addedElements = new ArrayList<T>();
Consider using Set API for this.
This method might not be efficient enough.
Line 43:         for (T element : newList) {
Line 44:             if (!oldList.contains(element)) {
Line 45:                 addedElements.add(element);
Line 46:             }


Line 70:         return qualifiedBricks;
Line 71:     }
Line 72: 
Line 73:     /**
Line 74:      * Checks if given brick <code>searchBrick</code> exists in the 
given collection of bricks. Note that this method
IMHO, brick methods should be placed in GlusterBrickUtils
Line 75:      * checks only two (and most important) attributes of the brick: 
server id and brick directory
Line 76:      *
Line 77:      * @param bricks
Line 78:      * @param searchBrick


....................................................
File 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumesListReturnForXmlRpc.java
Line 70: 
Line 71:         switch (volume.getVolumeType()) {
Line 72:         case REPLICATE:
Line 73:         case DISTRIBUTED_REPLICATE:
Line 74:             volume.setReplicaCount(Integer.valueOf((String) 
map.get(REPLICA_COUNT)));
Dont we have some "infra" method to do this at StatusReturnForXmlRpc?
Maybe we should consider having this, instead of doing Integer.valueOf... over 
and over again.
Line 75:             break;
Line 76:         case STRIPE:
Line 77:         case DISTRIBUTED_STRIPE:
Line 78:             volume.setStripeCount(Integer.valueOf((String) 
map.get(STRIPE_COUNT)));


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6b61eb6e93105e46e2706eac1d94bc10717224c2
Gerrit-PatchSet: 16
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shireesh Anjal <san...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Shireesh Anjal <san...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to