Frank Kobzik has uploaded a new change for review.

Change subject: frontend: VM Linux Boot options aren't parsing properly
......................................................................

frontend: VM Linux Boot options aren't parsing properly

This patch adds checking Linux Boot options in the Run Once dialog.

Change-Id: I23bd3ee3677c9bdbfacf1cf341dc1d97fd57c65e
Signed-off-by: Frantisek Kobzik <fkob...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=872178
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
1 file changed, 45 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/94/12494/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
index 9496630..55ec2e7 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
@@ -7,6 +7,7 @@
 import org.ovirt.engine.ui.uicommonweb.models.Model;
 import org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel;
 import org.ovirt.engine.ui.uicommonweb.validation.IValidation;
+import 
org.ovirt.engine.ui.uicommonweb.validation.NoTrimmingWhitespacesValidation;
 import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation;
 import org.ovirt.engine.ui.uicompat.ConstantsManager;
 import org.ovirt.engine.ui.uicompat.Event;
@@ -616,41 +617,48 @@
             getInitrd_path().setEntity(""); //$NON-NLS-1$
         }
 
-        //getCustomProperties().ValidateEntity(new IValidation[] { new 
CustomPropertyValidation(this.getCustomPropertiesKeysList()) });
         boolean customPropertyValidation = getCustomPropertySheet().validate();
 
-        if (getIsLinux_Unassign_UnknownOS()
-                && ((((String) getKernel_parameters().getEntity()).length() > 
0 || ((String) getInitrd_path().getEntity()).length() > 0) && ((String) 
getKernel_path().getEntity()).length() == 0))
-        {
-            boolean kernelParamInvalid = false;
-            boolean inetdPathInvalid = false;
-            if (((String) getKernel_parameters().getEntity()).length() > 0)
-            {
-                getKernel_parameters().setIsValid(false);
-                kernelParamInvalid = true;
-            }
-            if (((String) getInitrd_path().getEntity()).length() > 0)
-            {
-                getInitrd_path().setIsValid(false);
-                inetdPathInvalid = true;
-            }
+        if (getIsLinux_Unassign_UnknownOS()) {
+            getKernel_path().ValidateEntity(new IValidation[] { new 
NoTrimmingWhitespacesValidation() });
+            getInitrd_path().ValidateEntity(new IValidation[] { new 
NoTrimmingWhitespacesValidation() });
+            getKernel_parameters().ValidateEntity(new IValidation[] { new 
NoTrimmingWhitespacesValidation() });
 
-            String msg =
-                    ConstantsManager.getInstance()
-                            .getMessages()
-                            .invalidPath(kernelParamInvalid ? 
ConstantsManager.getInstance()
-                                    .getConstants()
-                                    .kernelInvalid() : "", //$NON-NLS-1$
-                                    kernelParamInvalid && inetdPathInvalid ? 
ConstantsManager.getInstance()
-                                            .getConstants()
-                                            .or() : "", //$NON-NLS-1$
-                                    inetdPathInvalid ? 
ConstantsManager.getInstance()
-                                            .getConstants()
-                                            .inetdInvalid() : ""); 
//$NON-NLS-1$
-            getKernel_path().setIsValid(false);
-            getInitrd_path().getInvalidityReasons().add(msg);
-            getKernel_parameters().getInvalidityReasons().add(msg);
-            getKernel_path().getInvalidityReasons().add(msg);
+            String kernelPath = (String) getKernel_path().getEntity();
+            String initrdPath = (String) getInitrd_path().getEntity();
+            String kernelParams = (String) getKernel_parameters().getEntity();
+
+            if ((kernelParams.length() > 0 || initrdPath.length() > 0) && 
kernelPath.length() == 0) {
+                boolean kernelParamInvalid = false;
+                boolean inetdPathInvalid = false;
+
+                if (kernelParams.length() > 0) {
+                    getKernel_parameters().setIsValid(false);
+                    kernelParamInvalid = true;
+                }
+                if (initrdPath.length() > 0) {
+                    getInitrd_path().setIsValid(false);
+                    inetdPathInvalid = true;
+                }
+
+                String msg =
+                        ConstantsManager.getInstance()
+                                .getMessages()
+                                .invalidPath(kernelParamInvalid ? 
ConstantsManager.getInstance()
+                                        .getConstants()
+                                        .kernelInvalid() : "", //$NON-NLS-1$
+                                        kernelParamInvalid && inetdPathInvalid 
? ConstantsManager.getInstance()
+                                                .getConstants()
+                                                .or() : "", //$NON-NLS-1$
+                                        inetdPathInvalid ? 
ConstantsManager.getInstance()
+                                                .getConstants()
+                                                .inetdInvalid() : ""); 
//$NON-NLS-1$
+
+                getKernel_path().setIsValid(false);
+                getInitrd_path().getInvalidityReasons().add(msg);
+                getKernel_parameters().getInvalidityReasons().add(msg);
+                getKernel_path().getInvalidityReasons().add(msg);
+            }
         }
 
         if (getIsAutoAssign().getEntity() != null && (Boolean) 
getIsAutoAssign().getEntity() == false)
@@ -662,7 +670,11 @@
             getDefaultHost().setIsValid(true);
         }
 
-        return getIsoImage().getIsValid() && getFloppyImage().getIsValid() && 
getKernel_path().getIsValid()
+        return getIsoImage().getIsValid()
+                && getFloppyImage().getIsValid()
+                && getKernel_path().getIsValid()
+                && getKernel_parameters().getIsValid()
+                && getInitrd_path().getIsValid()
                 && getDefaultHost().getIsValid()
                 && customPropertyValidation;
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23bd3ee3677c9bdbfacf1cf341dc1d97fd57c65e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Frank Kobzik <fkob...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to