Fix messages using VIR_ERR_XML_ERROR

This error code has existed since the dawn of time, yet the messages it
generates are almost universally busted. Here's a small sampling:

src/conf/domain_conf.c:4889 : XML description for missing root element is not well formed or invalid
src/conf/domain_conf.c:4951 : XML description for unknown device type is not well formed or invalid
src/conf/domain_conf.c:5460 : XML description for maximum vcpus must be an integer is not well formed or invalid
src/conf/domain_conf.c:5468 : XML description for invalid maxvcpus %(count)lu is not well formed or invalid

Fix up the error code to instead be

XML error: <msg>

Adjust the few locations that were using the original correctly (or shouldn't
have been using the error code at all).

v2:
    Fix wording of error code without a passed argument
This commit is contained in:
Cole Robinson 2011-05-12 17:22:29 -04:00
parent 824dcaff78
commit ed97be6176
3 changed files with 19 additions and 11 deletions

View File

@ -808,7 +808,8 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->nodes = l;
} else if (ret == -2) {
testError(VIR_ERR_XML_ERROR, "%s", _("node cpu numa nodes"));
testError(VIR_ERR_XML_ERROR, "%s",
_("invalid node cpu nodes value"));
goto error;
}
@ -816,7 +817,8 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->sockets = l;
} else if (ret == -2) {
testError(VIR_ERR_XML_ERROR, "%s", _("node cpu sockets"));
testError(VIR_ERR_XML_ERROR, "%s",
_("invalid node cpu sockets value"));
goto error;
}
@ -824,7 +826,8 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->cores = l;
} else if (ret == -2) {
testError(VIR_ERR_XML_ERROR, "%s", _("node cpu cores"));
testError(VIR_ERR_XML_ERROR, "%s",
_("invalid node cpu cores value"));
goto error;
}
@ -832,7 +835,8 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->threads = l;
} else if (ret == -2) {
testError(VIR_ERR_XML_ERROR, "%s", _("node cpu threads"));
testError(VIR_ERR_XML_ERROR, "%s",
_("invalid node cpu threads value"));
goto error;
}
@ -843,14 +847,16 @@ static int testOpenFromFile(virConnectPtr conn,
nodeInfo->cpus = l;
}
} else if (ret == -2) {
testError(VIR_ERR_XML_ERROR, "%s", _("node active cpu"));
testError(VIR_ERR_XML_ERROR, "%s",
_("invalid node cpu active value"));
goto error;
}
ret = virXPathLong("string(/node/cpu/mhz[1])", ctxt, &l);
if (ret == 0) {
nodeInfo->mhz = l;
} else if (ret == -2) {
testError(VIR_ERR_XML_ERROR, "%s", _("node cpu mhz"));
testError(VIR_ERR_XML_ERROR, "%s",
_("invalid node cpu mhz value"));
goto error;
}
@ -869,7 +875,8 @@ static int testOpenFromFile(virConnectPtr conn,
if (ret == 0) {
nodeInfo->memory = l;
} else if (ret == -2) {
testError(VIR_ERR_XML_ERROR, "%s", _("node memory"));
testError(VIR_ERR_XML_ERROR, "%s",
_("invalid node memory value"));
goto error;
}

View File

@ -925,9 +925,9 @@ virErrorMsg(virErrorNumber error, const char *info)
break;
case VIR_ERR_XML_ERROR:
if (info == NULL)
errmsg = _("XML description not well formed or invalid");
errmsg = _("XML description is invalid or not well formed");
else
errmsg = _("XML description for %s is not well formed or invalid");
errmsg = _("XML error: %s");
break;
case VIR_ERR_DOM_EXIST:
if (info == NULL)

View File

@ -1536,8 +1536,9 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
break;
}
default:
xenXMError(VIR_ERR_XML_ERROR,
"%s", _("unknown device"));
xenXMError(VIR_ERR_CONFIG_UNSUPPORTED,
_("device type '%s' cannot be detached"),
virDomainDeviceTypeToString(dev->type));
goto cleanup;
}