Lior Vernia has uploaded a new change for review. Change subject: engine: Add validation that display network is required ......................................................................
engine: Add validation that display network is required Previously the display network was de-facto treated as required, now added this as explicit validation. Also made sure existing display network are marked as required using an upgrade script, so that we can maintain a consistent state where display networks are from now on necessarily required. Change-Id: I5ca7c7ca3084d2dec6690bf60e7fa7fd7efc319c Bug-Url: https://bugzilla.redhat.com/1135779 Signed-off-by: Lior Vernia <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.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/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties A packaging/dbscripts/upgrade/03_06_0370_mark_display_network_required.sql 7 files changed, 18 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/32906/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java index e7bb162..a414545 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java @@ -31,6 +31,7 @@ return (!NetworkUtils.isManagementNetwork(getNetwork()) || validate(validator.managementNetworkAttachment(getNetworkName()))) && validate(validator.migrationPropertySupported(getNetworkName())) + && validate(validator.displayNetworkRequired()) && (!getNetwork().isExternal() || validateExternalNetwork(validator)); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java index bcafb22..a969cf6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java @@ -46,6 +46,16 @@ } /** + * Make sure the display network is also marked as required. + * + * @return Error iff the network is configured in the cluster as both display and non-required. + */ + public ValidationResult displayNetworkRequired() { + return !networkCluster.isDisplay() || networkCluster.isRequired() ? ValidationResult.VALID + : new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISPLAY_NETWORK_MUST_BE_REQUIRED); + } + + /** * Make sure the external network attachment is supported for the version. * * @return Error iff the external network attachment is not supported. 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 a3b983d..3b2e6ad 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 @@ -549,6 +549,7 @@ ACTION_TYPE_FAILED_CANNOT_ADD_VNIC_PROFILE_TO_NON_VM_NETWORK(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), ACTION_TYPE_FAILED_MIGRATION_NETWORK_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), + ACTION_TYPE_FAILED_DISPLAY_NETWORK_MUST_BE_REQUIRED(ErrorType.CONFLICT), ACTION_TYPE_FAILED_PROVIDER_DOESNT_EXIST(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_MANAGEMENT_NETWORK_REQUIRED(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_NETWORK_ADDRESS_CANNOT_BE_CHANGED(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 0ba7011..5f26c4a 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -599,6 +599,7 @@ NETWORK_MTU_DIFFERENCES=Cannot ${action} ${type}. The following Logical Networks do not have the same MTU value: ${NETWORK_MTU_DIFFERENCES_LIST}. NETWORK_MTU_OVERRIDE_NOT_SUPPORTED=Cannot ${action} ${type}. Overriding MTU is not supported for this Data Center's compatibility version. ACTION_TYPE_FAILED_MIGRATION_NETWORK_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Migration network is not supported for this cluster version. +ACTION_TYPE_FAILED_DISPLAY_NETWORK_MUST_BE_REQUIRED=Cannot ${action} ${type}. The display network of a cluster must also be configured as required in that cluster. ACTION_TYPE_FAILED_PROVIDER_DOESNT_EXIST=Cannot ${action} ${type}. The provider does not exist in the system. ACTION_TYPE_FAILED_PROVIDER_NETWORKS_USED=Cannot ${action} ${type}. Several external networks (${NETWORK_NAMES_COUNTER}) are being used by virtual machines and/or templates:\n${NETWORK_NAMES}\n - Please resolve the external networks usage first and try again. ACTION_TYPE_FAILED_PROVIDER_TYPE_MISMATCH=Cannot ${action} ${type}. The provider type should be 'OpenStack Networking'. 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 6709876..4950ca8 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 @@ -1645,6 +1645,9 @@ @DefaultStringValue("Cannot ${action} ${type}. Migration network is not supported for this cluster version.") String ACTION_TYPE_FAILED_MIGRATION_NETWORK_IS_NOT_SUPPORTED(); + @DefaultStringValue("Cannot ${action} ${type}. The display network of a cluster must also be configured as required in that cluster.") + String ACTION_TYPE_FAILED_DISPLAY_NETWORK_MUST_BE_REQUIRED(); + @DefaultStringValue("Cannot ${action} ${type}. The provider does not exist in the system.") String ACTION_TYPE_FAILED_PROVIDER_DOESNT_EXIST(); 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 83b64e3..d09fc1e 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 @@ -602,6 +602,7 @@ NETWORK_MTU_DIFFERENCES=Cannot ${action} ${type}. The following Logical Networks do not have the same MTU value: ${NETWORK_MTU_DIFFERENCES_LIST}. NETWORK_MTU_OVERRIDE_NOT_SUPPORTED=Cannot ${action} ${type}. Overriding MTU is not supported for this Data Center's compatibility version. ACTION_TYPE_FAILED_MIGRATION_NETWORK_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Migration network is not supported for this cluster version. +ACTION_TYPE_FAILED_DISPLAY_NETWORK_MUST_BE_REQUIRED=Cannot ${action} ${type}. The display network of a cluster must also be configured as required in that cluster. ACTION_TYPE_FAILED_PROVIDER_DOESNT_EXIST=Cannot ${action} ${type}. The provider does not exist in the system. ACTION_TYPE_FAILED_PROVIDER_TYPE_MISMATCH=Cannot ${action} ${type}. The provider type should be 'OpenStack Networking'. ACTION_TYPE_FAILED_MISSING_NETWORK_MAPPINGS=Cannot ${action} ${type}. The network mappings should be provided as a parameter or configured on the network provider. diff --git a/packaging/dbscripts/upgrade/03_06_0370_mark_display_network_required.sql b/packaging/dbscripts/upgrade/03_06_0370_mark_display_network_required.sql new file mode 100644 index 0000000..f7cec00 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_0370_mark_display_network_required.sql @@ -0,0 +1 @@ +UPDATE network_cluster SET required=true WHERE is_display; -- To view, visit http://gerrit.ovirt.org/32906 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5ca7c7ca3084d2dec6690bf60e7fa7fd7efc319c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Lior Vernia <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
