Source:
protected boolean canDoAction() { boolean returnValue = true; if (getVmTemplate() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); return false; } returnValue = buildAndCheckDestStorageDomains(); if (returnValue) { storageToDisksMap = ImagesHandler.buildStorageToDiskMap(getImagesToCheckDestinationStorageDomains(), diskInfoDestinationMap); returnValue = canDoAddVmCommand(); } String vmName = getParameters().getVm().getVmName(); if (vmName == null || vmName.isEmpty()) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_MAY_NOT_BE_EMPTY); } else { boolean vmNameValidLength = isVmNameValidLength(getParameters().getVm()); if (!vmNameValidLength) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_LENGTH_IS_TOO_LONG); } } if (returnValue && getParameters().getVmPayload() != null) { returnValue = checkPayload(getParameters().getVmPayload(), getParameters().getVmStaticData().getiso_path()); if (returnValue) { getParameters().getVmPayload().setContent(Base64.encodeBase64String( getParameters().getVmPayload().getContent().getBytes())); } } if (!VmHandler.isUsbPolicyLegal(getParameters().getVm().getUsbPolicy(), getParameters().getVm().getOs(), getVdsGroup(), getReturnValue().getCanDoActionMessages())) { returnValue = false; } if (returnValue) { VM vmFromParams = getParameters().getVm(); returnValue = isCpuPinningValid(vmFromParams.getCpuPinning(), vmFromParams.getStaticData(), getReturnValue().getCanDoActionMessages()); } if (getParameters().getVm().isUseHostCpuFlags() && getParameters().getVm().getMigrationSupport() == MigrationSupport.MIGRATABLE) { return failCanDoAction(VdcBllMessages.VM_HOSTCPU_MUST_BE_PINNED_TO_HOST); } return returnValue && checkCpuSockets(); }

Target:
protected boolean canDoAction() { boolean returnValue = true; if (getVmTemplate() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); return false; } returnValue = buildAndCheckDestStorageDomains(); if (returnValue) { storageToDisksMap = ImagesHandler.buildStorageToDiskMap(getImagesToCheckDestinationStorageDomains(), diskInfoDestinationMap); returnValue = canDoAddVmCommand(); } String vmName = getParameters().getVm().getVmName(); if (vmName == null || vmName.isEmpty()) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_MAY_NOT_BE_EMPTY); } else { boolean vmNameValidLength = isVmNameValidLength(getParameters().getVm()); if (!vmNameValidLength) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_LENGTH_IS_TOO_LONG); } } if (returnValue && getParameters().getVmPayload() != null) { returnValue = checkPayload(getParameters().getVmPayload(), getParameters().getVmStaticData().getiso_path()); if (returnValue) { getParameters().getVmPayload().setContent(Base64.encodeBase64String( getParameters().getVmPayload().getContent().getBytes())); } } if (!VmHandler.isUsbPolicyLegal(getParameters().getVm().getUsbPolicy(), getParameters().getVm().getOs(), getVdsGroup(), getReturnValue().getCanDoActionMessages())) { returnValue = false; } if (returnValue) { VM vmFromParams = getParameters().getVm(); returnValue = isCpuPinningValid(vmFromParams.getCpuPinning(), vmFromParams.getStaticData()); } if (getParameters().getVm().isUseHostCpuFlags() && getParameters().getVm().getMigrationSupport() == MigrationSupport.MIGRATABLE) { return failCanDoAction(VdcBllMessages.VM_HOSTCPU_MUST_BE_PINNED_TO_HOST); } return returnValue && checkCpuSockets(); }