Greg Padgett has uploaded a new change for review. Change subject: core: error message when deactivating SD with active VMs (#843407) ......................................................................
core: error message when deactivating SD with active VMs (#843407) https://bugzilla.redhat.com/843407 canDoAction() of DeactivateStorageDomainCommand runs a stored procedure to find VMs whose status should prevent deactivation. This patch renames the SP and associated DAO methods to reflect what it is really searching for (non-"Down" VMs), as well as changes the error message to accurately reflect the cause of the failure. Change-Id: I3ce9ce378ffeed980af508e6556f9d844a3e07bd Signed-off-by: Greg Padgett <gpadg...@redhat.com> --- M backend/manager/dbscripts/vms_sp.sql M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAO.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmDAOTest.java 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 10 files changed, 17 insertions(+), 17 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/7997/1 diff --git a/backend/manager/dbscripts/vms_sp.sql b/backend/manager/dbscripts/vms_sp.sql index fc0e842..95eda8c 100644 --- a/backend/manager/dbscripts/vms_sp.sql +++ b/backend/manager/dbscripts/vms_sp.sql @@ -779,7 +779,7 @@ -Create or replace FUNCTION GetRunningVmsByStorageDomainId(v_storage_domain_id UUID) RETURNS SETOF vms +Create or replace FUNCTION GetActiveVmsByStorageDomainId(v_storage_domain_id UUID) RETURNS SETOF vms AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java index e57bed1..0f00a1e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DeactivateStorageDomainCommand.java @@ -104,9 +104,9 @@ } if (!getParameters().getIsInternal() && !getVmDAO() - .getAllRunningForStorageDomain(getStorageDomain().getId()) + .getAllActiveForStorageDomain(getStorageDomain().getId()) .isEmpty()) { - addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DETECTED_RUNNING_VMS); + addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS); return false; } if (getStoragePool().getspm_vds_id() != null) { diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java index c015d83..672266f 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java @@ -138,7 +138,7 @@ ACTION_TYPE_FAILED_VM_NOT_FOUND_ON_EXPORT_DOMAIN, ACTION_TYPE_FAILED_IMPORTED_TEMPLATE_IS_MISSING, ACTION_TYPE_FAILED_SPECIFY_DOMAIN_IS_NOT_EXPORT_DOMAIN, - ACTION_TYPE_FAILED_DETECTED_RUNNING_VMS, + ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS, ACTION_TYPE_FAILED_VDS_WITH_SAME_HOST_EXIST, ACTION_TYPE_FAILED_ILLEGAL_MEMORY_SIZE, ACTION_TYPE_FAILED_ILLEGAL_NUM_OF_MONITORS, diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAO.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAO.java index 2ddc808..1b5f504 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAO.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAO.java @@ -149,7 +149,7 @@ * the storage domain * @return the running VMs */ - List<VM> getAllRunningForStorageDomain(Guid storageDomain); + List<VM> getAllActiveForStorageDomain(Guid storageDomain); /** * Get all vms related to quota id diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java index b2aebb4..efdf146 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java @@ -164,8 +164,8 @@ } @Override - public List<VM> getAllRunningForStorageDomain(Guid id) { - return getCallsHandler().executeReadList("GetRunningVmsByStorageDomainId", + public List<VM> getAllActiveForStorageDomain(Guid id) { + return getCallsHandler().executeReadList("GetActiveVmsByStorageDomainId", VMRowMapper.instance, getCustomMapSqlParameterSource() .addValue("storage_domain_id", id)); 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 431cbe7..bb073df 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -445,8 +445,8 @@ NETWORK_CANNOT_REMOVE_MANAGEMENT_NETWORK=The management Network (engine) is mandatory and cannot be removed. NETWORK_OLD_NETWORK_NOT_SPECIFIED=Previous network name is required. NETWORK_INTERFACE_EXITED_MAX_INTERFACES=Cannot ${action} ${type}. VM cannot have more than 8 interfaces. -ACTION_TYPE_FAILED_DETECTED_RUNNING_VMS=Cannot ${action} ${type}. Running VMs were detected.\n\ - -Please stop all running VMs associated with this Storage Domain first. +ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS=Cannot ${action} ${type}. Active VMs were detected.\n\ + -Please ensure all VMs associated with this Storage Domain are stopped and in the Down state first. ACTION_TYPE_FAILED_HOST_NOT_EXIST=The provided Host does not exist. TAGS_SPECIFY_TAG_IS_IN_USE=The specified Tag name already exists. NETWORK_NOT_EXISTS_IN_CLUSTER=The specified Logical Network does not exist in Cluster. diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmDAOTest.java index 42aa965..86b02d1 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmDAOTest.java @@ -286,8 +286,8 @@ * Ensures that all running VMs associated with a storage domain. */ @Test - public void testGetAllRunningForStorageDomain() { - List<VM> result = dao.getAllRunningForStorageDomain(STORAGE_DOMAIN_ID); + public void testGetAllActiveForStorageDomain() { + List<VM> result = dao.getAllActiveForStorageDomain(STORAGE_DOMAIN_ID); assertNotNull(result); assertFalse(result.isEmpty()); 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 a2575ac..9b154af 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 @@ -1171,8 +1171,8 @@ @DefaultStringValue("Cannot ${action} ${type}. VM cannot have more than 8 interfaces.") String NETWORK_INTERFACE_EXITED_MAX_INTERFACES(); - @DefaultStringValue("Cannot ${action} ${type}. Running VMs were detected.\n-Please stop all running VMs associated with this Storage Domain first.") - String ACTION_TYPE_FAILED_DETECTED_RUNNING_VMS(); + @DefaultStringValue("Cannot ${action} ${type}. Active VMs were detected.\n-Please ensure all VMs associated with this Storage Domain are stopped and in the Down state first.") + String ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS(); @DefaultStringValue("The provided Host does not exist.") String ACTION_TYPE_FAILED_HOST_NOT_EXIST(); 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 5f2fd99..ee3663d 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 @@ -443,8 +443,8 @@ NETWORK_CANNOT_REMOVE_MANAGEMENT_NETWORK=The management Network (engine) is mandatory and cannot be removed. NETWORK_OLD_NETWORK_NOT_SPECIFIED=Previous network name is required. NETWORK_INTERFACE_EXITED_MAX_INTERFACES=Cannot ${action} ${type}. VM cannot have more than 8 interfaces. -ACTION_TYPE_FAILED_DETECTED_RUNNING_VMS=Cannot ${action} ${type}. Running VMs were detected.\n\ - -Please stop all running VMs associated with this Storage Domain first. +ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS=Cannot ${action} ${type}. Active VMs were detected.\n\ + -Please ensure all VMs associated with this Storage Domain are stopped and in the Down state first. ACTION_TYPE_FAILED_HOST_NOT_EXIST=The provided Host does not exist. TAGS_SPECIFY_TAG_IS_IN_USE=The specified Tag name already exists. NETWORK_NET_EXISTS_IN_CLUSTER=The specified Logical Network does not exist in Cluster. 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 3872daa..e8da15a 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 @@ -441,8 +441,8 @@ NETWORK_CANNOT_REMOVE_MANAGEMENT_NETWORK=The management Network (engine) is mandatory and cannot be removed. NETWORK_OLD_NETWORK_NOT_SPECIFIED=Previous network name is required. NETWORK_INTERFACE_EXITED_MAX_INTERFACES=Cannot ${action} ${type}. VM cannot have more than 8 interfaces. -ACTION_TYPE_FAILED_DETECTED_RUNNING_VMS=Cannot ${action} ${type}. Running VMs were detected.\n\ - -Please stop all running VMs associated with this Storage Domain first. +ACTION_TYPE_FAILED_DETECTED_ACTIVE_VMS=Cannot ${action} ${type}. Active VMs were detected.\n\ + -Please ensure all VMs associated with this Storage Domain are stopped and in the Down state first. ACTION_TYPE_FAILED_HOST_NOT_EXIST=The provided Host does not exist. TAGS_SPECIFY_TAG_IS_IN_USE=The specified Tag name already exists. NETWORK_NET_EXISTS_IN_CLUSTER=The specified Logical Network does not exist in Cluster. -- To view, visit http://gerrit.ovirt.org/7997 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3ce9ce378ffeed980af508e6556f9d844a3e07bd Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Greg Padgett <gpadg...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches