[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: fix rtc_timeoffset setting


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 14 May 2012 16:31:54 +0000
  • Delivery-date: Mon, 14 May 2012 16:31:59 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Lin Ming <mlin@xxxxxxxxxxxxx>
# Date 1335285945 -3600
# Node ID 8c0e4983916cae5acd9991e9ef48e054c4e84a32
# Parent  1205b0b5b810cc4aec21a6c8a4451178cd2c71a9
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@xxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Lin Ming <mlin@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 1205b0b5b810 -r 8c0e4983916c tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Mon Apr 16 16:00:47 2012 +0100
+++ b/tools/libxl/libxl_create.c        Tue Apr 24 17:45:45 2012 +0100
@@ -150,15 +150,6 @@ int libxl__domain_build_info_setdefault(
         b_info->target_memkb = b_info->max_memkb;
 
     libxl_defbool_setdefault(&b_info->localtime, false);
-    if (libxl_defbool_val(b_info->localtime)) {
-        time_t t;
-        struct tm *tm;
-
-        t = time(NULL);
-        tm = localtime(&t);
-
-        b_info->rtc_timeoffset += tm->tm_gmtoff;
-    }
 
     libxl_defbool_setdefault(&b_info->disable_migrate, false);
 
diff -r 1205b0b5b810 -r 8c0e4983916c tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Mon Apr 16 16:00:47 2012 +0100
+++ b/tools/libxl/libxl_dom.c   Tue Apr 24 17:45:45 2012 +0100
@@ -65,6 +65,8 @@ int libxl__build_pre(libxl__gc *gc, uint
     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, uint
     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;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.