mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
[hvm] Keep track of time offset between domain time and dom0 time.
On each rtc time update from the hvm domain, we send an ioreq request to qemu which then updates the time offset xenstore entry. The time offset is preserved across reboot and can be set on domain creation by setting the rtc_timeoffset variable in a config file. From: Andrei Petrov <andrei.petrov@xensource.com> Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
This commit is contained in:
1 parent
9423a78d7f
commit
2bdbd3e193
16 files changed
+191
-20
No files matched your search
@@ -118,7 +118,7 @@ LEGACY_CFG_TO_XENAPI_CFG = reverse_dict(XENAPI_CFG_TO_LEGACY_CFG)
|
||||
# Platform configuration keys.
|
||||
XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'boot', 'device_model', 'display',
|
||||
'fda', 'fdb', 'keymap', 'isa', 'localtime',
|
||||
'nographic', 'pae', 'serial', 'sdl',
|
||||
'nographic', 'pae', 'rtc_timeoffset', 'serial', 'sdl',
|
||||
'soundhw','stdvga', 'usb', 'usbdevice', 'vnc',
|
||||
'vncconsole', 'vncdisplay', 'vnclisten',
|
||||
'vncpasswd', 'vncunused', 'xauthority']
|
||||
@@ -203,6 +203,7 @@ LEGACY_CFG_TYPES = {
|
||||
'on_xend_stop': str,
|
||||
'on_xend_start': str,
|
||||
'online_vcpus': int,
|
||||
'rtc/timeoffset': str,
|
||||
}
|
||||
|
||||
# Values that should be stored in xenstore's /vm/<uuid> that is used
|
||||
|
||||
@@ -859,7 +859,8 @@ class XendDomainInfo:
|
||||
# Check whether values in the configuration have
|
||||
# changed in Xenstore.
|
||||
|
||||
cfg_vm = ['name', 'on_poweroff', 'on_reboot', 'on_crash']
|
||||
cfg_vm = ['name', 'on_poweroff', 'on_reboot', 'on_crash',
|
||||
'rtc/timeoffset']
|
||||
|
||||
vm_details = self._readVMDetails([(k,XendConfig.LEGACY_CFG_TYPES[k])
|
||||
for k in cfg_vm])
|
||||
@@ -888,6 +889,11 @@ class XendDomainInfo:
|
||||
self.info.update_with_image_sxp(sxp.from_string(image_sxp))
|
||||
changed = True
|
||||
|
||||
# Check if the rtc offset has changes
|
||||
if vm_details.get("rtc/timeoffset", 0) != self.info["platform"].get("rtc_timeoffset", 0):
|
||||
self.info["platform"]["rtc_timeoffset"] = vm_details.get("rtc/timeoffset", 0)
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
# Update the domain section of the store, as this contains some
|
||||
# parameters derived from the VM configuration.
|
||||
|
||||
@@ -256,9 +256,12 @@ class HVMImageHandler(ImageHandler):
|
||||
self.xauthority = vmConfig['platform'].get('xauthority')
|
||||
self.vncconsole = vmConfig['platform'].get('vncconsole')
|
||||
|
||||
rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset')
|
||||
|
||||
self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
|
||||
("image/device-model", self.device_model),
|
||||
("image/display", self.display))
|
||||
self.vm.storeVm(("rtc/timeoffset", rtc_timeoffset))
|
||||
|
||||
self.pid = None
|
||||
|
||||
|
||||
@@ -186,6 +186,10 @@ gopts.var('cpus', val='CPUS',
|
||||
fn=set_value, default=None,
|
||||
use="CPUS to run the domain on.")
|
||||
|
||||
gopts.var('rtc_timeoffset', val='RTC_TIMEOFFSET',
|
||||
fn=set_value, default="0",
|
||||
use="Set RTC offset.")
|
||||
|
||||
gopts.var('pae', val='PAE',
|
||||
fn=set_int, default=1,
|
||||
use="Disable or enable PAE of HVM domain.")
|
||||
@@ -717,7 +721,7 @@ def configure_hvm(config_image, vals):
|
||||
args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb',
|
||||
'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
|
||||
'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
|
||||
'sdl', 'display', 'xauthority',
|
||||
'sdl', 'display', 'xauthority', 'rtc_timeoffset',
|
||||
'acpi', 'apic', 'usb', 'usbdevice', 'keymap' ]
|
||||
for a in args:
|
||||
if a in vals.__dict__ and vals.__dict__[a] is not None:
|
||||
|
||||