Lior Vernia has uploaded a new change for review.

Change subject: core: Added validation for host NIC name length
......................................................................

core: Added validation for host NIC name length

Linux apparently limits NIC names to be at most 15 characters long, so I
enforced that rule on our corresponding entities.

Change-Id: I901734ef19ae63c5879c19022bb2ed229a23b3a3
Signed-off-by: Lior Vernia <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BusinessEntitiesDefinitions.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VdsNetworkInterface.java
2 files changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/79/13479/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BusinessEntitiesDefinitions.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BusinessEntitiesDefinitions.java
index 9a79e38..ff67903 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BusinessEntitiesDefinitions.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BusinessEntitiesDefinitions.java
@@ -37,6 +37,7 @@
     public static final int NETWORK_NAME_SIZE = 50; // vm_interface
     public static final int NETWORK_MIN_LEGAL_PORT = 1;
     public static final int NETWORK_MAX_LEGAL_PORT = 65535;
+    public static final int HOST_NIC_NAME_LENGTH = 15;
 
     // Bookmark (bookmarks)
     public static final int BOOKMARK_NAME_SIZE = 40;
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VdsNetworkInterface.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VdsNetworkInterface.java
index 767f6f5..60c562f 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VdsNetworkInterface.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VdsNetworkInterface.java
@@ -3,7 +3,9 @@
 import java.io.Serializable;
 
 import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
 
+import 
org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions;
 import org.ovirt.engine.core.common.utils.ValidationUtils;
 import 
org.ovirt.engine.core.common.validation.annotation.ValidNetworkConfiguration;
 import org.ovirt.engine.core.compat.NGuid;
@@ -43,6 +45,12 @@
         super(new VdsNetworkStatistics(), VdsInterfaceType.NONE.getValue());
     }
 
+    @Override
+    @Size(min = 1, max = BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH)
+    public String getName() {
+        return super.getName();
+    }
+
     /**
      * Returns if this is the management interface.
      *


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

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

Reply via email to