summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-10-09 20:03:11 +0000
committerGerrit Code Review <review@openstack.org>2013-10-09 20:03:11 +0000
commit8e6b79f3d71fe07b19f1cc53dec7e19fb9ce0fca (patch)
treeaa153b7b93220a619378f086ba7d2bb087c5b82c
parent62f22180ad04ff7bb7829e608e707f4b4d56d32e (diff)
parent18de64748c645b32253901aa704c353e5705eadb (diff)
downloadnova-8e6b79f3d71fe07b19f1cc53dec7e19fb9ce0fca.tar.gz
Merge "Windows instances require the timezone to be "localtime"" into stable/grizzly
-rw-r--r--nova/tests/test_libvirt.py15
-rwxr-xr-xnova/virt/libvirt/driver.py11
2 files changed, 25 insertions, 1 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index 5e6315be64..aa341e6f39 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -434,6 +434,21 @@ class LibvirtConnTestCase(test.TestCase):
self.assertEquals(cfg.clock.timers[1].tickpolicy,
"catchup")
+ def test_get_guest_config_windows(self):
+ conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
+ instance_ref = db.instance_create(self.context, self.test_instance)
+ instance_ref['os_type'] = 'windows'
+
+ disk_info = blockinfo.get_disk_info(CONF.libvirt_type,
+ instance_ref)
+ cfg = conn.get_guest_config(instance_ref,
+ _fake_network_info(self.stubs, 1),
+ None, disk_info)
+
+ self.assertEquals(type(cfg.clock),
+ vconfig.LibvirtConfigGuestClock)
+ self.assertEquals(cfg.clock.offset, "localtime")
+
def test_get_guest_config_with_two_nics(self):
conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), 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 99e6cf4024..fcf796e7e2 100755
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -2243,8 +2243,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 = vconfig.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 CONF.libvirt_type == "kvm":