* src/xml.c: changes from Masayuki Sunou to improve error reporting

on device XML errors.
Daniel
This commit is contained in:
Daniel Veillard 2007-08-02 10:47:38 +00:00
parent 94711ff791
commit 6253863e8f
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Thu Aug 2 12:49:08 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/xml.c: changes from Masayuki Sunou to improve error reporting
on device XML errors.
Tue Jul 31 10:24:23 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_conf.c, src/xml.c, tests/qemuxml2argvtest.c,

View File

@ -1397,11 +1397,13 @@ virParseXMLDevice(virConnectPtr conn, char *xmldesc, int hvm, int xendConfigVers
buf.size = 1000;
buf.use = 0;
buf.content[0] = 0;
xml = xmlReadDoc((const xmlChar *) xmldesc, "domain.xml", NULL,
xml = xmlReadDoc((const xmlChar *) xmldesc, "device.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
if (xml == NULL)
if (xml == NULL) {
virXMLError(conn, VIR_ERR_XML_ERROR, NULL, 0);
goto error;
}
node = xmlDocGetRootElement(xml);
if (node == NULL)
goto error;
@ -1454,11 +1456,13 @@ virDomainXMLDevID(virDomainPtr domain, char *xmldesc, char *class, char *ref)
#endif /* WITH_XEN */
int ret = 0;
xml = xmlReadDoc((const xmlChar *) xmldesc, "domain.xml", NULL,
xml = xmlReadDoc((const xmlChar *) xmldesc, "device.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
if (xml == NULL)
if (xml == NULL) {
virXMLError(NULL, VIR_ERR_XML_ERROR, NULL, 0);
goto error;
}
node = xmlDocGetRootElement(xml);
if (node == NULL)
goto error;
@ -1499,6 +1503,8 @@ virDomainXMLDevID(virDomainPtr domain, char *xmldesc, char *class, char *ref)
goto error;
}
} else {
virXMLError(NULL, VIR_ERR_XML_ERROR, (const char *) node->name, 0);
}
error:
ret = -1;