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@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: