Allon Mureinik has posted comments on this change.

Change subject: core: initialize vds - select random host
......................................................................


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

(3 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBase.java
Line 87: 
Line 88:     @SuppressWarnings({ "unchecked", "rawtypes" })
Line 89:     protected boolean InitializeVds() {
Line 90:         boolean returnValue = true;
Line 91:         if (getVds() == null) {
Please add a comment to explain /why/ we need to select a host randomly.
Line 92:             List<VDS> hosts = 
getVdsDAO().getAllForStoragePoolAndStatus(getStoragePool().getId(),
Line 93:                     VDSStatus.Up);
Line 94:             if (!hosts.isEmpty()) {
Line 95:                 setVds(hosts.get(new Random().nextInt(hosts.size())));


Line 92:             List<VDS> hosts = 
getVdsDAO().getAllForStoragePoolAndStatus(getStoragePool().getId(),
Line 93:                     VDSStatus.Up);
Line 94:             if (!hosts.isEmpty()) {
Line 95:                 setVds(hosts.get(new Random().nextInt(hosts.size())));
Line 96:             }
You can replace this with RandomUtils.instance().pickRandom(hosts) - more 
elegant and easy to understand.
Line 97:             if (getVds() == null) {
Line 98:                 returnValue = false;
Line 99:                 
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_VDS_IN_POOL);
Line 100:             }


....................................................
Commit Message
Line 5: CommitDate: 2013-04-14 16:10:53 +0300
Line 6: 
Line 7: core: initialize vds - select random host
Line 8: 
Line 9: when attempting to initialize vds, attempt to perform it through random
s/random/a random/
Line 10: host to not try always through the same one.
Line 11: 
Line 12: Change-Id: If636850ba7d13b9a0be146059a9a964bb881abde


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If636850ba7d13b9a0be146059a9a964bb881abde
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <lara...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Liron Ar <lara...@redhat.com>
Gerrit-Reviewer: Michael Kublin <mkub...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to