Shahar Havivi has uploaded a new change for review.

Change subject: core: sysprep timezone is set as system timezone
......................................................................

core: sysprep timezone is set as system timezone

Vm.timezone needs to map for every run (i.e. system BIOS timezone - the
one that we sent to qemu command line).
Vm.VmInit.timezone needs to map only for Sysprep use (i.e. first run)

Change-Id: If48c49b7e36d5382965a77c99fd7fa1f5d884578
Bug-Url: https://bugzilla.redhat.com/1088440
Signed-off-by: Shahar Havivi <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmOnceCommand.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInitModel.java
5 files changed, 17 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/61/27461/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 87ebd2c..93aa9f9 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
@@ -141,6 +141,9 @@
             // the VM can run with keyboard layout type which is different 
from its default display type
             
getVm().getDynamicData().setVncKeyboardLayout(getParameters().getVncKeyboardLayout());
         }
+        if (getParameters().getVmInit() != null) {
+            getVm().setVmInit(getParameters().getVmInit());
+        }
     }
 
 }
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java
index 9807734..6b127d8 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java
@@ -128,17 +128,17 @@
     }
 
     private static String getTimeZone(VM vm) {
-        String timeZone;
+        String timeZone = null;
         // Can be empty if the VM was imported.
-        if (StringUtils.isEmpty(vm.getTimeZone())) {
-            vm.setTimeZone(Config.<String> 
getValue(ConfigValues.DefaultWindowsTimeZone));
+        if (vm.getVmInit() != null && 
StringUtils.isNotEmpty(vm.getVmInit().getTimeZone())) {
+            timeZone = vm.getVmInit().getTimeZone();
+        } else {
+            timeZone = Config.<String> 
getValue(ConfigValues.DefaultWindowsTimeZone);
         }
 
         if (osRepository.isTimezoneValueInteger(vm.getStaticData(). getOsId(), 
null)) {
             // send correct time zone as sysprep expect to get it (a wierd 
number)
-            timeZone = getTimezoneIndexByKey(vm.getTimeZone());
-        } else {
-            timeZone = vm.getTimeZone();
+            return getTimezoneIndexByKey(timeZone);
         }
 
         return timeZone;
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
index 163df7e..4c57346 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
@@ -27,8 +27,6 @@
 import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
 import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
 import org.ovirt.engine.ui.uicommonweb.models.SystemTreeItemModel;
-import org.ovirt.engine.ui.uicompat.ConstantsManager;
-import org.ovirt.engine.ui.uicompat.UIConstants;
 
 public class ExistingVmModelBehavior extends VmModelBehaviorBase
 {
@@ -238,14 +236,6 @@
                     }
                 }
         ));
-
-        if (vm.isInitialized())
-        {
-            UIConstants constants = 
ConstantsManager.getInstance().getConstants();
-            getModel().getTimeZone().setChangeProhibitionReason(
-                    constants.timeZoneCannotBeChangedAfterVMInit());
-            getModel().getTimeZone().setIsChangable(false);
-        }
 
         updateTimeZone(vm.getTimeZone());
 
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 2ff21b1..f18dd77 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
@@ -1,5 +1,9 @@
 package org.ovirt.engine.ui.uicommonweb.models.vms;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 import org.ovirt.engine.core.common.action.RunVmOnceParams;
 import org.ovirt.engine.core.common.businessentities.Disk;
 import org.ovirt.engine.core.common.businessentities.DisplayType;
@@ -32,10 +36,6 @@
 import org.ovirt.engine.ui.uicompat.EventArgs;
 import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs;
 import org.ovirt.engine.ui.uicompat.UIConstants;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
 
 public abstract class RunOnceModel extends Model
 {
@@ -738,7 +738,8 @@
             params.setSysPrepPassword((String) 
getSysPrepPassword().getEntity());
         }
 
-        if (getIsCloudInitEnabled() != null && (Boolean) 
getIsCloudInitEnabled().getEntity()) {
+        if (getIsCloudInitEnabled() != null && (Boolean) 
getIsCloudInitEnabled().getEntity() ||
+                getIsSysprepEnabled() != null && (Boolean) 
getIsSysprepEnabled().getEntity()) {
             params.setVmInit(getVmInit().buildCloudInitParameters(this));
         }
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInitModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInitModel.java
index f9f9eca..3d12f70 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInitModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInitModel.java
@@ -646,7 +646,8 @@
     }
 
     public VmInit buildCloudInitParameters(UnitVmModel model) {
-        if (model.getVmInitEnabled().getEntity()) {
+        if (model.getVmInitEnabled().getEntity() ||
+                model.getSysprepEnabled().getEntity()) {
             return buildModelSpecificParameters(model.getIsWindowsOS());
         } else {
             return null;


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

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

Reply via email to