Arik Hadas has uploaded a new change for review.

Change subject: webadmin: fix IAE on run once dialog
......................................................................

webadmin: fix IAE on run once dialog

This patch fixes IllegalArgumentException that was thrown when trying to
run-once a VM with no bootable device.

Before change http://gerrit.ovirt.org/#/c/11735 the boot sequence that
was generated when trying to run-once a VM was never empty - it always
contained at least the hard-disk (even for diskless VM).
After applying the change above, the returned boot sequence for a VM
with no bootable device is empty, and wrong handling of the empty
string that represents it results in IllegalArgumentException.

Change-Id: I42197615331c6b62f5978e1d4546298aee617db4
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmRunHandler.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BootSequenceModel.java
3 files changed, 3 insertions(+), 7 deletions(-)


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

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
index 22b4e02..a93fd33 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
@@ -51,7 +51,7 @@
         getVm().setKernelParams(runVmParameters.getkernel_params());
         getVm().setCustomProperties(runVmParameters.getCustomProperties());
 
-        getVm().setBootSequence(((runVmParameters.getBootSequence()) != null) ?
+        getVm().setBootSequence((runVmParameters.getBootSequence() != null) ?
                 runVmParameters.getBootSequence() :
                 getVm().getDefaultBootSequence());
     }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmRunHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmRunHandler.java
index f63f04e..16a6dac 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmRunHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmRunHandler.java
@@ -72,7 +72,7 @@
             VmHandler.handleCustomPropertiesError(validationErrors, message);
             retValue = false;
         } else {
-            BootSequence boot_sequence = ((runParams.getBootSequence()) != 
null) ? runParams.getBootSequence() : vm
+            BootSequence boot_sequence = (runParams.getBootSequence() != null) 
? runParams.getBootSequence() : vm
                     .getDefaultBootSequence();
             Guid storagePoolId = vm.getStoragePoolId();
             // Block from running a VM with no HDD when its first boot device 
is
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BootSequenceModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BootSequenceModel.java
index 4497f54..4c5f447 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BootSequenceModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BootSequenceModel.java
@@ -75,10 +75,6 @@
 
     public BootSequence getSequence()
     {
-        // string str = Items.Where(a => a.IsChangable)
-        // .Select(a => (BootSequence)a.Entity)
-        // .Aggregate(String.Empty, (a, b) => a += b.ToString());
-
         String str = ""; //$NON-NLS-1$
         for (EntityModel a : getItems())
         {
@@ -89,7 +85,7 @@
             }
         }
 
-        return BootSequence.valueOf(str);
+        return !str.equals("") ? BootSequence.valueOf(str) : null;  
//$NON-NLS-1$
     }
 
     public BootSequenceModel()


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

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

Reply via email to