Moti Asayag has posted comments on this change.

Change subject: engine: Moving Duplicate Code to Base Class
......................................................................


Patch Set 1: (3 inline comments)

How about moving the common validation to the MicValidator instead to the base 
class? so it could be tested easily ?

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/AbstractVmInterfaceCommand.java
Line 85:                 ? new 
ValidationResult(VdcBllMessages.NETWORK_INVALID_MAC_ADDRESS)
Line 86:                 : ValidationResult.VALID;
Line 87:     }
Line 88: 
Line 89:     protected boolean uniqueInterfaceName(List<VmNetworkInterface> 
interfaces) {
it can be simplified to a single return statement

 protected boolean uniqueInterfaceName(List<VmNetworkInterface> interfaces) { 
   return VmHandler.IsNotDuplicateInterfaceName(interfaces, getInterfaceName(),
getReturnValue().getCanDoActionMessages());
  }
Line 90:         if (!VmHandler.IsNotDuplicateInterfaceName(interfaces, 
getInterfaceName(),
Line 91:                 getReturnValue().getCanDoActionMessages())) {
Line 92:             return false;
Line 93:         } else {


Line 93:         } else {
Line 94:             return true;
Line 95:         }
Line 96:     }
Line 97: 
same as above
Line 98:     protected boolean pciAndIdeWithinLimit(VmStatic vm, 
List<VmNetworkInterface> allInterfaces, List<Disk> allDisks) {
Line 99:         if (!checkPciAndIdeLimit(vm.getNumOfMonitors(), allInterfaces, 
allDisks,
Line 100:                 getReturnValue().getCanDoActionMessages())) {
Line 101:             return false;


Line 110:                 : ValidationResult.VALID;
Line 111:     }
Line 112: 
Line 113:     protected Network getNetworkFromDb(Guid vdsGroupId) {
Line 114:         List<Network> networks = 
getNetworkDAO().getAllForCluster(vdsGroupId);
if moved already, maybe get rid of LinqUtils ?
Line 115:         return LinqUtils.firstOrNull(networks, new 
Predicate<Network>() {
Line 116:             @Override
Line 117:             public boolean eval(Network network) {
Line 118:                 return network.getName().equals(getNetworkName());


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3b07249bc2e554e2a420792fd100781dff748958
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Muli Salem <[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