Source:
<code>protected boolean validate() { if (getVm() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_VM_NOT_FOUND); } macPool = getMacPool(); if (!canRunActionOnNonManagedVm()) { return false; } if (getVm().isHostedEngine() && !getVm().isManagedHostedEngine()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_UNMANAGED_HOSTED_ENGINE); } if (!updateVnicForBackwardCompatibility()) { return false; } if (!validate(vmStatusLegal(vmDynamicDao.get(getParameters().getVmId()).getStatus()))) { return false; } List<VmNic> preexistingVmNics = vmNicDao.getAllForVm(getParameters().getVmId()); if (!uniqueInterfaceName(preexistingVmNics)) { return false; } if (!validate(vmTemplateEmpty())) { return false; } List<VmNic> allInterfaces = new ArrayList<>(preexistingVmNics); allInterfaces.add(getInterface()); if (!pciAndIdeWithinLimit(getVm(), allInterfaces)) { return false; } <START> if (duplicateMacExists(allInterfaces)) { <END> return false; } Version compatibilityVersion = getVm().getClusterCompatibilityVersion(); VmNicValidator nicValidator = new VmNicValidator(getInterface(), compatibilityVersion, getVm().getOs()); if (!validate(nicValidator.isCompatibleWithOs()) || !validate(nicValidator.profileValid(getVm().getClusterId())) || !validate(nicValidator.typeMatchesProfile()) || !validate(nicValidator.passthroughIsLinked()) || !validate(nicValidator.validateProfileNotEmptyForHostedEngineVm(getVm()))) { return false; } if (StringUtils.isNotEmpty(getMacAddress())) { if (!validate(macAvailable())) { return false; } } else if (macPool.getAvailableMacsCount() <= 0) { addValidationMessage(EngineMessage.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } return true; }</code><technical_language>do this validation in case 'StringUtils.isNotEmpty(getMacAddress()'</technical_language>

Target:
protected boolean validate() { if (getVm() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_VM_NOT_FOUND); } macPool = getMacPool(); if (!canRunActionOnNonManagedVm()) { return false; } if (getVm().isHostedEngine() && !getVm().isManagedHostedEngine()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_UNMANAGED_HOSTED_ENGINE); } if (!updateVnicForBackwardCompatibility()) { return false; } if (!validate(vmStatusLegal(vmDynamicDao.get(getParameters().getVmId()).getStatus()))) { return false; } List<VmNic> preexistingVmNics = vmNicDao.getAllForVm(getParameters().getVmId()); if (!uniqueInterfaceName(preexistingVmNics)) { return false; } if (!validate(vmTemplateEmpty())) { return false; } List<VmNic> allInterfaces = new ArrayList<>(preexistingVmNics); allInterfaces.add(getInterface()); if (!pciAndIdeWithinLimit(getVm(), allInterfaces)) { return false; } String macAddressOfInterface = getMacAddress(); boolean macAddressIsNotEmpty = macAddressOfInterface != null && !macAddressOfInterface.isEmpty(); if (macAddressIsNotEmpty && duplicateMacExists(allInterfaces)) { return false; } Version compatibilityVersion = getVm().getClusterCompatibilityVersion(); VmNicValidator nicValidator = new VmNicValidator(getInterface(), compatibilityVersion, getVm().getOs()); if (!validate(nicValidator.isCompatibleWithOs()) || !validate(nicValidator.profileValid(getVm().getClusterId())) || !validate(nicValidator.typeMatchesProfile()) || !validate(nicValidator.passthroughIsLinked()) || !validate(nicValidator.validateProfileNotEmptyForHostedEngineVm(getVm()))) { return false; } if (StringUtils.isNotEmpty(macAddressOfInterface)) { if (!validate(macAvailable())) { return false; } } else if (macPool.getAvailableMacsCount() <= 0) { addValidationMessage(EngineMessage.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } return true; }