Mailing List Archive

[xen-4.1-testing] libxl: support for "rtc_timeoffset" and "localtime"
# HG changeset patch
# User Giam Teck Choon <giamteckchoon@gmail.com>
# Date 1333552165 -3600
# Node ID 6f224431eca2ecea490fdcbd401942de5b20c3dd
# Parent 369bf6c946b9b25edb750fc834de8cdd1f346bc9
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>
---


diff -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/libxl.idl Wed Apr 04 16:09:25 2012 +0100
@@ -94,6 +94,8 @@ libxl_domain_build_info = Struct("domain
("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 -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/libxl_dom.c Wed Apr 04 16:09:25 2012 +0100
@@ -76,6 +76,9 @@ int libxl__build_pre(libxl_ctx *ctx, uin
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 -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c Wed Apr 04 16:09:25 2012 +0100
@@ -737,6 +737,20 @@ static void parse_config_data(const char
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;


_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog