Moti Asayag has uploaded a new change for review.

Change subject: engine: Generalize network-in-use message
......................................................................

engine: Generalize network-in-use message

The patch modifies the 'network-in-use' message so it could be
used by any entity type for unified message format and DRY.

Change-Id: Ie2d155616022c849f2395a0fd0f969386650426c
Signed-off-by: Moti Asayag <[email protected]>
---
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, 12 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/55/10755/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 fb2d102..59065bf 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
@@ -1,5 +1,6 @@
 package org.ovirt.engine.core.bll.network.dc;
 
+import java.util.Arrays;
 import java.util.List;
 
 import org.ovirt.engine.core.bll.ValidationResult;
@@ -147,7 +148,10 @@
             return ValidationResult.VALID;
         }
 
-        return new 
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_USE_BY_HOSTS,
-                ReplacementUtils.replaceWithNameable("HOSTS_USING_NETWORK", 
hostsWithNetwork));
+        List<String> replacements =
+                
Arrays.asList(ReplacementUtils.replaceWithNameable("ENTITIES_USING_NETWORK", 
hostsWithNetwork));
+        replacements.add(VdcBllMessages.VAR__TYPE__HOSTS.name());
+        return new 
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_USE,
+                replacements.toArray(new String[replacements.size()]));
     }
 }
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 487494a..12132d9 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
@@ -379,7 +379,7 @@
     NETWORK_NAME_ALREADY_EXISTS,
     NETWORK_HOST_IS_BUSY,
     ACTION_TYPE_FAILED_NETWORK_NAME_IN_USE,
-    ACTION_TYPE_FAILED_NETWORK_IN_USE_BY_HOSTS,
+    ACTION_TYPE_FAILED_NETWORK_IN_USE,
     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 5126099..96c8489 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -396,8 +396,7 @@
 VDS_GROUP_CANNOT_CHANGE_STORAGE_POOL=Cannot change Data Center association 
when editing a Cluster.
 ACTION_TYPE_FAILED_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.\n\
         -Please choose a different name.
-ACTION_TYPE_FAILED_NETWORK_IN_USE_BY_HOSTS=Cannot ${action} ${type}. Several 
hosts (${HOSTS_USING_NETWORK_COUNTER}) are using this logical network:\n\
-${HOSTS_USING_NETWORK}\n - Please remove it from all hosts in data-center and 
try again.
+ACTION_TYPE_FAILED_NETWORK_IN_USE=Cannot ${action} ${type}. Several 
${entities} (${ENTITIES_USING_NETWORK_COUNTER}) are using this logical 
network:\n${ENTITIES_USING_NETWORK}\n - Please remove it from all ${entities} 
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 edf702e..2d854cb 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
@@ -1062,8 +1062,8 @@
     @DefaultStringValue("Cannot ${action} ${type}. The logical network's name 
is already used by an existing logical network in the same 
data-center.\n-Please choose a different name.")
     String ACTION_TYPE_FAILED_NETWORK_NAME_IN_USE();
 
-    @DefaultStringValue("Cannot ${action} ${type}. Several hosts 
(${HOSTS_USING_NETWORK_COUNTER}) are using this logical 
network:\n${HOSTS_USING_NETWORK}\n- Please remove it from all hosts in 
data-center and try again.")
-    String ACTION_TYPE_FAILED_NETWORK_IN_USE_BY_HOSTS();
+    @DefaultStringValue("Cannot ${action} ${type}. Several ${entities} 
(${ENTITIES_USING_NETWORK_COUNTER}) are using this logical 
network:\n${ENTITIES_USING_NETWORK}\n - Please remove it from all ${entities} 
in data-center and try again.")
+    String ACTION_TYPE_FAILED_NETWORK_IN_USE();
 
     @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 7963f4b..ab0d201 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
@@ -392,8 +392,7 @@
 VDS_GROUP_CANNOT_CHANGE_STORAGE_POOL=Cannot change Data Center association 
when editing a Cluster.
 ACTION_TYPE_FAILED_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.\n\
         -Please choose a different name.
-ACTION_TYPE_FAILED_NETWORK_IN_USE_BY_HOSTS=Cannot ${action} ${type}. Several 
hosts (${HOSTS_USING_NETWORK_COUNTER}) are using this logical network:\n\
-${HOSTS_USING_NETWORK}\n - Please remove it from all hosts in data-center and 
try again.
+ACTION_TYPE_FAILED_NETWORK_IN_USE=Cannot ${action} ${type}. Several 
${entities} (${ENTITIES_USING_NETWORK_COUNTER}) are using this logical 
network:\n${ENTITIES_USING_NETWORK}\n - Please remove it from all ${entities} 
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 3df02de..0b96313 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
@@ -390,8 +390,7 @@
 VDS_GROUP_CANNOT_CHANGE_STORAGE_POOL=Cannot change Data Center association 
when editing a Cluster.
 ACTION_TYPE_FAILED_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.\n\
         -Please choose a different name.
-ACTION_TYPE_FAILED_NETWORK_IN_USE_BY_HOSTS=Cannot ${action} ${type}. Several 
hosts (${HOSTS_USING_NETWORK_COUNTER}) are using this logical network:\n\
-${HOSTS_USING_NETWORK}\n - Please remove it from all hosts in data-center and 
try again.
+ACTION_TYPE_FAILED_NETWORK_IN_USE=Cannot ${action} ${type}. Several 
${entities} (${ENTITIES_USING_NETWORK_COUNTER}) are using this logical 
network:\n${ENTITIES_USING_NETWORK}\n - Please remove it from all ${entities} 
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/10755
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2d155616022c849f2395a0fd0f969386650426c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to