Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
src/conf/network_conf.c | 73 +----------------------------------------
src/conf/network_conf.h | 2 +-
2 files changed, 2 insertions(+), 73 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 364c10e2..a652110c 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1959,77 +1959,6 @@ virNetworkDefParseNode(xmlDocPtr xml,
}
-static int
-virNetworkDNSDefFormat(virBuffer *buf,
- const virNetworkDNSDef *def)
-{
- size_t i;
-
- if (!(def->enable || def->forwardPlainNames || def->nfwds || 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->nfwds || def->nhosts || def->nsrvs || def->ntxts)) {
- virBufferAddLit(buf, "/>\n");
- return 0;
- }
-
- virBufferAddLit(buf, ">\n");
- virBufferAdjustIndent(buf, 2);
-
- for (i = 0; i < def->nfwds; i++) {
- if (virNetworkDNSForwarderFormatBuf(buf, "forwarder",
- &def->forwarders[i], def, NULL) <
0)
- return -1;
- }
-
- for (i = 0; i < def->ntxts; i++) {
- if (virNetworkDNSTxtDefFormatBuf(buf, "txt", &def->txts[i], def,
NULL) < 0)
- return -1;
- }
-
- for (i = 0; i < def->nsrvs; i++) {
- if (def->srvs[i].service && def->srvs[i].protocol) {
- if (virNetworkDNSSrvDefFormatBuf(buf, "srv", &def->srvs[i],
def, NULL) < 0)
- return -1;
- }
- }
-
- if (def->nhosts) {
- for (i = 0; i < def->nhosts; i++) {
- if (virNetworkDNSHostDefFormatBuf(buf, "host",
&def->hosts[i], def, NULL) < 0)
- return -1;
- }
- }
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, "</dns>\n");
- return 0;
-}
-
-
static int
virNetworkIPDefFormat(virBuffer *buf,
const virNetworkIPDef *def)
@@ -2436,7 +2365,7 @@ virNetworkDefFormatBuf(virBuffer *buf,
virBufferAddLit(buf, "/>\n");
}
- if (virNetworkDNSDefFormat(buf, &def->dns) < 0)
+ if (virNetworkDNSDefFormatBuf(buf, "dns", &def->dns, def, NULL) <
0)
return -1;
if (virNetDevVlanFormat(&def->vlan, buf) < 0)
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 9968d962..b0675175 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -156,7 +156,7 @@ struct _virNetworkDNSForwarder { /* genparse, genformat */
};
typedef struct _virNetworkDNSDef virNetworkDNSDef;
-struct _virNetworkDNSDef { /* genparse */
+struct _virNetworkDNSDef { /* genparse, genformat */
virTristateBool enable; /* xmlattr */
virTristateBool forwardPlainNames; /* xmlattr */
size_t nfwds;
--
2.25.1