From ef79fb5b5f56e1995874d0c609da36edfa5acf0d Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Thu, 7 Jul 2011 00:20:28 -0400 Subject: [PATCH] conf: add subelement to domain element Once it's plugged in, the element will be an optional replacement for the "listen" attribute that graphics elements already have. If the element is type='address', it will have an attribute called 'address' which will contain an IP address or dns name that the guest's display server should listen on. If, however, type='network', the element should have an attribute called 'network' that will be set to the name of a network configuration to get the IP address from. * docs/schemas/domain.rng: updated to allow the element * docs/formatdomain.html.in: document the element and its attributes. * src/conf/domain_conf.[hc]: 1) The domain parser, formatter, and data structure are modified to support 0 or more subelements to each element. The old style "legacy" listen attribute is also still accepted, and will be stored internally just as if it were a separate element. On output (i.e. format), the address attribute of the first element of type 'address' will be duplicated in the legacy "listen" attribute of the element. 2) The "listenAddr" attribute has been removed from the unions in virDomainGRaphicsDef for graphics types vnc, rdp, and spice. This attribute is now in the subelement (aka virDomainGraphicsListenDef) 3) Helper functions were written to provide simple access (both Get and Set) to the listen elements and their attributes. * src/libvirt_private.syms: export the listen helper functions * src/qemu/qemu_command.c, src/qemu/qemu_hotplug.c, src/qemu/qemu_migration.c, src/vbox/vbox_tmpl.c, src/vmx/vmx.c, src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c Modify all these files to use the listen helper functions rather than directly referencing the (now missing) listenAddr attribute. There can be multiple elements to a single , but the drivers all currently only support one, so all replacements of direct access with a helper function indicate index "0". * tests/* - only 3 of these are new files added explicitly to test the new element. All the others have been modified to reflect the fact that any legacy "listen" attributes passed in to the domain parse will be saved in a element (i.e. one of the virDomainGraphicsListenDefs), and during the domain format function, both the element as well as the legacy attributes will be output. --- docs/formatdomain.html.in | 55 ++- docs/schemas/domain.rng | 33 ++ src/conf/domain_conf.c | 408 ++++++++++++++++-- src/conf/domain_conf.h | 43 +- src/libvirt_private.syms | 6 + src/qemu/qemu_command.c | 42 +- src/qemu/qemu_hotplug.c | 10 +- src/qemu/qemu_migration.c | 4 +- src/vbox/vbox_tmpl.c | 13 +- src/vmx/vmx.c | 16 +- src/xenxs/xen_sxpr.c | 23 +- src/xenxs/xen_xm.c | 33 +- .../qemuxml2argv-graphics-listen-network.xml | 32 ++ .../qemuxml2argv-graphics-listen-network2.xml | 33 ++ ...emuxml2argv-graphics-spice-compression.xml | 1 + .../qemuxml2argv-graphics-spice-qxl-vga.xml | 1 + .../qemuxml2argv-graphics-spice.xml | 1 + .../qemuxml2argv-graphics-vnc-sasl.xml | 4 +- .../qemuxml2argv-graphics-vnc-tls.xml | 4 +- .../qemuxml2argv-graphics-vnc.xml | 4 +- .../qemuxml2argv-input-xen.xml | 4 +- ...emuxml2xmlout-graphics-listen-network2.xml | 33 ++ tests/qemuxml2xmltest.c | 2 + .../sexpr2xml-pv-vfb-new-vncdisplay.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml | 4 +- tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml | 4 +- tests/xmconfigdata/test-escape-paths.xml | 4 +- .../xmconfigdata/test-fullvirt-force-hpet.xml | 4 +- .../test-fullvirt-force-nohpet.xml | 4 +- .../xmconfigdata/test-fullvirt-localtime.xml | 4 +- .../xmconfigdata/test-fullvirt-net-ioemu.xml | 4 +- .../test-fullvirt-net-netfront.xml | 4 +- .../xmconfigdata/test-fullvirt-new-cdrom.xml | 4 +- .../xmconfigdata/test-fullvirt-old-cdrom.xml | 4 +- .../test-fullvirt-parallel-tcp.xml | 4 +- .../test-fullvirt-serial-dev-2-ports.xml | 4 +- .../test-fullvirt-serial-dev-2nd-port.xml | 4 +- .../test-fullvirt-serial-file.xml | 4 +- .../test-fullvirt-serial-null.xml | 4 +- .../test-fullvirt-serial-pipe.xml | 4 +- .../xmconfigdata/test-fullvirt-serial-pty.xml | 4 +- .../test-fullvirt-serial-stdio.xml | 4 +- .../test-fullvirt-serial-tcp-telnet.xml | 4 +- .../xmconfigdata/test-fullvirt-serial-tcp.xml | 4 +- .../xmconfigdata/test-fullvirt-serial-udp.xml | 4 +- .../test-fullvirt-serial-unix.xml | 4 +- tests/xmconfigdata/test-fullvirt-sound.xml | 4 +- tests/xmconfigdata/test-fullvirt-usbmouse.xml | 4 +- .../test-fullvirt-usbtablet-no-bus.xml | 4 +- .../xmconfigdata/test-fullvirt-usbtablet.xml | 4 +- tests/xmconfigdata/test-fullvirt-utc.xml | 4 +- .../xmconfigdata/test-paravirt-net-e1000.xml | 4 +- .../test-paravirt-net-vifname.xml | 4 +- .../test-paravirt-new-pvfb-vncdisplay.xml | 4 +- tests/xmconfigdata/test-paravirt-new-pvfb.xml | 4 +- .../test-paravirt-old-pvfb-vncdisplay.xml | 4 +- tests/xmconfigdata/test-paravirt-old-pvfb.xml | 4 +- 57 files changed, 823 insertions(+), 118 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 50c11c3949..7d2ba8a09d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2043,9 +2043,14 @@ qemu-kvm -net nic,model=? /dev/null ... <devices> <graphics type='sdl' display=':0.0'/> - <graphics type='vnc' port='5904'/> + <graphics type='vnc' port='5904'> + <listen type='address' address='1.2.3.4'/> + </graphics> <graphics type='rdp' autoport='yes' multiUser='yes' /> <graphics type='desktop' fullscreen='yes'/> + <graphics type='spice'> + <listen type='network' network='rednet'/> + </graphics> </devices> ... @@ -2191,6 +2196,54 @@ qemu-kvm -net nic,model=? /dev/null +

+ Rather than putting the address information used to set up the + listening socket for graphics types vnc + and spice in + the <graphics> listen attribute, + a separate subelement of <graphics>, + called <listen> can be specified (see the + examples above)since + 0.9.4. <listen> accepts the following + attributes: +

+
+
type
+
Set to either address + or network. This tells whether this listen + element is specifying the address to be used directly, or by + naming a network (which will then be used to determine an + appropriate address for listening). +
+
+
+
address
+
if type='address', the address + attribute will contain either an IP address or hostname (which + will be resolved to an IP address via a DNS query) to listen + on. In the "live" XML of a running domain, this attribute will + be set to the IP address used for listening, even + if type='network'. +
+
+
+
network
+
if type='network', the network + attribute will contain the name of a network in libvirt's list + of configured networks. The named network configuration will + be examined to determine an appropriate listen address. For + example, if the network has an IPv4 address in its + configuration (e.g. if it has a forward type + of route, nat, or no forward type + (isolated)), the first IPv4 address listed in the network's + configuration will be used. If the network is describing a + host bridge, the first IPv4 address associated with that + bridge device will be used, and if the network is describing + one of the 'direct' (macvtap) modes, the first IPv4 address of + the first forward dev will be used. +
+
+

Video devices

A video device. diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index aa4ce69419..6ccbeed271 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1289,6 +1289,7 @@ + @@ -1342,6 +1343,7 @@ + @@ -1478,6 +1480,7 @@ + @@ -1500,6 +1503,36 @@ + + + + + + + + address + + + + + + + + network + + + + + + + + + + + + + +