summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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":