]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix reading vncdisplay from xend, add several test cases for xen vnc corner case
authorCole Robinson <crobinso@redhat.com>
Tue, 9 Sep 2008 13:53:58 +0000 (13:53 +0000)
committerCole Robinson <crobinso@redhat.com>
Tue, 9 Sep 2008 13:53:58 +0000 (13:53 +0000)
s.

13 files changed:
ChangeLog
src/xend_internal.c
tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.sexpr [new file with mode: 0644]
tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml [new file with mode: 0644]
tests/sexpr2xmltest.c
tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.cfg [new file with mode: 0644]
tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml [new file with mode: 0644]
tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.cfg [new file with mode: 0644]
tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.xml [new file with mode: 0644]
tests/xmconfigtest.c
tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.sexpr [new file with mode: 0644]
tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml [new file with mode: 0644]
tests/xml2sexprtest.c

index 276cfd0b2a62c333757f2ae483d2e34db74dc1b6..f468e0765b0fd185905d2061d18c1b6ccd8865cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Tue Sep  9 09:50:00 EST 2008 Cole Robinson <crobinso@redhat.com>
+
+       * src/xend_internal.c: fix reading vncdisplay from xend domain
+       * tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.sexpr
+         tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml,
+         tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.cfg,
+         tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml,
+         tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.cfg,
+         tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.xml,
+         tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.sexpr,
+         tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml:
+         Add tests for various xen vnc cases.
+
 Tue Sep  9 09:42:00 EST 2008 Cole Robinson <crobinso@redhat.com>
 
        * src/qemu_conf.c : fix a segfault if no qemu emulator is passed
index e9ea09b6075041533ad6929b1fae6a2f29f1d96c..2e1a8d1d4771e2f885b50c1df8c13e24af9341d0 100644 (file)
@@ -2121,13 +2121,22 @@ xenDaemonParseSxprGraphicsNew(virConnectPtr conn,
                     goto no_memory;
             } else {
                 int port = xenStoreDomainGetVNCPort(conn, def->id);
+                if (port == -1) {
+                    // Didn't find port entry in xenstore
+                    port = sexpr_int(node, "device/vfb/vncdisplay");
+                }
                 const char *listenAddr = sexpr_node(node, "device/vfb/vnclisten");
                 const char *vncPasswd = sexpr_node(node, "device/vfb/vncpasswd");;
                 const char *keymap = sexpr_node(node, "device/vfb/keymap");
                 const char *unused = sexpr_node(node, "device/vfb/vncunused");
 
-                if ((unused && STREQ(unused, "1")) || port == -1)
+                if ((unused && STREQ(unused, "1")) || port == -1) {
                     graphics->data.vnc.autoport = 1;
+                    port = -1;
+                }
+
+                if (port >= 0 && port < 5900)
+                    port += 5900;
                 graphics->data.vnc.port = port;
 
                 if (listenAddr &&
diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.sexpr b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.sexpr
new file mode 100644 (file)
index 0000000..c0fb904
--- /dev/null
@@ -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 0)(vnclisten 0.0.0.0)(vncpasswd 123456)(keymap ja)(vncdisplay 25)))))
+
diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml
new file mode 100644 (file)
index 0000000..40302d0
--- /dev/null
@@ -0,0 +1,29 @@
+<domain type='xen' id='6'>
+  <name>pvtest</name>
+  <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
+  <os>
+    <type>linux</type>
+    <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+    <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+    <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>destroy</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <driver name='file'/>
+      <source file='/root/some.img'/>
+      <target dev='xvda' bus='xen'/>
+    </disk>
+    <console type='pty'>
+      <target port='0'/>
+    </console>
+    <input type='mouse' bus='xen'/>
+    <graphics type='vnc' port='5925' autoport='no' listen='0.0.0.0' keymap='ja'/>
+  </devices>
+</domain>
index 27952f6ab37b693ea5a5b480369ad5b33bf090d5..d36bc72fea17334cffc625bba6b7b8129a79b2a3 100644 (file)
@@ -106,6 +106,7 @@ mymain(int argc, char **argv)
     DO_TEST("fv-v2", "fv-v2", 2);
     DO_TEST("pv-vfb-orig", "pv-vfb-orig", 2);
     DO_TEST("pv-vfb-new", "pv-vfb-new", 3);
+    DO_TEST("pv-vfb-new-vncdisplay", "pv-vfb-new-vncdisplay", 3);
     DO_TEST("pv-bootloader", "pv-bootloader", 1);
 
     DO_TEST("disk-file", "disk-file", 2);
diff --git a/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.cfg b/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.cfg
new file mode 100644 (file)
index 0000000..35d5364
--- /dev/null
@@ -0,0 +1,12 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+bootloader = "/usr/bin/pygrub"
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vfb = [ "type=vnc,vncunused=0,vncdisplay=25,vnclisten=127.0.0.1,vncpasswd=123poi" ]
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0" ]
diff --git a/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml b/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml
new file mode 100644 (file)
index 0000000..f4d5bd8
--- /dev/null
@@ -0,0 +1,32 @@
+<domain type='xen'>
+  <name>XenGuest1</name>
+  <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
+  <memory>592896</memory>
+  <currentMemory>403456</currentMemory>
+  <vcpu>1</vcpu>
+  <bootloader>/usr/bin/pygrub</bootloader>
+  <os>
+    <type arch='i686' machine='xenpv'>linux</type>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+    <disk type='block' device='disk'>
+      <driver name='phy'/>
+      <source dev='/dev/HostVG/XenGuest1'/>
+      <target dev='xvda' bus='xen'/>
+    </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:66:94:9c'/>
+      <source bridge='br0'/>
+    </interface>
+    <console type='pty'>
+      <target port='0'/>
+    </console>
+    <input type='mouse' bus='xen'/>
+    <graphics type='vnc' port='5925' autoport='no' listen='127.0.0.1' passwd='123poi'/>
+  </devices>
+</domain>
diff --git a/tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.cfg b/tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.cfg
new file mode 100644 (file)
index 0000000..9e7000b
--- /dev/null
@@ -0,0 +1,17 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+bootloader = "/usr/bin/pygrub"
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+sdl = 0
+vnc = 1
+vncunused = 0
+vncdisplay = 25
+vnclisten = "127.0.0.1"
+vncpasswd = "123poi"
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0" ]
diff --git a/tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.xml b/tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.xml
new file mode 100644 (file)
index 0000000..f4d5bd8
--- /dev/null
@@ -0,0 +1,32 @@
+<domain type='xen'>
+  <name>XenGuest1</name>
+  <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
+  <memory>592896</memory>
+  <currentMemory>403456</currentMemory>
+  <vcpu>1</vcpu>
+  <bootloader>/usr/bin/pygrub</bootloader>
+  <os>
+    <type arch='i686' machine='xenpv'>linux</type>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+    <disk type='block' device='disk'>
+      <driver name='phy'/>
+      <source dev='/dev/HostVG/XenGuest1'/>
+      <target dev='xvda' bus='xen'/>
+    </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:66:94:9c'/>
+      <source bridge='br0'/>
+    </interface>
+    <console type='pty'>
+      <target port='0'/>
+    </console>
+    <input type='mouse' bus='xen'/>
+    <graphics type='vnc' port='5925' autoport='no' listen='127.0.0.1' passwd='123poi'/>
+  </devices>
+</domain>
index 5c2eeb1c598362056bd53e672a667476ad116e98..cf387f7f5a68200b3b750c9e6d4ec97de89407dd 100644 (file)
@@ -215,7 +215,9 @@ mymain(int argc, char **argv)
     } while (0)
 
     DO_TEST("paravirt-old-pvfb", 2);
+    DO_TEST("paravirt-old-pvfb-vncdisplay", 2);
     DO_TEST("paravirt-new-pvfb", 3);
+    DO_TEST("paravirt-new-pvfb-vncdisplay", 3);
     DO_TEST("paravirt-net-e1000", 3);
     DO_TEST("fullvirt-old-cdrom", 1);
     DO_TEST("fullvirt-new-cdrom", 2);
diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.sexpr b/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.sexpr
new file mode 100644 (file)
index 0000000..ecec85d
--- /dev/null
@@ -0,0 +1 @@
+(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d21-71f4-8fb2-e068-e2386a5c413e')(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_model '/usr/lib/xen/bin/qemu-dm')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vkbd))(device (vfb (type vnc)(vncunused 1)(vnclisten '127.0.0.1')(vncpasswd '123456')(keymap 'ja'))))
\ No newline at end of file
diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml b/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml
new file mode 100644 (file)
index 0000000..c17d9d5
--- /dev/null
@@ -0,0 +1,23 @@
+<domain type='xen' id='6'>
+  <name>pvtest</name>
+  <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+  <os>
+    <type>linux</type>
+    <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+    <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+    <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
+  </os>
+  <memory>430080</memory>
+  <vcpu>2</vcpu>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>destroy</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <driver name='file'/>
+      <source file='/root/some.img'/>
+      <target dev='xvda'/>
+    </disk>
+    <graphics type='vnc' port='-1' autoport='yes' listen="127.0.0.1" passwd="123456" keymap="ja"/>
+  </devices>
+</domain>
index 3888c8b61e2f9544dbc08e4c7204170223e9e387..aee006a7cc0f11463201455a14e639c134b98be5 100644 (file)
@@ -111,6 +111,7 @@ mymain(int argc, char **argv)
     DO_TEST("fv-vncunused", "fv-vncunused", "fvtest", 2);
     DO_TEST("pv-vfb-orig", "pv-vfb-orig", "pvtest", 2);
     DO_TEST("pv-vfb-new", "pv-vfb-new", "pvtest", 3);
+    DO_TEST("pv-vfb-new-auto", "pv-vfb-new-auto", "pvtest", 3);
     DO_TEST("pv-bootloader", "pv-bootloader", "pvtest", 1);
 
     DO_TEST("disk-file", "disk-file", "pvtest", 2);