Tomas Jelinek has uploaded a new change for review.

Change subject: webadmin: data copied from incorrect source
......................................................................

webadmin: data copied from incorrect source

when the custom instance type is selected and the template selection changes,
the data has been copied always from the newly selected template.

This is not always correct. The problem is on edit VM/pool when the VM can
already have some fields changed comparing to the template and the source has
to be the VM/pool itself.

The logic deciding about the appropriate source has already been implemented in
the getSource() method and was used in updateFields() which is supposed to be
called at the end of the initialization of the dialog. They were some race
situations when the updateFields() has been called before the setSelectedItem
on the template causing incorrect data to be copied to the dialog.

Fixed by using the proper getSource() instead of hardcoded usage of the
selected template.

Change-Id: I3f0114e7fb5741694127d5ab50b6953e98c58139
Bug-Url: https://bugzilla.redhat.com/1104318
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/instancetypes/InstanceTypeManager.java
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/28834/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/instancetypes/InstanceTypeManager.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/instancetypes/InstanceTypeManager.java
index 29df5c4..61458eb 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/instancetypes/InstanceTypeManager.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/instancetypes/InstanceTypeManager.java
@@ -198,8 +198,8 @@
             boolean customInstanceTypeSelected = 
model.getInstanceTypes().getSelectedItem() instanceof CustomInstanceType;
 
             if (sender == model.getTemplate() && customInstanceTypeSelected) {
-                // only if the instance type is not selected use the template
-                
updateInstanceTypeFieldsFrom(model.getTemplate().getSelectedItem());
+                // returns the VM/Pool's static data or the template 
(depending on the specific new/existing manager)
+                updateInstanceTypeFieldsFrom(getSource());
             } else if (sender == model.getInstanceTypes() && 
!customInstanceTypeSelected) {
                 // the instance type is in fact a template
                 updateInstanceTypeFieldsFrom((VmTemplate) 
model.getInstanceTypes().getSelectedItem());
@@ -209,7 +209,7 @@
 
         }
 
-        private void updateInstanceTypeFieldsFrom(VmTemplate template) {
+        private void updateInstanceTypeFieldsFrom(VmBase template) {
             if (template == null) {
                 return;
             }


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

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

Reply via email to