Sergey Gotliv has posted comments on this change. Change subject: engine: Introduce commands to manage iscsi bonds entities ......................................................................
Patch Set 11: (7 comments) http://gerrit.ovirt.org/#/c/22952/11/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddIscsiBondCommand.java: Line 44: @Override Line 45: public Void runInTransaction() { Line 46: getDbFacade().getIscsiBondDao().save(iscsiBond); Line 47: Line 48: for (Guid networkId : iscsiBond.getNetworkIds()) { > getNetworkIds can return nulll Currently feature supported by UI which validates that each bond has at least one network. I will implement the same logic in the REST mapper, so it can't be null. Line 49: getDbFacade().getIscsiBondDao().addNetworkToIscsiBond(iscsiBond.getId(), networkId); Line 50: } Line 51: Line 52: for (String connectionId : iscsiBond.getStorageConnectionIds()) { Line 45: public Void runInTransaction() { Line 46: getDbFacade().getIscsiBondDao().save(iscsiBond); Line 47: Line 48: for (Guid networkId : iscsiBond.getNetworkIds()) { Line 49: getDbFacade().getIscsiBondDao().addNetworkToIscsiBond(iscsiBond.getId(), networkId); > please add getIscsiBondDao method and export to it getDbFacade().getIscsiB AuditLogableBase is probably not the right place to keep all dao getters that's the reason why I didn't add it there. Line 50: } Line 51: Line 52: for (String connectionId : iscsiBond.getStorageConnectionIds()) { Line 53: getDbFacade().getIscsiBondDao().addStorageConnectionToIscsiBond(iscsiBond.getId(), connectionId); Line 52: for (String connectionId : iscsiBond.getStorageConnectionIds()) { Line 53: getDbFacade().getIscsiBondDao().addStorageConnectionToIscsiBond(iscsiBond.getId(), connectionId); Line 54: } Line 55: Line 56: getCompensationContext().stateChanged(); > there's no compensation here. Done Line 57: return null; Line 58: } Line 59: }); Line 60: http://gerrit.ovirt.org/#/c/22952/11/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/EditIscsiBondCommand.java: Line 16: import org.ovirt.engine.core.compat.Guid; Line 17: import org.ovirt.engine.core.utils.transaction.TransactionMethod; Line 18: import org.ovirt.engine.core.utils.transaction.TransactionSupport; Line 19: Line 20: @LockIdNameAttribute > locks? I will remove locks in another patch. Meantime I remove annotations. Line 21: @NonTransactiveCommandAttribute Line 22: public class EditIscsiBondCommand <T extends EditIscsiBondParameters> extends BaseIscsiBondCommand<T> { Line 23: Line 24: private IscsiBond existingIscsiBond; Line 60: Line 61: updateNetworksIds(); Line 62: updateConnectionsIds(); Line 63: Line 64: getCompensationContext().stateChanged(); > no compensation here Done Line 65: return null; Line 66: } Line 67: }); Line 68: Line 73: Set<Guid> beforeChangeNetworkIds = new HashSet<>(getExistingIscsiBond().getNetworkIds()); Line 74: Line 75: for (Guid networkId : getIscsiBond().getNetworkIds()) { Line 76: if (!beforeChangeNetworkIds.remove(networkId)) { Line 77: getDbFacade().getIscsiBondDao().addNetworkToIscsiBond(getExistingIscsiBond().getId(), networkId); > i suggest to have this dao method to accept multiple networks at once. I will address it in another patch. Line 78: } Line 79: } Line 80: Line 81: for (Guid networkId : beforeChangeNetworkIds) { http://gerrit.ovirt.org/#/c/22952/11/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveIscsiBondCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveIscsiBondCommand.java: Line 13: import org.ovirt.engine.core.common.businessentities.IscsiBond; Line 14: import org.ovirt.engine.core.common.errors.VdcBllMessages; Line 15: import org.ovirt.engine.core.compat.Guid; Line 16: Line 17: @LockIdNameAttribute > locks? I will remove locks in another patch. Meantime I remove annotations. Line 18: public class RemoveIscsiBondCommand<T extends RemoveIscsiBondParameters> extends BaseIscsiBondCommand<T> { Line 19: Line 20: private IscsiBond iscsiBond; Line 21: -- To view, visit http://gerrit.ovirt.org/22952 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I06890ea40d22b86d9421cb1b0c68ea28bc430b0a Gerrit-PatchSet: 11 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sergey Gotliv <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Amador Pahim <[email protected]> Gerrit-Reviewer: Daniel Erez <[email protected]> Gerrit-Reviewer: Liron Ar <[email protected]> Gerrit-Reviewer: Maor Lipchuk <[email protected]> Gerrit-Reviewer: Sergey Gotliv <[email protected]> Gerrit-Reviewer: Tal Nisan <[email protected]> Gerrit-Reviewer: Vered Volansky <[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
