mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
conf: Improve incorrect root element error messages
When user pass wrong root element, it is not 'internal error' and we can give him hint what we are expecting.
This commit is contained in:
parent
508aef9b0e
commit
a6916977bb
@ -7932,8 +7932,10 @@ virDomainDefPtr virDomainDefParseNode(virCapsPtr caps,
|
|||||||
virDomainDefPtr def = NULL;
|
virDomainDefPtr def = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "domain")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "domain")) {
|
||||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
virDomainReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("incorrect root element"));
|
_("unexpected root element <%s>, "
|
||||||
|
"expecting <domain>"),
|
||||||
|
root->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7963,8 +7965,10 @@ virDomainObjParseNode(virCapsPtr caps,
|
|||||||
virDomainObjPtr obj = NULL;
|
virDomainObjPtr obj = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "domstatus")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "domstatus")) {
|
||||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
virDomainReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("incorrect root element"));
|
_("unexpected root element <%s>, "
|
||||||
|
"expecting <domstatus>"),
|
||||||
|
root->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -838,8 +838,10 @@ virInterfaceDefPtr virInterfaceDefParseNode(xmlDocPtr xml,
|
|||||||
virInterfaceDefPtr def = NULL;
|
virInterfaceDefPtr def = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "interface")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "interface")) {
|
||||||
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
|
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("incorrect root element"));
|
_("unexpected root element <%s>, "
|
||||||
|
"expecting <interface>"),
|
||||||
|
root->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1107,8 +1107,10 @@ virNetworkDefPtr virNetworkDefParseNode(xmlDocPtr xml,
|
|||||||
virNetworkDefPtr def = NULL;
|
virNetworkDefPtr def = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "network")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "network")) {
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virNetworkReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("incorrect root element"));
|
_("unexpected root element <%s>, "
|
||||||
|
"expecting <network>"),
|
||||||
|
root->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1204,8 +1204,10 @@ virNodeDeviceDefParseNode(xmlDocPtr xml,
|
|||||||
virNodeDeviceDefPtr def = NULL;
|
virNodeDeviceDefPtr def = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "device")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "device")) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virNodeDeviceReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("incorrect root element"));
|
_("unexpected root element <%s> "
|
||||||
|
"expecting <device>"),
|
||||||
|
root->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,8 +126,10 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
|
|||||||
char *uuidstr = NULL;
|
char *uuidstr = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "secret")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "secret")) {
|
||||||
virSecretReportError(VIR_ERR_XML_ERROR, "%s",
|
virSecretReportError(VIR_ERR_XML_ERROR,
|
||||||
_("incorrect root element"));
|
_("unexpected root element <%s>, "
|
||||||
|
"expecting <secret>"),
|
||||||
|
root->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,7 +644,7 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!xmlStrEqual(ctxt->node->name, BAD_CAST "domain")) {
|
if (!xmlStrEqual(ctxt->node->name, BAD_CAST "domain")) {
|
||||||
vah_error(NULL, 0, _("incorrect root element"));
|
vah_error(NULL, 0, _("unexpected root element, expecting <domain>"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user