From d658456530c1010a49f45865613ed361a0fcc5b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?=
Date: Mon, 27 Jun 2016 11:56:17 +0200
Subject: [PATCH] Revert "conf: support host-side IP/route information in
"
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 bb1c0792b9..2466df735d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5012,32 +5012,6 @@ qemu-kvm -net nic,model=? /dev/null
definitions. This is used by the LXC driver.
-
- ...
- <devices>
- <interface type='ethernet'>
- <source/>
- <ip address='192.168.123.1' prefix='24'/>
- <ip address='10.0.0.10' prefix='24' peer='192.168.122.5'/>
- <route family='ipv4' address='192.168.42.0' prefix='24' gateway='192.168.123.4'/>
- <source/>
- ...
- </interface>
- ...
- </devices>
- ...
-
-
-
- Since 2.0.0 network devices of type
- "ethernet" can optionally be provided one or more IP addresses
- and one or more routes to set on the host side of the
- network device. These are configured as subelements of
- the <source>
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).
-
-
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 964ff92215..2d12da95e3 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2142,7 +2142,7 @@
-
+
@@ -2392,6 +2392,7 @@
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 90d2eaa7cc..3a81f7e2aa 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);
@@ -4608,23 +4607,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 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, "data.bridge.brname);
- sourceLines++;
- }
+ virBufferEscapeString(buf, " \n",
+ def->data.bridge.brname);
break;
case VIR_DOMAIN_NET_TYPE_SERVER:
@@ -20829,27 +20804,25 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, "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, " \n",
def->data.socket.localaddr,
def->data.socket.localport);
virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, " \n");
break;
case VIR_DOMAIN_NET_TYPE_INTERNAL:
- if (def->data.internal.name) {
- virBufferEscapeString(buf, "data.internal.name);
- sourceLines++;
- }
+ virBufferEscapeString(buf, " \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 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, "\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, " \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 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, "\n",
def->script);
virBufferEscapeString(buf, " \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, " \n", def->ifname);
}
-
if (def->ifname_guest || def->ifname_guest_actual) {
virBufferAddLit(buf, " ) */
- 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 ce455f7920..0000000000
--- a/tests/lxcxml2xmldata/lxc-ethernet-hostip.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
- 8675309
- e21987a5-e98e-9c99-0e35-803e4d9ad1fe
- 1048576
- 1048576
- 1
-
- /machine
-
-
- exe
- /sbin/init
-
-
-
-
-
-
- destroy
- restart
- restart
-
- /usr/libexec/libvirt_lxc
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index 2f7f779734..1b16088e67 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);