Martin Mucha has uploaded a new change for review. Change subject: core,webadmin: enforce that datacenter id cannot be changed. ......................................................................
core,webadmin: enforce that datacenter id cannot be changed. Change-Id: I1a1a0e5fa0dfd9c1756ebba75f84d3a12c723317 Bug-Url: https://bugzilla.redhat.com/1140492 Signed-off-by: Martin Mucha <mmu...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.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/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 4 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/32828/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java index 129f0b3..12e6483 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java @@ -130,6 +130,7 @@ && validate(validatorNew.qosExistsInDc()) && validate(validatorOld.networkIsSet()) && validate(validatorOld.notRenamingManagementNetwork(getNetwork())) + && validate(validatorOld.notChangingDataCenterId(getNetwork().getDataCenterId())) && validate(validatorNew.networkNameNotUsed()) && validate(validatorOld.networkNotUsedByRunningVms()) && validate(validatorOld.nonVmNetworkNotUsedByVms(getNetwork())) @@ -315,6 +316,11 @@ : new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_NETWORK_DETAILS_CANNOT_BE_EDITED); } + public ValidationResult notChangingDataCenterId(Guid dataCenterId) { + final Guid oldDataCenterId = network.getDataCenterId(); + return ValidationResult.failWith(VdcBllMessages.ACTION_TYPE_FAILED_DATA_CENTER_ID_CANNOT_BE_CHANGED) + .when(!oldDataCenterId.equals(dataCenterId)); + } } @Override 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 e714829..1ca1510 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 @@ -558,6 +558,7 @@ ACTION_TYPE_FAILED_EXTERNAL_NETWORK_MUST_BE_VM_NETWORK(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_EXTERNAL_NETWORK_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), ACTION_TYPE_FAILED_NOT_SUPPORTED_FOR_EXTERNAL_NETWORK(ErrorType.NOT_SUPPORTED), + ACTION_TYPE_FAILED_DATA_CENTER_ID_CANNOT_BE_CHANGED(ErrorType.NOT_SUPPORTED), ACTION_TYPE_FAILED_EXTERNAL_NETWORK_CANNOT_BE_DISPLAY(ErrorType.NOT_SUPPORTED), ACTION_TYPE_FAILED_EXTERNAL_NETWORK_CANNOT_BE_REQUIRED(ErrorType.NOT_SUPPORTED), ACTION_TYPE_FAILED_EXTERNAL_NETWORK_WITH_VLAN_MUST_BE_LABELED(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 f4142ed..01cef5d 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -609,6 +609,7 @@ ACTION_TYPE_FAILED_EXTERNAL_NETWORK_DETAILS_CANNOT_BE_EDITED=Cannot ${action} ${type}. External network details (except name and description) cannot be changed. ACTION_TYPE_FAILED_EXTERNAL_NETWORK_NOT_SUPPORTED=Cannot ${action} ${type}. External networks are not supported for this cluster's compatibility version. ACTION_TYPE_FAILED_NOT_SUPPORTED_FOR_EXTERNAL_NETWORK=Cannot ${action} ${type}. This operation is not supported for external networks. +ACTION_TYPE_FAILED_DATA_CENTER_ID_CANNOT_BE_CHANGED=Cannot ${action} ${type}. Change of DataCenter ID is not allowed. ACTION_TYPE_FAILED_EXTERNAL_NETWORK_CANNOT_BE_DISPLAY=Cannot ${action} ${type}. External network cannot be used as a display network. ACTION_TYPE_FAILED_EXTERNAL_NETWORK_CANNOT_BE_REQUIRED=Cannot ${action} ${type}. External network cannot be set as required in the cluster. ACTION_TYPE_FAILED_EXTERNAL_NETWORK_WITH_VLAN_MUST_BE_LABELED=Cannot ${action} ${type}. External network with vlan must be labeled. 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 d022e4d..e5b03b0 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 @@ -612,6 +612,7 @@ ACTION_TYPE_FAILED_EXTERNAL_NETWORK_DETAILS_CANNOT_BE_EDITED=Cannot ${action} ${type}. External network details (except name and description) cannot be changed. ACTION_TYPE_FAILED_EXTERNAL_NETWORK_NOT_SUPPORTED=Cannot ${action} ${type}. External networks are not supported for this cluster's compatibility version. ACTION_TYPE_FAILED_NOT_SUPPORTED_FOR_EXTERNAL_NETWORK=Cannot ${action} ${type}. This operation is not supported for external networks. +ACTION_TYPE_FAILED_DATA_CENTER_ID_CANNOT_BE_CHANGED=Cannot ${action} ${type}. Change of DataCenter ID is not allowed. ACTION_TYPE_FAILED_EXTERNAL_NETWORK_CANNOT_BE_DISPLAY=Cannot ${action} ${type}. External network cannot be used as a display network. ACTION_TYPE_FAILED_EXTERNAL_NETWORK_CANNOT_BE_REQUIRED=Cannot ${action} ${type}. External network cannot be set as required in the cluster. ACTION_TYPE_FAILED_EXTERNAL_NETWORK_WITH_VLAN_MUST_BE_LABELED=Cannot ${action} ${type}. External network with vlan must be labeled. -- To view, visit http://gerrit.ovirt.org/32828 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1a1a0e5fa0dfd9c1756ebba75f84d3a12c723317 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha <mmu...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches