Tomas Jelinek has uploaded a new change for review.

Change subject: core: respect user preference on payload, smartcard and watchdog
......................................................................

core: respect user preference on payload, smartcard and watchdog

The payload, smardcard and watchdog were copied from the instance type if it
was selected all the time. Since this properties are no longer the "marked"
ones, we need to respect the user preference on them.

Change-Id: I1bc56e7b9f6e91431acb9345b4d87e9bfe145ee9
Bug-Url: https://bugzilla.redhat.com/1149663
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
1 file changed, 6 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/52/35152/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
index 9737a2a..b25a036 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
@@ -820,11 +820,9 @@
                     public Void runInTransaction() {
                         copyVmDevices();
                         addDiskPermissions();
-                        if (getInstanceType() == null) {
-                            addVmPayload();
-                            updateSmartCardDevices();
-                            addVmWatchdog();
-                        }
+                        addVmPayload();
+                        updateSmartCardDevices();
+                        addVmWatchdog();
                         setActionReturnValue(getVm().getId());
                         setSucceeded(true);
                         return null;
@@ -837,9 +835,10 @@
     }
 
     private void updateSmartCardDevices() {
-        // if vm smartcard settings is different from template's
+        // if vm smartcard settings is different from device source's
         // add or remove the smartcard according to user request
-        if (getVm().isSmartcardEnabled() != 
getVmTemplate().isSmartcardEnabled()) {
+        boolean smartcardOnDeviceSource = getInstanceTypeId() != null ? 
getInstanceType().isSmartcardEnabled() : getVmTemplate().isSmartcardEnabled();
+        if (getVm().isSmartcardEnabled() != smartcardOnDeviceSource) {
             VmDeviceUtils.updateSmartcardDevice(getVm().getId(), 
getVm().isSmartcardEnabled());
         }
     }


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

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