Sahina Bose has posted comments on this change.

Change subject: gluster : In the task tab, size of rebalanced files is shown 
with units
......................................................................


Patch Set 13:

(3 comments)

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/SizeConverter.java
Line 28:             for (SizeUnit unit : SizeUnit.values()) {
Line 29:                 if (((int) weight) == ((int) unit.getUnitWeight())) {
Line 30:                     return unit;
Line 31:                 }
Line 32:             }
How about keeping a static map of weights to SizeUnit, and returning from the 
map?
Line 33:             return SizeUnit.BYTES;
Line 34:         }
Line 35:     };
Line 36: 


Line 40:         return (size) * ((Math.pow(CONVERT_FACTOR, fromType)) / 
(Math.pow(CONVERT_FACTOR, toType)));
Line 41:     }
Line 42: 
Line 43:     public static String autoConvert(long size , SizeUnit inUnit) {
Line 44:         for(int i = (int)(inUnit.getUnitWeight()); i <= 
SizeUnit.GB.getUnitWeight();i++ ) {
Why aren't you using long?
Line 45:             if(size > Math.pow(1024, i)) {
Line 46:                 if(i == 0 ) {
Line 47:                     break;
Line 48:                 }


Line 41:     }
Line 42: 
Line 43:     public static String autoConvert(long size , SizeUnit inUnit) {
Line 44:         for(int i = (int)(inUnit.getUnitWeight()); i <= 
SizeUnit.GB.getUnitWeight();i++ ) {
Line 45:             if(size > Math.pow(1024, i)) {
Shouldn't you be using CONVERT_FACTOR?
Also, is the condition correct? Wouldn't it always return in Bytes?
Line 46:                 if(i == 0 ) {
Line 47:                     break;
Line 48:                 }
Line 49:                 return ((String.valueOf(convert(size, inUnit, 
SizeUnit.getUnit(i-1)))).concat(" ")).concat(SizeUnit.getUnit(i-1).toString());


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iea6c90a098bfddfb616bc2b8ce58c9d0bb567f66
Gerrit-PatchSet: 13
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: anmolbabu <[email protected]>
Gerrit-Reviewer: Kanagaraj M <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: anmolbabu <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to