Omer Frenkel has posted comments on this change.
Change subject: gluster: Add gluster hook to missing servers
......................................................................
Patch Set 5: (7 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java
Line 41: addCanDoActionMessage(VdcBllMessages.VAR__ACTION__UPDATE);
Line 42: addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_HOOK);
Line 43: }
Line 44:
Line 45: private List<GlusterServerHook> getMissingServerHooks() {
wouldnt it be better to cache this list in the command? instead of calculating
it every time (i see more than 1 call to this method)
Line 46: //get all destination servers - only serverhooks where hook is
missing
Line 47: List<GlusterServerHook> serverHooks = new
ArrayList<GlusterServerHook>();
Line 48: for (GlusterServerHook serverHook:
getGlusterHook().getServerHooks()) {
Line 49: if
(serverHook.getStatus().equals(GlusterHookStatus.MISSING)) {
Line 66:
Line 67: for (GlusterServerHook serverHook: getMissingServerHooks()) {
Line 68: VDS vds = getVdsDAO().get(serverHook.getServerId());
Line 69: if (vds == null || vds.getStatus() != VDSStatus.Up) {
Line 70: setVdsName(vds.getName());
if vds == null then vds.getName() will throw NPE
Line 71:
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP);
Line 72: return false;
Line 73: }
Line 74: }
Line 81:
Line 82: entity = getGlusterHook();
Line 83: addCustomValue(GlusterConstants.HOOK_NAME, entity.getName());
Line 84:
Line 85: final boolean hookEnabled = entity.getStatus() ==
GlusterHookStatus.ENABLED ? true : false;
the above line equals just to:
final boolean hookEnabled = entity.getStatus() == GlusterHookStatus.ENABLED
Line 86:
Line 87: List<Callable<Pair<GlusterServerHook, VDSReturnValue>>>
taskList = new ArrayList<Callable<Pair<GlusterServerHook, VDSReturnValue>>>();
Line 88: for (final GlusterServerHook serverHook :
getMissingServerHooks()) {
Line 89: taskList.add(new Callable<Pair<GlusterServerHook,
VDSReturnValue>>() {
Line 105: }
Line 106: });
Line 107: }
Line 108:
Line 109: setSucceeded(true);
not sure i understand why setting succeed to true here and not after going over
results
Line 110: if (!taskList.isEmpty()) {
Line 111: List<Pair<GlusterServerHook, VDSReturnValue>> pairResults
= ThreadPoolUtil.invokeAll(taskList);
Line 112: for (Pair<GlusterServerHook, VDSReturnValue> pairResult :
pairResults) {
Line 113:
Line 125: }
Line 126:
Line 127: if (errors.size() > 0) {
Line 128: setSucceeded(false);
Line 129: errorType = AuditLogType.GLUSTER_HOOK_ADD_FAILED;
please remove extra space here :)
Line 130: handleVdsErrors(getAuditLogTypeValue(), errors);
Line 131: addCustomValue(GlusterConstants.FAILURE_MESSAGE ,
StringUtils.join(errors, SystemUtils.LINE_SEPARATOR));
Line 132: }
Line 133:
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
Line 258: GLUSTER_SERVER_SERVICE_STATUS_CHANGED(4058),
Line 259: GLUSTER_HOOK_UPDATED(4059),
Line 260: GLUSTER_HOOK_UPDATE_FAILED(4060),
Line 261: GLUSTER_HOOK_ADDED(4061),
Line 262: GLUSTER_HOOK_ADD_FAILED(4062),
not sure about changing old values names, please remember these are saved in
the db for existing users, so you actually affect existing data.
Line 263:
Line 264: USER_VDS_RESTART(41),
Line 265: USER_FAILED_VDS_RESTART(107),
Line 266: USER_VDS_START(20),
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterHooksDaoDbFacadeImpl.java
Line 219: }
Line 220:
Line 221: @Override
Line 222: public void removeGlusterServerHooks(Guid id) {
Line 223:
getCallsHandler().executeModification("DeleteGlusterServerHookById",
no changes required in sql files?
Line 224: getCustomMapSqlParameterSource().addValue("hook_id",
id));
Line 225: }
Line 226:
Line 227: @Override
--
To view, visit http://gerrit.ovirt.org/15093
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I6a9b47b18e6fffc43393fdcf09f09f714f734b3d
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sahina Bose <[email protected]>
Gerrit-Reviewer: Kanagaraj M <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Shubhendu Tripathi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches