Moti Asayag has uploaded a new change for review. Change subject: engine: Allow updating network if not used by hosts ......................................................................
engine: Allow updating network if not used by hosts The requirement for updating network only if not attached to a cluster was mitigated and now we support updating a network only if it is not being used (e.g. not attached to any host's nic): As long as the network isn't defined on the hosts, there shouldn't be an issue of modifying its configuration. Change-Id: I75f6e21defef5e70e91013f9bd645e5d7d265ba8 Signed-off-by: Moti Asayag <masa...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/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(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/10686/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 cd92908..b9c109e 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 @@ -53,7 +53,7 @@ && validate(notChangingManagementNetworkName()) && validate(networkNameNotUsed()) && validate(networkNotUsedByRunningVm()) - && validate(networkNotAttachedToCluster(getOldNetwork())); + && validate(networkNotUsedByHost()); } @Override @@ -138,4 +138,10 @@ ? new ValidationResult(VdcBllMessages.NETWORK_CAN_NOT_REMOVE_DEFAULT_NETWORK) : ValidationResult.VALID; } + + private ValidationResult networkNotUsedByHost() { + return getVdsDAO().getAllForNetwork(getOldNetwork().getId()).isEmpty() + ? ValidationResult.VALID + : new ValidationResult(VdcBllMessages.NETWORK_IN_USE_BY_HOSTS); + } } 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 43bd353..636ebfb 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 @@ -376,6 +376,7 @@ NETWORK_NAME_ALREADY_EXISTS, NETWORK_HOST_IS_BUSY, NETWORK_NAME_IN_USE, + NETWORK_IN_USE_BY_HOSTS, NETWORK_NOT_EXISTS, NETWORK_NOT_EXISTS_IN_CLUSTER, NETWORK_OLD_NETWORK_NOT_SPECIFIED, 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 6d8935f..9bc5eb2 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -392,6 +392,8 @@ -Please deactivate all domains and wait for tasks to finish before removing the Data Center. VDS_GROUP_CANNOT_CHANGE_STORAGE_POOL=Cannot change Data Center association when editing a Cluster. NETWORK_NAME_IN_USE=Cannot ${action} ${type}. The Logical Network's name is already used by an existing Logical Network in the same Data-Center. +NETWORK_IN_USE_BY_HOSTS=Cannot ${action} ${type}. The Logical Network is in use.\n\ + -Please remove it from all Hosts in Data-Center and try again. ERROR_CANNOT_CREATE_STORAGE_DOMAIN_WITHOUT_VG_LV=Volume Group (VGs) and Logical Volumes (LVs) are not specified. NETWORK_INTERFACE_TEMPLATE_CANNOT_BE_SET=Cannot ${action} ${type}. VM Template ID must be empty. NETWORK_INTERFACE_VM_CANNOT_BE_SET=Cannot ${action} ${type}. VM ID must be empty. 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 9e65f76..4c87c44 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 @@ -1053,6 +1053,9 @@ @DefaultStringValue("Cannot ${action} ${type}. The Logical Network's name is already used by an existing Logical Network in the same Data-Center.") String NETWORK_NAME_IN_USE(); + @DefaultStringValue("Cannot ${action} ${type}. The Logical Network is in use.\n-Please remove it from all Hosts in Data-Center and try again.") + String NETWORK_IN_USE_BY_HOSTS(); + @DefaultStringValue("Volume Group (VGs) and Logical Volumes (LVs) are not specified.") String ERROR_CANNOT_CREATE_STORAGE_DOMAIN_WITHOUT_VG_LV(); 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 e154ce4..ee59d48 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 @@ -388,6 +388,8 @@ -Please deactivate all domains and wait for tasks to finish before removing the Data Center. VDS_GROUP_CANNOT_CHANGE_STORAGE_POOL=Cannot change Data Center association when editing a Cluster. NETWORK_NAME_IN_USE=Cannot ${action} ${type}. The Logical Network's name is already used by an existing Logical Network in the same Data-Center. +NETWORK_IN_USE_BY_HOSTS=The Logical Network is in use.\n\ + -Please remove it from all Hosts in Data-Center and try again. ERROR_CANNOT_CREATE_STORAGE_DOMAIN_WITHOUT_VG_LV=Volume Group (VGs) and Logical Volumes (LVs) are not specified. NETWORK_INTERFACE_TEMPLATE_CANNOT_BE_SET=Cannot ${action} ${type}. VM Template ID must be empty. NETWORK_INTERFACE_VM_CANNOT_BE_SET=Cannot ${action} ${type}. VM ID must be empty. 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 f237e87..2468cf2 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 @@ -386,6 +386,8 @@ -Please deactivate all domains and wait for tasks to finish before removing the Data Center. VDS_GROUP_CANNOT_CHANGE_STORAGE_POOL=Cannot change Data Center association when editing a Cluster. NETWORK_NAME_IN_USE=Cannot ${action} ${type}. The Logical Network's name is already used by an existing Logical Network in the same Data-Center. +NETWORK_IN_USE_BY_HOSTS=Cannot ${action} ${type}. The Logical Network is in use.\n\ + -Please remove it from all Hosts in Data-Center and try again. ERROR_CANNOT_CREATE_STORAGE_DOMAIN_WITHOUT_VG_LV=Volume Group (VGs) and Logical Volumes (LVs) are not specified. NETWORK_INTERFACE_TEMPLATE_CANNOT_BE_SET=Cannot ${action} ${type}. VM Template ID must be empty. NETWORK_INTERFACE_VM_CANNOT_BE_SET=Cannot ${action} ${type}. VM ID must be empty. -- To view, visit http://gerrit.ovirt.org/10686 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I75f6e21defef5e70e91013f9bd645e5d7d265ba8 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches