PATCH: Specify BIOS clock offset for HVM

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

 



The attached patch introduces a new XML element for specifying information
about the guest (BIOS) clock. For Xen HVM, and QEMU / KVM guests this is
used to specifyc whether the guest clock should be in UTC, or localtime.
The latter is useful for Windows which likes the BIOS to be localtime,
while the former is useful for all other operating systems. The former is
of course the default - so no change in existing semantics.

The <clock> element currently takes a single attribute 'offset'. This is
either 'utc' or 'localtime', but if we port to VMWare, it will also allow
an arbitrary numeric offset as well as these special constants.

   <clock offset='utc'/>

Or

   <clock offset='localtime'/>


It may later also be desirable to add a 'sync=[yes|no]'  attribute to 
specify whether the HV tries to keep the clock in sync with the HV while
it is running. VMWare has this concept, and so does Xen paravirt - though
Xen paravirt sets it via /proc/sys/xen/independant_wallclock inside the
guest and AFAICT doesn't (yet) expose it to the guest config in Dom0.

Anyway, my patch implements use of utc/localtime offsets for Xen, and QEMU
drivers. I've tested to verify that -localtime gets passed to the QEMU
process as appropriate.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
? foo
? docs/APIchunk5.html
? docs/APIchunk6.html
? docs/apibuild.pyc
? tests/foo
? tests/sexpr2xmldata/sexpr2xml-fv-localtime.sexpr
? tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
? tests/sexpr2xmldata/sexpr2xml-fv-utc.sexpr
? tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
? tests/xmconfigdata/test-fullvirt-localtime.cfg
? tests/xmconfigdata/test-fullvirt-localtime.xml
? tests/xmconfigdata/test-fullvirt-utc.cfg
? tests/xmconfigdata/test-fullvirt-utc.xml
? tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr
? tests/xml2sexprdata/xml2sexpr-fv-localtime.xml
? tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr
? tests/xml2sexprdata/xml2sexpr-fv-utc.xml
Index: docs/format.html
===================================================================
RCS file: /data/cvs/libvirt/docs/format.html,v
retrieving revision 1.24
diff -u -p -r1.24 format.html
--- docs/format.html	29 Jun 2007 12:44:58 -0000	1.24
+++ docs/format.html	13 Jul 2007 15:58:49 -0000
@@ -117,6 +117,7 @@ systems:</p><pre>&lt;domain type='xen' i
      &lt;acpi/&gt;
      &lt;apic/&gt;</span>
   &lt;/features&gt;
+  <span style="color: #0000E5; background-color: #FFFFFF">&lt;clock sync="localtime"/&gt;</span>
   &lt;devices&gt;
     <span style="color: #0000E5; background-color: #FFFFFF">&lt;emulator&gt;/usr/lib/xen/bin/qemu-dm&lt;/emulator&gt;</span>
     &lt;interface type='bridge'&gt;
@@ -146,6 +147,11 @@ systems:</p><pre>&lt;domain type='xen' i
       <li><code>apic</code> - enable IO APIC</li>
       <li><code>acpi</code> - enable ACPI bios</li>
     </ul></li>
+  <li>the optional <code>&lt;clock&gt;</code> element is used to specify
+     whether the emulated BIOS clock in the guest is synced to either
+     <code>localtime</code> or <code>utc</code>. In general Windows will
+     want <code>localtime</code> while all other operating systems will
+     want <code>utc</code>. The default is thus <code>utc</code></li>
   <li>the <code>&lt;os&gt;</code> block description is very different, first
     it indicates that the type is 'hvm' for hardware virtualization, then
     instead of a kernel, boot and command line arguments, it points to an os
@@ -194,6 +200,7 @@ XML description is quite similar, here i
   &lt;os&gt;
     &lt;type&gt;hvm&lt;/type&gt;
   &lt;/os&gt;
+  <span style="color: #0000E5; background-color: #FFFFFF">&lt;clock sync="localtime"/&gt;</span>
   &lt;devices&gt;
     <span style="color: #FF0000; background-color: #FFFFFF">&lt;emulator&gt;/home/user/usr/kvm-devel/bin/qemu-system-x86_64&lt;/emulator&gt;</span>
     &lt;disk type='file' device='disk'&gt;
@@ -206,6 +213,7 @@ XML description is quite similar, here i
     &lt;graphics type='vnc' port='-1'/&gt;
   &lt;/devices&gt;
 &lt;/domain&gt;</pre><p>The specific points to note if using KVM are:</p><ul><li>the top level domain element carries a type of 'kvm'</li>
+  <li>the &lt;clock&gt; optional is supported as with Xen HVM</li>
   <li>the &lt;devices&gt; emulator points to the special qemu binary required
     for KVM</li>
   <li>networking interface definitions definitions are somewhat different due
Index: docs/libvir.html
===================================================================
RCS file: /data/cvs/libvirt/docs/libvir.html,v
retrieving revision 1.71
diff -u -p -r1.71 libvir.html
--- docs/libvir.html	12 Jul 2007 15:47:19 -0000	1.71
+++ docs/libvir.html	13 Jul 2007 15:58:49 -0000
@@ -738,6 +738,7 @@ systems:</p>
      &lt;acpi/&gt;
      &lt;apic/&gt;</span>
   &lt;/features&gt;
+  <span style="color: #0000E5; background-color: #FFFFFF">&lt;clock sync="localtime"/&gt;</span>
   &lt;devices&gt;
     <span style="color: #0000E5; background-color: #FFFFFF">&lt;emulator&gt;/usr/lib/xen/bin/qemu-dm&lt;/emulator&gt;</span>
     &lt;interface type='bridge'&gt;
@@ -773,6 +774,11 @@ systems:</p>
       <li><code>acpi</code> - enable ACPI bios</li>
     </ul>
   </li>
+  <li>the optional <code>&lt;clock&gt;</code> element is used to specify
+     whether the emulated BIOS clock in the guest is synced to either
+     <code>localtime</code> or <code>utc</code>. In general Windows will
+     want <code>localtime</code> while all other operating systems will
+     want <code>utc</code>. The default is thus <code>utc</code></li>
   <li>the <code>&lt;os&gt;</code> block description is very different, first
     it indicates that the type is 'hvm' for hardware virtualization, then
     instead of a kernel, boot and command line arguments, it points to an os
@@ -832,6 +838,7 @@ XML description is quite similar, here i
   &lt;os&gt;
     &lt;type&gt;hvm&lt;/type&gt;
   &lt;/os&gt;
+  <span style="color: #0000E5; background-color: #FFFFFF">&lt;clock sync="localtime"/&gt;</span>
   &lt;devices&gt;
     <span style="color: #FF0000; background-color: #FFFFFF">&lt;emulator&gt;/home/user/usr/kvm-devel/bin/qemu-system-x86_64&lt;/emulator&gt;</span>
     &lt;disk type='file' device='disk'&gt;
@@ -848,6 +855,7 @@ XML description is quite similar, here i
 <p>The specific points to note if using KVM are:</p>
 <ul>
   <li>the top level domain element carries a type of 'kvm'</li>
+  <li>the &lt;clock&gt; optional is supported as with Xen HVM</li>
   <li>the &lt;devices&gt; emulator points to the special qemu binary required
     for KVM</li>
   <li>networking interface definitions definitions are somewhat different due
@@ -2231,8 +2239,14 @@ Blank lines and comments beginning with 
 <h3><a name="Remote_IPv6">IPv6 support</a></h3>
 
 <p>
-IPv6 has received some limited testing and should work.  Problems with
-libvirt and IPv6 should be reported as <a href="bugs.html">bugs</a>.
+The libvirtd service and libvirt remote client driver both use the
+<code>getaddrinfo()</code> functions for name resolution and are
+thus fully IPv6 enabled. ie, if a server has IPv6 address configured
+the daemon will listen for incoming connections on both IPv4 and IPv6
+protocols. If a client has an IPv6 address configured and the DNS
+address resolved for a service is reachable over IPv6, then an IPv6
+connection will be made, otherwise IPv4 will be used. In summary it
+should just 'do the right thing(tm)'.
 </p>
 
 <h3><a name="Remote_limitations">Limitations</a></h3>
Index: docs/remote.html
===================================================================
RCS file: /data/cvs/libvirt/docs/remote.html,v
retrieving revision 1.11
diff -u -p -r1.11 remote.html
--- docs/remote.html	12 Jul 2007 15:47:19 -0000	1.11
+++ docs/remote.html	13 Jul 2007 15:58:50 -0000
@@ -548,8 +548,14 @@ Blank lines and comments beginning with 
   </p>
 </td>
 </tr></table><h3><a name="Remote_IPv6" id="Remote_IPv6">IPv6 support</a></h3><p>
-IPv6 has received some limited testing and should work.  Problems with
-libvirt and IPv6 should be reported as <a href="bugs.html">bugs</a>.
+The libvirtd service and libvirt remote client driver both use the
+<code>getaddrinfo()</code> functions for name resolution and are
+thus fully IPv6 enabled. ie, if a server has IPv6 address configured
+the daemon will listen for incoming connections on both IPv4 and IPv6
+protocols. If a client has an IPv6 address configured and the DNS
+address resolved for a service is reachable over IPv6, then an IPv6
+connection will be made, otherwise IPv4 will be used. In summary it
+should just 'do the right thing(tm)'.
 </p><h3><a name="Remote_limitations" id="Remote_limitations">Limitations</a></h3><ul><li> Remote storage: To be fully useful, particularly for
 creating new domains, it should be possible to enumerate
 and provision storage on the remote machine.  This is currently
Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.2
diff -u -p -r1.2 qemu_conf.c
--- src/qemu_conf.c	12 Jul 2007 15:09:01 -0000	1.2
+++ src/qemu_conf.c	13 Jul 2007 15:58:50 -0000
@@ -967,6 +967,20 @@ static struct qemud_vm_def *qemudParseXM
     if (obj)
         xmlXPathFreeObject(obj);
 
+    /* See if we set clock to localtime */
+    obj = xmlXPathEval(BAD_CAST "string(/domain/clock/@offset)", ctxt);
+    if ((obj == NULL) || (obj->type != XPATH_STRING) ||
+        (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
+        def->localtime = 0;
+    } else {
+        if (!strcmp((char*)obj->stringval, "localtime"))
+            def->localtime = 1;
+        else
+            def->localtime = 0;
+    }
+    if (obj)
+        xmlXPathFreeObject(obj);
+
 
     /* Extract OS type info */
     obj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt);
@@ -1338,6 +1352,7 @@ int qemudBuildCommandLine(virConnectPtr 
         2 + /* cpus */
         2 + /* boot device */
         2 + /* monitor */
+        (vm->def->localtime ? 1 : 0) + /* localtime */
         (driver->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
          vm->def->noReboot ? 1 : 0) + /* no-reboot */
         (vm->def->features & QEMUD_FEATURE_ACPI ? 0 : 1) + /* acpi */
@@ -1376,6 +1391,11 @@ int qemudBuildCommandLine(virConnectPtr 
     if (!((*argv)[++n] = strdup("pty")))
         goto no_memory;
 
+    if (vm->def->localtime) {
+        if (!((*argv)[++n] = strdup("-localtime")))
+            goto no_memory;
+    }
+
     if (driver->qemuCmdFlags & QEMUD_CMD_FLAG_NO_REBOOT &&
         vm->def->noReboot) {
         if (!((*argv)[++n] = strdup("-no-reboot")))
@@ -2623,6 +2643,8 @@ char *qemudGenerateXML(virConnectPtr con
             goto no_memory;
     }
 
+    virBufferVSprintf(buf, "  <clock offset='%s'/>\n", def->localtime ? "localtime" : "utc");
+
     if (virBufferAdd(buf, "  <on_poweroff>destroy</on_poweroff>\n", -1) < 0)
         goto no_memory;
     if (def->noReboot) {
Index: src/qemu_conf.h
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.h,v
retrieving revision 1.2
diff -u -p -r1.2 qemu_conf.h
--- src/qemu_conf.h	12 Jul 2007 15:09:01 -0000	1.2
+++ src/qemu_conf.h	13 Jul 2007 15:58:50 -0000
@@ -164,6 +164,7 @@ struct qemud_vm_def {
 
     struct qemud_vm_os_def os;
 
+    int localtime;
     int features;
     int graphicsType;
     int vncPort;
Index: src/remote_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.15
diff -u -p -r1.15 remote_internal.c
--- src/remote_internal.c	12 Jul 2007 15:17:08 -0000	1.15
+++ src/remote_internal.c	13 Jul 2007 15:58:50 -0000
@@ -551,7 +551,7 @@ doRemoteOpen (virConnectPtr conn, struct
 
     case trans_ssh: {
         int j, nr_args = username ? 10 : 8;
-
+        nr_args += 2;
         command = command ? : strdup ("ssh");
 
         // Generate the final command argv[] array.
@@ -559,6 +559,8 @@ doRemoteOpen (virConnectPtr conn, struct
         cmd_argv = malloc (nr_args * sizeof (char *));
         j = 0;
         cmd_argv[j++] = strdup (command);
+        cmd_argv[j++] = strdup ("-o");
+        cmd_argv[j++] = strdup ("ControlMaster=yes,ControlPath=/home/berrange/ssh");
         cmd_argv[j++] = strdup ("-p");
         cmd_argv[j++] = strdup (port);
         if (username) {
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.129
diff -u -p -r1.129 xend_internal.c
--- src/xend_internal.c	9 Jul 2007 11:24:52 -0000	1.129
+++ src/xend_internal.c	13 Jul 2007 15:58:50 -0000
@@ -1442,6 +1442,8 @@ xend_parse_sexp_desc(virConnectPtr conn,
         virBufferVSprintf(&buf, "  <on_crash>%s</on_crash>\n", tmp);
 
     if (hvm) {
+        int clockLocal;
+
         virBufferAdd(&buf, "  <features>\n", 13);
         if (sexpr_int(root, "domain/image/hvm/acpi"))
             virBufferAdd(&buf, "    <acpi/>\n", 12);
@@ -1450,6 +1452,9 @@ xend_parse_sexp_desc(virConnectPtr conn,
         if (sexpr_int(root, "domain/image/hvm/pae"))
             virBufferAdd(&buf, "    <pae/>\n", 11);
         virBufferAdd(&buf, "  </features>\n", 14);
+
+        clockLocal = sexpr_int(root, "domain/image/hvm/localtime");
+        virBufferVSprintf(&buf, "  <clock offset='%s'/>\n", clockLocal ? "localtime" : "utc");
     }
 
     virBufferAdd(&buf, "  <devices>\n", 12);
Index: src/xm_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xm_internal.c,v
retrieving revision 1.36
diff -u -p -r1.36 xm_internal.c
--- src/xm_internal.c	9 Jul 2007 11:24:52 -0000	1.36
+++ src/xm_internal.c	13 Jul 2007 15:58:50 -0000
@@ -708,6 +708,10 @@ char *xenXMDomainFormatXML(virConnectPtr
             val)
             virBufferAdd(buf, "    <apic/>\n", -1);
         virBufferAdd(buf, "  </features>\n", -1);
+
+        if (xenXMConfigGetInt(conf, "localtime", &val) < 0)
+            val = 0;
+        virBufferVSprintf(buf, "  <clock offset='%s'/>\n", val ? "localtime" : "utc");
     }
 
     virBufferAdd(buf, "  <devices>\n", -1);
@@ -1812,6 +1816,7 @@ virConfPtr xenXMParseXMLToConfig(virConn
 
     if (hvm) {
         const char *boot = "c";
+        int clockLocal = 0;
         if (xenXMConfigSetString(conf, "builder", "hvm") < 0)
             goto error;
 
@@ -1845,6 +1850,16 @@ virConfPtr xenXMParseXMLToConfig(virConn
                                        "cannot set the apic parameter") < 0)
             goto error;
 
+        obj = xmlXPathEval(BAD_CAST "string(/domain/clock/@offset)", ctxt);
+        if ((obj != NULL) && (obj->type == XPATH_STRING) &&
+            (obj->stringval != NULL)) {
+            if (!strcmp((const char*)obj->stringval, "localtime"))
+                clockLocal = 1;
+        }
+        xmlXPathFreeObject(obj);
+        if (xenXMConfigSetInt(conf, "localtime", clockLocal) < 0)
+            goto error;
+
         if (priv->xendConfigVersion == 1) {
             if (xenXMConfigSetStringFromXPath(conn, conf, ctxt, "cdrom", "string(/domain/devices/disk[@device='cdrom']/source/@file)", 1,
                                               "cannot set the cdrom parameter") < 0)
Index: src/xml.c
===================================================================
RCS file: /data/cvs/libvirt/src/xml.c,v
retrieving revision 1.81
diff -u -p -r1.81 xml.c
--- src/xml.c	11 Jul 2007 08:41:11 -0000	1.81
+++ src/xml.c	13 Jul 2007 15:58:50 -0000
@@ -562,6 +562,11 @@ virDomainParseXMLOSDescHVM(virConnectPtr
         }
     }
 
+    str = virXPathString("string(/domain/clock/@offset)", ctxt);
+    if (str != NULL && !strcmp(str, "localtime")) {
+        virBufferAdd(buf, "(localtime 1)", 13);
+    }
+
     virBufferAdd(buf, "))", 2);
 
     return (0);
Index: tests/sexpr2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmltest.c,v
retrieving revision 1.13
diff -u -p -r1.13 sexpr2xmltest.c
--- tests/sexpr2xmltest.c	7 Jun 2007 13:50:18 -0000	1.13
+++ tests/sexpr2xmltest.c	13 Jul 2007 15:58:50 -0000
@@ -28,12 +28,13 @@ static int testCompareFiles(const char *
   if (!(gotxml = xend_parse_domain_sexp(NULL, sexprData, xendConfigVersion)))
     goto fail;
 
-  if (getenv("DEBUG_TESTS")) {
-      printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData);
-      printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml);
-  }
-  if (strcmp(xmlData, gotxml))
+  if (strcmp(xmlData, gotxml)) {
+    if (getenv("DEBUG_TESTS")) {
+        printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData);
+        printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml);
+    }
     goto fail;
+  }
 
   ret = 0;
 
@@ -136,6 +137,19 @@ static int testCompareNoSourceCDRom(void
 			  1);
 }
 
+static int testCompareFVclockUTC(void *data ATTRIBUTE_UNUSED) {
+  return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-utc.xml",
+			  "sexpr2xmldata/sexpr2xml-fv-utc.sexpr",
+			  1);
+}
+
+static int testCompareFVclockLocaltime(void *data ATTRIBUTE_UNUSED) {
+  return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-localtime.xml",
+			  "sexpr2xmldata/sexpr2xml-fv-localtime.sexpr",
+			  1);
+}
+
+
 
 int
 main(int argc, char **argv)
@@ -209,6 +223,14 @@ main(int argc, char **argv)
 		    1, testCompareNoSourceCDRom, NULL) != 0)
 	ret = -1;
 
+    if (virtTestRun("SEXPR-2-XML clock UTC",
+		    1, testCompareFVclockUTC, NULL) != 0)
+	ret = -1;
+
+    if (virtTestRun("SEXPR-2-XML clock Localtime",
+		    1, testCompareFVclockLocaltime, NULL) != 0)
+	ret = -1;
+
     exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 #else /* WITHOUT_XEN */
Index: tests/xmconfigtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xmconfigtest.c,v
retrieving revision 1.4
diff -u -p -r1.4 xmconfigtest.c
--- tests/xmconfigtest.c	4 Apr 2007 14:19:49 -0000	1.4
+++ tests/xmconfigtest.c	13 Jul 2007 15:58:50 -0000
@@ -49,7 +49,7 @@ static int testCompareParseXML(const cha
     void *old_priv;
     struct _xenUnifiedPrivate priv;
 
-    conn = virConnectOpen("test:///default");
+    conn = virConnectOpenReadOnly("test:///default");
     if (!conn) goto fail;
     old_priv = conn->privateData;
 
@@ -70,12 +70,13 @@ static int testCompareParseXML(const cha
         goto fail;
     gotxmcfgPtr[wrote] = '\0';
 
-    if (getenv("DEBUG_TESTS")) {
-        printf("Expect %d '%s'\n", (int)strlen(xmcfgData), xmcfgData);
-        printf("Actual %d '%s'\n", (int)strlen(gotxmcfgData), gotxmcfgData);
-    }
-    if (strcmp(xmcfgData, gotxmcfgData))
+    if (strcmp(xmcfgData, gotxmcfgData)) {
+        if (getenv("DEBUG_TESTS")) {
+            printf("Expect %d '%s'\n", (int)strlen(xmcfgData), xmcfgData);
+            printf("Actual %d '%s'\n", (int)strlen(gotxmcfgData), gotxmcfgData);
+        }
         goto fail;
+    }
 
     ret = 0;
 
@@ -103,7 +104,7 @@ static int testCompareFormatXML(const ch
     void *old_priv;
     struct _xenUnifiedPrivate priv;
 
-    conn = virConnectOpen("test:///default");
+    conn = virConnectOpenReadOnly("test:///default");
     if (!conn) goto fail;
     old_priv = conn->privateData;
 
@@ -123,12 +124,13 @@ static int testCompareFormatXML(const ch
     if (!(gotxml = xenXMDomainFormatXML(conn, conf)))
         goto fail;
 
-    if (getenv("DEBUG_TESTS")) {
-        printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData);
-        printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml);
-    }
-    if (strcmp(xmlData, gotxml))
+    if (strcmp(xmlData, gotxml)) {
+        if (getenv("DEBUG_TESTS")) {
+            printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData);
+            printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml);
+        }
         goto fail;
+    }
 
     ret = 0;
 
@@ -190,6 +192,29 @@ static int testCompareFullvirtNewCDROMPa
                                2);
 }
 
+static int testCompareFullvirtClockUTCFormat(void *data ATTRIBUTE_UNUSED) {
+    return testCompareFormatXML("xmconfigdata/test-fullvirt-utc.cfg",
+                                "xmconfigdata/test-fullvirt-utc.xml",
+                                2);
+}
+
+static int testCompareFullvirtClockUTCParse(void *data ATTRIBUTE_UNUSED) {
+    return testCompareParseXML("xmconfigdata/test-fullvirt-utc.cfg",
+                               "xmconfigdata/test-fullvirt-utc.xml",
+                               2);
+}
+
+static int testCompareFullvirtClockLocaltimeFormat(void *data ATTRIBUTE_UNUSED) {
+    return testCompareFormatXML("xmconfigdata/test-fullvirt-localtime.cfg",
+                                "xmconfigdata/test-fullvirt-localtime.xml",
+                                2);
+}
+static int testCompareFullvirtClockLocaltimeParse(void *data ATTRIBUTE_UNUSED) {
+    return testCompareParseXML("xmconfigdata/test-fullvirt-localtime.cfg",
+                               "xmconfigdata/test-fullvirt-localtime.xml",
+                               2);
+}
+
 
 int
 main(int argc, char **argv)
@@ -203,22 +228,27 @@ main(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
 
+    /* Config -> XML */
     if (virtTestRun("Paravirt old PVFB (Format)",
                     1, testCompareParavirtOldPVFBFormat, NULL) != 0)
         ret = -1;
-
     if (virtTestRun("Paravirt new PVFB (Format)",
                     1, testCompareParavirtNewPVFBFormat, NULL) != 0)
         ret = -1;
-
     if (virtTestRun("Fullvirt old PVFB (Format)",
                     1, testCompareFullvirtOldCDROMFormat, NULL) != 0)
         ret = -1;
-
     if (virtTestRun("Fullvirt new PVFB (Format)",
                     1, testCompareFullvirtNewCDROMFormat, NULL) != 0)
         ret = -1;
+    if (virtTestRun("Fullvirt clock Localtime (Format)",
+                    1, testCompareFullvirtClockLocaltimeFormat, NULL) != 0)
+        ret = -1;
+    if (virtTestRun("Fullvirt clock UTC (Format)",
+                    1, testCompareFullvirtClockUTCFormat, NULL) != 0)
+        ret = -1;
 
+    /* XML -> Config */
     if (virtTestRun("Paravirt old PVFB (Parse)",
                     1, testCompareParavirtOldPVFBParse, NULL) != 0)
         ret = -1;
@@ -231,6 +261,12 @@ main(int argc, char **argv)
     if (virtTestRun("Fullvirt new PVFB (Parse)",
                     1, testCompareFullvirtNewCDROMParse, NULL) != 0)
         ret = -1;
+    if (virtTestRun("Fullvirt clock Localtime (Parse)",
+                    1, testCompareFullvirtClockLocaltimeParse, NULL) != 0)
+        ret = -1;
+    if (virtTestRun("Fullvirt clock UTC (Parse)",
+                    1, testCompareFullvirtClockUTCParse, NULL) != 0)
+        ret = -1;
 
     exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
Index: tests/xml2sexprtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprtest.c,v
retrieving revision 1.12
diff -u -p -r1.12 xml2sexprtest.c
--- tests/xml2sexprtest.c	7 Jun 2007 13:50:18 -0000	1.12
+++ tests/xml2sexprtest.c	13 Jul 2007 15:58:50 -0000
@@ -187,6 +187,20 @@ static int testCompareNoSourceCDRom(void
 			  2);
 }
 
+static int testCompareFVclockUTC(void *data ATTRIBUTE_UNUSED) {
+  return testCompareFiles("xml2sexprdata/xml2sexpr-fv-utc.xml",
+			  "xml2sexprdata/xml2sexpr-fv-utc.sexpr",
+			  "fvtest",
+			  1);
+}
+
+static int testCompareFVclockLocaltime(void *data ATTRIBUTE_UNUSED) {
+  return testCompareFiles("xml2sexprdata/xml2sexpr-fv-localtime.xml",
+			  "xml2sexprdata/xml2sexpr-fv-localtime.sexpr",
+			  "fvtest",
+			  1);
+}
+
 
 int
 main(int argc, char **argv)
@@ -276,5 +290,13 @@ main(int argc, char **argv)
 		    1, testCompareNoSourceCDRom, NULL) != 0)
 	ret = -1;
 
+    if (virtTestRun("XML-2-SEXPR clock UTC",
+		    1, testCompareFVclockUTC, NULL) != 0)
+	ret = -1;
+
+    if (virtTestRun("XML-2-SEXPR clock Localtime",
+		    1, testCompareFVclockLocaltime, NULL) != 0)
+	ret = -1;
+
     exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
Index: tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml,v
retrieving revision 1.3
diff -u -p -r1.3 sexpr2xml-fv-v2.xml
--- tests/sexpr2xmldata/sexpr2xml-fv-v2.xml	6 Mar 2007 20:00:17 -0000	1.3
+++ tests/sexpr2xmldata/sexpr2xml-fv-v2.xml	13 Jul 2007 15:58:50 -0000
@@ -14,6 +14,7 @@
   <features>
     <acpi/>
   </features>
+  <clock offset='utc'/>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='cdrom'>
Index: tests/sexpr2xmldata/sexpr2xml-fv.xml
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-fv.xml,v
retrieving revision 1.3
diff -u -p -r1.3 sexpr2xml-fv.xml
--- tests/sexpr2xmldata/sexpr2xml-fv.xml	6 Mar 2007 20:00:17 -0000	1.3
+++ tests/sexpr2xmldata/sexpr2xml-fv.xml	13 Jul 2007 15:58:50 -0000
@@ -14,6 +14,7 @@
   <features>
     <acpi/>
   </features>
+  <clock offset='utc'/>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
Index: tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml,v
retrieving revision 1.2
diff -u -p -r1.2 sexpr2xml-no-source-cdrom.xml
--- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml	13 Apr 2007 00:43:57 -0000	1.2
+++ tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml	13 Jul 2007 15:58:50 -0000
@@ -17,6 +17,7 @@
     <apic/>
     <pae/>
   </features>
+  <clock offset='utc'/>
   <devices>
     <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
     <interface type='bridge'>
Index: tests/xmconfigdata/test-fullvirt-new-cdrom.cfg
===================================================================
RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-new-cdrom.cfg,v
retrieving revision 1.2
diff -u -p -r1.2 test-fullvirt-new-cdrom.cfg
--- tests/xmconfigdata/test-fullvirt-new-cdrom.cfg	7 Jun 2007 18:21:58 -0000	1.2
+++ tests/xmconfigdata/test-fullvirt-new-cdrom.cfg	13 Jul 2007 15:58:51 -0000
@@ -9,6 +9,7 @@ boot = "d"
 pae = 1
 acpi = 1
 apic = 1
+localtime = 0
 on_poweroff = "destroy"
 on_reboot = "restart"
 on_crash = "restart"
Index: tests/xmconfigdata/test-fullvirt-new-cdrom.xml
===================================================================
RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-new-cdrom.xml,v
retrieving revision 1.3
diff -u -p -r1.3 test-fullvirt-new-cdrom.xml
--- tests/xmconfigdata/test-fullvirt-new-cdrom.xml	7 Jun 2007 18:21:58 -0000	1.3
+++ tests/xmconfigdata/test-fullvirt-new-cdrom.xml	13 Jul 2007 15:58:51 -0000
@@ -17,6 +17,7 @@
     <acpi/>
     <apic/>
   </features>
+  <clock offset='utc'/>
   <devices>
     <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
     <disk type='block' device='disk'>
Index: tests/xmconfigdata/test-fullvirt-old-cdrom.cfg
===================================================================
RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-old-cdrom.cfg,v
retrieving revision 1.2
diff -u -p -r1.2 test-fullvirt-old-cdrom.cfg
--- tests/xmconfigdata/test-fullvirt-old-cdrom.cfg	7 Jun 2007 18:21:58 -0000	1.2
+++ tests/xmconfigdata/test-fullvirt-old-cdrom.cfg	13 Jul 2007 15:58:51 -0000
@@ -9,6 +9,7 @@ boot = "d"
 pae = 1
 acpi = 1
 apic = 1
+localtime = 0
 cdrom = "/root/boot.iso"
 on_poweroff = "destroy"
 on_reboot = "restart"
Index: tests/xmconfigdata/test-fullvirt-old-cdrom.xml
===================================================================
RCS file: /data/cvs/libvirt/tests/xmconfigdata/test-fullvirt-old-cdrom.xml,v
retrieving revision 1.3
diff -u -p -r1.3 test-fullvirt-old-cdrom.xml
--- tests/xmconfigdata/test-fullvirt-old-cdrom.xml	7 Jun 2007 18:21:58 -0000	1.3
+++ tests/xmconfigdata/test-fullvirt-old-cdrom.xml	13 Jul 2007 15:58:51 -0000
@@ -17,6 +17,7 @@
     <acpi/>
     <apic/>
   </features>
+  <clock offset='utc'/>
   <devices>
     <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
     <disk type='block' device='disk'>
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]