#endif
-#define virLibConnError(code, ...) \
- virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-#define virLibDomainError(code, ...) \
- virReportErrorHelper(VIR_FROM_DOM, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
-
/**
* virRegisterNetworkDriver:
* @driver: pointer to a network driver block
size_t alias_len;
if (value->type != VIR_CONF_LIST) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Expected a list for 'uri_aliases' config parameter"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expected a list for 'uri_aliases' config parameter"));
return -1;
}
size_t safe;
if (entry->type != VIR_CONF_STRING) {
- virLibConnError(VIR_ERR_CONF_SYNTAX, "%s",
- _("Expected a string for 'uri_aliases' config parameter list entry"));
+ virReportError(VIR_ERR_CONF_SYNTAX, "%s",
+ _("Expected a string for 'uri_aliases' config parameter list entry"));
return -1;
}
if (!(offset = strchr(entry->str, '='))) {
- virLibConnError(VIR_ERR_CONF_SYNTAX,
- _("Malformed 'uri_aliases' config entry '%s', expected 'alias=uri://host/path'"),
+ virReportError(VIR_ERR_CONF_SYNTAX,
+ _("Malformed 'uri_aliases' config entry '%s', expected 'alias=uri://host/path'"),
entry->str);
return -1;
}
safe = strspn(entry->str, URI_ALIAS_CHARS);
if (safe < (offset - entry->str)) {
- virLibConnError(VIR_ERR_CONF_SYNTAX,
- _("Malformed 'uri_aliases' config entry '%s', aliases may only contain 'a-Z, 0-9, _, -'"),
+ virReportError(VIR_ERR_CONF_SYNTAX,
+ _("Malformed 'uri_aliases' config entry '%s', aliases may only contain 'a-Z, 0-9, _, -'"),
entry->str);
return -1;
}
*name = defname;
} else if ((value = virConfGetValue(conf, "uri_default"))) {
if (value->type != VIR_CONF_STRING) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Expected a string for 'uri_default' config parameter"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Expected a string for 'uri_default' config parameter"));
goto cleanup;
}
VIR_DEBUG("Using config file uri '%s'", value->str);
if (!ret->driver) {
/* If we reach here, then all drivers declined the connection. */
- virLibConnError(VIR_ERR_NO_CONNECT,
- "%s",
- NULLSTR(name));
+ virReportError(VIR_ERR_NO_CONNECT, "%s", NULLSTR(name));
goto failed;
}
/* We must absolutize the file path as the save is done out of process */
if (virFileAbsPath(to, &absolute_to) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not build absolute output file path"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not build absolute output file path"));
goto error;
}
/* We must absolutize the file path as the save is done out of process */
if (virFileAbsPath(to, &absolute_to) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not build absolute output file path"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not build absolute output file path"));
goto error;
}
/* We must absolutize the file path as the restore is done out of process */
if (virFileAbsPath(from, &absolute_from) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not build absolute input file path"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not build absolute input file path"));
goto error;
}
/* We must absolutize the file path as the restore is done out of process */
if (virFileAbsPath(from, &absolute_from) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not build absolute input file path"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not build absolute input file path"));
goto error;
}
virCheckNonNullArgGoto(file, error);
if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
- virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
- _("virDomainSaveImageGetXMLDesc with secure flag"));
+ virReportError(VIR_ERR_OPERATION_DENIED, "%s",
+ _("virDomainSaveImageGetXMLDesc with secure flag"));
goto error;
}
/* We must absolutize the file path as the read is done out of process */
if (virFileAbsPath(file, &absolute_file) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not build absolute input file path"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not build absolute input file path"));
goto error;
}
/* We must absolutize the file path as the read is done out of process */
if (virFileAbsPath(file, &absolute_file) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not build absolute input file path"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not build absolute input file path"));
goto error;
}
/* We must absolutize the file path as the save is done out of process */
if (virFileAbsPath(to, &absolute_to) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not build absolute core file path"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not build absolute core file path"));
goto error;
}
if (ret == 0)
goto error;
if ((unsigned long) ret != ret) {
- virLibDomainError(VIR_ERR_OVERFLOW, _("result too large: %llu"),
- ret);
+ virReportError(VIR_ERR_OVERFLOW, _("result too large: %llu"),
+ ret);
goto error;
}
return ret;
conn = domain->conn;
if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
- virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
- _("virDomainGetXMLDesc with secure flag"));
+ virReportError(VIR_ERR_OPERATION_DENIED, "%s",
+ _("virDomainGetXMLDesc with secure flag"));
goto error;
}
virCheckNonZeroArgGoto(nvcpus, error);
if ((unsigned short) nvcpus != nvcpus) {
- virLibDomainError(VIR_ERR_OVERFLOW, _("input too large: %u"), nvcpus);
+ virReportError(VIR_ERR_OVERFLOW, _("input too large: %u"), nvcpus);
goto error;
}
conn = domain->conn;
virCheckPositiveArgGoto(maplen, error);
if ((unsigned short) vcpu != vcpu) {
- virLibDomainError(VIR_ERR_OVERFLOW, _("input too large: %u"), vcpu);
+ virReportError(VIR_ERR_OVERFLOW, _("input too large: %u"), vcpu);
goto error;
}
virCheckPositiveArgGoto(maplen, error);
if ((unsigned short) vcpu != vcpu) {
- virLibDomainError(VIR_ERR_OVERFLOW, _("input too large: %u"), vcpu);
+ virReportError(VIR_ERR_OVERFLOW, _("input too large: %u"), vcpu);
goto error;
}
virCheckPositiveArgGoto(maplen, error);
if (INT_MULTIPLY_OVERFLOW(ncpumaps, maplen)) {
- virLibDomainError(VIR_ERR_OVERFLOW, _("input too large: %d * %d"),
- ncpumaps, maplen);
+ virReportError(VIR_ERR_OVERFLOW, _("input too large: %d * %d"),
+ ncpumaps, maplen);
goto error;
}
virCheckZeroArgGoto(maplen, error);
if (cpumaps && INT_MULTIPLY_OVERFLOW(maxinfo, maplen)) {
- virLibDomainError(VIR_ERR_OVERFLOW, _("input too large: %d * %d"),
- maxinfo, maplen);
+ virReportError(VIR_ERR_OVERFLOW, _("input too large: %d * %d"),
+ maxinfo, maplen);
goto error;
}
virCheckNonNullArgGoto(handler, cleanup);
if (stream->flags & VIR_STREAM_NONBLOCK) {
- virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
- _("data sources cannot be used for non-blocking streams"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("data sources cannot be used for non-blocking streams"));
goto cleanup;
}
virCheckNonNullArgGoto(handler, cleanup);
if (stream->flags & VIR_STREAM_NONBLOCK) {
- virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
- _("data sinks cannot be used for non-blocking streams"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("data sinks cannot be used for non-blocking streams"));
goto cleanup;
}
conn = snapshot->domain->conn;
if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
- virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
- _("virDomainSnapshotGetXMLDesc with secure flag"));
+ virReportError(VIR_ERR_OPERATION_DENIED, "%s",
+ _("virDomainSnapshotGetXMLDesc with secure flag"));
goto error;
}
virCheckNonNullArgGoto(cb, error);
if (conn->closeCallback->callback) {
- virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
- _("A close callback is already registered"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("A close callback is already registered"));
goto error;
}
virCheckNonNullArgGoto(cb, error);
if (conn->closeCallback->callback != cb) {
- virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
- _("A different callback was requested"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("A different callback was requested"));
goto error;
}
virCheckNullArgGoto(params, error);
if (nparams && ncpus > UINT_MAX / nparams) {
- virLibDomainError(VIR_ERR_OVERFLOW, _("input too large: %u * %u"),
- nparams, ncpus);
+ virReportError(VIR_ERR_OVERFLOW, _("input too large: %u * %u"),
+ nparams, ncpus);
goto error;
}
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,