separate virDomainDefParseWatchdogInfo from virDomainDefParseXML,
move virDomainDefParseWatchdogInfo into virDomainDefParseDeviceInfo
---
src/conf/domain_conf.c | 59 +++++++++++++++++++++++++++++++++-----------------
1 file changed, 39 insertions(+), 20 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1e44e76..b2a1b34 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20467,6 +20467,44 @@ virDomainDefParseHostdevInfo(virDomainParseTotalParamPtr param)
static int
+virDomainDefParseWatchdogInfo(virDomainParseTotalParamPtr param)
+{
+ virDomainDefPtr def = param->def;
+ xmlXPathContextPtr ctxt = param->ctxt;
+ virDomainXMLOptionPtr xmlopt = param->xmlopt;
+ unsigned int flags = param->flags;
+
+ int ret = -1;
+ int n = 0;
+ xmlNodePtr *nodes = NULL;
+
+ /* analysis of the watchdog devices */
+ def->watchdog = NULL;
+ if ((n = virXPathNodeSet("./devices/watchdog", ctxt, &nodes)) < 0)
+ goto cleanup;
+ if (n > 1) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only a single watchdog device is supported"));
+ goto cleanup;
+ }
+ if (n > 0) {
+ virDomainWatchdogDefPtr watchdog;
+
+ watchdog = virDomainWatchdogDefParseXML(xmlopt, nodes[0], flags);
+ if (!watchdog)
+ goto cleanup;
+
+ def->watchdog = watchdog;
+ }
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(nodes);
+ return ret;
+}
+
+
+static int
virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
{
typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param);
@@ -20489,6 +20527,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
virDomainDefParseSoundInfo,
virDomainDefParseVideoInfo,
virDomainDefParseHostdevInfo,
+ virDomainDefParseWatchdogInfo,
NULL
};
@@ -20592,26 +20631,6 @@ virDomainDefParseXML(xmlDocPtr xml,
fun_index++;
}
- /* analysis of the watchdog devices */
- def->watchdog = NULL;
- if ((n = virXPathNodeSet("./devices/watchdog", ctxt, &nodes)) < 0)
- goto error;
- if (n > 1) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("only a single watchdog device is supported"));
- goto error;
- }
- if (n > 0) {
- virDomainWatchdogDefPtr watchdog;
-
- watchdog = virDomainWatchdogDefParseXML(xmlopt, nodes[0], flags);
- if (!watchdog)
- goto error;
-
- def->watchdog = watchdog;
- VIR_FREE(nodes);
- }
-
/* analysis of the memballoon devices */
def->memballoon = NULL;
if ((n = virXPathNodeSet("./devices/memballoon", ctxt, &nodes)) <
0)
--
2.8.3