xcp-1.6-updates/xen-4.1.hg

changeset 23276:6f224431eca2

libxl: support for "rtc_timeoffset" and "localtime"

Implement "rtc_timeoffset" and "localtime" options compatible as xm.

rtc_timeoffset is the offset between host time and guest time.
localtime means to specify whether the emulted RTC appears as UTC or is
offset by the host.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Committed-by: Ian Jackson <ian.jackson.citrix.com>

xen-unstable changeset: 25131:6f81f4d79fde
Backport-requested-by: Giam Teck Choon <giamteckchoon@gmail.com>
Signed-off-by: Giam Teck Choon <giamteckchoon@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Giam Teck Choon <giamteckchoon@gmail.com>
date Wed Apr 04 16:09:25 2012 +0100 (2012-04-04)
parents 369bf6c946b9
children 80130491806f
files tools/libxl/libxl.idl tools/libxl/libxl_dom.c tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/libxl.idl	Tue Apr 03 16:06:10 2012 +0100
     1.2 +++ b/tools/libxl/libxl.idl	Wed Apr 04 16:09:25 2012 +0100
     1.3 @@ -94,6 +94,8 @@ libxl_domain_build_info = Struct("domain
     1.4      ("target_memkb",    uint32),
     1.5      ("video_memkb",     uint32),
     1.6      ("shadow_memkb",    uint32),
     1.7 +    ("rtc_timeoffset",  uint32),
     1.8 +    ("localtime",       bool),
     1.9      ("disable_migrate", bool),
    1.10      ("kernel",          libxl_file_reference),
    1.11      ("cpuid",           libxl_cpuid_policy_list),
     2.1 --- a/tools/libxl/libxl_dom.c	Tue Apr 03 16:06:10 2012 +0100
     2.2 +++ b/tools/libxl/libxl_dom.c	Wed Apr 04 16:09:25 2012 +0100
     2.3 @@ -76,6 +76,9 @@ int libxl__build_pre(libxl_ctx *ctx, uin
     2.4      if ( info->disable_migrate )
     2.5          xc_domain_disable_migrate(ctx->xch, domid);
     2.6  
     2.7 +    if (info->rtc_timeoffset)
     2.8 +        xc_domain_set_time_offset(ctx->xch, domid, info->rtc_timeoffset);
     2.9 +
    2.10      if (info->hvm) {
    2.11          unsigned long shadow;
    2.12          shadow = (info->shadow_memkb + 1023) / 1024;
     3.1 --- a/tools/libxl/xl_cmdimpl.c	Tue Apr 03 16:06:10 2012 +0100
     3.2 +++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:09:25 2012 +0100
     3.3 @@ -737,6 +737,20 @@ static void parse_config_data(const char
     3.4      if (!xlu_cfg_get_long(config, "tsc_mode", &l))
     3.5          b_info->tsc_mode = l;
     3.6  
     3.7 +    b_info->rtc_timeoffset = !xlu_cfg_get_long(config, "rtc_timeoffset", &l)
     3.8 +        ? l : 0;
     3.9 +
    3.10 +    b_info->localtime = !xlu_cfg_get_long(config, "localtime", &l) ? l : 0;
    3.11 +    if (b_info->localtime) {
    3.12 +        time_t t;
    3.13 +        struct tm *tm;
    3.14 +
    3.15 +        t = time(NULL);
    3.16 +        tm = localtime(&t);
    3.17 +
    3.18 +        b_info->rtc_timeoffset += tm->tm_gmtoff;
    3.19 +    }
    3.20 +
    3.21      if (!xlu_cfg_get_long (config, "videoram", &l))
    3.22          b_info->video_memkb = l * 1024;
    3.23