Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
src/conf/network_conf.c | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 3b93772..4c0751f 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -900,6 +900,30 @@ virNetworkDNSForwarderParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
}
+static int
+virNetworkDNSDefParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
+ virNetworkDNSDefPtr def,
+ const char *networkName,
+ void *opaque G_GNUC_UNUSED,
+ const char *enable G_GNUC_UNUSED,
+ const char *forwardPlainNames G_GNUC_UNUSED,
+ int ntxts,
+ int nhosts,
+ int nsrvs,
+ int nfwds)
+{
+ if (def->enable == VIR_TRISTATE_BOOL_NO &&
+ (nfwds || nhosts || nsrvs || ntxts)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Extra data in disabled network '%s'"),
+ networkName);
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
virNetworkDNSDefParseXML(const char *networkName,
xmlNodePtr node,
@@ -1025,13 +1049,10 @@ virNetworkDNSDefParseXML(const char *networkName,
}
}
- if (def->enable == VIR_TRISTATE_BOOL_NO &&
- (nfwds || nhosts || nsrvs || ntxts)) {
- virReportError(VIR_ERR_XML_ERROR,
- _("Extra data in disabled network '%s'"),
- networkName);
+ if (virNetworkDNSDefParseXMLHook(node, def, networkName, NULL,
+ enable, forwardPlainNames,
+ ntxts, nhosts, nsrvs, nfwds) < 0)
goto cleanup;
- }
ret = 0;
cleanup:
--
2.17.1