[libvirt] [ 0/5] netdev ethernet allow to set ip, route and peer address

Some minor improvements and patch split as suggested by Laine Stump Vasiliy Tolstov (5): virnetdev allow to set peer address libvirt domain xml allow to set peer address lxc domain allow to set peer address bridge network ignore peer address qemu domain allow to set ip address, peer address and route docs/formatdomain.html.in | 12 +++++++++- docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 14 ++++++++++- src/conf/domain_conf.h | 1 + src/lxc/lxc_container.c | 2 +- src/network/bridge_driver.c | 2 +- src/qemu/qemu_interface.c | 39 +++++++++++++++++++++++++++++++ src/util/virnetdev.c | 54 ++++++++++++++++++++++++++++++------------- src/util/virnetdev.h | 1 + 9 files changed, 110 insertions(+), 20 deletions(-) -- 2.7.3

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- src/util/virnetdev.c | 54 ++++++++++++++++++++++++++++++++++++---------------- src/util/virnetdev.h | 1 + 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index aed50f546263..6e32ebbf6cee 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1039,21 +1039,28 @@ virNetDevCreateNetlinkAddressMessage(int messageType, const char *ifname, virSocketAddr *addr, unsigned int prefix, - virSocketAddr *broadcast) + virSocketAddr *broadcast, + virSocketAddr *peer) { struct nl_msg *nlmsg = NULL; struct ifaddrmsg ifa; unsigned int ifindex; void *addrData = NULL; + void *peerData = NULL; void *broadcastData = NULL; size_t addrDataLen; if (virNetDevGetIPAddressBinary(addr, &addrData, &addrDataLen) < 0) return NULL; - if (broadcast && virNetDevGetIPAddressBinary(broadcast, &broadcastData, - &addrDataLen) < 0) - return NULL; + if (peer && VIR_SOCKET_ADDR_VALID(peer)) { + if (virNetDevGetIPAddressBinary(peer, &peerData, &addrDataLen) < 0) + return NULL; + } else if (broadcast) { + if (virNetDevGetIPAddressBinary(broadcast, &broadcastData, + &addrDataLen) < 0) + return NULL; + } /* Get the interface index */ if ((ifindex = if_nametoindex(ifname)) == 0) @@ -1078,12 +1085,15 @@ virNetDevCreateNetlinkAddressMessage(int messageType, if (nla_put(nlmsg, IFA_LOCAL, addrDataLen, addrData) < 0) goto buffer_too_small; - if (nla_put(nlmsg, IFA_ADDRESS, addrDataLen, addrData) < 0) - goto buffer_too_small; + if (peerData) { + if (nla_put(nlmsg, IFA_ADDRESS, addrDataLen, peerData) < 0) + goto buffer_too_small; + } - if (broadcastData && - nla_put(nlmsg, IFA_BROADCAST, addrDataLen, broadcastData) < 0) - goto buffer_too_small; + if (broadcastData) { + if (nla_put(nlmsg, IFA_BROADCAST, addrDataLen, broadcastData) < 0) + goto buffer_too_small; + } return nlmsg; @@ -1098,6 +1108,7 @@ virNetDevCreateNetlinkAddressMessage(int messageType, * virNetDevSetIPAddress: * @ifname: the interface name * @addr: the IP address (IPv4 or IPv6) + * @peer: The IP address of peer (IPv4 or IPv6) * @prefix: number of 1 bits in the netmask * * Add an IP address to an interface. This function *does not* remove @@ -1108,6 +1119,7 @@ virNetDevCreateNetlinkAddressMessage(int messageType, */ int virNetDevSetIPAddress(const char *ifname, virSocketAddr *addr, + virSocketAddr *peer, unsigned int prefix) { virSocketAddr *broadcast = NULL; @@ -1116,9 +1128,8 @@ int virNetDevSetIPAddress(const char *ifname, struct nlmsghdr *resp = NULL; unsigned int recvbuflen; - /* The caller needs to provide a correct address */ - if (VIR_SOCKET_ADDR_FAMILY(addr) == AF_INET) { + if (VIR_SOCKET_ADDR_FAMILY(addr) == AF_INET && !VIR_SOCKET_ADDR_VALID(peer)) { /* compute a broadcast address if this is IPv4 */ if (VIR_ALLOC(broadcast) < 0) return -1; @@ -1129,7 +1140,7 @@ int virNetDevSetIPAddress(const char *ifname, if (!(nlmsg = virNetDevCreateNetlinkAddressMessage(RTM_NEWADDR, ifname, addr, prefix, - broadcast))) + broadcast, peer))) goto cleanup; if (virNetlinkCommand(nlmsg, &resp, &recvbuflen, 0, 0, @@ -1288,7 +1299,7 @@ int virNetDevClearIPAddress(const char *ifname, if (!(nlmsg = virNetDevCreateNetlinkAddressMessage(RTM_DELADDR, ifname, addr, prefix, - NULL))) + NULL, NULL))) goto cleanup; if (virNetlinkCommand(nlmsg, &resp, &recvbuflen, 0, 0, @@ -1423,21 +1434,27 @@ virNetDevWaitDadFinish(virSocketAddrPtr *addrs, size_t count) int virNetDevSetIPAddress(const char *ifname, virSocketAddr *addr, + virSocketAddr *peer, unsigned int prefix) { virCommandPtr cmd = NULL; - char *addrstr = NULL, *bcaststr = NULL; + char *addrstr = NULL, *bcaststr = NULL, *peerstr = NULL; virSocketAddr broadcast; int ret = -1; if (!(addrstr = virSocketAddrFormat(addr))) goto cleanup; + + if (VIR_SOCKET_ADDR_VALID(peer) && !(peerstr = virSocketAddrFormat(&peer))) + goto cleanup; + /* format up a broadcast address if this is IPv4 */ - if ((VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET)) && + if (!peerstr && ((VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET)) && ((virSocketAddrBroadcastByPrefix(addr, prefix, &broadcast) < 0) || - !(bcaststr = virSocketAddrFormat(&broadcast)))) { + !(bcaststr = virSocketAddrFormat(&broadcast))))) { goto cleanup; } + # ifdef IFCONFIG_PATH cmd = virCommandNew(IFCONFIG_PATH); virCommandAddArg(cmd, ifname); @@ -1446,6 +1463,8 @@ int virNetDevSetIPAddress(const char *ifname, else virCommandAddArg(cmd, "inet"); virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix); + if (peerstr) + virCommandAddArgList(cmd, "pointopoint", peerstr, NULL); if (bcaststr) virCommandAddArgList(cmd, "broadcast", bcaststr, NULL); virCommandAddArg(cmd, "alias"); @@ -1453,6 +1472,8 @@ int virNetDevSetIPAddress(const char *ifname, cmd = virCommandNew(IP_PATH); virCommandAddArgList(cmd, "addr", "add", NULL); virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix); + if (peerstr) + virCommandAddArgList(cmd, "peer", peerstr, NULL); if (bcaststr) virCommandAddArgList(cmd, "broadcast", bcaststr, NULL); virCommandAddArgList(cmd, "dev", ifname, NULL); @@ -1465,6 +1486,7 @@ int virNetDevSetIPAddress(const char *ifname, cleanup: VIR_FREE(addrstr); VIR_FREE(bcaststr); + VIR_FREE(peerstr); virCommandFree(cmd); return ret; } diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h index e7719d58a410..240fff774d30 100644 --- a/src/util/virnetdev.h +++ b/src/util/virnetdev.h @@ -90,6 +90,7 @@ int virNetDevGetOnline(const char *ifname, int virNetDevSetIPAddress(const char *ifname, virSocketAddr *addr, + virSocketAddr *peer, unsigned int prefix) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; int virNetDevAddRoute(const char *ifname, -- 2.7.3

On Mon, Apr 04, 2016 at 09:00:02PM +0000, Vasiliy Tolstov wrote:
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- src/util/virnetdev.c | 54 ++++++++++++++++++++++++++++++++++++---------------- src/util/virnetdev.h | 1 + 2 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h index e7719d58a410..240fff774d30 100644 --- a/src/util/virnetdev.h +++ b/src/util/virnetdev.h @@ -90,6 +90,7 @@ int virNetDevGetOnline(const char *ifname,
int virNetDevSetIPAddress(const char *ifname, virSocketAddr *addr, + virSocketAddr *peer, unsigned int prefix) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; int virNetDevAddRoute(const char *ifname,
Since you've added a new parameter to this method, this patch ought to also add 'NULL' to each place in the code which currently uses this API, otherwise the build breaks after applying just this patch. ACK, I'll fix that when pushing. 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 :|

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- docs/formatdomain.html.in | 12 +++++++++++- docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 14 +++++++++++++- src/conf/domain_conf.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 957b839eb745..a6c6b15aa8e4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4758,6 +4758,7 @@ qemu-kvm -net nic,model=? /dev/null <source network='default'/> <target dev='vnet0'/> <b><ip address='192.168.122.5' prefix='24'/></b> + <b><ip address='192.168.122.5' prefix='24' peer='10.0.0.10'/></b> <b><route family='ipv4' address='192.168.122.0' prefix='24' gateway='192.168.122.1'/></b> <b><route family='ipv4' address='192.168.122.8' gateway='192.168.122.1'/></b> </interface> @@ -4790,7 +4791,16 @@ qemu-kvm -net nic,model=? /dev/null to define the network routes to use for the network device. The attributes of this element are described in the documentation for the <code>route</code> element in <a href="formatnetwork.html#elementsStaticroute">network definitions</a>. - This is only used by the LXC driver. + This is used by the LXC driver and <span class="since">Since 1.3.3</span> by the QEMU + driver. + </p> + + <p> + <span class="since">Since 1.3.3</span> ip elements can hold peer attribute to assign + a point-to-point address for the network device. The attributes of this element + are described in the documentation for the <code>ip</code> element in + <a href="formatnetwork.html#elementsAddress">network definitions</a>. + This is only used by the LXC and QEMU drivers. </p> <h5><a name="elementVhostuser">vhost-user interface</a></h5> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 54c149dd5290..fa545261326d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2393,6 +2393,11 @@ <ref name="ipPrefix"/> </attribute> </optional> + <optional> + <attribute name="peer"> + <ref name="ipAddr"/> + </attribute> + </optional> <empty/> </element> </zeroOrMore> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d4c78fdb9fbb..65d2b3eeef3b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5734,7 +5734,7 @@ virDomainNetIpParseXML(xmlNodePtr node) unsigned int prefixValue = 0; char *familyStr = NULL; int family = AF_UNSPEC; - char *address = NULL; + char *address = NULL, *peer = NULL; if (!(prefixStr = virXMLPropString(node, "prefix")) || (virStrToLong_ui(prefixStr, NULL, 10, &prefixValue) < 0)) { @@ -5748,6 +5748,9 @@ virDomainNetIpParseXML(xmlNodePtr node) goto cleanup; } + if ((peer = virXMLPropString(node, "peer")) == NULL) + VIR_DEBUG("Peer is empty"); + familyStr = virXMLPropString(node, "family"); if (familyStr && STREQ(familyStr, "ipv4")) family = AF_INET; @@ -5765,6 +5768,14 @@ virDomainNetIpParseXML(xmlNodePtr node) address); goto cleanup; } + + if ((peer != NULL) && (virSocketAddrParse(&ip->peer, peer, family) < 0)) { + virReportError(VIR_ERR_INVALID_ARG, + _("Failed to parse IP address: '%s'"), + peer); + goto cleanup; + } + ip->prefix = prefixValue; ret = ip; @@ -5774,6 +5785,7 @@ virDomainNetIpParseXML(xmlNodePtr node) VIR_FREE(prefixStr); VIR_FREE(familyStr); VIR_FREE(address); + VIR_FREE(peer); VIR_FREE(ip); return ret; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index fe9faebff6d6..029eee3a5618 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -514,6 +514,7 @@ typedef struct _virDomainNetIpDef virDomainNetIpDef; typedef virDomainNetIpDef *virDomainNetIpDefPtr; struct _virDomainNetIpDef { virSocketAddr address; /* ipv4 or ipv6 address */ + virSocketAddr peer; /* ipv4 or ipv6 address of peer */ unsigned int prefix; /* number of 1 bits in the net mask */ }; -- 2.7.3

On Mon, Apr 04, 2016 at 09:00:03PM +0000, Vasiliy Tolstov wrote:
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- docs/formatdomain.html.in | 12 +++++++++++- docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 14 +++++++++++++- src/conf/domain_conf.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-)
ACK 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 :|

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- src/lxc/lxc_container.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 348bbfbc01fc..a1deb0c00d4c 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -520,7 +520,7 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef, VIR_DEBUG("Adding IP address '%s/%u' to '%s'", ipStr, ip->prefix, newname); - if (virNetDevSetIPAddress(newname, &ip->address, prefix) < 0) { + if (virNetDevSetIPAddress(newname, &ip->address, &ip->peer, prefix) < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, _("Failed to set IP address '%s' on %s"), ipStr, newname); -- 2.7.3

On Mon, Apr 04, 2016 at 09:00:04PM +0000, Vasiliy Tolstov wrote:
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- src/lxc/lxc_container.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 348bbfbc01fc..a1deb0c00d4c 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -520,7 +520,7 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
VIR_DEBUG("Adding IP address '%s/%u' to '%s'", ipStr, ip->prefix, newname); - if (virNetDevSetIPAddress(newname, &ip->address, prefix) < 0) { + if (virNetDevSetIPAddress(newname, &ip->address, &ip->peer, prefix) < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, _("Failed to set IP address '%s' on %s"), ipStr, newname);
ACK 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 :|

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- src/network/bridge_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 0d999914e3a3..73236ffe1cd9 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1971,7 +1971,7 @@ networkAddAddrToBridge(virNetworkObjPtr network, } if (virNetDevSetIPAddress(network->def->bridge, - &ipdef->address, prefix) < 0) + &ipdef->address, NULL, prefix) < 0) return -1; return 0; -- 2.7.3

On Mon, Apr 04, 2016 at 09:00:05PM +0000, Vasiliy Tolstov wrote:
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- src/network/bridge_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 0d999914e3a3..73236ffe1cd9 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1971,7 +1971,7 @@ networkAddAddrToBridge(virNetworkObjPtr network, }
if (virNetDevSetIPAddress(network->def->bridge, - &ipdef->address, prefix) < 0) + &ipdef->address, NULL, prefix) < 0) return -1;
This just gets squashed into the first patch 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 :|

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- src/qemu/qemu_interface.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 13a513152876..5729325fadb9 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -474,6 +474,45 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def, if (virNetDevSetMAC(net->ifname, &tapmac) < 0) goto cleanup; + for (j = 0; j < net->nips; j++) { + virDomainNetIpDefPtr ip = net->ips[j]; + unsigned int prefix = (ip->prefix > 0) ? ip->prefix : + VIR_SOCKET_ADDR_DEFAULT_PREFIX; + char *ipStr = virSocketAddrFormat(&ip->address); + + VIR_DEBUG("Adding IP address '%s/%u' to '%s'", + ipStr, ip->prefix, net->ifname); + + if (virNetDevSetIPAddress(net->ifname, &ip->address, &ip->peer, prefix) < 0) { + virReportError(VIR_ERR_SYSTEM_ERROR, + _("Failed to set IP address '%s' on %s"), + ipStr, net->ifname); + VIR_FREE(ipStr); + goto cleanup; + } + VIR_FREE(ipStr); + } + + if (net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP || + net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT) { + if (virNetDevSetOnline(net->ifname, true) < 0) + goto cleanup; + + /* Set the routes */ + for (j = 0; j < net->nroutes; j++) { + virNetworkRouteDefPtr route = net->routes[j]; + + if (virNetDevAddRoute(net->ifname, + virNetworkRouteDefGetAddress(route), + virNetworkRouteDefGetPrefix(route), + virNetworkRouteDefGetGateway(route), + virNetworkRouteDefGetMetric(route)) < 0) { + goto cleanup; + } + } + } + + if (net->script && qemuExecuteEthernetScript(net->ifname, net->script) < 0) goto cleanup; -- 2.7.3

On Mon, Apr 04, 2016 at 09:00:06PM +0000, Vasiliy Tolstov wrote:
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru> --- src/qemu/qemu_interface.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 13a513152876..5729325fadb9 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -474,6 +474,45 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def, if (virNetDevSetMAC(net->ifname, &tapmac) < 0) goto cleanup;
+ for (j = 0; j < net->nips; j++) { + virDomainNetIpDefPtr ip = net->ips[j]; + unsigned int prefix = (ip->prefix > 0) ? ip->prefix : + VIR_SOCKET_ADDR_DEFAULT_PREFIX; + char *ipStr = virSocketAddrFormat(&ip->address); + + VIR_DEBUG("Adding IP address '%s/%u' to '%s'", + ipStr, ip->prefix, net->ifname); + + if (virNetDevSetIPAddress(net->ifname, &ip->address, &ip->peer, prefix) < 0) { + virReportError(VIR_ERR_SYSTEM_ERROR, + _("Failed to set IP address '%s' on %s"), + ipStr, net->ifname); + VIR_FREE(ipStr); + goto cleanup; + } + VIR_FREE(ipStr); + } + + if (net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP || + net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT) { + if (virNetDevSetOnline(net->ifname, true) < 0) + goto cleanup;
With this call added, we break the unit tests, but that's easy to fix by adding a stub to the qemuxml2argvmock.c file, so I've made that change ACK 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 Mon, Apr 04, 2016 at 09:00:01PM +0000, Vasiliy Tolstov wrote:
Some minor improvements and patch split as suggested by Laine Stump
FYI, make sure you include the word PATCH in mails, so they get picked up by out patch tracking too, otherwise they could get left without being noticed. 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 Thu, Apr 07, 2016 at 06:35:43PM +0100, Daniel P. Berrange wrote:
On Mon, Apr 04, 2016 at 09:00:01PM +0000, Vasiliy Tolstov wrote:
Some minor improvements and patch split as suggested by Laine Stump
FYI, make sure you include the word PATCH in mails, so they get picked up by out patch tracking too, otherwise they could get left without being noticed.
I fixed the few problems with this and pushed it to git. 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 04/07/2016 01:35 PM, Daniel P. Berrange wrote:
Some minor improvements and patch split as suggested by Laine Stump FYI, make sure you include the word PATCH in mails, so they get
On Mon, Apr 04, 2016 at 09:00:01PM +0000, Vasiliy Tolstov wrote: picked up by out patch tracking too, otherwise they could get left without being noticed.
Regards, Daniel
Something I've found myself worrying about lately while driving in the car or nodding off to sleep - are the "address" and "peer" attributes effectively used in the same way for all network connection types and both hypervisors? I think the answer may be "no", and if so we need to fix that before they go out in a release. In particular, when an lxc domain's interface has: <ip address='192.168.128.1'/> That is the IP address seen by the guest, not the host. So I would assume that if an LXC domain had: <ip address='192.168.128.1' peer='192.168.128.2'/> that 192.168.128.1 would still be the IP address see by the guest, and 192.168.128.2 would be the IP address on the host side; and it should be the same for qemu. From what I can see of the code, though, on a qemu domain, the IP address is set for the tap device's own IP, meaning that it would show up on the *host* side, while the peer address would be what the host expects to be at the other end of the tap device (i.e. the guest side), so the two attributes are used for the *opposite* end of the PTP link in lxc vs. qemu. I think that, instead, the "address" attribute should *always* be the IP address that is seen/used by the guest, and the "peer" attribute should be the IP address that is seen/used by the host. (perhaps "peer" could be replaced with some other name, like "host" or "hostAddress" to avoid confusion? (don't like either of those alternatives, but I don't really like peer either)). Aside from that, I can see that these patches have been pushed in the code that I'm running, and I've been trying to add "peer='blah'" to interface IP addresses on my test machine, but it's just removed from the config. Have you tested what got pushed? Has something gone wrong? Since there hasn't been a release with these patches included yet, there is still time to fix it at least to be consistent (assuming that my suspicions are correct; I've been unable to test it myself for the reason above).
participants (3)
-
Daniel P. Berrange
-
Laine Stump
-
Vasiliy Tolstov