Maor Lipchuk has uploaded a new change for review. Change subject: core: Remove business logic of MSD validation for detach ......................................................................
core: Remove business logic of MSD validation for detach Remove message and validation for entities with disks on multiple storage domains, since this should be valid now. Change-Id: Ieb0115e4c8fb22f61c69f2cdd0c92c06adb2bcd5 Signed-off-by: Maor Lipchuk <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBase.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 7 files changed, 0 insertions(+), 58 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/35/28535/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBase.java index ea9d7d8..7a3ed9d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBase.java @@ -14,7 +14,6 @@ import org.ovirt.engine.core.bll.interfaces.BackendInternal; import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator; import org.ovirt.engine.core.bll.utils.PermissionSubject; -import org.ovirt.engine.core.bll.validator.StorageDomainValidator; import org.ovirt.engine.core.common.FeatureSupported; import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.StoragePoolParametersBase; @@ -173,11 +172,6 @@ protected boolean canDetachStorageDomainWithVmsAndDisks(StorageDomain storageDomain) { if (!storageDomain.getStorageDomainType().isDataDomain()) { return true; - } - StorageDomainValidator storageValidator = new StorageDomainValidator(storageDomain); - if (!validate(storageValidator.hasVmsWithDisksOnOtherStorageDomains()) || - !validate(storageValidator.hasTempaltesWithDisksOnOtherStorageDomains())) { - return false; } List<VM> vmRelatedToDomain = getVMsForStorageDomain(storageDomain.getId()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java index 4ee48f2..40294ee 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java @@ -1,20 +1,15 @@ package org.ovirt.engine.core.bll.validator; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; -import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.ValidationResult; import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.common.businessentities.StorageDomain; import org.ovirt.engine.core.common.businessentities.StorageDomainDynamic; import org.ovirt.engine.core.common.businessentities.StorageDomainStatus; -import org.ovirt.engine.core.common.businessentities.VM; -import org.ovirt.engine.core.common.businessentities.VmTemplate; import org.ovirt.engine.core.common.businessentities.VolumeFormat; import org.ovirt.engine.core.common.businessentities.VolumeType; import org.ovirt.engine.core.common.config.Config; @@ -99,39 +94,6 @@ private static Integer getLowDiskSpaceThreshold() { return Config.<Integer> getValue(ConfigValues.FreeSpaceCriticalLowInGB); - } - - // TODO: Validation should be removed once we support detach of storage domain with VMs containing multiple disks - // resides on different storage domains. - public ValidationResult hasVmsWithDisksOnOtherStorageDomains() { - // If there are VMs with disks on other storage domain we should block the operation. - List<VM> vms = getDbFacade().getVmDao().getAllVMsWithDisksOnOtherStorageDomain(storageDomain.getId()); - - if (!vms.isEmpty()) { - List<String> entityNames = new ArrayList<>(); - for (VM vm : vms) { - entityNames.add(vm.getName()); - } - return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONTAINS_VMS_WITH_DISKS_ON_OTHER_DOMAINS, - String.format("$vms %1$s", StringUtils.join(entityNames, ","))); - } - return ValidationResult.VALID; - } - - public ValidationResult hasTempaltesWithDisksOnOtherStorageDomains() { - // If there are Templates with disks on other storage domain we should block the operation. - List<VmTemplate> vmTemplates = - getDbFacade().getVmTemplateDao().getAllTemplatesWithDisksOnOtherStorageDomain(storageDomain.getId()); - - if (!vmTemplates.isEmpty()) { - List<String> entityNames = new ArrayList<>(); - for (VmTemplate vmTemplate : vmTemplates) { - entityNames.add(vmTemplate.getName()); - } - return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONTAINS_TEMPLATES_WITH_DISKS_ON_OTHER_DOMAINS, - String.format("$vmTemplates %1$s", StringUtils.join(entityNames, ","))); - } - return ValidationResult.VALID; } public ValidationResult hasSpaceForNewDisks(Collection<DiskImage> diskImages) { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java index 2638e86..512cbd0 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java @@ -551,8 +551,6 @@ ACTION_TYPE_FAILED_LUNS_ALREADY_USED_BY_DISKS(ErrorType.CONFLICT), ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST(ErrorType.BAD_PARAMETERS), - ACTION_TYPE_FAILED_STORAGE_CONTAINS_VMS_WITH_DISKS_ON_OTHER_DOMAINS(ErrorType.BAD_PARAMETERS), - ACTION_TYPE_FAILED_STORAGE_CONTAINS_TEMPLATES_WITH_DISKS_ON_OTHER_DOMAINS(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_STORAGE_CONNECTION_NOT_EXIST(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_STORAGE_CONNECTION_FOR_DOMAIN_NOT_EXIST(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS(ErrorType.CONFLICT), diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index 3475f8e..e227fb3 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -459,8 +459,6 @@ ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_RUNNING_VMS_AND_DOMAINS_STATUS=Cannot ${action} ${type}. The data domains ${domainNames} should be in maintenance or unattached, and VMs ${vmNames} should be down. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_NOT_SAME_STORAGE_TYPE=Cannot ${action} ${type}. Storage connection and domain type don't match. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_RUNNING_VMS=Cannot ${action} ${type}. VMs ${vmNames} should be down. -ACTION_TYPE_FAILED_STORAGE_CONTAINS_VMS_WITH_DISKS_ON_OTHER_DOMAINS=Cannot ${action} ${type}. There are VMs which contain disks related to other storage domains. The VMs are: ${vms}. -ACTION_TYPE_FAILED_STORAGE_CONTAINS_TEMPLATES_WITH_DISKS_ON_OTHER_DOMAINS=Cannot ${action} ${type}. There are Templates which contain disks related to other storage domains. The Templates are: ${vmTemplates}. ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS=Cannot ${action} ${type}. Storage connection parameters are used by the following storage domains : ${domainNames}. ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS_AND_DISKS=Cannot ${action} ${type}. Storage connection parameters are used by the following storage domains : ${domainNames} and disks: ${diskNames}. ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_DISKS=Cannot ${action} ${type}. Storage connection parameters are used by the following disks : ${diskNames}. diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java index 98ac5ea..c53787b 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java @@ -379,12 +379,6 @@ @DefaultStringValue("Cannot ${action} ${type}. The following VMs are previewing a snapshot: ${vms}.") String ACTION_TYPE_FAILED_STORAGE_DELETE_VMS_IN_PREVIEW(); - @DefaultStringValue("Cannot ${action} ${type}. The following VM's disks snapshots are attached to other VMs (Disk Alias/Snapshot Description/VM attached to):\n\n ${disksInfo} \n\nPlease detach them from those VMs and try again.") - String ACTION_TYPE_FAILED_VM_DISK_SNAPSHOT_IS_ATTACHED_TO_ANOTHER_VM(); - - @DefaultStringValue("Cannot ${action} ${type}. The following VM's disks snapshots are plugged to other VMs (Disk Alias/Snapshot Description/VM attached to):\n\n ${disksInfo} \n\nPlease deactivate/detach them from those VMs and try again.") - String ACTION_TYPE_FAILED_VM_DISK_SNAPSHOT_IS_PLUGGED_TO_ANOTHER_VM(); - @DefaultStringValue("Cannot ${action} ${type}. The following VM's activated disks are disk snapshots (VM/Disk Snapshots): \n\n ${disksInfo}. \n\nPlease deactivate them and try again.") String ACTION_TYPE_FAILED_VM_HAS_PLUGGED_DISK_SNAPSHOT(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 5c33181..f92de6c 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -430,8 +430,6 @@ ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_RUNNING_VMS_AND_DOMAINS_STATUS=Cannot ${action} ${type}. The data domains ${domainNames} should be in maintenance or unattached, and VMs ${vmNames} should be down. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_NOT_SAME_STORAGE_TYPE=Cannot ${action} ${type}. Storage connection and domain type don't match. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_RUNNING_VMS=Cannot ${action} ${type}. VMs ${vmNames} should be down. -ACTION_TYPE_FAILED_STORAGE_CONTAINS_VMS_WITH_DISKS_ON_OTHER_DOMAINS=Cannot ${action} ${type}. There are VMs which contain disks related to other storage domains. The VMs are: ${vms}. -ACTION_TYPE_FAILED_STORAGE_CONTAINS_TEMPLATES_WITH_DISKS_ON_OTHER_DOMAINS=Cannot ${action} ${type}. There are Templates which contain disks related to other storage domains. The Templates are: ${vmTemplates}. ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS=Cannot ${action} ${type}. Storage connection parameters are used by the following storage domains : ${domainNames}. ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS_AND_DISKS=Cannot ${action} ${type}. Storage connection parameters are used by the following storage domains : ${domainNames} and disks: ${diskNames}. ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_DISKS=Cannot ${action} ${type}. Storage connection parameters are used by the following disks : ${diskNames}. diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index ff19764..8936607 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -463,8 +463,6 @@ ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_DOMAINS_STATUS=Cannot ${action} ${type}. The data domains ${domainNames} should be in maintenance or unattached. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_NOT_SAME_STORAGE_TYPE=Cannot ${action} ${type}. Storage connection and domain type don't match. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_RUNNING_VMS=Cannot ${action} ${type}. VMs ${vmNames} should be down. -ACTION_TYPE_FAILED_STORAGE_CONTAINS_VMS_WITH_DISKS_ON_OTHER_DOMAINS=Cannot ${action} ${type}. There are VMs which contain disks related to other storage domains. The VMs are: ${vms}. -ACTION_TYPE_FAILED_STORAGE_CONTAINS_TEMPLATES_WITH_DISKS_ON_OTHER_DOMAINS=Cannot ${action} ${type}. There are Templates which contain disks related to other storage domains. The Templates are: ${vmTemplates}. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_RUNNING_VMS_AND_DOMAINS_STATUS=Cannot ${action} ${type}. The data domains ${domainNames} should be in maintenance or unattached, and VMs ${vmNames} should be down. ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS=Cannot ${action} ${type}. Storage connection parameters are used by the following storage domains : ${domainNames}. ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS_AND_DISKS=Cannot ${action} ${type}. Storage connection parameters are used by the following storage domains : ${domainNames} and disks: ${diskNames}. -- To view, visit http://gerrit.ovirt.org/28535 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ieb0115e4c8fb22f61c69f2cdd0c92c06adb2bcd5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
