Moti Asayag has uploaded a new change for review.

Change subject: core: Validate network label format
......................................................................

core: Validate network label format

The network label will be limited to the following
format: [0-9a-zA-Z_-]+

Change-Id: Id645a96af80ef5de4d6239de64faba04026c8cd2
Signed-off-by: Moti Asayag <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.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
6 files changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/54/22654/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java
index 45db187..f06a2f0 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/Network.java
@@ -15,6 +15,7 @@
 import org.ovirt.engine.core.common.businessentities.Nameable;
 import org.ovirt.engine.core.common.utils.ValidationUtils;
 import org.ovirt.engine.core.common.validation.annotation.MTU;
+import org.ovirt.engine.core.common.validation.annotation.ValidName;
 import org.ovirt.engine.core.common.validation.group.CreateEntity;
 import org.ovirt.engine.core.common.validation.group.UpdateEntity;
 import org.ovirt.engine.core.compat.Guid;
@@ -63,6 +64,7 @@
 
     private ProviderNetwork providedBy;
 
+    @ValidName(message = "NETWORK_LABEL_FORMAT_INVALID", groups = { 
CreateEntity.class, UpdateEntity.class })
     private String label;
 
     @MTU
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 fd7125c..f20dfa0 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
@@ -471,6 +471,7 @@
     NETWORK_MTU_DIFFERENCES(ErrorType.CONFLICT),
     NETWORK_MTU_OVERRIDE_NOT_SUPPORTED(ErrorType.CONFLICT),
     EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED(ErrorType.NOT_SUPPORTED),
+    NETWORK_LABEL_FORMAT_INVALID(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_VNIC_PROFILE_NOT_EXISTS(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_VNIC_PROFILE_NAME_IN_USE(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_VNIC_PROFILE_IN_USE(ErrorType.CONFLICT),
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 1f13889..efe7da8 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -470,6 +470,7 @@
 NETWORK_NOT_EXISTS=The specified Logical Network doesn't exist.
 ACTION_TYPE_FAILED_NETWORK_QOS_NOT_EXISTS=The specified Network QoS doesn't 
exist.
 EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED=The specified external network cannot 
be configured on the host's interface.
+NETWORK_LABEL_FORMAT_INVALID=Network label must be formed of "a-z0-9A-Z" or 
"-_"
 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\
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 17a88a0..0ed4d64 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
@@ -1294,6 +1294,9 @@
     @DefaultStringValue("The specified external network cannot be configured 
on the host's interface.")
     String EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED();
 
+    @DefaultStringValue("NETWORK_LABEL_FORMAT_INVALID=Network label must be 
formed of \"a-z0-9A-Z\" or \"-_\"")
+    String NETWORK_LABEL_FORMAT_INVALID();
+
     @DefaultStringValue("Cannot recover Data Center with active Data Storage 
Domain in Data Center.")
     String ERROR_CANNOT_RECOVERY_STORAGE_POOL_THERE_IS_ACTIVE_DATA_DOMAINS();
 
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 63c2905..51b54fa 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
@@ -451,6 +451,7 @@
 ACTION_TYPE_FAILED_CANNOT_ADD_VNIC_PROFILE_TO_NON_VM_NETWORK=Cannot ${action} 
${type}. VM network interface profiles can be added to a VM network only.
 ACTION_TYPE_FAILED_CANNOT_FIND_VNIC_PROFILE_FOR_NETWORK=Cannot ${action} 
${type}. There is no VM network interface profile for the network the user can 
use.\n- Please use a VM network interface profile instead of a network name.
 EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED=The specified external network cannot 
be configured on the host's interface.
+NETWORK_LABEL_FORMAT_INVALID=Network label must be formed of "a-z0-9A-Z" or 
"-_"
 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\
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 d656ae3..2840e17 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
@@ -474,6 +474,7 @@
 NETWORK_NOT_EXISTS=The specified Logical Network doesn't exist.
 ACTION_TYPE_FAILED_NETWORK_QOS_NOT_EXISTS=The specified Network QoS doesn't 
exist.
 EXTERNAL_NETWORK_CANNOT_BE_PROVISIONED=The specified external network cannot 
be configured on the host's interface.
+NETWORK_LABEL_FORMAT_INVALID=Network label must be formed of "a-z0-9A-Z" or 
"-_"
 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\


-- 
To view, visit http://gerrit.ovirt.org/22654
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id645a96af80ef5de4d6239de64faba04026c8cd2
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