[libvirt] [PATCH libvirt master] interface type: add udp socket support

Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type. The interface type required the addition of a "destaddr" (destination address), this then maps into the following xml and qemu call. <interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source address='127.0.0.1' port='11112'/> <model type='virtio'/> <dest address="127.0.0.1' port='22222'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> ... QEMU call: -netdev socket,udp=127.0.0.1:22222,localaddr=127.0.0.1:11112 Notice the xml "source" entry becomes the "localaddr" for the qemu call. reference: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.html Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> --- docs/formatdomain.html.in | 17 ++++++++++++ src/conf/domain_conf.c | 56 +++++++++++++++++++++++++++++++++++++--- src/conf/domain_conf.h | 3 +++ src/conf/netdev_bandwidth_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/lxc/lxc_controller.c | 1 + src/lxc/lxc_process.c | 1 + src/qemu/qemu_command.c | 12 +++++++++ src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_interface.c | 2 ++ src/uml/uml_conf.c | 5 ++++ src/xenconfig/xen_sxpr.c | 1 + tools/virsh-domain.c | 1 + 13 files changed, 99 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c0a265a..95f7f5d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4165,6 +4165,23 @@ </devices> ...</pre> + <h5><a name="elementsNICSUDP">UDP unicast tunnel</a></h5> + + <p> + A UDP unicast architecture provides a virtual network which enables + connections between Qemu instances using Qemu's UDP infrastructure.</p> + +<pre> + ... + <devices> + <interface type='udp'> + <mac address='52:54:00:22:c9:42'/> + <source address='127.0.0.1' port='11115'/> + <dest address='127.0.0.1' port='11116'/> + </interface> + </devices> + ...</pre> + <h5><a name="elementsNICSModel">Setting the NIC model</a></h5> <pre> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e4114f8..11961ea 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -385,7 +385,8 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST, "bridge", "internal", "direct", - "hostdev") + "hostdev", + "udp") VIR_ENUM_IMPL(virDomainNetBackend, VIR_DOMAIN_NET_BACKEND_TYPE_LAST, "default", @@ -1629,7 +1630,9 @@ void virDomainNetDefFree(virDomainNetDefPtr def) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: VIR_FREE(def->data.socket.address); + VIR_FREE(def->data.socket.destaddr); break; case VIR_DOMAIN_NET_TYPE_NETWORK: @@ -8398,6 +8401,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, char *script = NULL; char *address = NULL; char *port = NULL; + char *destaddr = NULL; + char *destport = NULL; char *model = NULL; char *backend = NULL; char *txmode = NULL; @@ -8510,10 +8515,15 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } else if (!address && (def->type == VIR_DOMAIN_NET_TYPE_SERVER || def->type == VIR_DOMAIN_NET_TYPE_CLIENT || - def->type == VIR_DOMAIN_NET_TYPE_MCAST) && + def->type == VIR_DOMAIN_NET_TYPE_MCAST || + def->type == VIR_DOMAIN_NET_TYPE_UDP) && xmlStrEqual(cur->name, BAD_CAST "source")) { address = virXMLPropString(cur, "address"); port = virXMLPropString(cur, "port"); + } else if (!destaddr && def->type == VIR_DOMAIN_NET_TYPE_UDP && + xmlStrEqual(cur->name, BAD_CAST "dest")) { + destaddr = virXMLPropString(cur, "address"); + destport = virXMLPropString(cur, "port"); } else if (xmlStrEqual(cur->name, BAD_CAST "ip")) { virDomainNetIpDefPtr ip = NULL; @@ -8751,6 +8761,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: if (port == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("No <source> 'port' attribute " @@ -8766,7 +8777,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, if (address == NULL) { if (def->type == VIR_DOMAIN_NET_TYPE_CLIENT || - def->type == VIR_DOMAIN_NET_TYPE_MCAST) { + def->type == VIR_DOMAIN_NET_TYPE_MCAST || + def->type == VIR_DOMAIN_NET_TYPE_UDP) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("No <source> 'address' attribute " "specified with socket interface")); @@ -8776,6 +8788,32 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, def->data.socket.address = address; address = NULL; } + + if (def->type != VIR_DOMAIN_NET_TYPE_UDP) + break; + + if (destport == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <dest> 'port' attribute " + "specified with socket interface")); + goto error; + } + if (virStrToLong_i(destport, NULL, 10, &def->data.socket.destport) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <dest> 'port' attribute " + "with socket interface")); + goto error; + } + + if (destport == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <dest> 'address' attribute " + "specified with socket interface")); + goto error; + } else { + def->data.socket.destaddr = destaddr; + address = NULL; + } break; case VIR_DOMAIN_NET_TYPE_INTERNAL: @@ -19732,6 +19770,7 @@ virDomainNetDefFormat(virBufferPtr buf, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: if (def->data.socket.address) { virBufferAsprintf(buf, "<source address='%s' port='%d'/>\n", def->data.socket.address, def->data.socket.port); @@ -19739,6 +19778,17 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAsprintf(buf, "<source port='%d'/>\n", def->data.socket.port); } + + if (def->type != VIR_DOMAIN_NET_TYPE_UDP) + break; + + if (def->data.socket.destaddr) { + virBufferAsprintf(buf, "<dest address='%s' port='%d'/>\n", + def->data.socket.destaddr, def->data.socket.destport); + } else { + virBufferAsprintf(buf, "<dest port='%d'/>\n", + def->data.socket.destport); + } break; case VIR_DOMAIN_NET_TYPE_INTERNAL: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 698a4d2..e96fece 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -889,6 +889,7 @@ typedef enum { VIR_DOMAIN_NET_TYPE_INTERNAL, VIR_DOMAIN_NET_TYPE_DIRECT, VIR_DOMAIN_NET_TYPE_HOSTDEV, + VIR_DOMAIN_NET_TYPE_UDP, VIR_DOMAIN_NET_TYPE_LAST } virDomainNetType; @@ -991,6 +992,8 @@ struct _virDomainNetDef { struct { char *address; int port; + char *destaddr; + int destport; } socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */ struct { char *name; diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h index 6cbf4ae..cdeac09 100644 --- a/src/conf/netdev_bandwidth_conf.h +++ b/src/conf/netdev_bandwidth_conf.h @@ -53,6 +53,7 @@ static inline bool virNetDevSupportBandwidth(virDomainNetType type) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index e845759..a76ad5a 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1177,6 +1177,7 @@ libxlMakeNic(virDomainDefPtr def, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 110a556..03d6311 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -382,6 +382,7 @@ static int virLXCControllerGetNICIndexes(virLXCControllerPtr ctrl) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index e99b039..04fbb0a 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -429,6 +429,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_LAST: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index eb00f0f..2dac923 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5354,6 +5354,17 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, type_sep = ','; break; + case VIR_DOMAIN_NET_TYPE_UDP: + virBufferAsprintf(&buf, "socket%cudp=%s:%d%clocaladdr=%s:%d", + type_sep, + net->data.socket.destaddr, + net->data.socket.destport, + type_sep, + net->data.socket.address, + net->data.socket.port); + type_sep = ','; + break; + case VIR_DOMAIN_NET_TYPE_USER: default: virBufferAddLit(&buf, "user"); @@ -8416,6 +8427,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1ea397f..e6c20e9 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2394,6 +2394,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: if (STRNEQ_NULLABLE(olddev->data.socket.address, newdev->data.socket.address) || olddev->data.socket.port != newdev->data.socket.port) { diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 01226ac..4d55e4d 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -100,6 +100,7 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: @@ -187,6 +188,7 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 90deb2a..afc0375 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -195,6 +195,11 @@ umlBuildCommandLineNet(virConnectPtr conn, _("TCP client networking type not supported")); goto error; + case VIR_DOMAIN_NET_TYPE_UDP: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("UDP networking type not supported")); + goto error; + case VIR_DOMAIN_NET_TYPE_MCAST: /* ethNNN=tuntap,macaddr,ipaddr,port */ virBufferAddLit(&buf, "mcast"); diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index 05e938a..1d43ec1 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -1962,6 +1962,7 @@ xenFormatSxprNet(virConnectPtr conn, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 4988ba2..fc23ee1 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -993,6 +993,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: -- 1.9.1

On 08/07/2015 06:14 PM, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "destaddr" (destination address), this then maps into the following xml and qemu call.
<interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source address='127.0.0.1' port='11112'/> <model type='virtio'/> <dest address="127.0.0.1' port='22222'/>
I think I don't like the "dest" element. Historically, <source> has been used to describe the resources used in the real world to backup the emulated device, or maybe "the real world source of the data that's going into the emulated device". What you're doing is kind of redefining it to be "the local end of real world resources". Aside from that, for mcast, client, and server interface types, <source address....> is where the remote address for the socket is set. I'd say that to make it fit in better with the existing types, the remote address should be in <source address='blah'>, and the local address should be a subelement of that, something like: <source address='remoteaddr' port='remoteport'> <local address='localaddr' port='localport'/> </source> That makes source address exactly fit the same purpose as source address for the existing mcast, server, and client interface types. (It may seem a little odd until you start thinking of "source" as "the thing farthest away from the virtual machine"). (I haven't had any time to look at the rest of the patch yet, as I'm just back from vacation and chasing a nasty bug, but wanted to get this thought out there sooner rather than later)

On 8/10/15 1:28 AM, Laine Stump wrote:
On 08/07/2015 06:14 PM, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "destaddr" (destination address), this then maps into the following xml and qemu call.
<interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source address='127.0.0.1' port='11112'/> <model type='virtio'/> <dest address="127.0.0.1' port='22222'/>
I think I don't like the "dest" element. Historically, <source> has been used to describe the resources used in the real world to backup the emulated device, or maybe "the real world source of the data that's going into the emulated device". What you're doing is kind of redefining it to be "the local end of real world resources". Aside from that, for mcast, client, and server interface types, <source address....> is where the remote address for the socket is set.
I'd say that to make it fit in better with the existing types, the remote address should be in <source address='blah'>, and the local address should be a subelement of that, something like:
<source address='remoteaddr' port='remoteport'> <local address='localaddr' port='localport'/> </source>
That makes source address exactly fit the same purpose as source address for the existing mcast, server, and client interface types. (It may seem a little odd until you start thinking of "source" as "the thing farthest away from the virtual machine").
I am not partial to "dest", would be happy to change the tag to something that makes more sense. Would need to think about (or be given some pointers to) how one would process a nested entry like this. Am sure it is "simple" but didn't really look much into it and followed what the surrounding code had done. From a, I need to generate this by hand or edit it by hand, it would make sense to me to keep the nesting in the <interface> entry as simple as possible, it seems right now it is only one tag level deep (limited knowledge though). On the other hand nesting it like this would make writing a DTD/XSD easier, not sure if libvirt does this for its xml configurations. Thanks for the comments so far.

On 8/10/15 1:28 AM, Laine Stump wrote: >> On 08/07/2015 06:14 PM, Jonathan Toppins wrote: >>> Adds a new interface type using UDP sockets, this seems only >>> applicable to QEMU but have edited tree-wide to support the new >>> interface type. >>> >>> The interface type required the addition of a "destaddr" >>> (destination address), this then maps into the following xml and >>> qemu call. >>> >>> <interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source >>> address='127.0.0.1'
I am not partial to "dest", would be happy to change the tag to > something that makes more sense. > > Would need to think about (or be given some pointers to) how one > would process a nested entry like
On 08/11/2015 12:45 PM, Jonathan Toppins wrote: port='11112'/> <model type='virtio'/> <dest >>> address="127.0.0.1' port='22222'/> >> >> I think I don't like the "dest" element. Historically, <source> has >> been used to describe the resources used in the real world to >> backup the emulated device, or maybe "the real world source of the >> data that's going into the emulated device". What you're doing is >> kind of redefining it to be "the local end of real world >> resources". Aside from that, for mcast, client, and server >> interface types, <source address....> is where the remote address >> for the socket is set. >> >> I'd say that to make it fit in better with the existing types, the >> remote address should be in <source address='blah'>, and the local >> address should be a subelement of that, something like: >> >> <source address='remoteaddr' port='remoteport'> <local >> address='localaddr' port='localport'/> </source> >> >> That makes source address exactly fit the same purpose as source >> address for the existing mcast, server, and client interface types. >> (It may seem a little odd until you start thinking of "source" as >> "the thing farthest away from the virtual machine"). > this. Am sure it is "simple" but > didn't really look much into it and followed what the surrounding > code had done. Look at examples of the function virXPathString(). You can grab nested things with the virXPath* functions quite easily. For example: virXPathString("string(./source/@address)", ctxt) gets the address in <source>, and virXPathString("string(./source/local/@address)", ctxt) ges the address in <source ...> <local>.
From a, I need to generate this by hand or edit it by hand, it would > make sense to me to keep the nesting in the <interface> entry as > simple as possible, it seems right now it is only one tag level deep > (limited knowledge though).
The most important things are 1) don't paint ourselves into a corner where we will need to add something later but the grammar has no reasonable place for us to expand, and 2) remain as consistent as possible with the existing elements/attributes. Nesting things in subelements doesn't usually cause problems in practice; for example, look at how <vlan> is done - for a single vlan tag we could have made it much simpler, not nested, but then when we added vlan trunks, etc, it would have been either very ugly or impossible.
On the other hand nesting it like this > would make writing a DTD/XSD easier, not sure if libvirt does this > for its xml configurations. Ah, this points out that you didn't update the grammar file: docs/schemas/domaincommon.rng. Anything allowed in the XML needs to be described in the RNG files.
(and, as Jan pointed out, you will also need to add test cases in tests/qemuxml2argvdata and tests/qemuxml2xmldata, and plug them into tests/qemuxml2argvtest and tests/qemuxml2xmltest.)
Thanks for the comments so far. >
and thanks for putting up with them :-)

Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type. The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call. <interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source address='127.0.0.1' port='11112' > <local address='127.0.0.1' port='22222'/> </source> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> ... QEMU call: -net socket,udp=127.0.0.1:11112,localaddr=127.0.0.1:22222 Notice the xml "local" entry becomes the "localaddr" for the qemu call. reference: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.html Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> --- since v1: I expect there will be one more round, thanks for the comments thus far. Wanted to go a head and send this out since it has been a little to long to get to this point. Some final issues I am seeing: * there seems to be some trouble with adding a new UDP type interface to a running VM. Stanley who is CC'ed and helping me test has more details. * unittests pass even though qemuxml2argvtest still fails, this appears to be due to disk-drive-network-gluster failing - analysis looks to be the URI is incorrect, not enough slashes - cuz more is better ;) * please verify I have added the schema correctly, was kinda confusing Code Comments: [Laine Stump] * [DONE] change to using "local" as a nested element inside the "source" element * [DONE] enhance schema to validate the new formatting of the source and local elements [Ján Tomko] * [DONE] implement unit tests in tests/qemuxml2argvtest.c and tests/qemuxml2xmltest.c * [DONE] increase verbosity and note when the feature was added in formatdomain.html.in docs/formatdomain.html.in | 24 ++++++++ docs/schemas/domaincommon.rng | 27 +++++++++ src/conf/domain_conf.c | 74 ++++++++++++++++++++++-- src/conf/domain_conf.h | 3 + src/conf/netdev_bandwidth_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/lxc/lxc_controller.c | 1 + src/lxc/lxc_process.c | 1 + src/qemu/qemu_command.c | 12 ++++ src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_interface.c | 2 + src/uml/uml_conf.c | 5 ++ src/xenconfig/xen_sxpr.c | 1 + tests/qemuxml2argvdata/qemuxml2argv-net-udp.args | 6 ++ tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml | 34 +++++++++++ tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmltest.c | 1 + tools/virsh-domain.c | 1 + 18 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-udp.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 5ca8ede..d307d4d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4260,6 +4260,30 @@ </devices> ...</pre> + <h5><a name="elementsNICSUDP">UDP unicast tunnel</a></h5> + + <p> + A UDP unicast architecture provides a virtual network which enables + connections between Qemu instances using Qemu's UDP infrastructure. + + The xml "source" address is the endpoint address to which the UDP socket + packets will be sent from the host running QEMU. + The xml "local" address is the address of the interface from which the + UDP socket packets will originate from the qemu host. + <span class="since">Since 1.2.19</span></p> + +<pre> + ... + <devices> + <interface type='udp'> + <mac address='52:54:00:22:c9:42'/> + <source address='127.0.0.1' port='11115'> + <local address='127.0.0.1' port='11116'/> + </source> + </interface> + </devices> + ...</pre> + <h5><a name="elementsNICSModel">Setting the NIC model</a></h5> <pre> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ccc74cc..f196177 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2181,6 +2181,33 @@ </group> <group> <attribute name="type"> + <choice> + <value>udp</value> + </choice> + </attribute> + <interleave> + <element name="source"> + <attribute name="address"> + <ref name="ipv4Addr"/> + </attribute> + <attribute name="port"> + <ref name="PortNumber"/> + </attribute> + <element name="local"> + <attribute name="address"> + <ref name="ipv4Addr"/> + </attribute> + <attribute name="port"> + <ref name="PortNumber"/> + </attribute> + <empty/> + </element> + </element> + <ref name="interface-options"/> + </interleave> + </group> + <group> + <attribute name="type"> <value>server</value> </attribute> <interleave> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c5e9653..70e8b39 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -397,7 +397,8 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST, "bridge", "internal", "direct", - "hostdev") + "hostdev", + "udp") VIR_ENUM_IMPL(virDomainNetBackend, VIR_DOMAIN_NET_BACKEND_TYPE_LAST, "default", @@ -1645,7 +1646,9 @@ void virDomainNetDefFree(virDomainNetDefPtr def) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: VIR_FREE(def->data.socket.address); + VIR_FREE(def->data.socket.localaddr); break; case VIR_DOMAIN_NET_TYPE_NETWORK: @@ -8589,6 +8592,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, char *script = NULL; char *address = NULL; char *port = NULL; + char *localaddr = NULL; + char *localport = NULL; char *model = NULL; char *backend = NULL; char *txmode = NULL; @@ -8701,10 +8706,18 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } else if (!address && (def->type == VIR_DOMAIN_NET_TYPE_SERVER || def->type == VIR_DOMAIN_NET_TYPE_CLIENT || - def->type == VIR_DOMAIN_NET_TYPE_MCAST) && + def->type == VIR_DOMAIN_NET_TYPE_MCAST || + def->type == VIR_DOMAIN_NET_TYPE_UDP) && xmlStrEqual(cur->name, BAD_CAST "source")) { address = virXMLPropString(cur, "address"); port = virXMLPropString(cur, "port"); + if (!localaddr && def->type == VIR_DOMAIN_NET_TYPE_UDP) { + xmlNodePtr tmpnode = ctxt->node; + ctxt->node = cur; + localaddr = virXPathString("string(./local/@address)", ctxt); + localport = virXPathString("string(./local/@port)", ctxt); + ctxt->node = tmpnode; + } } else if (xmlStrEqual(cur->name, BAD_CAST "ip")) { virDomainNetIpDefPtr ip = NULL; @@ -8942,6 +8955,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: if (port == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("No <source> 'port' attribute " @@ -8957,7 +8971,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, if (address == NULL) { if (def->type == VIR_DOMAIN_NET_TYPE_CLIENT || - def->type == VIR_DOMAIN_NET_TYPE_MCAST) { + def->type == VIR_DOMAIN_NET_TYPE_MCAST || + def->type == VIR_DOMAIN_NET_TYPE_UDP) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("No <source> 'address' attribute " "specified with socket interface")); @@ -8967,6 +8982,32 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, def->data.socket.address = address; address = NULL; } + + if (def->type != VIR_DOMAIN_NET_TYPE_UDP) + break; + + if (localport == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <local> 'port' attribute " + "specified with socket interface")); + goto error; + } + if (virStrToLong_i(localport, NULL, 10, &def->data.socket.localport) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <local> 'port' attribute " + "with socket interface")); + goto error; + } + + if (localaddr == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <local> 'address' attribute " + "specified with socket interface")); + goto error; + } else { + def->data.socket.localaddr = localaddr; + localaddr = NULL; + } break; case VIR_DOMAIN_NET_TYPE_INTERNAL: @@ -19959,13 +20000,34 @@ virDomainNetDefFormat(virBufferPtr buf, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: if (def->data.socket.address) { - virBufferAsprintf(buf, "<source address='%s' port='%d'/>\n", - def->data.socket.address, def->data.socket.port); + virBufferAsprintf(buf, "<source address='%s' port='%d'", + def->data.socket.address, + def->data.socket.port); } else { - virBufferAsprintf(buf, "<source port='%d'/>\n", + virBufferAsprintf(buf, "<source port='%d'", def->data.socket.port); } + + if (def->type != VIR_DOMAIN_NET_TYPE_UDP) { + virBufferAddLit(buf, "/>\n"); + break; + } + + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); + + if (def->data.socket.localaddr) { + virBufferAsprintf(buf, "<local address='%s' port='%d'/>\n", + def->data.socket.localaddr, + def->data.socket.localport); + } else { + virBufferAsprintf(buf, "<local port='%d'/>", + def->data.socket.localport); + } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "</source>\n"); break; case VIR_DOMAIN_NET_TYPE_INTERNAL: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 961e4ed..f043554 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -923,6 +923,7 @@ typedef enum { VIR_DOMAIN_NET_TYPE_INTERNAL, VIR_DOMAIN_NET_TYPE_DIRECT, VIR_DOMAIN_NET_TYPE_HOSTDEV, + VIR_DOMAIN_NET_TYPE_UDP, VIR_DOMAIN_NET_TYPE_LAST } virDomainNetType; @@ -1025,6 +1026,8 @@ struct _virDomainNetDef { struct { char *address; int port; + char *localaddr; + int localport; } socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */ struct { char *name; diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h index 6cbf4ae..cdeac09 100644 --- a/src/conf/netdev_bandwidth_conf.h +++ b/src/conf/netdev_bandwidth_conf.h @@ -53,6 +53,7 @@ static inline bool virNetDevSupportBandwidth(virDomainNetType type) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index e845759..a76ad5a 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1177,6 +1177,7 @@ libxlMakeNic(virDomainDefPtr def, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index d36bc9b..0e6a3e1 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -385,6 +385,7 @@ static int virLXCControllerGetNICIndexes(virLXCControllerPtr ctrl) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index ade0ed7..57e3880 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -566,6 +566,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_LAST: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index abc57d7..1210fb2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5594,6 +5594,17 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, type_sep = ','; break; + case VIR_DOMAIN_NET_TYPE_UDP: + virBufferAsprintf(&buf, "socket%cudp=%s:%d%clocaladdr=%s:%d", + type_sep, + net->data.socket.address, + net->data.socket.port, + type_sep, + net->data.socket.localaddr, + net->data.socket.localport); + type_sep = ','; + break; + case VIR_DOMAIN_NET_TYPE_USER: default: virBufferAddLit(&buf, "user"); @@ -8667,6 +8678,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e71a204..ac683ad 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2402,6 +2402,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: if (STRNEQ_NULLABLE(olddev->data.socket.address, newdev->data.socket.address) || olddev->data.socket.port != newdev->data.socket.port) { diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 01226ac..4d55e4d 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -100,6 +100,7 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: @@ -187,6 +188,7 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 90deb2a..afc0375 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -195,6 +195,11 @@ umlBuildCommandLineNet(virConnectPtr conn, _("TCP client networking type not supported")); goto error; + case VIR_DOMAIN_NET_TYPE_UDP: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("UDP networking type not supported")); + goto error; + case VIR_DOMAIN_NET_TYPE_MCAST: /* ethNNN=tuntap,macaddr,ipaddr,port */ virBufferAddLit(&buf, "mcast"); diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index 05e938a..1d43ec1 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -1962,6 +1962,7 @@ xenFormatSxprNet(virConnectPtr conn, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-udp.args b/tests/qemuxml2argvdata/qemuxml2argv-net-udp.args new file mode 100644 index 0000000..f8d48a8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-udp.args @@ -0,0 +1,6 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M \ +pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 -net nic,\ +macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139 -net socket,udp=192.168.10.1:5555,localaddr=192.168.10.1:5556,\ +vlan=0 -serial none -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml new file mode 100644 index 0000000..c19107d --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <controller type='usb' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <interface type='udp'> + <mac address='52:54:00:8c:b9:05'/> + <source address='192.168.10.1' port='5555'> + <local address='192.168.10.1' port='5556'/> + </source> + <model type='rtl8139'/> + </interface> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c2482e6..d4432df 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1029,6 +1029,7 @@ mymain(void) DO_TEST("net-client", NONE); DO_TEST("net-server", NONE); DO_TEST("net-mcast", NONE); + DO_TEST("net-udp", NONE); DO_TEST("net-hostdev", QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); DO_TEST("net-hostdev-multidomain", diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5c1c2e9..d41954e 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -628,6 +628,7 @@ mymain(void) DO_TEST("memory-hotplug"); DO_TEST("memory-hotplug-nonuma"); DO_TEST("memory-hotplug-dimm"); + DO_TEST("net-udp"); virObjectUnref(driver.caps); virObjectUnref(driver.xmlopt); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8d2700f..b029b65 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1005,6 +1005,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: -- 2.1.4

From my testing, the v2 patch works. I can create a new interface with the udp tunnel interface in a fresh domain configuration, or use virsh attach-device to add a new udp tunnel interface to an existing domain config.

Hi, On Sat, Aug 29, 2015 at 04:19:10PM -0400, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call.
<interface type='udp'>
Sine we do have <interface type='mcast'> already wouldn't it be better to have something like <interface type='ucast' protocol='udp'> Cheers, -- Guido

On 08/31/2015 03:25 PM, Guido Günther wrote:
Hi, On Sat, Aug 29, 2015 at 04:19:10PM -0400, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call.
<interface type='udp'>
Sine we do have
<interface type='mcast'>
already wouldn't it be better to have something like
<interface type='ucast' protocol='udp'>
This possibly could be better, my concern would be now tcp is configured differently than udp, no? Or are you saying something like: <interface type='ucast' protocol='udp|tcp'> My concern here is this would be a bigger change and does libvirt have a stable xml configuration guarantee? Thanks, -Jon

Hi, On Mon, Aug 31, 2015 at 04:06:18PM -0400, Jonathan Toppins wrote:
On 08/31/2015 03:25 PM, Guido Günther wrote:
Hi, On Sat, Aug 29, 2015 at 04:19:10PM -0400, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call.
<interface type='udp'>
Sine we do have
<interface type='mcast'>
already wouldn't it be better to have something like
<interface type='ucast' protocol='udp'>
This possibly could be better, my concern would be now tcp is configured differently than udp, no? Or are you saying something like:
tcp client/server is configured with <interface type='server'> atm which fits as well. That said I don't have a strong opinion on that one.
<interface type='ucast' protocol='udp|tcp'>
My concern here is this would be a bigger change and does libvirt have a stable xml configuration guarantee?
XML of older lbvirt must be parseable by newer ones, yes. Cheers, -- Guido

On 08/31/2015 04:06 PM, Jonathan Toppins wrote:
On 08/31/2015 03:25 PM, Guido Günther wrote:
Hi, On Sat, Aug 29, 2015 at 04:19:10PM -0400, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call.
<interface type='udp'>
Sine we do have
<interface type='mcast'>
already wouldn't it be better to have something like
<interface type='ucast' protocol='udp'>
This possibly could be better, my concern would be now tcp is configured differently than udp, no? Or are you saying something like:
<interface type='ucast' protocol='udp|tcp'>
I think the case of a tcp connection is already handled by <interface type='client'> and <interface type='server'> together, so that doesn't seem likely to happen. I suppose it's possible someone would come up with an sctp-based transport in the future though. I'm undecided about this.
My concern here is this would be a bigger change and does libvirt have a stable xml configuration guarantee?
libvirt's guarantee of 100% backward-compatible stable API (both functions and XML) is one of the big reasons why we worry over this kind of detail so much :-) (so yeah, once it goes in, we will continue to accept it forever even if we later wish we had done it a different way)

On Tue, Sep 01, 2015 at 02:11:05PM -0400, Laine Stump wrote:
On 08/31/2015 04:06 PM, Jonathan Toppins wrote:
On 08/31/2015 03:25 PM, Guido Günther wrote:
Hi, On Sat, Aug 29, 2015 at 04:19:10PM -0400, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call.
<interface type='udp'>
Sine we do have
<interface type='mcast'>
already wouldn't it be better to have something like
<interface type='ucast' protocol='udp'>
This possibly could be better, my concern would be now tcp is configured differently than udp, no? Or are you saying something like:
<interface type='ucast' protocol='udp|tcp'>
I think the case of a tcp connection is already handled by <interface type='client'> and <interface type='server'> together, so that doesn't seem likely to happen. I suppose it's possible someone would come up with an sctp-based transport in the future though. I'm undecided about this.
Yeah, given what we've done for TCP already, I don't really see any point in trying to invent a more generic type=ucast + protocol=udp|tcp. We might as well just stick with a simple type=udp Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 09/01/2015 02:11 PM, Laine Stump wrote:
On 08/31/2015 04:06 PM, Jonathan Toppins wrote:
On 08/31/2015 03:25 PM, Guido Günther wrote:
Hi, On Sat, Aug 29, 2015 at 04:19:10PM -0400, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call.
<interface type='udp'>
Sine we do have
<interface type='mcast'>
already wouldn't it be better to have something like
<interface type='ucast' protocol='udp'>
This possibly could be better, my concern would be now tcp is configured differently than udp, no? Or are you saying something like:
<interface type='ucast' protocol='udp|tcp'>
I think the case of a tcp connection is already handled by <interface type='client'> and <interface type='server'> together, so that doesn't seem likely to happen. I suppose it's possible someone would come up with an sctp-based transport in the future though. I'm undecided about this.
I am willing to work with Guido if you have some time to put into it. Otherwise the current implementation <interface type="foo"> models are pretty much 1:1 representations of what is in the C code and this looks pretty extensible to me. Have not seen any (or very few) copy-and-paste sections of code so it seems to be holding up currently. I will not try and speak for supporting the xml configuration long term, would appreciate some other perspectives. Lacking this I leave it up to the maintainer(s) to determine if this is worthy to go in. I see v1.2.19-rc2 has been put out there so a possible compromise (policy even?) is for this to go into v1.2.20-devel so people can play around with it. I assume implementations can be changed/reverted between releases v1.2.19 to v1.2.20. Completely understand the concern about supporting an interface for ever :) Regards, -Jon

Hi, On Tue, Sep 01, 2015 at 02:31:41PM -0400, Jonathan Toppins wrote:
I am willing to work with Guido if you have some time to put into it. Otherwise the current implementation <interface type="foo"> models are pretty much 1:1 representations of what is in the C code and this looks pretty extensible to me. Have not seen any (or very few) copy-and-paste sections of code so it seems to be holding up currently. I will not try and speak for supporting the xml configuration long term, would appreciate some other perspectives. Lacking this I leave it up to the maintainer(s) to determine if this is worthy to go in. I see v1.2.19-rc2 has been put out there so a possible compromise (policy even?) is for this to go into v1.2.20-devel so people can play around with it. I assume implementations can be changed/reverted between releases v1.2.19 to v1.2.20. Completely understand the concern about supporting an interface for ever :)
From what I read in the thread going with "udp" is fine so let's stick to that if nobody has concerns. Cheers, -- Guido

On Sat, Aug 29, 2015 at 04:19:10PM -0400, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call.
<interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source address='127.0.0.1' port='11112' > <local address='127.0.0.1' port='22222'/> </source> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> ...
QEMU call: -net socket,udp=127.0.0.1:11112,localaddr=127.0.0.1:22222
Notice the xml "local" entry becomes the "localaddr" for the qemu call.
reference: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.html
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> ---
since v1: I expect there will be one more round, thanks for the comments thus far. Wanted to go a head and send this out since it has been a little to long to get to this point. Some final issues I am seeing: * there seems to be some trouble with adding a new UDP type interface to a running VM. Stanley who is CC'ed and helping me test has more details. * unittests pass even though qemuxml2argvtest still fails, this appears to be due to disk-drive-network-gluster failing - analysis looks to be the URI is incorrect, not enough slashes - cuz more is better ;)
Works fine for me, what is your libxml version? This could be related to http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=8f17d0e commit 8f17d0eaae7ee2fa3e214b79b188fc14ed5aa1eb util: Prepare URI formatting for libxml2 >= 2.9.2
* please verify I have added the schema correctly, was kinda confusing
Code Comments: [Laine Stump] * [DONE] change to using "local" as a nested element inside the "source" element * [DONE] enhance schema to validate the new formatting of the source and local elements [Ján Tomko] * [DONE] implement unit tests in tests/qemuxml2argvtest.c and tests/qemuxml2xmltest.c * [DONE] increase verbosity and note when the feature was added in formatdomain.html.in
docs/formatdomain.html.in | 24 ++++++++ docs/schemas/domaincommon.rng | 27 +++++++++ src/conf/domain_conf.c | 74 ++++++++++++++++++++++-- src/conf/domain_conf.h | 3 + src/conf/netdev_bandwidth_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/lxc/lxc_controller.c | 1 + src/lxc/lxc_process.c | 1 + src/qemu/qemu_command.c | 12 ++++ src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_interface.c | 2 + src/uml/uml_conf.c | 5 ++ src/xenconfig/xen_sxpr.c | 1 + tests/qemuxml2argvdata/qemuxml2argv-net-udp.args | 6 ++ tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml | 34 +++++++++++ tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmltest.c | 1 + tools/virsh-domain.c | 1 + 18 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-udp.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml
ACK I have fixed the nits mentioned below and pushed the patch. Jan
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 5ca8ede..d307d4d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4260,6 +4260,30 @@ </devices> ...</pre>
+ <h5><a name="elementsNICSUDP">UDP unicast tunnel</a></h5> + + <p> + A UDP unicast architecture provides a virtual network which enables + connections between Qemu instances using Qemu's UDP infrastructure. + + The xml "source" address is the endpoint address to which the UDP socket + packets will be sent from the host running QEMU. + The xml "local" address is the address of the interface from which the + UDP socket packets will originate from the qemu host. + <span class="since">Since 1.2.19</span></p>
That will be 1.2.20 now. I also unified all the spellings of QEMU in the paragraph.
+ +<pre> + ... + <devices> + <interface type='udp'> + <mac address='52:54:00:22:c9:42'/> + <source address='127.0.0.1' port='11115'> + <local address='127.0.0.1' port='11116'/> + </source> + </interface> + </devices> + ...</pre> + <h5><a name="elementsNICSModel">Setting the NIC model</a></h5>
<pre>
@@ -8701,10 +8706,18 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } else if (!address && (def->type == VIR_DOMAIN_NET_TYPE_SERVER || def->type == VIR_DOMAIN_NET_TYPE_CLIENT || - def->type == VIR_DOMAIN_NET_TYPE_MCAST) && + def->type == VIR_DOMAIN_NET_TYPE_MCAST || + def->type == VIR_DOMAIN_NET_TYPE_UDP) && xmlStrEqual(cur->name, BAD_CAST "source")) { address = virXMLPropString(cur, "address"); port = virXMLPropString(cur, "port"); + if (!localaddr && def->type == VIR_DOMAIN_NET_TYPE_UDP) { + xmlNodePtr tmpnode = ctxt->node; + ctxt->node = cur; + localaddr = virXPathString("string(./local/@address)", ctxt); + localport = virXPathString("string(./local/@port)", ctxt);
virXPathString strdups the string, they need to be VIR_FREE'd in the cleanup section.
+ ctxt->node = tmpnode; + } } else if (xmlStrEqual(cur->name, BAD_CAST "ip")) { virDomainNetIpDefPtr ip = NULL;
@@ -19959,13 +20000,34 @@ virDomainNetDefFormat(virBufferPtr buf, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_UDP: if (def->data.socket.address) { - virBufferAsprintf(buf, "<source address='%s' port='%d'/>\n", - def->data.socket.address, def->data.socket.port); + virBufferAsprintf(buf, "<source address='%s' port='%d'", + def->data.socket.address, + def->data.socket.port); } else { - virBufferAsprintf(buf, "<source port='%d'/>\n", + virBufferAsprintf(buf, "<source port='%d'", def->data.socket.port); } + + if (def->type != VIR_DOMAIN_NET_TYPE_UDP) { + virBufferAddLit(buf, "/>\n"); + break; + } + + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); + + if (def->data.socket.localaddr) {
We don't allow parsing a UDP interface without an address, this condition can be eliminated.
+ virBufferAsprintf(buf, "<local address='%s' port='%d'/>\n", + def->data.socket.localaddr, + def->data.socket.localport); + } else { + virBufferAsprintf(buf, "<local port='%d'/>", + def->data.socket.localport); + } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "</source>\n"); break;
case VIR_DOMAIN_NET_TYPE_INTERNAL:
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index abc57d7..1210fb2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5594,6 +5594,17 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, type_sep = ','; break;
+ case VIR_DOMAIN_NET_TYPE_UDP: + virBufferAsprintf(&buf, "socket%cudp=%s:%d%clocaladdr=%s:%d", + type_sep, + net->data.socket.address, + net->data.socket.port, + type_sep,
type_sep is only used for the first separator, the second one should be a comma. But practically, type_sep will always be a comma - it is only set to ' ' when hotplugging a device with qemu old enough not to support -netdev.
+ net->data.socket.localaddr, + net->data.socket.localport); + type_sep = ','; + break; + case VIR_DOMAIN_NET_TYPE_USER: default: virBufferAddLit(&buf, "user");

On Wed, Sep 02, 2015 at 10:23:56AM +0200, Ján Tomko wrote: [..snip..]
Works fine for me, what is your libxml version? This could be related to http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=8f17d0e
commit 8f17d0eaae7ee2fa3e214b79b188fc14ed5aa1eb util: Prepare URI formatting for libxml2 >= 2.9.2
We do have exactly this in Debian atm: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=781232 Didn't get around to look into it yet. -- Guido

On 09/02/2015 04:23 AM, Ján Tomko wrote:
On Sat, Aug 29, 2015 at 04:19:10PM -0400, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call.
<interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source address='127.0.0.1' port='11112' > <local address='127.0.0.1' port='22222'/> </source> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> ...
QEMU call: -net socket,udp=127.0.0.1:11112,localaddr=127.0.0.1:22222
Notice the xml "local" entry becomes the "localaddr" for the qemu call.
reference: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.html
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> ---
since v1: I expect there will be one more round, thanks for the comments thus far. Wanted to go a head and send this out since it has been a little to long to get to this point. Some final issues I am seeing: * there seems to be some trouble with adding a new UDP type interface to a running VM. Stanley who is CC'ed and helping me test has more details. * unittests pass even though qemuxml2argvtest still fails, this appears to be due to disk-drive-network-gluster failing - analysis looks to be the URI is incorrect, not enough slashes - cuz more is better ;)
Works fine for me, what is your libxml version? This could be related to http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=8f17d0e
commit 8f17d0eaae7ee2fa3e214b79b188fc14ed5aa1eb util: Prepare URI formatting for libxml2 >= 2.9.2
jtoppins@penguin:~$ apt-cache policy libxml2 libxml2: Installed: 2.9.1+dfsg1-5 Candidate: 2.9.1+dfsg1-5 Version table: *** 2.9.1+dfsg1-5 0 500 http://ftp.us.debian.org/debian/ jessie/main amd64 Packages 100 /var/lib/dpkg/status jtoppins@penguin:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.1 (jessie) Release: 8.1 Codename: jessie So looks like its related to the commit listed.
* please verify I have added the schema correctly, was kinda confusing
Code Comments: [Laine Stump] * [DONE] change to using "local" as a nested element inside the "source" element * [DONE] enhance schema to validate the new formatting of the source and local elements [Ján Tomko] * [DONE] implement unit tests in tests/qemuxml2argvtest.c and tests/qemuxml2xmltest.c * [DONE] increase verbosity and note when the feature was added in formatdomain.html.in
docs/formatdomain.html.in | 24 ++++++++ docs/schemas/domaincommon.rng | 27 +++++++++ src/conf/domain_conf.c | 74 ++++++++++++++++++++++-- src/conf/domain_conf.h | 3 + src/conf/netdev_bandwidth_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/lxc/lxc_controller.c | 1 + src/lxc/lxc_process.c | 1 + src/qemu/qemu_command.c | 12 ++++ src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_interface.c | 2 + src/uml/uml_conf.c | 5 ++ src/xenconfig/xen_sxpr.c | 1 + tests/qemuxml2argvdata/qemuxml2argv-net-udp.args | 6 ++ tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml | 34 +++++++++++ tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmltest.c | 1 + tools/virsh-domain.c | 1 + 18 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-udp.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-udp.xml
ACK
I have fixed the nits mentioned below and pushed the patch.
Thanks Ján. Sorry it was still a little messy.

On Fri, Sep 04, 2015 at 03:06:15PM -0400, Jonathan Toppins wrote: [..snip..]
Works fine for me, what is your libxml version? This could be related to http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=8f17d0e
commit 8f17d0eaae7ee2fa3e214b79b188fc14ed5aa1eb util: Prepare URI formatting for libxml2 >= 2.9.2
jtoppins@penguin:~$ apt-cache policy libxml2 libxml2: Installed: 2.9.1+dfsg1-5 Candidate: 2.9.1+dfsg1-5 Version table: *** 2.9.1+dfsg1-5 0 500 http://ftp.us.debian.org/debian/ jessie/main amd64 Packages 100 /var/lib/dpkg/status jtoppins@penguin:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.1 (jessie) Release: 8.1 Codename: jessie
So looks like its related to the commit listed.
Due to a revert in sid of libxml2 to the old versions all libxml2 in Jessie/Testing/Sid are affected. I dug out the fix here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=781232#100 Cheers, -- Guido

On Fri, Aug 07, 2015 at 03:14:36PM -0700, Jonathan Toppins wrote:
Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type.
The interface type required the addition of a "destaddr" (destination address), this then maps into the following xml and qemu call.
<interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source address='127.0.0.1' port='11112'/> <model type='virtio'/> <dest address="127.0.0.1' port='22222'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> ...
QEMU call: -netdev socket,udp=127.0.0.1:22222,localaddr=127.0.0.1:11112
Notice the xml "source" entry becomes the "localaddr" for the qemu call.
reference: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.html
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> --- docs/formatdomain.html.in | 17 ++++++++++++ src/conf/domain_conf.c | 56 +++++++++++++++++++++++++++++++++++++--- src/conf/domain_conf.h | 3 +++ src/conf/netdev_bandwidth_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/lxc/lxc_controller.c | 1 + src/lxc/lxc_process.c | 1 + src/qemu/qemu_command.c | 12 +++++++++ src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_interface.c | 2 ++ src/uml/uml_conf.c | 5 ++++ src/xenconfig/xen_sxpr.c | 1 + tools/virsh-domain.c | 1 + 13 files changed, 99 insertions(+), 3 deletions(-)
Missing test cases for tests/qemuxml2argvtest.c and tests/qemuxml2xmltest.c.
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c0a265a..95f7f5d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4165,6 +4165,23 @@ </devices> ...</pre>
+ <h5><a name="elementsNICSUDP">UDP unicast tunnel</a></h5> + + <p> + A UDP unicast architecture provides a virtual network which enables + connections between Qemu instances using Qemu's UDP infrastructure.</p> +
It would be nice to document what the addresses mean, and mention that this is supported <span class="since">Since 1.2.19</span>. Jan

On 8/10/15 11:06 AM, Ján Tomko wrote:
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> --- docs/formatdomain.html.in | 17 ++++++++++++ src/conf/domain_conf.c | 56 +++++++++++++++++++++++++++++++++++++--- src/conf/domain_conf.h | 3 +++ src/conf/netdev_bandwidth_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/lxc/lxc_controller.c | 1 + src/lxc/lxc_process.c | 1 + src/qemu/qemu_command.c | 12 +++++++++ src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_interface.c | 2 ++ src/uml/uml_conf.c | 5 ++++ src/xenconfig/xen_sxpr.c | 1 + tools/virsh-domain.c | 1 + 13 files changed, 99 insertions(+), 3 deletions(-)
Missing test cases for tests/qemuxml2argvtest.c and tests/qemuxml2xmltest.c.
Didn't know about the unit test area, would be happy to add some unit tests. Is there some text document describing how one runs these tests and needs to set things up or should I just read a good example?
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c0a265a..95f7f5d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4165,6 +4165,23 @@ </devices> ...</pre>
+ <h5><a name="elementsNICSUDP">UDP unicast tunnel</a></h5> + + <p> + A UDP unicast architecture provides a virtual network which enables + connections between Qemu instances using Qemu's UDP infrastructure.</p> +
It would be nice to document what the addresses mean, and mention that this is supported <span class="since">Since 1.2.19</span>.
ack, do I need to add it after the description paragraph (<p></p>)?

On Tue, Aug 11, 2015 at 12:30:03PM -0400, Jonathan Toppins wrote:
On 8/10/15 11:06 AM, Ján Tomko wrote:
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> --- docs/formatdomain.html.in | 17 ++++++++++++ src/conf/domain_conf.c | 56 +++++++++++++++++++++++++++++++++++++--- src/conf/domain_conf.h | 3 +++ src/conf/netdev_bandwidth_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/lxc/lxc_controller.c | 1 + src/lxc/lxc_process.c | 1 + src/qemu/qemu_command.c | 12 +++++++++ src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_interface.c | 2 ++ src/uml/uml_conf.c | 5 ++++ src/xenconfig/xen_sxpr.c | 1 + tools/virsh-domain.c | 1 + 13 files changed, 99 insertions(+), 3 deletions(-)
Missing test cases for tests/qemuxml2argvtest.c and tests/qemuxml2xmltest.c.
Didn't know about the unit test area, would be happy to add some unit tests. Is there some text document describing how one runs these tests and needs to set things up or should I just read a good example?
Running 'make check' and 'make syntax-check' should run most of them with no setup needed. (There are some tests that will be skipped if utilities like cppi or pdwtags are not found on the system) For an example, just take a look at some of the commits changing qemuxml2argvtest.c. The XML files in qemuxml2argvdata are automatically validated against the schema in docs/schemas/domain.rng by domainschematest. They are also used by both qemuxml2xmltest and qemuxml2argvtest as the source XML. (these tests need to be added to the C files by hand). The .args files are used by qemuxml2argvtest to check if the generated QEMU command line does not change.
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c0a265a..95f7f5d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4165,6 +4165,23 @@ </devices> ...</pre>
+ <h5><a name="elementsNICSUDP">UDP unicast tunnel</a></h5> + + <p> + A UDP unicast architecture provides a virtual network which enables + connections between Qemu instances using Qemu's UDP infrastructure.</p> +
It would be nice to document what the addresses mean, and mention that this is supported <span class="since">Since 1.2.19</span>.
ack, do I need to add it after the description paragraph (<p></p>)?
Before the end of the paragraph. Jan

On 8/12/15 12:29 PM, Ján Tomko wrote:
On Tue, Aug 11, 2015 at 12:30:03PM -0400, Jonathan Toppins wrote:
On 8/10/15 11:06 AM, Ján Tomko wrote:
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> --- docs/formatdomain.html.in | 17 ++++++++++++ src/conf/domain_conf.c | 56 +++++++++++++++++++++++++++++++++++++--- src/conf/domain_conf.h | 3 +++ src/conf/netdev_bandwidth_conf.h | 1 + src/libxl/libxl_conf.c | 1 + src/lxc/lxc_controller.c | 1 + src/lxc/lxc_process.c | 1 + src/qemu/qemu_command.c | 12 +++++++++ src/qemu/qemu_hotplug.c | 1 + src/qemu/qemu_interface.c | 2 ++ src/uml/uml_conf.c | 5 ++++ src/xenconfig/xen_sxpr.c | 1 + tools/virsh-domain.c | 1 + 13 files changed, 99 insertions(+), 3 deletions(-)
Missing test cases for tests/qemuxml2argvtest.c and tests/qemuxml2xmltest.c.
Didn't know about the unit test area, would be happy to add some unit tests. Is there some text document describing how one runs these tests and needs to set things up or should I just read a good example?
Running 'make check' and 'make syntax-check' should run most of them with no setup needed.
(There are some tests that will be skipped if utilities like cppi or pdwtags are not found on the system)
For an example, just take a look at some of the commits changing qemuxml2argvtest.c.
The XML files in qemuxml2argvdata are automatically validated against the schema in docs/schemas/domain.rng by domainschematest. They are also used by both qemuxml2xmltest and qemuxml2argvtest as the source XML. (these tests need to be added to the C files by hand).
The .args files are used by qemuxml2argvtest to check if the generated QEMU command line does not change.
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c0a265a..95f7f5d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4165,6 +4165,23 @@ </devices> ...</pre>
+ <h5><a name="elementsNICSUDP">UDP unicast tunnel</a></h5> + + <p> + A UDP unicast architecture provides a virtual network which enables + connections between Qemu instances using Qemu's UDP infrastructure.</p> +
It would be nice to document what the addresses mean, and mention that this is supported <span class="since">Since 1.2.19</span>.
ack, do I need to add it after the description paragraph (<p></p>)?
Before the end of the paragraph.
Thanks for the info, traveling today. Hope to get to this over the weekend. -Jon
participants (6)
-
Daniel P. Berrange
-
Guido Günther
-
Jonathan Toppins
-
Ján Tomko
-
Laine Stump
-
Stanley Karunditu