diff options
author | Giam Teck Choon <giamteckchoon@gmail.com> | 2012-04-04 16:09:25 +0100 |
---|---|---|
committer | Giam Teck Choon <giamteckchoon@gmail.com> | 2012-04-04 16:09:25 +0100 |
commit | 26b9db9bd2221562146805f5b590752ff20ff15b (patch) | |
tree | bbbbaf0a5f41b84f3ca198dd06234267ec99541e | |
parent | 6ad3a86f1e485235becc1eb4d5a21d59fc5c5779 (diff) | |
download | xen-26b9db9bd2221562146805f5b590752ff20ff15b.tar.gz xen-26b9db9bd2221562146805f5b590752ff20ff15b.tar.bz2 xen-26b9db9bd2221562146805f5b590752ff20ff15b.zip |
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>
-rw-r--r-- | tools/libxl/libxl.idl | 2 | ||||
-rw-r--r-- | tools/libxl/libxl_dom.c | 3 | ||||
-rw-r--r-- | tools/libxl/xl_cmdimpl.c | 14 |
3 files changed, 19 insertions, 0 deletions
diff --git a/tools/libxl/libxl.idl b/tools/libxl/libxl.idl index 377417a8c8..319350630d 100644 --- a/tools/libxl/libxl.idl +++ b/tools/libxl/libxl.idl @@ -94,6 +94,8 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("target_memkb", uint32), ("video_memkb", uint32), ("shadow_memkb", uint32), + ("rtc_timeoffset", uint32), + ("localtime", bool), ("disable_migrate", bool), ("kernel", libxl_file_reference), ("cpuid", libxl_cpuid_policy_list), diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index c702cf7cc5..7ab78db2e3 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -76,6 +76,9 @@ int libxl__build_pre(libxl_ctx *ctx, uint32_t domid, if ( info->disable_migrate ) xc_domain_disable_migrate(ctx->xch, domid); + if (info->rtc_timeoffset) + xc_domain_set_time_offset(ctx->xch, domid, info->rtc_timeoffset); + if (info->hvm) { unsigned long shadow; shadow = (info->shadow_memkb + 1023) / 1024; diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 2dbced7ec9..6bace41fef 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -737,6 +737,20 @@ static void parse_config_data(const char *configfile_filename_report, if (!xlu_cfg_get_long(config, "tsc_mode", &l)) b_info->tsc_mode = l; + b_info->rtc_timeoffset = !xlu_cfg_get_long(config, "rtc_timeoffset", &l) + ? l : 0; + + b_info->localtime = !xlu_cfg_get_long(config, "localtime", &l) ? l : 0; + if (b_info->localtime) { + time_t t; + struct tm *tm; + + t = time(NULL); + tm = localtime(&t); + + b_info->rtc_timeoffset += tm->tm_gmtoff; + } + if (!xlu_cfg_get_long (config, "videoram", &l)) b_info->video_memkb = l * 1024; |