Liron Aravot has posted comments on this change.

Change subject: engine: Add validation to cpu pinning
......................................................................


Patch Set 2: (2 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
Line 334:             VDS dedicatedVds;
Line 335:             VM vmFromParams = getParameters().getVm();
Line 336:             if (vmFromParams.getDedicatedVmForVds() != null &&
Line 337:                     (dedicatedVds = 
DbFacade.getInstance().getVdsDao().
Line 338:                             get(vmFromParams.getDedicatedVmForVds())) 
!= null) {
the 'design pattern' in all of the checks here is to pass the messages list and 
return true/false - why do you need to use VdcBllMessages.Unassigned and not 
return true from isCpuPinningValid ?
Line 339:                 VdcBllMessages returnMsg = 
isCpuPinningValid(vmFromParams.getCpuPinning(),
Line 340:                                 
getParameters().getVm().getNumOfCpus(),
Line 341:                         dedicatedVds.getcpu_cores() * 
dedicatedVds.getcpu_sockets() * dedicatedVds.getcpu_sockets());
Line 342:                 if (returnMsg != VdcBllMessages.Unassigned) {


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
Line 78:      *            Number of vCPUs in the VM
Line 79:      * @param maxPcpus
Line 80:      *            Number of pCPUs in the host
Line 81:      * @return Error message or Unassigned if string is valid
Line 82:      */
it's better to return true and get as parameter the messages list, as done in 
all checks.
Line 83:     static VdcBllMessages isCpuPinningValid(final String cpuPinning, 
int maxVcpus, int maxPcpus) {
Line 84:         if (StringUtils.isEmpty(cpuPinning)) {
Line 85:             return VdcBllMessages.Unassigned;
Line 86:         }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I690b60fcde6bf337058246ef9b1ee24fa3b7220a
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Noam Slomianko <nslom...@redhat.com>
Gerrit-Reviewer: Andrew Cathrow <and...@cathrow.com>
Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com>
Gerrit-Reviewer: Einav Cohen <eco...@redhat.com>
Gerrit-Reviewer: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Noam Slomianko <nslom...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to