Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.78
diff -u -r1.78 xend_internal.c
--- src/xend_internal.c 22 Nov 2006 17:48:29 -0000 1.78
+++ src/xend_internal.c 5 Dec 2006 20:47:19 -0000
@@ -1736,6 +1736,19 @@
tmp2);
virBufferAdd(&buf, " \n", 17);
+ } else if (!hvm &&
+ sexpr_lookup(node, "device/vfb")) {
+ /* New style graphics config for PV guests only in 3.0.4 */
+ tmp = sexpr_node(node, "device/vfb/type");
+
+ if (tmp && !strcmp(tmp, "sdl")) {
+ virBufferAdd(&buf, " \n", 27);
+ } else if (tmp && !strcmp(tmp, "vnc")) {
+ int port = xenStoreDomainGetVNCPort(conn, domid);
+ if (port == -1)
+ port = 5900 + domid;
+ virBufferVSprintf(&buf, " \n", port);
+ }
}
}
@@ -1769,21 +1782,26 @@
}
}
- /* Graphics device */
- tmp = sexpr_fmt_node(root, "domain/image/%s/vnc", hvm ? "hvm" : "linux");
- if (tmp != NULL) {
- if (tmp[0] == '1') {
- int port = xenStoreDomainGetVNCPort(conn, domid);
- if (port == -1)
- port = 5900 + domid;
- virBufferVSprintf(&buf, " \n", port);
+ /* Graphics device (HVM, or old (pre-3.0.4) style PV vnc config) */
+ if (hvm || xendConfigVersion < 3) {
+ tmp = sexpr_fmt_node(root, "domain/image/%s/vnc", hvm ? "hvm" : "linux");
+ if (tmp != NULL) {
+ if (tmp[0] == '1') {
+ int port = xenStoreDomainGetVNCPort(conn, domid);
+ if (port == -1)
+ port = 5900 + domid;
+ virBufferVSprintf(&buf, " \n", port);
+ }
}
}
- tmp = sexpr_fmt_node(root, "domain/image/%s/sdl", hvm ? "hvm" : "linux");
- if (tmp != NULL) {
- if (tmp[0] == '1')
- virBufferAdd(&buf, " \n", 27 );
+ /* Graphics device (HVM, or old (pre-3.0.4) style PV sdl config) */
+ if (hvm || xendConfigVersion < 3){
+ tmp = sexpr_fmt_node(root, "domain/image/%s/sdl", hvm ? "hvm" : "linux");
+ if (tmp != NULL) {
+ if (tmp[0] == '1')
+ virBufferAdd(&buf, " \n", 27 );
+ }
}
tty = xenStoreDomainGetConsolePath(conn, domid);
Index: tests/sexpr2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmltest.c,v
retrieving revision 1.7
diff -u -r1.7 sexpr2xmltest.c
--- tests/sexpr2xmltest.c 15 Nov 2006 00:38:13 -0000 1.7
+++ tests/sexpr2xmltest.c 5 Dec 2006 20:47:19 -0000
@@ -60,6 +60,20 @@
2);
}
+static int testComparePVOrigVFB(void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml",
+ "sexpr2xmldata/sexpr2xml-pv-vfb-orig.sexpr",
+ 2);
+}
+
+
+static int testComparePVNewVFB(void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("sexpr2xmldata/sexpr2xml-pv-vfb-new.xml",
+ "sexpr2xmldata/sexpr2xml-pv-vfb-new.sexpr",
+ 3);
+}
+
+
static int testCompareFVversion2(void *data ATTRIBUTE_UNUSED) {
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-v2.xml",
"sexpr2xmldata/sexpr2xml-fv-v2.sexpr",
@@ -133,8 +147,15 @@
if (virtTestRun("SEXPR-2-XML PV config (version 2)",
1, testComparePVversion2, NULL) != 0)
ret = -1;
+ if (virtTestRun("SEXPR-2-XML PV config (Orig VFB)",
+ 1, testComparePVOrigVFB, NULL) != 0)
+ ret = -1;
+
+ if (virtTestRun("SEXPR-2-XML PV config (New VFB)",
+ 1, testComparePVNewVFB, NULL) != 0)
+ ret = -1;
- if (virtTestRun("SEXPR-2-XML FV config (version 2)",
+ if (virtTestRun("SEXPR-2-XML FV config (version 2)",
1, testCompareFVversion2, NULL) != 0)
ret = -1;
Index: tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.sexpr
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.sexpr
diff -N tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.sexpr
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.sexpr 5 Dec 2006 20:47:19 -0000
@@ -0,0 +1,2 @@
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vfb (type vnc)(vncunused 1)(vnclisten 0.0.0.0)(vncpasswd 123456)))))
+
Index: tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml
diff -N tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml 5 Dec 2006 20:47:19 -0000
@@ -0,0 +1,23 @@
+
+ pvtest
+ 596a5d2171f48fb2e068e2386a5c413e
+
+ linux
+ /var/lib/xen/vmlinuz.2Dn2YT
+ /var/lib/xen/initrd.img.0u-Vhq
+ method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os
+
+ 430080
+ 2
+ destroy
+ destroy
+ destroy
+
+
+
+
+
+
+
+
+
Index: tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.sexpr
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.sexpr
diff -N tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.sexpr
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.sexpr 5 Dec 2006 20:47:19 -0000
@@ -0,0 +1,2 @@
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')(vnc 1)(vncunused 1)(vnclisten 0.0.0.0)(vncpasswd 123456)))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
+
Index: tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml
diff -N tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml 5 Dec 2006 20:47:19 -0000
@@ -0,0 +1,23 @@
+
+ pvtest
+ 596a5d2171f48fb2e068e2386a5c413e
+
+ linux
+ /var/lib/xen/vmlinuz.2Dn2YT
+ /var/lib/xen/initrd.img.0u-Vhq
+ method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os
+
+ 430080
+ 2
+ destroy
+ destroy
+ destroy
+
+
+
+
+
+
+
+
+