Vitor de Lima has uploaded a new change for review. Change subject: core, engine: Prevent DC removal with clusters on it ......................................................................
core, engine: Prevent DC removal with clusters on it This patch prevents the removal of a Data Center that still has clusters on it. Without this check, the Data Center can be removed and leave all its clusters orphaned. Change-Id: Ia9323c500b5a38f2535891e247ca88d2973157eb Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1056232 Signed-off-by: Vitor de Lima <vitor.l...@eldorado.org.br> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.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 6 files changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/09/24109/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java index 91fd054..be26145 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java @@ -25,6 +25,7 @@ import org.ovirt.engine.core.common.businessentities.StoragePoolStatus; import org.ovirt.engine.core.common.businessentities.StorageType; import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.VmStatic; import org.ovirt.engine.core.common.businessentities.network.Network; @@ -313,6 +314,12 @@ return false; } + final List<VDSGroup> vdsGroups = getVdsGroupDAO().getAllForStoragePool(getStoragePool().getId()); + + if (!vdsGroups.isEmpty()) { + return failCanDoAction(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_CLUSTERS); + } + final List<StorageDomain> poolDomains = getStorageDomainDAO().getAllForStoragePool(getStoragePool().getId()); final List<StorageDomain> activeOrLockedDomains = getActiveOrLockedDomainList(poolDomains); 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 82cfd03..83faf07 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 @@ -575,6 +575,7 @@ ERROR_CANNOT_CHANGE_STORAGE_DOMAIN_FIELDS(ErrorType.BAD_PARAMETERS), ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_IMAGES(ErrorType.CONFLICT), ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_VMS(ErrorType.CONFLICT), + ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_CLUSTERS(ErrorType.CONFLICT), ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_NONMASTER_DOMAINS(ErrorType.CONFLICT), ERROR_CANNOT_FORCE_REMOVE_STORAGE_POOL_WITH_VDS_NOT_IN_MAINTENANCE(ErrorType.CONFLICT), ERROR_CANNOT_UPDATE_STORAGE_POOL_COMPATIBILITY_VERSION_BIGGER_THAN_CLUSTERS(ErrorType.INCOMPATIBLE_VERSION), 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 880c539..322b78d 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -459,6 +459,8 @@ -Please remove them first. ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_VMS=Cannot remove Data Center while there are VMs on it.\n\ -Please remove all VMs and Templates first. +ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_CLUSTERS=Cannot remove Data Center while there are clusters on it.\n\ + -Please remove all clusters first. ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_NONMASTER_DOMAINS=Cannot remove Data Center while there are more than one Storage Domain attached. ERROR_CANNOT_REMOVE_STORAGE_DOMAIN_DO_FORMAT=Cannot remove Storage Domain. Data storage must be formatted after remove.\n\ -Please verify that Format option is enabled on the Data Domain. 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 623cf95..ef4bdc5 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 @@ -1261,6 +1261,9 @@ @DefaultStringValue("Cannot remove Data Center while there are VMs on it.\n-Please remove all VMs and Templates first.") String ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_VMS(); + @DefaultStringValue("Cannot remove Data Center while there are clusters on it.\n-Please remove all clusters first.") + String ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_CLUSTERS(); + @DefaultStringValue("Cannot remove Data Center while there are more than one Storage Domains attached.") String ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_NONMASTER_DOMAINS(); 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 8aad2c7..74584c6 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 @@ -432,6 +432,8 @@ -Please remove them first. ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_VMS=Cannot remove Data Center while there are VMs on it.\n\ -Please remove all VMs and Templates first. +ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_CLUSTERS=Cannot remove Data Center while there are clusters on it.\n\ + -Please remove all clusters first. ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_NONMASTER_DOMAINS=Cannot remove Data Center when there are more than one Storage Domain attached. ERROR_CANNOT_REMOVE_STORAGE_DOMAIN_DO_FORMAT=Cannot remove Storage Domain. Data storage must be formatted after remove.\n\ -Please verify that Format option is enabled on the Data Domain. 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 07136c9..f8958d1 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,6 +463,8 @@ -Please remove them first. ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_VMS=Cannot remove Data Center while there are VMs on it.\n\ -Please remove all VMs and Templates first. +ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_VMS=Cannot remove Data Center while there are clusters on it.\n\ + -Please remove all clusters first. ERROR_CANNOT_REMOVE_STORAGE_POOL_WITH_NONMASTER_DOMAINS=Cannot remove Data Center when there are more than one Storage Domain attached. ERROR_CANNOT_REMOVE_STORAGE_DOMAIN_DO_FORMAT=Cannot remove Storage Domain. Data storage must be formatted after remove.\n\ -Please verify that Format option is enabled on the Data Domain. -- To view, visit http://gerrit.ovirt.org/24109 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia9323c500b5a38f2535891e247ca88d2973157eb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vitor de Lima <vitor.l...@eldorado.org.br> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches