Moti Asayag has uploaded a new change for review. Change subject: core: Validate vm nic name has no special characters ......................................................................
core: Validate vm nic name has no special characters The patch validates the vm nic name is consisted of a-zA-Z0-9-_. only. This is verified on the UI but should be enforced when adding nics via the API. Change-Id: I596f546473b1e4c8832aa56dd56320df514977ae Bug-Url: https://bugzilla.redhat.com/973971 Signed-off-by: Moti Asayag <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.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 5 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/18487/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java index 090079d..4a6a56a 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java @@ -4,6 +4,7 @@ import javax.validation.constraints.Pattern; import org.ovirt.engine.core.common.utils.ObjectUtils; +import org.ovirt.engine.core.common.utils.ValidationUtils; import org.ovirt.engine.core.common.validation.group.CreateEntity; import org.ovirt.engine.core.common.validation.group.UpdateEntity; import org.ovirt.engine.core.common.validation.group.UpdateVmNic; @@ -64,6 +65,8 @@ @NotNull(message = VmNic.VALIDATION_MESSAGE_NAME_NOT_NULL, groups = { CreateEntity.class, UpdateEntity.class }) + @Pattern(regexp = ValidationUtils.NO_SPECIAL_CHARACTERS_WITH_DOT, message = "VALIDATION_NAME_INVALID_WITH_DOT", + groups = { CreateEntity.class, UpdateEntity.class }) @Override public String getName() { return super.getName(); 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 a1bd1f6..06e6607 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -687,6 +687,7 @@ VALIDATION_ID_NULL=ID is required. VALIDATION_NAME_NULL=Name is required. VALIDATION_NAME_INVALID=Name must be formed of alphanumeric characters, numbers or "-_". +VALIDATION_NAME_INVALID_WITH_DOT=Name must be formed of alphanumeric characters, numbers or "-_.". VALIDATION_URL_NULL=URL is required. VALIDATION_PROVIDER_TYPE_NULL=Provider type is required. VALIDATION.VMINTERFACE.MACADDRESS=MAC Address must be in the following format: XX:XX:XX:XX:XX:XX, (XX=0-9 or A-F) 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 c5548f5..e912e33 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 @@ -1852,6 +1852,9 @@ @DefaultStringValue("Name must be formed of alphanumeric characters, numbers or \"-_\".") String VALIDATION_NAME_INVALID(); + @DefaultStringValue("Name must be formed of alphanumeric characters, numbers or \"-_.\".") + String VALIDATION_NAME_INVALID_WITH_DOT(); + @DefaultStringValue("URL is required.") String VALIDATION_URL_NULL(); 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 41feda9..de2b530 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 @@ -671,6 +671,7 @@ VALIDATION_ID_NULL=ID is required. VALIDATION_NAME_NULL=Name is required. VALIDATION_NAME_INVALID=Name must be formed of alphanumeric characters, numbers or "-_". +VALIDATION_NAME_INVALID_WITH_DOT=Name must be formed of alphanumeric characters, numbers or "-_.". VALIDATION_URL_NULL=URL is required. VALIDATION_VMINTERFACE_MACADDRESS=MAC Address must be in the following format: XX:XX:XX:XX:XX:XX, (XX=0-9 or A-F) VALIDATION_EVENTS_EMAIL_FORMAT=email format is not valid 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 4ba4b73..f79c602 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 @@ -691,6 +691,7 @@ VALIDATION_ID_NULL=ID is required. VALIDATION_NAME_NULL=Name is required. VALIDATION_NAME_INVALID=Name must be formed of alphanumeric characters, numbers or "-_". +VALIDATION_NAME_INVALID_WITH_DOT=Name must be formed of alphanumeric characters, numbers or "-_.". VALIDATION_URL_NULL=URL is required. VALIDATION_PROVIDER_TYPE_NULL=Provider type is required. VALIDATION_QUOTA_NAME_INVALID=Quota name must be formed of "a-z0-9A-Z" and "-_" -- To view, visit http://gerrit.ovirt.org/18487 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I596f546473b1e4c8832aa56dd56320df514977ae 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
