WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-3.2-testing] xend: Obey localtime config option for

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.2-testing] xend: Obey localtime config option for HVM guests as well as PV guests.
From: "Xen patchbot-3.2-testing" <patchbot-3.2-testing@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 05 Feb 2008 11:11:03 -0800
Delivery-date: Tue, 05 Feb 2008 11:11:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201620274 0
# Node ID e4c9d46e6abf1cb1df87f048c3fbe9ea04e4372d
# Parent  4b31b74fabdd0b7929ded2ef148b366efab1c717
xend: Obey localtime config option for HVM guests as well as PV guests.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   16932:04e24b9dcc1649e86d3e94a81489dab9c6ec82bc
xen-unstable date:        Tue Jan 29 15:15:51 2008 +0000
---
 tools/python/xen/lowlevel/xc/xc.c       |   25 ++++++++-----------------
 tools/python/xen/xend/XendDomainInfo.py |   10 +++++++---
 tools/python/xen/xend/image.py          |    6 ++++++
 3 files changed, 21 insertions(+), 20 deletions(-)

diff -r 4b31b74fabdd -r e4c9d46e6abf tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Tue Jan 29 15:24:04 2008 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue Jan 29 15:24:34 2008 +0000
@@ -1154,23 +1154,13 @@ static PyObject *pyxc_domain_set_time_of
 static PyObject *pyxc_domain_set_time_offset(XcObject *self, PyObject *args)
 {
     uint32_t dom;
-    int32_t time_offset_seconds;
-    time_t calendar_time;
-    struct tm local_time;
-    struct tm utc_time;
-
-    if (!PyArg_ParseTuple(args, "i", &dom))
-        return NULL;
-
-    calendar_time = time(NULL);
-    localtime_r(&calendar_time, &local_time);
-    gmtime_r(&calendar_time, &utc_time);
-    /* set up to get calendar time based on utc_time, with local dst setting */
-    utc_time.tm_isdst = local_time.tm_isdst;
-    time_offset_seconds = (int32_t)difftime(calendar_time, mktime(&utc_time));
-
-    if (xc_domain_set_time_offset(self->xc_handle, dom, time_offset_seconds) 
!= 0)
-        return NULL;
+    int32_t offset;
+
+    if (!PyArg_ParseTuple(args, "ii", &dom, &offset))
+        return NULL;
+
+    if (xc_domain_set_time_offset(self->xc_handle, dom, offset) != 0)
+        return pyxc_error_to_exception();
 
     Py_INCREF(zero);
     return zero;
@@ -1619,6 +1609,7 @@ static PyMethodDef pyxc_methods[] = {
       METH_VARARGS, "\n"
       "Set a domain's time offset to Dom0's localtime\n"
       " dom        [int]: Domain whose time offset is being set.\n"
+      " offset     [int]: Time offset from UTC in seconds.\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
     { "domain_send_trigger",
diff -r 4b31b74fabdd -r e4c9d46e6abf tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Jan 29 15:24:04 2008 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Jan 29 15:24:34 2008 +0000
@@ -1700,10 +1700,14 @@ class XendDomainInfo:
         self._configureBootloader()
 
         try:
+            if self.info['platform'].get('localtime', 0):
+                t = time.time()
+                loc = time.localtime(t)
+                utc = time.gmtime(t)
+                timeoffset = int(time.mktime(loc) - time.mktime(utc))
+                self.info['platform']['rtc_timeoffset'] = timeoffset
+
             self.image = image.create(self, self.info)
-
-            if self.info['platform'].get('localtime', 0):
-                xc.domain_set_time_offset(self.domid)
 
             xc.domain_setcpuweight(self.domid, \
                                    self.info['vcpus_params']['weight'])
diff -r 4b31b74fabdd -r e4c9d46e6abf tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Tue Jan 29 15:24:04 2008 +0000
+++ b/tools/python/xen/xend/image.py    Tue Jan 29 15:24:34 2008 +0000
@@ -342,6 +342,12 @@ class LinuxImageHandler(ImageHandler):
     flags = 0
     vhpt = 0
 
+    def configure(self, vmConfig):
+        ImageHandler.configure(self, vmConfig)
+        rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset')
+        if rtc_timeoffset is not None:
+            xc.domain_set_time_offset(self.vm.getDomid(), rtc_timeoffset)
+
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
         console_evtchn = self.vm.getConsolePort()

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.2-testing] xend: Obey localtime config option for HVM guests as well as PV guests., Xen patchbot-3.2-testing <=