Windows instances require the timezone to be "localtime"
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 commit280a336a07
) (cherry picked from commit18de64748c
) 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
This commit is contained in:
parent
5a09443262
commit
6d3cf9010a
|
@ -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)
|
||||
|
|
|
@ -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":
|
||||
|
|
Loading…
Reference in New Issue