Liron Ar has uploaded a new change for review. Change subject: core: RecoveryStoragePool - adding further domain checks ......................................................................
core: RecoveryStoragePool - adding further domain checks When performing recovery storage pool, the engine reconstruct using an unattached domain, therefore the different CDA checks should also check the domain format, type, etc as done in attach storage domain flow. Change-Id: Ib0d2d0b57d5b82f9b1dc4871db7dc1711777e16d Signed-off-by: Liron Aravot <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RecoveryStoragePoolCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBase.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, 27 insertions(+), 21 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/62/18162/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RecoveryStoragePoolCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RecoveryStoragePoolCommand.java index 4943321..99a7d48 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RecoveryStoragePoolCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RecoveryStoragePoolCommand.java @@ -7,8 +7,8 @@ import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.businessentities.StorageDomain; -import org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus; import org.ovirt.engine.core.common.businessentities.StorageDomainStatus; +import org.ovirt.engine.core.common.businessentities.StorageDomainType; import org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap; import org.ovirt.engine.core.common.businessentities.StoragePoolStatus; import org.ovirt.engine.core.common.errors.VdcBLLException; @@ -65,18 +65,24 @@ returnValue = false; } else { StorageDomain domain = loadTargetedMasterDomain(); - if (domain.getStorageDomainSharedStatus() != StorageDomainSharedStatus.Unattached) { - addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL); - returnValue = false; - } else if (domain.getStorageType() != getStoragePool().getStorageType()) { - addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_RECOVERY_STORAGE_POOL_STORAGE_TYPE_MISSMATCH); - returnValue = false; + if (!checkDomainCanBeAttached(domain)) { + return false; } } } return returnValue; } + @Override + protected boolean checkStorageDomainType(final StorageDomain storageDomain) { + if (StorageDomainType.Data != storageDomain.getStorageDomainType()) { + addCanDoActionMessage(String.format("$StorageDomainType %1$s", StorageDomainType.Data.name())); + return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_WRONG_STORAGE_DOMAIN_TYPE); + } + + return true; + } + private StorageDomain loadTargetedMasterDomain() { return getStorageDomainDAO().get( _newMasterStorageDomainId); 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 a73fc88..993b9a8 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 @@ -148,7 +148,7 @@ if (storageDomain.getStorageDomainType() != StorageDomainType.ISO && storageDomain.getStorageDomainType() != StorageDomainType.ImportExport && getStoragePool().getStorageType() != storageDomain.getStorageType()) { - addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH); + addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH); return false; } return true; 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 4429958..fa6d640 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 @@ -445,6 +445,7 @@ ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_IN_STORAGE_POOL(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_WRONG_STORAGE_DOMAIN_TYPE(ErrorType.CONFLICT), ACTION_TYPE_FAILED_STORAGE_CONNECTION_NOT_EXIST(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_STORAGE_TYPE(ErrorType.NOT_SUPPORTED), @@ -481,7 +482,7 @@ ERROR_CANNOT_CREATE_STORAGE_DOMAIN_WITHOUT_VG_LV(ErrorType.BAD_PARAMETERS), ERROR_CANNOT_REMOVE_POOL_WITH_NETWORKS(ErrorType.CONFLICT), ERROR_CANNOT_REMOVE_POOL_WITH_ACTIVE_DOMAINS(ErrorType.CONFLICT), - ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH(ErrorType.CONFLICT), + ACTION_TYPE_FAILED_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH(ErrorType.CONFLICT), ERROR_CANNOT_CHANGE_STORAGE_POOL_TYPE_WITH_DOMAINS(ErrorType.CONFLICT), ERROR_CANNOT_EXTEND_CONNECTION_FAILED(ErrorType.CONFLICT), ERROR_CANNOT_CHANGE_STORAGE_DOMAIN_FIELDS(ErrorType.BAD_PARAMETERS), @@ -491,7 +492,6 @@ 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), ERROR_CANNOT_ADD_EXISTING_STORAGE_DOMAIN_CONNECTION_DATA_ILLEGAL(ErrorType.BAD_PARAMETERS), - ERROR_CANNOT_RECOVERY_STORAGE_POOL_STORAGE_TYPE_MISSMATCH(ErrorType.BAD_PARAMETERS), ERROR_CANNOT_REMOVE_STORAGE_DOMAIN_DO_FORMAT(ErrorType.BAD_PARAMETERS), ERROR_CANNOT_MANAGE_STORAGE_DOMAIN(ErrorType.NOT_SUPPORTED), ERROR_CANNOT_FIND_ISO_IMAGE_PATH(ErrorType.BAD_PARAMETERS), 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 13d4b5a..cc82358 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -374,6 +374,7 @@ ACTION_TYPE_FAILED_STORAGE_CONNECTION_WRONG_PARAMETERS_FOR_STORAGE_TYPE=Cannot ${action} ${type}. Connection parameters are invalid for this storage type. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_CHANGE_STORAGE_TYPE=Cannot ${action} ${type}. Storage type cannot be edited. ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST=Cannot ${action} ${type}. Storage Domain doesn't exist. +ACTION_TYPE_FAILED_WRONG_STORAGE_DOMAIN_TYPE==Cannot ${action} ${type}. The operation can be done using ${StorageDomainType} Storage Domain. ACTION_TYPE_FAILED_CANNOT_CHANGE_STORAGE_DOMAIN_TYPE=Cannot ${action} ${type}. Cannot change Storage Domain type. ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL=Cannot ${action} ${type}. The relevant Storage Domain is inaccessible.\n\ -Please handle Storage Domain issues and retry the operation. @@ -407,7 +408,7 @@ NETWORK_INTERFACE_NOT_EXISTS=Network name doesn't exist. ERROR_CANNOT_ATTACH_MORE_THAN_ONE_ISO_DOMAIN=Cannot attach more than one ISO Storage Domain to the same Data Center. If you want to use a newly created Domain, detach the existing attached Domain and attach the new one. ERROR_CANNOT_ATTACH_MORE_THAN_ONE_EXPORT_DOMAIN=Cannot attach more than one Import/Export Storage Domain to the same Data Center. If you want to use a newly created Domain, detach the existing attached Domain and attach the new one. -ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH=Cannot attach storage to Data Center. Storage type doesn't match the Data Center type. +ACTION_TYPE_FAILED_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH=Cannot ${action} ${type}. Storage type doesn't match the Data Center type. ERROR_CANNOT_CHANGE_STORAGE_POOL_TYPE_WITH_DOMAINS=Cannot change Data Center type when Storage Domains are still attached to it.\n\ -Please detach all attached Storage Domains and retry. NETWORK_INTERFACE_ALREADY_HAVE_NETWORK=The Network Interface is already attached to a Logical Network. @@ -415,7 +416,6 @@ NETWORK_NOT_EXISTS=The specified Logical Network doesn't exist. EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED=The specified external network cannot be configured on the host's interface. ERROR_CANNOT_RECOVERY_STORAGE_POOL_THERE_IS_ACTIVE_DATA_DOMAINS=Cannot recover Data Center with active Data Storage Domain in Data Center. -ERROR_CANNOT_RECOVERY_STORAGE_POOL_STORAGE_TYPE_MISSMATCH=Cannot recover Data Center. Mismatch between Storage Domain type and Data Center type. ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN=Cannot remove the master Storage Domain from the Data Center without another active Storage Domain to take its place.\n\ -Either activate another Storage Domain in the Data Center, or remove the Data Center. ERROR_CANNOT_DESTROY_LAST_STORAGE_DOMAIN=Cannot destroy the master Storage Domain from the Data Center without another active Storage Domain to take its place.\n\ 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 cf5dacd..611620e 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 @@ -1051,6 +1051,9 @@ @DefaultStringValue("Cannot ${action} ${type}. Storage Domain doesn't exist.") String ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST(); + @DefaultStringValue("Cannot ${action} ${type}. The operation can be done using ${StorageDomainType} Storage Domain.") + String ACTION_TYPE_FAILED_WRONG_STORAGE_DOMAIN_TYPE(); + @DefaultStringValue("Cannot ${action} ${type}. Cannot change Storage Domain type.") String ACTION_TYPE_FAILED_CANNOT_CHANGE_STORAGE_DOMAIN_TYPE(); @@ -1123,8 +1126,8 @@ @DefaultStringValue("Cannot attach more than one Import/Export Storage Domain to the same Data Center. If you want to use a newly created Domain, detach the existing attached Domain and attach the new one.") String ERROR_CANNOT_ATTACH_MORE_THAN_ONE_EXPORT_DOMAIN(); - @DefaultStringValue("Cannot attach storage to Data Center. Storage type doesn't match the Data Center type.") - String ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH(); + @DefaultStringValue("Cannot ${action} ${type}. Storage type doesn't match the Data Center type.") + String ACTION_TYPE_FAILED_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH(); @DefaultStringValue("Cannot change Data Center type when Storage Domains are still attached to it.\n-Please detach all attached Storage Domains and retry.") String ERROR_CANNOT_CHANGE_STORAGE_POOL_TYPE_WITH_DOMAINS(); @@ -1143,9 +1146,6 @@ @DefaultStringValue("Cannot recover Data Center with active Data Storage Domain in Data Center.") String ERROR_CANNOT_RECOVERY_STORAGE_POOL_THERE_IS_ACTIVE_DATA_DOMAINS(); - - @DefaultStringValue("Cannot recover Data Center. Mismatch between Storage Domain type and Data Center type.") - String ERROR_CANNOT_RECOVERY_STORAGE_POOL_STORAGE_TYPE_MISSMATCH(); @DefaultStringValue("Cannot remove the master Storage Domain from the Data Center without another active Storage Domain to take its place.\n-Either activate another Storage Domain in the Data Center, or remove the Data Center.") String ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN(); 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 f7d5ac1..d459528 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 @@ -361,6 +361,7 @@ ACTION_TYPE_FAILED_STORAGE_CONNECTION_WRONG_PARAMETERS_FOR_STORAGE_TYPE=Cannot ${action} ${type}. Connection parameters are invalid for this storage type. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_CHANGE_STORAGE_TYPE=Cannot ${action} ${type}. Storage type cannot be edited. ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST=Cannot ${action} ${type}. Storage Domain doesn't exist. +ACTION_TYPE_FAILED_WRONG_STORAGE_DOMAIN_TYPE==Cannot ${action} ${type}. The operation can be done using ${StorageDomainType} Storage Domain. ACTION_TYPE_FAILED_CANNOT_CHANGE_STORAGE_DOMAIN_TYPE=Cannot ${action} ${type}. Cannot change Storage Domain type. ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL=Cannot ${action} ${type}. The relevant Storage Domain is inaccessible.\n\ -Please handle Storage Domain issues and retry the operation. @@ -394,7 +395,7 @@ NETWORK_INTERFACE_NOT_EXISTS=Network name doesn't exist. ERROR_CANNOT_ATTACH_MORE_THAN_ONE_ISO_DOMAIN=Cannot attach more than one ISO Storage Domain to the same Data Center. If you want to use a newly created Domain, detach the existing attached Domain and attach the new one. ERROR_CANNOT_ATTACH_MORE_THAN_ONE_EXPORT_DOMAIN=Cannot attach more than one Import/Export Storage Domain to the same Data Center. If you want to use a newly created Domain, detach the existing attached Domain and attach the new one. -ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH=Cannot attach storage to Data Center. Storage type doesn't match the Data Center type. +ACTION_TYPE_FAILED_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH=Cannot ${action} ${type}. Storage type doesn't match the Data Center type. ERROR_CANNOT_CHANGE_STORAGE_POOL_TYPE_WITH_DOMAINS=Cannot change Data Center type when Storage Domains are still attached to it.\n\ -Please detach all attached Storage Domains and retry. NETWORK_INTERFACE_ALREADY_HAVE_NETWORK=The Network Interface is already attached to a Logical Network. @@ -402,7 +403,6 @@ NETWORK_NOT_EXISTS=The specified Logical Network doesn't exist. EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED=The specified external network cannot be configured on the host's interface. ERROR_CANNOT_RECOVERY_STORAGE_POOL_THERE_IS_ACTIVE_DATA_DOMAINS=Cannot recover Data Center with active Data Storage Domain in Data Center. -ERROR_CANNOT_RECOVERY_STORAGE_POOL_STORAGE_TYPE_MISSMATCH=Cannot recover Data Center. Mismatch between Storage Domain type and Data Center type. ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN=Cannot remove the master Storage Domain from the Data Center without another active Storage Domain to take its place.\n\ -Either activate another Storage Domain in the Data Center, or remove the Data Center. ERROR_CANNOT_DESTROY_LAST_STORAGE_DOMAIN=Cannot destroy the master Storage Domain from the Data Center without another active Storage Domain to take its place.\n\ 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 b5c2b2a..b8745eb 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 @@ -379,6 +379,7 @@ ACTION_TYPE_FAILED_STORAGE_CONNECTION_WRONG_PARAMETERS_FOR_STORAGE_TYPE=Cannot ${action} ${type}. Connection parameters are invalid for this storage type. ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_CHANGE_STORAGE_TYPE=Cannot ${action} ${type}. Storage type cannot be edited. ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST=Cannot ${action} ${type}. Storage Domain doesn't exist. +ACTION_TYPE_FAILED_WRONG_STORAGE_DOMAIN_TYPE==Cannot ${action} ${type}. The operation can be done using ${StorageDomainType} Storage Domain. ACTION_TYPE_FAILED_CANNOT_CHANGE_STORAGE_DOMAIN_TYPE=Cannot ${action} ${type}. Cannot change Storage Domain type. ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL=Cannot ${action} ${type}. The relevant Storage Domain is inaccessible.\n\ -Please handle Storage Domain issues and retry the operation. @@ -412,7 +413,7 @@ NETWORK_INTERFACE_NOT_EXISTS=Network name doesn't exist. ERROR_CANNOT_ATTACH_MORE_THAN_ONE_ISO_DOMAIN=Cannot attach more than one ISO Storage Domain to the same Data Center. If you want to use a newly created Domain, detach the existing attached Domain and attach the new one. ERROR_CANNOT_ATTACH_MORE_THAN_ONE_EXPORT_DOMAIN=Cannot attach more than one Import/Export Storage Domain to the same Data Center. If you want to use a newly created Domain, detach the existing attached Domain and attach the new one. -ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH=Cannot attach storage to Data Center. Storage type doesn't match the Data Center type. +ACTION_TYPE_FAILED_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH=Cannot ${action} ${type}. Storage type doesn't match the Data Center type. ERROR_CANNOT_CHANGE_STORAGE_POOL_TYPE_WITH_DOMAINS=Cannot change Data Center type when Storage Domains are still attached to it.\n\ -Please detach all attached Storage Domains and retry. NETWORK_INTERFACE_ALREADY_HAVE_NETWORK=The Network Interface is already attached to a Logical Network. @@ -420,7 +421,6 @@ NETWORK_NOT_EXISTS=The specified Logical Network doesn't exist. EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED=The specified external network cannot be configured on the host's interface. ERROR_CANNOT_RECOVERY_STORAGE_POOL_THERE_IS_ACTIVE_DATA_DOMAINS=Cannot recover Data Center with active Data Storage Domain in Data Center. -ERROR_CANNOT_RECOVERY_STORAGE_POOL_STORAGE_TYPE_MISSMATCH=Cannot recover Data Center. Mismatch between Storage Domain type and Data Center type. ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN=Cannot remove the master Storage Domain from the Data Center without another active Storage Domain to take its place.\n\ -Either activate another Storage Domain in the Data Center, or remove the Data Center. ERROR_CANNOT_DESTROY_LAST_STORAGE_DOMAIN=Cannot destroy the master Storage Domain from the Data Center without another active Storage Domain to take its place.\n\ -- To view, visit http://gerrit.ovirt.org/18162 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib0d2d0b57d5b82f9b1dc4871db7dc1711777e16d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Ar <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
