diff options
author | Lin Ming <mlin@ss.pku.edu.cn> | 2012-04-24 17:45:45 +0100 |
---|---|---|
committer | Lin Ming <mlin@ss.pku.edu.cn> | 2012-04-24 17:45:45 +0100 |
commit | abddd66b10194202f82d8e0f99fc1cbddcfdb06a (patch) | |
tree | d77faf489ea97133c9497ce4a99f684c78bcb379 /tools/libxl/libxl_dom.c | |
parent | e601453ce6046956507df3efab03a9f767517ea5 (diff) | |
download | xen-abddd66b10194202f82d8e0f99fc1cbddcfdb06a.tar.gz xen-abddd66b10194202f82d8e0f99fc1cbddcfdb06a.tar.bz2 xen-abddd66b10194202f82d8e0f99fc1cbddcfdb06a.zip |
libxl: fix rtc_timeoffset setting
libxl__domain_build_info_setdefault may be called several times,
so rtc_timeoffset can't be setted in it.
Move rtc_timeoffset setting logic to libxl__build_pre.
Reported-by: Teck Choon Giam <giamteckchoon@gmail.com>
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>
---
tools/libxl/libxl_create.c | 9 ---------
tools/libxl/libxl_dom.c | 17 +++++++++++++++--
2 files changed, 15 insertions(+), 11 deletions(-)
Diffstat (limited to 'tools/libxl/libxl_dom.c')
-rw-r--r-- | tools/libxl/libxl_dom.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 0bdd654745..91c4bd8efb 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -65,6 +65,8 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, libxl_ctx *ctx = libxl__gc_owner(gc); int tsc_mode; char *xs_domid, *con_domid; + uint32_t rtc_timeoffset; + xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus); libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap); xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT); @@ -91,8 +93,19 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, if (libxl_defbool_val(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); + rtc_timeoffset = info->rtc_timeoffset; + if (libxl_defbool_val(info->localtime)) { + time_t t; + struct tm *tm; + + t = time(NULL); + tm = localtime(&t); + + rtc_timeoffset += tm->tm_gmtoff; + } + + if (rtc_timeoffset) + xc_domain_set_time_offset(ctx->xch, domid, rtc_timeoffset); if (info->type == LIBXL_DOMAIN_TYPE_HVM) { unsigned long shadow; |