Lior Vernia has posted comments on this change.

Change subject: engine: Added sorting to host NICs query
......................................................................


Patch Set 1: (3 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/GetVdsInterfacesByVdsIdQuery.java
Line 65:                 }
Line 66:             }
Line 67:         }
Line 68: 
Line 69:         Collections.sort(interfaces, new 
Comparator<VdsNetworkInterface>() {
Because LexoNumeric compares strings, and this compares VdsNetworkInterfaces.
Line 70: 
Line 71:             private boolean isBond(VdsNetworkInterface nic) {
Line 72:                 return (nic.getBonded() != null && nic.getBonded());
Line 73:             }


Line 68: 
Line 69:         Collections.sort(interfaces, new 
Comparator<VdsNetworkInterface>() {
Line 70: 
Line 71:             private boolean isBond(VdsNetworkInterface nic) {
Line 72:                 return (nic.getBonded() != null && nic.getBonded());
I could put some generic argument here about the performance of reflection, but 
as you wish.
Line 73:             }
Line 74: 
Line 75:             private String extractBondName(VdsNetworkInterface nic) {
Line 76:                 if (isBond(nic)) {


Line 103:                         return -1;
Line 104:                     }
Line 105:                     return compRes;
Line 106:                 }
Line 107:                 if (isBond(nic1) != isBond(nic2)) {
This condition will be true anytime a bond is compared with one of its 
contained NICs. Then I want to put the bond itself before the contained NIC.
Line 108:                     return isBond(nic1) ? -1 : 1;
Line 109:                 }
Line 110:                 return LexoNumericComparator.comp(nic1.getName(), 
nic2.getName());
Line 111:             }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2cb5b00230d7957dd3375b093e73d2a4a51d72b9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <[email protected]>
Gerrit-Reviewer: Alona Kaplan <[email protected]>
Gerrit-Reviewer: Lior Vernia <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to