Allon Mureinik has uploaded a new change for review. Change subject: core: Del ImagesHandler.isDomainWithinThresholds ......................................................................
core: Del ImagesHandler.isDomainWithinThresholds ImagesHandler.isDomainWithThresholds is useless method - all it does is invoke a StorageDomainValidator, which could (and should!) be done directly. This patch replaces the single usage it had with a direct call to the validator, and removes this method, along with the validate method that's only called from it. Change-Id: I7a0c776e9798d6128a3aac4400e1a22b3df84b56 Signed-off-by: Allon Mureinik <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java 1 file changed, 1 insertion(+), 35 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/67/14267/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java index 6450411..02b34c4 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java @@ -35,7 +35,6 @@ import org.ovirt.engine.core.common.businessentities.image_storage_domain_map; import org.ovirt.engine.core.common.errors.VdcBLLException; import org.ovirt.engine.core.common.errors.VdcBllErrors; -import org.ovirt.engine.core.common.utils.ListUtils; import org.ovirt.engine.core.common.utils.VmDeviceType; import org.ovirt.engine.core.common.vdscommands.GetImageInfoVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.IrsBaseVDSCommandParameters; @@ -78,7 +77,7 @@ for (StorageDomain storageDomain : domains) { StorageDomainValidator validator = new StorageDomainValidator(storageDomain); if (validator.isDomainExistAndActive().isValid() && validator.domainIsValidDestination().isValid() - && (notCheckSize || isStorageDomainWithinThresholds(storageDomain, null, false))) { + && (notCheckSize || validator.isDomainWithinThresholds().isValid())) { storageDomainsMap.put(storageDomain.getId(), storageDomain); } } @@ -460,39 +459,6 @@ domainsIds.addAll(image.getStorageIds()); } return domainsIds; - } - - /** - * Returns whether the storage domain is within the threshold - * - * @param storageDomain - * - The storage domain to be checked. - * @param messages - * - Add a message to the messages list. - * @param addCanDoMessage - * - Indicate whether to add a CDA message for failure - * @return <code>boolean</code> value which indicates if the storage domain has enough free space. - */ - private static boolean isStorageDomainWithinThresholds(StorageDomain storageDomain, - List<String> messages, - boolean addCanDoMessage) { - ValidationResult validationResult = new StorageDomainValidator(storageDomain).isDomainWithinThresholds(); - if (addCanDoMessage) { - validate(validationResult, messages); - } - return validationResult.isValid(); - } - - private static boolean validate(ValidationResult validationResult, List<String> messages) { - if (!validationResult.isValid()) { - ListUtils.nullSafeAdd(messages, validationResult.getMessage().name()); - if (validationResult.getVariableReplacements() != null) { - for (String variableReplacement : validationResult.getVariableReplacements()) { - messages.add(variableReplacement); - } - } - } - return validationResult.isValid(); } public static void fillImagesBySnapshots(VM vm) { -- To view, visit http://gerrit.ovirt.org/14267 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7a0c776e9798d6128a3aac4400e1a22b3df84b56 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
