On 07/25/2011 03:00 AM, Laine Stump wrote:
The domain XML now understands the<listen> subelement of its
<graphics> element (including when listen type='network'), and the
network driver has an internal API that will turn a network name into
an IP address, so the final logical step is to put the glue into the
qemu driver so that when it is starting up a domain, if it finds
<listen type='network' network='xyz'/> in the XML, it will call
the
network driver to get an IPv4 address associated with network xyz, and
tell qemu to listen for vnc (or spice) on that address rather than the
default address (localhost).
There may be some fallout to this patch, based on what happens to 1/2,
but in general:
@@ -4127,7 +4126,37 @@ qemuBuildCommandLine(virConnectPtr conn,
def->graphics[0]->data.vnc.socket);
} else if (qemuCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) {
+ const char *listenNetwork;
+ const char *listenAddr = NULL;
+ char *netAddr = NULL;
bool escapeAddr;
+ int ret;
+
+ switch (virDomainGraphicsListenGetType(def->graphics[0], 0)) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ listenAddr = virDomainGraphicsListenGetAddress(def->graphics[0], 0);
+ break;
+
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
+ listenNetwork = virDomainGraphicsListenGetNetwork(def->graphics[0],
0);
+ if (!listenNetwork)
+ break;
+ ret = networkGetNetworkAddress(listenNetwork,&netAddr);
+ if (ret<= -2) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("network-based listen not
possible, "
+ "network driver not present"));
+ goto error;
+ }
+ if (ret< 0) {
+ qemuReportError(VIR_ERR_XML_ERROR,
+ _("listen network '%s' had no usable
address"),
+ listenNetwork);
+ goto error;
+ }
+ listenAddr = netAddr;
+ break;
+ }
this looks good.
ACK.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org