Change in vdsm[master]: vm: hyperv: make hw clock friendlier to windows

fromani at redhat.com fromani at redhat.com
Thu Jun 26 07:14:58 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: vm: hyperv: make hw clock friendlier to windows
......................................................................

vm: hyperv: make hw clock friendlier to windows

This patch sets the local time as windows reportedly
expect. According to libvirt docs:

" Most operating systems expect the hardware clock to
be kept in UTC, and this is the default.
Windows, however, expects it to be in so called 'localtime'."
http://libvirt.org/formatdomain.html#elementsTime

This is the reccommended setting for windows and reportedly
has stability benefits for live migrations.

The new setting is enabled on top of the hyperv optimizations,
and is disabled by default for backward compatibility.

Change-Id: I84a8cfded683a42826b6dabb67b4a5eb456594d7
Bug-Url: https://bugzilla.redhat.com/1107835
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M tests/vmTests.py
M vdsm/virt/vm.py
2 files changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/29233/1

diff --git a/tests/vmTests.py b/tests/vmTests.py
index f435ada..7ee2eb8 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -379,6 +379,20 @@
         domxml.appendClock()
         self.assertXML(domxml.dom, clockXML, 'clock')
 
+    def testHyperVClockXML(self):
+        clockXML = """
+            <clock adjustment="-3600" offset="variable">
+                <timer name="rtc" tickpolicy="catchup" track="guest"/>
+                <timer name="pit" tickpolicy="delay"/>
+                <timer name="hpet" present="no"/>
+            </clock>"""
+        conf = {'timeOffset': '-3600', 'hypervEnable': 'true'}
+        conf.update(self.conf)
+        domxml = vm._DomXML(conf, self.log,
+                            caps.Architecture.X86_64)
+        domxml.appendClock()
+        self.assertXML(domxml.dom, clockXML, 'clock')
+
     def testCpuXML(self):
         cpuXML = """
           <cpu match="exact">
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 94e81b3..ec8ca12 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -721,7 +721,9 @@
 
         m = XMLElement('clock', offset='variable',
                        adjustment=str(self.conf.get('timeOffset', 0)))
-        m.appendChildWithArgs('timer', name='rtc', tickpolicy='catchup')
+        rtc = m.appendChildWithArgs('timer', name='rtc', tickpolicy='catchup')
+        if utils.tobool(self.conf.get('hypervEnable', 'false')):
+            rtc.setAttrs(track='guest')
         m.appendChildWithArgs('timer', name='pit', tickpolicy='delay')
 
         if self.arch == caps.Architecture.X86_64:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I84a8cfded683a42826b6dabb67b4a5eb456594d7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list