[libvirt] [PATCH 0/6] Revert: 'IP peer address and host-side address config support'

This series was accidentally pushed in the feature freeze. Revert the last six commits adding the new functionality. The rest are either bugfixes or preparation for the bugfixes. Ján Tomko (6): Revert "qemu: support setting host-side IP addresses/routes" Revert "lxc: support setting host-side IP addresses/routes" Revert "util: support setting peer for virNetDevIPInfo addresses" Revert "conf: support host-side IP/route information in <interface>" Revert "conf: allow setting peer address in <ip> element of <interface>" Revert "util: new function virNetDevIPInfoAddToDev" docs/formatdomain.html.in | 60 +++-------- docs/schemas/domaincommon.rng | 8 +- src/conf/domain_conf.c | 117 ++++----------------- src/conf/domain_conf.h | 3 +- src/libvirt_private.syms | 1 - src/lxc/lxc_container.c | 47 +++++++-- src/lxc/lxc_process.c | 8 -- src/qemu/qemu_interface.c | 6 +- src/util/virnetdevip.c | 60 ----------- src/util/virnetdevip.h | 7 +- tests/lxcxml2xmldata/lxc-ethernet-hostip.xml | 44 -------- tests/lxcxml2xmltest.c | 1 - .../qemuxml2argv-net-eth-hostip.args | 23 ---- .../qemuxml2argv-net-eth-hostip.xml | 39 ------- tests/qemuxml2argvtest.c | 1 - .../qemuxml2xmlout-net-eth-hostip.xml | 44 -------- tests/qemuxml2xmltest.c | 1 - 17 files changed, 75 insertions(+), 395 deletions(-) delete mode 100644 tests/lxcxml2xmldata/lxc-ethernet-hostip.xml delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.args delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.xml delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-hostip.xml -- 2.7.3

This reverts commit 0b4645a7e061abc8a4be71fe89865cf248ce6e56. This feature was accidentally pushed in the feature freeze. --- src/qemu/qemu_interface.c | 6 +-- .../qemuxml2argv-net-eth-hostip.args | 23 ----------- .../qemuxml2argv-net-eth-hostip.xml | 39 ------------------- tests/qemuxml2argvtest.c | 1 - .../qemuxml2xmlout-net-eth-hostip.xml | 44 ---------------------- tests/qemuxml2xmltest.c | 1 - 6 files changed, 1 insertion(+), 113 deletions(-) delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.args delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.xml delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-hostip.xml diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index e637d21..b48ae50 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -196,12 +196,8 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net) break; } - case VIR_DOMAIN_NET_TYPE_ETHERNET: - if (virNetDevIPInfoAddToDev(net->ifname, &net->hostIP) < 0) - goto cleanup; - break; - case VIR_DOMAIN_NET_TYPE_USER: + case VIR_DOMAIN_NET_TYPE_ETHERNET: case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.args b/tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.args deleted file mode 100644 index b96c933..0000000 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.args +++ /dev/null @@ -1,23 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/home/test \ -USER=test \ -LOGNAME=test \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu \ --name QEMUGuest1 \ --S \ --M pc \ --m 214 \ --smp 1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --nographic \ --nodefaults \ --monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ --no-acpi \ --boot c \ --usb \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ --device rtl8139,vlan=0,id=net0,mac=00:11:22:33:44:55,bus=pci.0,addr=0x3 \ --net tap,fd=3,vlan=0,name=hostnet0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.xml deleted file mode 100644 index 6d08e82..0000000 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.xml +++ /dev/null @@ -1,39 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219100</memory> - <currentMemory unit='KiB'>219100</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'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> - <controller type='pci' index='0' model='pci-root'/> - <interface type='ethernet'> - <mac address='00:11:22:33:44:55'/> - <source> - <ip address='192.168.125.1' family='ipv4' prefix='24' peer='192.168.125.2'/> - <route family='ipv4' address='10.20.0.0' prefix='16' gateway='192.168.125.2'/> - </source> - <script path='/etc/qemu-ifup'/> - <model type='rtl8139'/> - </interface> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index bc0d805..a4b8bf4 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1012,7 +1012,6 @@ mymain(void) DO_TEST("net-eth", NONE); DO_TEST("net-eth-ifname", NONE); DO_TEST("net-eth-names", NONE); - DO_TEST("net-eth-hostip", NONE); DO_TEST("net-client", NONE); DO_TEST("net-server", NONE); DO_TEST("net-mcast", NONE); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-hostip.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-hostip.xml deleted file mode 100644 index 856b35b..0000000 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-hostip.xml +++ /dev/null @@ -1,44 +0,0 @@ -<domain type='qemu'> - <name>QEMUGuest1</name> - <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> - <memory unit='KiB'>219100</memory> - <currentMemory unit='KiB'>219100</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'> - <driver name='qemu' type='raw'/> - <source dev='/dev/HostVG/QEMUGuest1'/> - <target dev='hda' bus='ide'/> - <address type='drive' controller='0' bus='0' target='0' unit='0'/> - </disk> - <controller type='usb' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> - </controller> - <controller type='ide' index='0'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> - </controller> - <controller type='pci' index='0' model='pci-root'/> - <interface type='ethernet'> - <mac address='00:11:22:33:44:55'/> - <source> - <ip address='192.168.125.1' family='ipv4' prefix='24' peer='192.168.125.2'/> - <route family='ipv4' address='10.20.0.0' prefix='16' gateway='192.168.125.2'/> - </source> - <script path='/etc/qemu-ifup'/> - <model type='rtl8139'/> - <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> - </interface> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <memballoon model='none'/> - </devices> -</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 29a29c5..7db9cb7 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -464,7 +464,6 @@ mymain(void) DO_TEST("net-virtio-disable-offloads"); DO_TEST("net-eth"); DO_TEST("net-eth-ifname"); - DO_TEST("net-eth-hostip"); DO_TEST("net-virtio-network-portgroup"); DO_TEST("net-hostdev"); DO_TEST("net-hostdev-vfio"); -- 2.7.3

This reverts commit cd5c9f21ded4f8e6216eba02b8795f70503ab404. This feature was accidentally pushed in the feature freeze. --- src/lxc/lxc_process.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 28313f0..07eb22a 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -304,14 +304,6 @@ virLXCProcessSetupInterfaceTap(virDomainDefPtr vm, if (virNetDevSetOnline(parentVeth, true) < 0) goto cleanup; - if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_ETHERNET) { - /* Set IP info for the host side, but only if the type is - * 'ethernet'. - */ - if (virNetDevIPInfoAddToDev(parentVeth, &net->hostIP) < 0) - goto cleanup; - } - if (net->filter && virDomainConfNWFilterInstantiate(vm->uuid, net) < 0) goto cleanup; -- 2.7.3

This reverts commit cb20f989df393ec97ba65afb06089d0ab87af484. This feature was accidentally pushed in the feature freeze. --- src/util/virnetdevip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index f8b04e4..cae566a 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -919,7 +919,7 @@ virNetDevIPInfoAddToDev(const char *ifname, ipStr); goto cleanup; } - if (virNetDevIPAddrAdd(ifname, &ip->address, &ip->peer, prefix) < 0) + if (virNetDevIPAddrAdd(ifname, &ip->address, NULL, prefix) < 0) goto cleanup; VIR_FREE(ipStr); } -- 2.7.3

This reverts commit fe6a77898a38f491403a70cc49925a584101daee. This feature was accidentally pushed in the feature freeze. --- docs/formatdomain.html.in | 26 ------- docs/schemas/domaincommon.rng | 3 +- src/conf/domain_conf.c | 101 ++++++--------------------- src/conf/domain_conf.h | 3 +- tests/lxcxml2xmldata/lxc-ethernet-hostip.xml | 44 ------------ tests/lxcxml2xmltest.c | 1 - 6 files changed, 23 insertions(+), 155 deletions(-) delete mode 100644 tests/lxcxml2xmldata/lxc-ethernet-hostip.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index bb1c079..2466df7 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5012,32 +5012,6 @@ qemu-kvm -net nic,model=? /dev/null definitions</a>. This is used by the LXC driver. </p> -<pre> - ... - <devices> - <interface type='ethernet'> - <b><source/></b> - <b><ip address='192.168.123.1' prefix='24'/></b> - <b><ip address='10.0.0.10' prefix='24' peer='192.168.122.5'/></b> - <b><route family='ipv4' address='192.168.42.0' prefix='24' gateway='192.168.123.4'/></b> - <b><source/></b> - ... - </interface> - ... - </devices> - ... -</pre> - - <p> - <span class="since">Since 2.0.0</span> network devices of type - "ethernet" can optionally be provided one or more IP addresses - and one or more routes to set on the <b>host</b> side of the - network device. These are configured as subelements of - the <code><source></code> element of the interface, and - have the same attributes as the similarly named elements used to - configure the guest side of the interface (described above). - </p> - <h5><a name="elementVhostuser">vhost-user interface</a></h5> <p> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 964ff92..2d12da9 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2142,7 +2142,7 @@ <interleave> <optional> <element name="source"> - <ref name="interface-ip-info"/> + <empty/> </element> </optional> <ref name="interface-options"/> @@ -2392,6 +2392,7 @@ <attribute name="dev"> <ref name="deviceName"/> </attribute> + <empty/> </element> </optional> <optional> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 90d2eaa..3a81f7e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1798,7 +1798,6 @@ virDomainNetDefClear(virDomainNetDefPtr def) VIR_FREE(def->ifname_guest_actual); virNetDevIPInfoClear(&def->guestIP); - virNetDevIPInfoClear(&def->hostIP); virDomainDeviceInfoClear(&def->info); VIR_FREE(def->filter); @@ -4609,23 +4608,6 @@ virDomainRedirdevDefValidate(const virDomainDef *def, static int -virDomainNetDefValidate(const virDomainNetDef *net) -{ - if ((net->hostIP.nroutes || net->hostIP.nips) && - net->type != VIR_DOMAIN_NET_TYPE_ETHERNET) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Invalid attempt to set network interface " - "host-side IP route and/or address info on " - "interface of type '%s'. This is only supported " - "on interfaces of type 'ethernet'"), - virDomainNetTypeToString(net->type)); - return -1; - } - return 0; -} - - -static int virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev, const virDomainDef *def) { @@ -4636,11 +4618,9 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev, case VIR_DOMAIN_DEVICE_REDIRDEV: return virDomainRedirdevDefValidate(def, dev->data.redirdev); - case VIR_DOMAIN_DEVICE_NET: - return virDomainNetDefValidate(dev->data.net); - case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: + case VIR_DOMAIN_DEVICE_NET: case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: @@ -9009,15 +8989,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, cur = node->children; while (cur != NULL) { if (cur->type == XML_ELEMENT_NODE) { - if (xmlStrEqual(cur->name, BAD_CAST "source")) { - xmlNodePtr tmpnode = ctxt->node; - - ctxt->node = cur; - if (virDomainNetIPInfoParseXML(_("interface host IP"), - ctxt, &def->hostIP) < 0) - goto error; - ctxt->node = tmpnode; - } if (!macaddr && xmlStrEqual(cur->name, BAD_CAST "mac")) { macaddr = virXMLPropString(cur, "address"); } else if (!network && @@ -20721,7 +20692,6 @@ virDomainNetDefFormat(virBufferPtr buf, { unsigned int actualType = virDomainNetGetActualType(def); bool publicActual = false; - int sourceLines = 0; const char *typeStr; virDomainHostdevDefPtr hostdef = NULL; char macstr[VIR_MAC_STRING_BUFLEN]; @@ -20791,7 +20761,15 @@ virDomainNetDefFormat(virBufferPtr buf, def->data.network.name); virBufferEscapeString(buf, " portgroup='%s'", def->data.network.portgroup); - sourceLines++; + virBufferAddLit(buf, "/>\n"); + + /* ONLY for internal status storage - format the ActualNetDef + * as a subelement of <interface> so that no persistent config + * data is overwritten. + */ + if ((flags & VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET) && + (virDomainActualNetDefFormat(buf, def, flags) < 0)) + return -1; break; case VIR_DOMAIN_NET_TYPE_ETHERNET: @@ -20805,16 +20783,13 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAsprintf(buf, " mode='%s'", def->data.vhostuser->data.nix.listen ? "server" : "client"); - sourceLines++; + virBufferAddLit(buf, "/>\n"); } break; case VIR_DOMAIN_NET_TYPE_BRIDGE: - if (def->data.bridge.brname) { - virBufferEscapeString(buf, "<source bridge='%s'", - def->data.bridge.brname); - sourceLines++; - } + virBufferEscapeString(buf, "<source bridge='%s'/>\n", + def->data.bridge.brname); break; case VIR_DOMAIN_NET_TYPE_SERVER: @@ -20829,27 +20804,25 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAsprintf(buf, "<source port='%d'", def->data.socket.port); } - sourceLines++; - if (def->type != VIR_DOMAIN_NET_TYPE_UDP) + if (def->type != VIR_DOMAIN_NET_TYPE_UDP) { + virBufferAddLit(buf, "/>\n"); break; + } virBufferAddLit(buf, ">\n"); - sourceLines++; virBufferAdjustIndent(buf, 2); virBufferAsprintf(buf, "<local address='%s' port='%d'/>\n", def->data.socket.localaddr, def->data.socket.localport); virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "</source>\n"); break; case VIR_DOMAIN_NET_TYPE_INTERNAL: - if (def->data.internal.name) { - virBufferEscapeString(buf, "<source name='%s'", - def->data.internal.name); - sourceLines++; - } + virBufferEscapeString(buf, "<source name='%s'/>\n", + def->data.internal.name); break; case VIR_DOMAIN_NET_TYPE_DIRECT: @@ -20857,7 +20830,7 @@ virDomainNetDefFormat(virBufferPtr buf, def->data.direct.linkdev); virBufferAsprintf(buf, " mode='%s'", virNetDevMacVLanModeTypeToString(def->data.direct.mode)); - sourceLines++; + virBufferAddLit(buf, "/>\n"); break; case VIR_DOMAIN_NET_TYPE_HOSTDEV: @@ -20872,44 +20845,12 @@ virDomainNetDefFormat(virBufferPtr buf, break; } - /* if sourceLines == 0 - no <source> info at all so far - * sourceLines == 1 - first line written, no terminating ">" - * sourceLines > 1 - multiple lines, including subelements - */ - if (def->hostIP.nips || def->hostIP.nroutes) { - if (sourceLines == 0) { - virBufferAddLit(buf, "<source>\n"); - sourceLines += 2; - } else if (sourceLines == 1) { - virBufferAddLit(buf, ">\n"); - sourceLines++; - } - virBufferAdjustIndent(buf, 2); - if (virDomainNetIPInfoFormat(buf, &def->hostIP) < 0) - return -1; - virBufferAdjustIndent(buf, -2); - } - if (sourceLines == 1) - virBufferAddLit(buf, "/>\n"); - else if (sourceLines > 1) - virBufferAddLit(buf, "</source>\n"); - if (virNetDevVlanFormat(&def->vlan, buf) < 0) return -1; if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) return -1; if (virNetDevBandwidthFormat(def->bandwidth, buf) < 0) return -1; - - /* ONLY for internal status storage - format the ActualNetDef - * as a subelement of <interface> so that no persistent config - * data is overwritten. - */ - if (def->type == VIR_DOMAIN_NET_TYPE_NETWORK && - (flags & VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET) && - (virDomainActualNetDefFormat(buf, def, flags) < 0)) - return -1; - } if (virDomainNetIPInfoFormat(buf, &def->guestIP) < 0) @@ -20918,7 +20859,6 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferEscapeString(buf, "<script path='%s'/>\n", def->script); virBufferEscapeString(buf, "<backenddomain name='%s'/>\n", def->domain_name); - if (def->ifname && !((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && (STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX) || @@ -20926,7 +20866,6 @@ virDomainNetDefFormat(virBufferPtr buf, /* Skip auto-generated target names for inactive config. */ virBufferEscapeString(buf, "<target dev='%s'/>\n", def->ifname); } - if (def->ifname_guest || def->ifname_guest_actual) { virBufferAddLit(buf, "<guest"); /* Skip auto-generated target names for inactive config. */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5df4758..7c5cbd9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -963,8 +963,7 @@ struct _virDomainNetDef { } tune; char *script; char *domain_name; /* backend domain name */ - char *ifname; /* interface name on the host (<target dev='x'/>) */ - virNetDevIPInfo hostIP; + char *ifname; char *ifname_guest_actual; char *ifname_guest; virNetDevIPInfo guestIP; diff --git a/tests/lxcxml2xmldata/lxc-ethernet-hostip.xml b/tests/lxcxml2xmldata/lxc-ethernet-hostip.xml deleted file mode 100644 index ce455f7..0000000 --- a/tests/lxcxml2xmldata/lxc-ethernet-hostip.xml +++ /dev/null @@ -1,44 +0,0 @@ -<domain type='lxc'> - <name>8675309</name> - <uuid>e21987a5-e98e-9c99-0e35-803e4d9ad1fe</uuid> - <memory unit='KiB'>1048576</memory> - <currentMemory unit='KiB'>1048576</currentMemory> - <vcpu placement='static'>1</vcpu> - <resource> - <partition>/machine</partition> - </resource> - <os> - <type arch='x86_64'>exe</type> - <init>/sbin/init</init> - </os> - <idmap> - <uid start='0' target='100000' count='100000'/> - <gid start='0' target='100000' count='100000'/> - </idmap> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>restart</on_crash> - <devices> - <emulator>/usr/libexec/libvirt_lxc</emulator> - <filesystem type='mount' accessmode='passthrough'> - <source dir='/mach/8675309'/> - <target dir='/'/> - </filesystem> - <interface type='ethernet'> - <mac address='00:16:3e:0f:ef:8a'/> - <source> - <ip address='192.168.122.12' family='ipv4' prefix='24' peer='192.168.122.1'/> - <ip address='192.168.122.13' family='ipv4' prefix='24'/> - <route family='ipv4' address='0.0.0.0' gateway='192.168.122.1'/> - <route family='ipv4' address='192.168.124.0' prefix='24' gateway='192.168.124.1'/> - </source> - <ip address='192.168.122.1' family='ipv4' prefix='32' peer='192.168.122.12'/> - <guest dev='eth2'/> - </interface> - <console type='pty'> - <target type='lxc' port='0'/> - </console> - </devices> - <seclabel type='none'/> -</domain> diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c index 2f7f779..1b16088 100644 --- a/tests/lxcxml2xmltest.c +++ b/tests/lxcxml2xmltest.c @@ -95,7 +95,6 @@ mymain(void) DO_TEST("capabilities"); DO_TEST("sharenet"); DO_TEST("ethernet"); - DO_TEST("ethernet-hostip"); DO_TEST_FULL("filesystem-root", 0, false, VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS); -- 2.7.3

This reverts commit 93135abf1454d8a1c8542e8c951ed615305ffa24. This feature was accidentally pushed in the feature freeze. --- docs/formatdomain.html.in | 40 +++++++++++++++------------------------- docs/schemas/domaincommon.rng | 5 ----- src/conf/domain_conf.c | 16 +--------------- src/util/virnetdevip.h | 5 ++--- 4 files changed, 18 insertions(+), 48 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 2466df7..f660aa6 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4967,7 +4967,6 @@ 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> @@ -4986,30 +4985,21 @@ qemu-kvm -net nic,model=? /dev/null </pre> <p> - <span class="since">Since 1.2.12</span> network devices and - hostdev devices with network capabilities can optionally be provided - one or more IP addresses to set on the network device in the - guest. Note that some hypervisors or network device types will - simply ignore them or only use the first one. - The <code>family</code> attribute can be set to - either <code>ipv4</code> or <code>ipv6</code>, and the - <code>address</code> attribute contains the IP address. The - optional <code>prefix</code> is the number of 1 bits in the - netmask, and will be automatically set if not specified - for - IPv4 the default prefix is determined according to the network - "class" (A, B, or C - see RFC870), and for IPv6 the default - prefix is 64. The optional <code>peer</code> attribute holds the - IP address of the other end of a point-to-point network - device <span class="since">(since 2.0.0)</span>. - </p> - - <p> - <span class="since">Since 1.2.12</span> route elements can also be - added to define IP routes to add in the guest. 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 used by the LXC driver. + <span class="since">Since 1.2.12</span> the network devices and host devices + with network capabilities can be provided zero or more IP addresses to set + on the target device. Note that some hypervisors or network device types + will simply ignore them or only use the first one. The <code>family</code> + attribute can be set to either <code>ipv4</code> or <code>ipv6</code>, the + <code>address</code> attribute holds the IP address. The <code>prefix</code> + is not mandatory since some hypervisors do not handle it. + </p> + + <p> + <span class="since">Since 1.2.12</span> route elements can also be added + 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. </p> <h5><a name="elementVhostuser">vhost-user interface</a></h5> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 2d12da9..563cb3c 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2629,11 +2629,6 @@ <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 3a81f7e..ef266af 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6121,7 +6121,7 @@ virDomainNetIPParseXML(xmlNodePtr node) unsigned int prefixValue = 0; char *familyStr = NULL; int family = AF_UNSPEC; - char *address = NULL, *peer = NULL; + char *address = NULL; if (!(address = virXMLPropString(node, "address"))) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -6159,13 +6159,6 @@ virDomainNetIPParseXML(xmlNodePtr node) } ip->prefix = prefixValue; - if ((peer = virXMLPropString(node, "peer")) != NULL && - virSocketAddrParse(&ip->peer, peer, family) < 0) { - virReportError(VIR_ERR_INVALID_ARG, - _("Invalid peer '%s' in <ip>"), peer); - goto cleanup; - } - ret = ip; ip = NULL; @@ -6173,7 +6166,6 @@ virDomainNetIPParseXML(xmlNodePtr node) VIR_FREE(prefixStr); VIR_FREE(familyStr); VIR_FREE(address); - VIR_FREE(peer); VIR_FREE(ip); return ret; } @@ -20272,12 +20264,6 @@ virDomainNetIPInfoFormat(virBufferPtr buf, virBufferAsprintf(buf, " family='%s'", familyStr); if (def->ips[i]->prefix) virBufferAsprintf(buf, " prefix='%u'", def->ips[i]->prefix); - if (VIR_SOCKET_ADDR_VALID(&def->ips[i]->peer)) { - if (!(ipStr = virSocketAddrFormat(&def->ips[i]->peer))) - return -1; - virBufferAsprintf(buf, " peer='%s'", ipStr); - VIR_FREE(ipStr); - } virBufferAddLit(buf, "/>\n"); } diff --git a/src/util/virnetdevip.h b/src/util/virnetdevip.h index 8277654..86fb77e 100644 --- a/src/util/virnetdevip.h +++ b/src/util/virnetdevip.h @@ -26,9 +26,8 @@ # include "virsocketaddr.h" typedef struct { - virSocketAddr address; /* ipv4 or ipv6 address */ - virSocketAddr peer; /* ipv4 or ipv6 address of peer */ - unsigned int prefix; /* number of 1 bits in the netmask */ + virSocketAddr address; /* ipv4 or ipv6 address */ + unsigned int prefix; /* number of 1 bits in the net mask */ } virNetDevIPAddr, *virNetDevIPAddrPtr; typedef struct { -- 2.7.3

This reverts commit f1e0d0da11c473905470c28a6488bf57d9d0ae6e. This feature was accidentally pushed in the feature freeze. --- src/libvirt_private.syms | 1 - src/lxc/lxc_container.c | 47 ++++++++++++++++++++++++++++--------- src/util/virnetdevip.c | 60 ------------------------------------------------ src/util/virnetdevip.h | 2 -- 4 files changed, 36 insertions(+), 74 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8579cfd..4617f5d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1931,7 +1931,6 @@ virNetDevBridgeSetVlanFiltering; virNetDevIPAddrAdd; virNetDevIPAddrDel; virNetDevIPAddrGet; -virNetDevIPInfoAddToDev; virNetDevIPInfoClear; virNetDevIPRouteAdd; virNetDevIPRouteFree; diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 916a37b..0d5f16c 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -490,7 +490,7 @@ lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef, char **veths) { int ret = -1; - size_t i; + size_t i, j; const char *newname; virDomainNetDefPtr netDef; bool privNet = vmDef->features[VIR_DOMAIN_FEATURE_PRIVNET] == @@ -509,28 +509,53 @@ lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef, VIR_DEBUG("Renaming %s to %s", veths[i], newname); if (virNetDevSetName(veths[i], newname) < 0) - goto cleanup; + goto cleanup; + + for (j = 0; j < netDef->guestIP.nips; j++) { + virNetDevIPAddrPtr ip = netDef->guestIP.ips[j]; + int prefix; + char *ipStr = virSocketAddrFormat(&ip->address); + + if ((prefix = virSocketAddrGetIPPrefix(&ip->address, + NULL, ip->prefix)) < 0) { + ipStr = virSocketAddrFormat(&ip->address); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to determine prefix for IP address '%s'"), + ipStr); + VIR_FREE(ipStr); + goto cleanup; + } + VIR_FREE(ipStr); + + if (virNetDevIPAddrAdd(newname, &ip->address, NULL, prefix) < 0) + goto cleanup; + } - /* Only enable this device if there is a reason to do so (either - * at least one IP was specified, or link state was set to up in - * the config) - */ if (netDef->guestIP.nips || netDef->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP) { VIR_DEBUG("Enabling %s", newname); if (virNetDevSetOnline(newname, true) < 0) goto cleanup; - } - /* set IP addresses and routes */ - if (virNetDevIPInfoAddToDev(newname, &netDef->guestIP) < 0) - goto cleanup; + /* Set the routes */ + for (j = 0; j < netDef->guestIP.nroutes; j++) { + virNetDevIPRoutePtr route = netDef->guestIP.routes[j]; + + if (virNetDevIPRouteAdd(newname, + virNetDevIPRouteGetAddress(route), + virNetDevIPRouteGetPrefix(route), + virNetDevIPRouteGetGateway(route), + virNetDevIPRouteGetMetric(route)) < 0) { + goto cleanup; + } + } + } } /* enable lo device only if there were other net devices */ if ((veths || privNet) && virNetDevSetOnline("lo", true) < 0) - goto cleanup; + goto cleanup; ret = 0; cleanup: diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index cae566a..e5b88fe 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -887,63 +887,3 @@ virNetDevIPInfoClear(virNetDevIPInfoPtr ip) virNetDevIPRouteFree(ip->routes[i]); VIR_FREE(ip->routes); } - - -/** - * virNetDevIPInfoAddToDev: - * @ifname: name of device to operate on - * @ipInfo: list of routes and IP addresses to add to this device - * - * All IP routes and IP addresses in ipInfo are added to the named device. - * - * Returns: 0 on success, -1 (and error reported) on failure. - */ -int -virNetDevIPInfoAddToDev(const char *ifname, - virNetDevIPInfo const *ipInfo) -{ - int ret = -1; - size_t i; - char *ipStr = NULL; - int prefix; - - /* add all IP addresses */ - for (i = 0; i < ipInfo->nips; i++) { - virNetDevIPAddrPtr ip = ipInfo->ips[i]; - - ipStr = virSocketAddrFormat(&ip->address); - if ((prefix = virSocketAddrGetIPPrefix(&ip->address, - NULL, ip->prefix)) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to determine prefix for IP address '%s'"), - ipStr); - goto cleanup; - } - if (virNetDevIPAddrAdd(ifname, &ip->address, NULL, prefix) < 0) - goto cleanup; - VIR_FREE(ipStr); - } - - /* add all routes */ - for (i = 0; i < ipInfo->nroutes; i++) { - virNetDevIPRoutePtr route = ipInfo->routes[i]; - - ipStr = virSocketAddrFormat(&route->address); - if ((prefix = virNetDevIPRouteGetPrefix(route)) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to determine prefix for route with destination '%s'"), - ipStr); - goto cleanup; - } - if (virNetDevIPRouteAdd(ifname, &route->address, prefix, - &route->gateway, - virNetDevIPRouteGetMetric(route)) < 0) - goto cleanup; - VIR_FREE(ipStr); - } - - ret = 0; - cleanup: - VIR_FREE(ipStr); - return ret; -} diff --git a/src/util/virnetdevip.h b/src/util/virnetdevip.h index 86fb77e..be41636 100644 --- a/src/util/virnetdevip.h +++ b/src/util/virnetdevip.h @@ -86,7 +86,5 @@ virSocketAddrPtr virNetDevIPRouteGetGateway(virNetDevIPRoutePtr def); /* virNetDevIPInfo object */ void virNetDevIPInfoClear(virNetDevIPInfoPtr ip); -int virNetDevIPInfoAddToDev(const char *ifname, - virNetDevIPInfo const *ipInfo); #endif /* __VIR_NETDEVIP_H__ */ -- 2.7.3

On 06/27/2016 07:01 AM, Ján Tomko wrote:
This series was accidentally pushed in the feature freeze.
Revert the last six commits adding the new functionality.
The rest are either bugfixes or preparation for the bugfixes.
Sigh. Sorry about pushing these after the freeze. I was watching for the freeze notice, but I guess not well enough, and the tag apparaently scrolled by during a large pull Sunday morning. ACK series (although truthfully the ones most likely to cause problems (as evidenced by what Andrea found with the FreeBSD build) are the ones setting up for these final patches, which are more straightforward in comparison (in particular, the code is built on all platforms, except for the final two, which are just a few lines outside of new unit tests).
Ján Tomko (6): Revert "qemu: support setting host-side IP addresses/routes" Revert "lxc: support setting host-side IP addresses/routes" Revert "util: support setting peer for virNetDevIPInfo addresses" Revert "conf: support host-side IP/route information in <interface>" Revert "conf: allow setting peer address in <ip> element of <interface>" Revert "util: new function virNetDevIPInfoAddToDev"
docs/formatdomain.html.in | 60 +++-------- docs/schemas/domaincommon.rng | 8 +- src/conf/domain_conf.c | 117 ++++----------------- src/conf/domain_conf.h | 3 +- src/libvirt_private.syms | 1 - src/lxc/lxc_container.c | 47 +++++++-- src/lxc/lxc_process.c | 8 -- src/qemu/qemu_interface.c | 6 +- src/util/virnetdevip.c | 60 ----------- src/util/virnetdevip.h | 7 +- tests/lxcxml2xmldata/lxc-ethernet-hostip.xml | 44 -------- tests/lxcxml2xmltest.c | 1 - .../qemuxml2argv-net-eth-hostip.args | 23 ---- .../qemuxml2argv-net-eth-hostip.xml | 39 ------- tests/qemuxml2argvtest.c | 1 - .../qemuxml2xmlout-net-eth-hostip.xml | 44 -------- tests/qemuxml2xmltest.c | 1 - 17 files changed, 75 insertions(+), 395 deletions(-) delete mode 100644 tests/lxcxml2xmldata/lxc-ethernet-hostip.xml delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.args delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.xml delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-hostip.xml

On Mon, Jun 27, 2016 at 08:22:30AM -0400, Laine Stump wrote:
On 06/27/2016 07:01 AM, Ján Tomko wrote:
This series was accidentally pushed in the feature freeze.
Revert the last six commits adding the new functionality.
The rest are either bugfixes or preparation for the bugfixes.
Sigh. Sorry about pushing these after the freeze. I was watching for the freeze notice, but I guess not well enough, and the tag apparaently scrolled by during a large pull Sunday morning.
ACK series
Thanks, pushed now.
(although truthfully the ones most likely to cause problems (as evidenced by what Andrea found with the FreeBSD build) are the ones setting up for these final patches, which are more straightforward in comparison (in particular, the code is built on all platforms, except for the final two, which are just a few lines outside of new unit tests).
I did not want to revert the bugfixes and resolving the conflicts caused by trying to revert everything but bugfixes would probably be more risky. Jan

On 06/27/2016 07:01 AM, Ján Tomko wrote:
This series was accidentally pushed in the feature freeze.
Revert the last six commits adding the new functionality.
The rest are either bugfixes or preparation for the bugfixes.
Now that 2.0.0 is released, I adjusted the docs additions to say "2.1.0", added a note about the original commit ID and later revert commit ID for each, and re-pushed. So we should now be able to set the IP address (and peer address) of the host side of a type='ethernet' interface's tap device for both qemu and lxc.
Ján Tomko (6): Revert "qemu: support setting host-side IP addresses/routes" Revert "lxc: support setting host-side IP addresses/routes" Revert "util: support setting peer for virNetDevIPInfo addresses" Revert "conf: support host-side IP/route information in <interface>" Revert "conf: allow setting peer address in <ip> element of <interface>" Revert "util: new function virNetDevIPInfoAddToDev"
docs/formatdomain.html.in | 60 +++-------- docs/schemas/domaincommon.rng | 8 +- src/conf/domain_conf.c | 117 ++++----------------- src/conf/domain_conf.h | 3 +- src/libvirt_private.syms | 1 - src/lxc/lxc_container.c | 47 +++++++-- src/lxc/lxc_process.c | 8 -- src/qemu/qemu_interface.c | 6 +- src/util/virnetdevip.c | 60 ----------- src/util/virnetdevip.h | 7 +- tests/lxcxml2xmldata/lxc-ethernet-hostip.xml | 44 -------- tests/lxcxml2xmltest.c | 1 - .../qemuxml2argv-net-eth-hostip.args | 23 ---- .../qemuxml2argv-net-eth-hostip.xml | 39 ------- tests/qemuxml2argvtest.c | 1 - .../qemuxml2xmlout-net-eth-hostip.xml | 44 -------- tests/qemuxml2xmltest.c | 1 - 17 files changed, 75 insertions(+), 395 deletions(-) delete mode 100644 tests/lxcxml2xmldata/lxc-ethernet-hostip.xml delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.args delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-hostip.xml delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-hostip.xml
participants (2)
-
Ján Tomko
-
Laine Stump