diff options
author | 2008-09-09 13:53:58 +0000 | |
---|---|---|
committer | 2008-09-09 13:53:58 +0000 | |
commit | a82bd0784b1dda58efdca17e0dded8cfe63ad972 (patch) | |
tree | 828b3d5eb3fd17a60879ac41d5bd8034530508d0 | |
parent | Fix a segfault if defining a qemu domain without an emulator. (diff) | |
download | libvirt-a82bd0784b1dda58efdca17e0dded8cfe63ad972.tar.gz libvirt-a82bd0784b1dda58efdca17e0dded8cfe63ad972.tar.bz2 libvirt-a82bd0784b1dda58efdca17e0dded8cfe63ad972.zip |
Fix reading vncdisplay from xend, add several test cases for xen vnc corner case
s.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | src/xend_internal.c | 11 | ||||
-rw-r--r-- | tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.sexpr | 2 | ||||
-rw-r--r-- | tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml | 29 | ||||
-rw-r--r-- | tests/sexpr2xmltest.c | 1 | ||||
-rw-r--r-- | tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.cfg | 12 | ||||
-rw-r--r-- | tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml | 32 | ||||
-rw-r--r-- | tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.cfg | 17 | ||||
-rw-r--r-- | tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.xml | 32 | ||||
-rw-r--r-- | tests/xmconfigtest.c | 2 | ||||
-rw-r--r-- | tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.sexpr | 1 | ||||
-rw-r--r-- | tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml | 23 | ||||
-rw-r--r-- | tests/xml2sexprtest.c | 1 |
13 files changed, 175 insertions, 1 deletions
@@ -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 diff --git a/src/xend_internal.c b/src/xend_internal.c index e9ea09b60..2e1a8d1d4 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -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 index 000000000..c0fb904c7 --- /dev/null +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.sexpr @@ -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 index 000000000..40302d0c0 --- /dev/null +++ b/tests/sexpr2xmldata/sexpr2xml-pv-vfb-new-vncdisplay.xml @@ -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> diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c index 27952f6ab..d36bc72fe 100644 --- a/tests/sexpr2xmltest.c +++ b/tests/sexpr2xmltest.c @@ -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 index 000000000..35d536420 --- /dev/null +++ b/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.cfg @@ -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 index 000000000..f4d5bd873 --- /dev/null +++ b/tests/xmconfigdata/test-paravirt-new-pvfb-vncdisplay.xml @@ -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 index 000000000..9e7000b42 --- /dev/null +++ b/tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.cfg @@ -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 index 000000000..f4d5bd873 --- /dev/null +++ b/tests/xmconfigdata/test-paravirt-old-pvfb-vncdisplay.xml @@ -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/xmconfigtest.c b/tests/xmconfigtest.c index 5c2eeb1c5..cf387f7f5 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -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 index 000000000..ecec85ddc --- /dev/null +++ b/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.sexpr @@ -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 index 000000000..c17d9d5ff --- /dev/null +++ b/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml @@ -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> diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c index 3888c8b61..aee006a7c 100644 --- a/tests/xml2sexprtest.c +++ b/tests/xml2sexprtest.c @@ -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); |