Change in vdsm[master]: vdsm: fix RTC offset

peet at redhat.com peet at redhat.com
Wed May 15 14:02:43 UTC 2013


Peter V. Saveliev has uploaded a new change for review.

Change subject: vdsm: fix RTC offset
......................................................................

vdsm: fix RTC offset

Upon RTC update (hwclock --systohc) on the guest side, libvirt sends the event
with RTC offset from the qemu start -rtc value in seconds. The received offset
should not replace the previous value, but should be added to it. Since the
time update event is relative to the qemu start time, we should store the
initial value and use it for the calculation.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=956741
Change-Id: I27c70a53f64fb05607e93bffbac25fdee7d1cd2a
Signed-off-by: Peter V. Saveliev <peet at redhat.com>
---
M vdsm/vm.py
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/14750/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index 2b76662..bbc833a 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -351,6 +351,7 @@
         self.id = self.conf['vmId']
         self._volPrepareLock = threading.Lock()
         self._initTimePauseCode = None
+        self._initTimeRTC = None
         self.guestAgent = None
         self._guestEvent = 'Powering up'
         self._guestEventTime = 0
@@ -852,7 +853,9 @@
     def _rtcUpdate(self, timeOffset):
         self.log.debug('new rtc offset %s', timeOffset)
         with self._confLock:
-            self.conf['timeOffset'] = timeOffset
+            if self._initTimeRTC is None:
+                self._initTimeRTC = long(self.conf['timeOffset'])
+            self.conf['timeOffset'] = self._initTimeRTC + long(timeOffset)
 
     def extendDriveVolume(self, vmDrive):
         if not vmDrive.blockDev:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I27c70a53f64fb05607e93bffbac25fdee7d1cd2a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet at redhat.com>


More information about the vdsm-patches mailing list