Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx> --- docs/schemas/network.rng | 3 +- src/conf/network_conf.c | 71 +--------------------------------------- 2 files changed, 3 insertions(+), 71 deletions(-) diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index ba5db0b..db04b7c 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -264,7 +264,8 @@ "output": "src/conf/network_conf", "post": true, "args.instname": true - } + }, + "formatfunc": {"output": "src/conf/network_conf"} } --> <element name="dns"> <optional> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index e5d6e49..e46c208 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -1922,75 +1922,6 @@ virNetworkDefParseNode(xmlDocPtr xml, } -static int -virNetworkDNSDefFormat(virBufferPtr buf, - const virNetworkDNSDef *def) -{ - size_t i; - - if (!(def->enable || def->forwardPlainNames || def->nforwarders || def->nhosts || - def->nsrvs || def->ntxts)) - return 0; - - virBufferAddLit(buf, "<dns"); - if (def->enable) { - const char *fwd = virTristateBoolTypeToString(def->enable); - - if (!fwd) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown enable type %d in network"), - def->enable); - return -1; - } - virBufferAsprintf(buf, " enable='%s'", fwd); - } - if (def->forwardPlainNames) { - const char *fwd = virTristateBoolTypeToString(def->forwardPlainNames); - - if (!fwd) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown forwardPlainNames type %d in network"), - def->forwardPlainNames); - return -1; - } - virBufferAsprintf(buf, " forwardPlainNames='%s'", fwd); - } - if (!(def->nforwarders || def->nhosts || def->nsrvs || def->ntxts)) { - virBufferAddLit(buf, "/>\n"); - return 0; - } - - virBufferAddLit(buf, ">\n"); - virBufferAdjustIndent(buf, 2); - - for (i = 0; i < def->nforwarders; i++) { - if (virNetworkDNSForwarderFormatBuf(buf, "forwarder", - &def->forwarders[i]) < 0) - return -1; - } - - for (i = 0; i < def->ntxts; i++) { - if (virNetworkDNSTxtDefFormatBuf(buf, "txt", &def->txts[i]) < 0) - return -1; - } - - for (i = 0; i < def->nsrvs; i++) { - if (virNetworkDNSSrvDefFormatBuf(buf, "srv", &def->srvs[i]) < 0) - return -1; - } - - if (def->nhosts) { - for (i = 0; i < def->nhosts; i++) { - if (virNetworkDNSHostDefFormatBuf(buf, "host", &def->hosts[i]) < 0) - return -1; - } - } - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "</dns>\n"); - return 0; -} - - static int virNetworkIPDefFormat(virBufferPtr buf, const virNetworkIPDef *def) @@ -2366,7 +2297,7 @@ virNetworkDefFormatBuf(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } - if (virNetworkDNSDefFormat(buf, &def->dns) < 0) + if (virNetworkDNSDefFormatBuf(buf, "dns", &def->dns) < 0) return -1; if (virNetDevVlanFormat(&def->vlan, buf) < 0) -- 2.17.1