Martin Betak has uploaded a new change for review.

Change subject: engine: Correct utc_diff handling
......................................................................

engine: Correct utc_diff handling

Now the utc_diff is always updated for running VMs (Linux or Windows)
and reset on VM run.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1062615
Change-Id: I907cd1ab724b6c3217cc90bd886b678d4bb9d37a
Signed-off-by: Martin Betak <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
2 files changed, 24 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/62/25062/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
index d7c83f6..9242d97 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
@@ -650,6 +650,14 @@
         this.vmDynamic.setExitMessage(value);
     }
 
+    /**
+     * Tracking value of VM's UTC offset. Useful for long running VMs when 
there
+     * can be significant drift over initial value computed from timeZone.
+     * Note that this value is no longer being used when
+     * starting VMs (The timeZone field is used to calculate that offset) and 
is kept
+     * in sync with value reported by VDSM only for debugging purposes.
+     * {@see VmInfoBuilderBase#buildVmTimeZone()}
+     */
     public Integer getUtcDiff() {
         return this.vmDynamic.getUtcDiff();
     }
@@ -1254,9 +1262,7 @@
         setAcpiEnable(vm.getAcpiEnable());
         setGuestCurrentUserName(vm.getGuestCurrentUserName());
         setWin2kHackEnable(vm.getWin2kHackEnable());
-        if 
(SimpleDependecyInjector.getInstance().get(OsRepository.class).isLinux(getVmOsId()))
 {
-            setUtcDiff(vm.getUtcDiff());
-        }
+        setUtcDiff(vm.getUtcDiff());
         setExitStatus(vm.getExitStatus());
         setExitMessage(vm.getExitMessage());
         setClientIp(vm.getClientIp());
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
index 484bf97..a311b98 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
@@ -198,29 +198,23 @@
     }
 
     protected void buildVmTimeZone() {
-        // send vm_dynamic.utc_diff if exist, if not send vm_static.time_zone
-        if (vm.getUtcDiff() != null) {
-            createInfo.put(VdsProperties.utc_diff, vm.getUtcDiff().toString());
+        // get vm timezone
+        String timeZone = getTimeZoneForVm(vm);
+
+        String javaZoneId = null;
+        if (osRepository.isWindows(vm.getOs())) {
+            // convert to java & calculate offset
+            javaZoneId = 
WindowsJavaTimezoneMapping.windowsToJava.get(timeZone);
         } else {
-            // get vm timezone
-            String timeZone = getTimeZoneForVm(vm);
-
-            int offset = 0;
-            String javaZoneId = null;
-
-            if (osRepository.isWindows(vm.getOs())) {
-                // convert to java & calculate offset
-                javaZoneId = 
WindowsJavaTimezoneMapping.windowsToJava.get(timeZone);
-            } else {
-                javaZoneId = timeZone;
-            }
-
-            if (javaZoneId != null) {
-                offset = (TimeZone.getTimeZone(javaZoneId).getOffset(
-                        new Date().getTime()) / 1000);
-            }
-            createInfo.put(VdsProperties.utc_diff, "" + offset);
+            javaZoneId = timeZone;
         }
+
+        int offset = 0;
+        if (javaZoneId != null) {
+            offset = (TimeZone.getTimeZone(javaZoneId).getOffset(
+                    new Date().getTime()) / 1000);
+        }
+        createInfo.put(VdsProperties.utc_diff, "" + offset);
     }
 
     private String getTimeZoneForVm(VM vm) {


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

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

Reply via email to