summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2013-09-26 14:45:11 +1000
committerMichael Still <mikal@stillhq.com>2013-10-14 13:50:14 +1100
commit6d3cf9010a45edb16f28b2582eafe35666381d1f (patch)
treef3172348db18ea0eff38c9004105c7e5a480c2db
parent5a094432620c8ca928e26825bf6225e9a05de271 (diff)
downloadnova-folsom-eol.tar.gz
Windows instances require the timezone to be "localtime"folsom-eol
This was relatively simple to fix, assuming that the image used to boot the windows instance has the os_type set to "windows". The use of os_type in this manner is consistent with the existing use in the Xen hypervisor driver. DocImpact: if you're booting windows instances, then you need to set the os_type image property in glance to "windows". Otherwise your instances will have their clock timezone set to UTC, which has unexpected side effects in windows. (cherry picked from commit 280a336a07006b2c998719f2f9033d43289ec7ef) (cherry picked from commit 18de64748c645b32253901aa704c353e5705eadb) Conflicts: nova/virt/libvirt/driver.py Note that the unit test had to be tweaked to work in the backport. There are no functional changes however. Change-Id: Id6759a290ed25c9add97ac61bb7d165b3fb908b2 Closes-Bug: 1231254
-rw-r--r--nova/tests/test_libvirt.py13
-rw-r--r--nova/virt/libvirt/driver.py11
2 files changed, 23 insertions, 1 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index e956eb02f0..ef6fbeba8f 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -608,6 +608,19 @@ class LibvirtConnTestCase(test.TestCase):
self.assertEquals(cfg.clock.timers[1].tickpolicy,
"catchup")
+ def test_get_guest_config_windows(self):
+ conn = libvirt_driver.LibvirtDriver(True)
+ instance_ref = db.instance_create(self.context, self.test_instance)
+ instance_ref['os_type'] = 'windows'
+
+ cfg = conn.get_guest_config(instance_ref,
+ _fake_network_info(self.stubs, 1),
+ None, None)
+
+ self.assertEquals(type(cfg.clock),
+ config.LibvirtConfigGuestClock)
+ self.assertEquals(cfg.clock.offset, "localtime")
+
def test_get_guest_config_with_two_nics(self):
conn = libvirt_driver.LibvirtDriver(True)
instance_ref = db.instance_create(self.context, self.test_instance)
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 060f864036..7ac0f7cbd1 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -1801,8 +1801,17 @@ class LibvirtDriver(driver.ComputeDriver):
guest.acpi = True
guest.apic = True
+ # NOTE(mikal): Microsoft Windows expects the clock to be in
+ # "localtime". If the clock is set to UTC, then you can use a
+ # registry key to let windows know, but Microsoft says this is
+ # buggy in http://support.microsoft.com/kb/2687252
clk = config.LibvirtConfigGuestClock()
- clk.offset = "utc"
+ if instance['os_type'] == 'windows':
+ LOG.info(_('Configuring timezone for windows instance to '
+ 'localtime'), instance=instance)
+ clk.offset = 'localtime'
+ else:
+ clk.offset = 'utc'
guest.set_clock(clk)
if FLAGS.libvirt_type == "kvm":