diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2012-07-18 11:50:44 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2012-07-18 19:01:50 +0100 |
commit | 1e0bb184a72f3af79cba2d3ece3b10dc8406c987 (patch) | |
tree | a0fee9e0fc20d270e188d7b27b26ef547190e9ad | |
parent | Add missing _(...) around 2 error messages in test driver (diff) | |
download | libvirt-1e0bb184a72f3af79cba2d3ece3b10dc8406c987.tar.gz libvirt-1e0bb184a72f3af79cba2d3ece3b10dc8406c987.tar.bz2 libvirt-1e0bb184a72f3af79cba2d3ece3b10dc8406c987.zip |
Convert all files in src/conf/ to use virReportError()
This removes all the per-file error reporting macros
from the code in src/conf/
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
28 files changed, 1912 insertions, 1927 deletions
@@ -513,7 +513,6 @@ msg_gen_function += PHYP_ERROR msg_gen_function += VIR_ERROR msg_gen_function += VMX_ERROR msg_gen_function += XENXS_ERROR -msg_gen_function += eventReportError msg_gen_function += interfaceReportError msg_gen_function += lxcError msg_gen_function += libxlError @@ -531,9 +530,7 @@ msg_gen_function += vah_warning msg_gen_function += vboxError msg_gen_function += virConfError msg_gen_function += virCPUReportError -msg_gen_function += virDomainReportError msg_gen_function += virGenericReportError -msg_gen_function += virInterfaceReportError msg_gen_function += virLibConnError msg_gen_function += virLibDomainError msg_gen_function += virLibDomainSnapshotError @@ -544,7 +541,6 @@ msg_gen_function += virLibNWFilterError msg_gen_function += virLibSecretError msg_gen_function += virLibStoragePoolError msg_gen_function += virLibStorageVolError -msg_gen_function += virNetworkReportError msg_gen_function += virNodeDeviceReportError msg_gen_function += virNWFilterReportError msg_gen_function += virRaiseError diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 7fe3c1ef9..175a7ed33 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -32,10 +32,6 @@ #define VIR_FROM_THIS VIR_FROM_CPU -#define virCPUReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_CPU, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - VIR_ENUM_IMPL(virCPU, VIR_CPU_TYPE_LAST, "host", "guest", "auto") @@ -201,9 +197,9 @@ virCPUDefParseXML(const xmlNodePtr node, char *cpuMode; if (!xmlStrEqual(node->name, BAD_CAST "cpu")) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("XML does not contain expected 'cpu' element")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("XML does not contain expected 'cpu' element")); return NULL; } @@ -215,9 +211,9 @@ virCPUDefParseXML(const xmlNodePtr node, if (mode == VIR_CPU_TYPE_AUTO) { if (virXPathBoolean("boolean(./arch)", ctxt)) { if (virXPathBoolean("boolean(./@match)", ctxt)) { - virCPUReportError(VIR_ERR_XML_ERROR, "%s", - _("'arch' element element cannot be used inside 'cpu'" - " element with 'match' attribute'")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'arch' element element cannot be used inside 'cpu'" + " element with 'match' attribute'")); goto error; } def->type = VIR_CPU_TYPE_HOST; @@ -231,16 +227,16 @@ virCPUDefParseXML(const xmlNodePtr node, if ((cpuMode = virXMLPropString(node, "mode"))) { if (def->type == VIR_CPU_TYPE_HOST) { VIR_FREE(cpuMode); - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Attribute mode is only allowed for guest CPU")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Attribute mode is only allowed for guest CPU")); goto error; } else { def->mode = virCPUModeTypeFromString(cpuMode); if (def->mode < 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid mode attribute '%s'"), - cpuMode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid mode attribute '%s'"), + cpuMode); VIR_FREE(cpuMode); goto error; } @@ -266,8 +262,8 @@ virCPUDefParseXML(const xmlNodePtr node, VIR_FREE(match); if (def->match < 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid match attribute for CPU specification")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Invalid match attribute for CPU specification")); goto error; } } @@ -276,16 +272,16 @@ virCPUDefParseXML(const xmlNodePtr node, if (def->type == VIR_CPU_TYPE_HOST) { def->arch = virXPathString("string(./arch[1])", ctxt); if (!def->arch) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing CPU architecture")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing CPU architecture")); goto error; } } if (!(def->model = virXPathString("string(./model[1])", ctxt)) && def->type == VIR_CPU_TYPE_HOST) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing CPU model name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing CPU model name")); goto error; } @@ -300,8 +296,8 @@ virCPUDefParseXML(const xmlNodePtr node, def->fallback = virCPUFallbackTypeFromString(fallback); VIR_FREE(fallback); if (def->fallback < 0) { - virCPUReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid fallback attribute")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Invalid fallback attribute")); goto error; } } @@ -313,18 +309,18 @@ virCPUDefParseXML(const xmlNodePtr node, ctxt); if (!vendor_id || strlen(vendor_id) != VIR_CPU_VENDOR_ID_LENGTH) { - virCPUReportError(VIR_ERR_XML_ERROR, - _("vendor_id must be exactly" - " %d characters long"), - VIR_CPU_VENDOR_ID_LENGTH); + virReportError(VIR_ERR_XML_ERROR, + _("vendor_id must be exactly" + " %d characters long"), + VIR_CPU_VENDOR_ID_LENGTH); VIR_FREE(vendor_id); goto error; } /* ensure that the string can be passed to qemu*/ for (i = 0; i < strlen(vendor_id); i++) { if (vendor_id[i]==',') { - virCPUReportError(VIR_ERR_XML_ERROR, "%s", - _("vendor id is invalid")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("vendor id is invalid")); VIR_FREE(vendor_id); goto error; } @@ -336,8 +332,8 @@ virCPUDefParseXML(const xmlNodePtr node, def->vendor = virXPathString("string(./vendor[1])", ctxt); if (def->vendor && !def->model) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("CPU vendor specified without CPU model")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("CPU vendor specified without CPU model")); goto error; } @@ -348,8 +344,8 @@ virCPUDefParseXML(const xmlNodePtr node, ret = virXPathULong("string(./topology[1]/@sockets)", ctxt, &ul); if (ret < 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing 'sockets' attribute in CPU topology")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing 'sockets' attribute in CPU topology")); goto error; } def->sockets = (unsigned int) ul; @@ -357,8 +353,8 @@ virCPUDefParseXML(const xmlNodePtr node, ret = virXPathULong("string(./topology[1]/@cores)", ctxt, &ul); if (ret < 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing 'cores' attribute in CPU topology")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing 'cores' attribute in CPU topology")); goto error; } def->cores = (unsigned int) ul; @@ -366,15 +362,15 @@ virCPUDefParseXML(const xmlNodePtr node, ret = virXPathULong("string(./topology[1]/@threads)", ctxt, &ul); if (ret < 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing 'threads' attribute in CPU topology")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing 'threads' attribute in CPU topology")); goto error; } def->threads = (unsigned int) ul; if (!def->sockets || !def->cores || !def->threads) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid CPU topology")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Invalid CPU topology")); goto error; } } @@ -385,8 +381,8 @@ virCPUDefParseXML(const xmlNodePtr node, if (n > 0) { if (!def->model) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Non-empty feature list specified without CPU model")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Non-empty feature list specified without CPU model")); goto error; } @@ -412,8 +408,8 @@ virCPUDefParseXML(const xmlNodePtr node, VIR_FREE(strpolicy); if (policy < 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid CPU feature policy")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Invalid CPU feature policy")); goto error; } } else { @@ -422,16 +418,16 @@ virCPUDefParseXML(const xmlNodePtr node, if (!(name = virXMLPropString(nodes[i], "name")) || *name == 0) { VIR_FREE(name); - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid CPU feature name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Invalid CPU feature name")); goto error; } for (j = 0 ; j < i ; j++) { if (STREQ(name, def->features[j].name)) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("CPU feature `%s' specified more than once"), - name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU feature `%s' specified more than once"), + name); VIR_FREE(name); goto error; } @@ -445,8 +441,8 @@ virCPUDefParseXML(const xmlNodePtr node, VIR_FREE(nodes); n = virXPathNodeSet("./numa[1]/cell", ctxt, &nodes); if (n <= 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("NUMA topology defined without NUMA cells")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("NUMA topology defined without NUMA cells")); goto error; } @@ -464,8 +460,8 @@ virCPUDefParseXML(const xmlNodePtr node, def->cells[i].cellid = i; cpus = virXMLPropString(nodes[i], "cpus"); if (!cpus) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing 'cpus' attribute in NUMA cell")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing 'cpus' attribute in NUMA cell")); goto error; } def->cells[i].cpustr = cpus; @@ -481,15 +477,15 @@ virCPUDefParseXML(const xmlNodePtr node, memory = virXMLPropString(nodes[i], "memory"); if (!memory) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing 'memory' attribute in NUMA cell")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing 'memory' attribute in NUMA cell")); goto error; } ret = virStrToLong_ui(memory, NULL, 10, &def->cells[i].mem); if (ret == -1) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid 'memory' attribute in NUMA cell")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Invalid 'memory' attribute in NUMA cell")); VIR_FREE(memory); goto error; } @@ -547,8 +543,8 @@ virCPUDefFormatBufFull(virBufferPtr buf, if (def->mode != VIR_CPU_MODE_CUSTOM || def->model) { if (!(tmp = virCPUModeTypeToString(def->mode))) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected CPU mode %d"), def->mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected CPU mode %d"), def->mode); return -1; } virBufferAsprintf(buf, " mode='%s'", tmp); @@ -558,9 +554,9 @@ virCPUDefFormatBufFull(virBufferPtr buf, (def->mode == VIR_CPU_MODE_CUSTOM || (flags & VIR_DOMAIN_XML_UPDATE_CPU))) { if (!(tmp = virCPUMatchTypeToString(def->match))) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected CPU match policy %d"), - def->match); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected CPU match policy %d"), + def->match); return -1; } virBufferAsprintf(buf, " match='%s'", tmp); @@ -600,8 +596,8 @@ virCPUDefFormatBuf(virBufferPtr buf, (def->mode == VIR_CPU_MODE_CUSTOM && def->model))); if (!def->model && def->nfeatures) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Non-empty feature list specified without CPU model")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Non-empty feature list specified without CPU model")); return -1; } @@ -612,9 +608,9 @@ virCPUDefFormatBuf(virBufferPtr buf, fallback = virCPUFallbackTypeToString(def->fallback); if (!fallback) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected CPU fallback value: %d"), - def->fallback); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected CPU fallback value: %d"), + def->fallback); return -1; } virBufferAsprintf(buf, " fallback='%s'", fallback); @@ -644,8 +640,8 @@ virCPUDefFormatBuf(virBufferPtr buf, virCPUFeatureDefPtr feature = def->features + i; if (!feature->name) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing CPU feature name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing CPU feature name")); return -1; } @@ -654,9 +650,9 @@ virCPUDefFormatBuf(virBufferPtr buf, policy = virCPUFeaturePolicyTypeToString(feature->policy); if (!policy) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected CPU feature policy %d"), - feature->policy); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected CPU feature policy %d"), + feature->policy); return -1; } virBufferAsprintf(buf, "<feature policy='%s' name='%s'/>\n", @@ -691,8 +687,8 @@ virCPUDefAddFeature(virCPUDefPtr def, for (i = 0 ; i < def->nfeatures ; i++) { if (STREQ(name, def->features[i].name)) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("CPU feature `%s' specified more than once"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU feature `%s' specified more than once"), name); return -1; } } @@ -728,96 +724,96 @@ virCPUDefIsEqual(virCPUDefPtr src, return true; if ((src && !dst) || (!src && dst)) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Target CPU does not match source")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target CPU does not match source")); goto cleanup; } if (src->type != dst->type) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU type %s does not match source %s"), - virCPUTypeToString(dst->type), - virCPUTypeToString(src->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU type %s does not match source %s"), + virCPUTypeToString(dst->type), + virCPUTypeToString(src->type)); goto cleanup; } if (src->mode != dst->mode) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU mode %s does not match source %s"), - virCPUModeTypeToString(dst->mode), - virCPUModeTypeToString(src->mode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU mode %s does not match source %s"), + virCPUModeTypeToString(dst->mode), + virCPUModeTypeToString(src->mode)); goto cleanup; } if (STRNEQ_NULLABLE(src->arch, dst->arch)) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU arch %s does not match source %s"), - NULLSTR(dst->arch), NULLSTR(src->arch)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU arch %s does not match source %s"), + NULLSTR(dst->arch), NULLSTR(src->arch)); goto cleanup; } if (STRNEQ_NULLABLE(src->model, dst->model)) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU model %s does not match source %s"), - NULLSTR(dst->model), NULLSTR(src->model)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU model %s does not match source %s"), + NULLSTR(dst->model), NULLSTR(src->model)); goto cleanup; } if (STRNEQ_NULLABLE(src->vendor, dst->vendor)) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU vendor %s does not match source %s"), - NULLSTR(dst->vendor), NULLSTR(src->vendor)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU vendor %s does not match source %s"), + NULLSTR(dst->vendor), NULLSTR(src->vendor)); goto cleanup; } if (STRNEQ_NULLABLE(src->vendor_id, dst->vendor_id)) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU model %s does not match source %s"), - NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU model %s does not match source %s"), + NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id)); goto cleanup; } if (src->sockets != dst->sockets) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU sockets %d does not match source %d"), - dst->sockets, src->sockets); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU sockets %d does not match source %d"), + dst->sockets, src->sockets); goto cleanup; } if (src->cores != dst->cores) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU cores %d does not match source %d"), - dst->cores, src->cores); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU cores %d does not match source %d"), + dst->cores, src->cores); goto cleanup; } if (src->threads != dst->threads) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU threads %d does not match source %d"), - dst->threads, src->threads); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU threads %d does not match source %d"), + dst->threads, src->threads); goto cleanup; } if (src->nfeatures != dst->nfeatures) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU feature count %zu does not match source %zu"), - dst->nfeatures, src->nfeatures); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU feature count %zu does not match source %zu"), + dst->nfeatures, src->nfeatures); goto cleanup; } for (i = 0 ; i < src->nfeatures ; i++) { if (STRNEQ(src->features[i].name, dst->features[i].name)) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU feature %s does not match source %s"), - dst->features[i].name, src->features[i].name); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU feature %s does not match source %s"), + dst->features[i].name, src->features[i].name); goto cleanup; } if (src->features[i].policy != dst->features[i].policy) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU feature policy %s does not match source %s"), - virCPUFeaturePolicyTypeToString(dst->features[i].policy), - virCPUFeaturePolicyTypeToString(src->features[i].policy)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU feature policy %s does not match source %s"), + virCPUFeaturePolicyTypeToString(dst->features[i].policy), + virCPUFeaturePolicyTypeToString(src->features[i].policy)); goto cleanup; } } diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 398f630a1..1b5dad95b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -655,10 +655,6 @@ VIR_ENUM_IMPL(virDomainNumatuneMemPlacementMode, "static", "auto"); -#define virDomainReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_DOMAIN, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - #define VIR_DOMAIN_XML_WRITE_FLAGS VIR_DOMAIN_XML_SECURE #define VIR_DOMAIN_XML_READ_FLAGS VIR_DOMAIN_XML_INACTIVE @@ -699,9 +695,9 @@ virDomainBlkioDeviceWeightParseXML(xmlNodePtr root, } else if (xmlStrEqual(node->name, BAD_CAST "weight")) { c = (char *)xmlNodeGetContent(node); if (virStrToLong_ui(c, NULL, 10, &dw->weight) < 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("could not parse weight %s"), - c); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("could not parse weight %s"), + c); VIR_FREE(c); VIR_FREE(dw->path); return -1; @@ -712,8 +708,8 @@ virDomainBlkioDeviceWeightParseXML(xmlNodePtr root, node = node->next; } if (!dw->path) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("missing per-device path")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("missing per-device path")); return -1; } @@ -1697,8 +1693,8 @@ static virDomainObjPtr virDomainObjNew(virCapsPtr caps) domain->privateDataFreeFunc = caps->privateDataFreeFunc; if (virMutexInit(&domain->lock) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); if (domain->privateDataFreeFunc) (domain->privateDataFreeFunc)(domain->privateData); VIR_FREE(domain); @@ -1854,21 +1850,21 @@ virDomainLiveConfigHelperMethod(virCapsPtr caps, } if (!isActive && (*flags & VIR_DOMAIN_AFFECT_LIVE)) { - virDomainReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); goto cleanup; } if (*flags & VIR_DOMAIN_AFFECT_CONFIG) { if (!dom->persistent) { - virDomainReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot change persistent config of a " - "transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot change persistent config of a " + "transient domain")); goto cleanup; } if (!(*persistentDef = virDomainObjGetPersistentDef(caps, dom))) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Get persistent config failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Get persistent config failed")); goto cleanup; } } @@ -2121,9 +2117,9 @@ virDomainDeviceInfoFormat(virBufferPtr buf, const char *rombar = virDomainPciRombarModeTypeToString(info->rombar); if (!rombar) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected rom bar value %d"), - info->rombar); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected rom bar value %d"), + info->rombar); return -1; } virBufferAsprintf(buf, " bar='%s'", rombar); @@ -2187,8 +2183,8 @@ virDomainDeviceInfoFormat(virBufferPtr buf, break; default: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown address type '%d'"), info->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown address type '%d'"), info->type); return -1; } @@ -2214,43 +2210,43 @@ virDomainDevicePCIAddressParseXML(xmlNodePtr node, if (domain && virStrToLong_ui(domain, NULL, 0, &addr->domain) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'domain' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'domain' attribute")); goto cleanup; } if (bus && virStrToLong_ui(bus, NULL, 0, &addr->bus) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'bus' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'bus' attribute")); goto cleanup; } if (slot && virStrToLong_ui(slot, NULL, 0, &addr->slot) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'slot' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'slot' attribute")); goto cleanup; } if (function && virStrToLong_ui(function, NULL, 0, &addr->function) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'function' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'function' attribute")); goto cleanup; } if (multi && ((addr->multi = virDomainDeviceAddressPciMultiTypeFromString(multi)) <= 0)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown value '%s' for <address> 'multifunction' attribute"), - multi); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown value '%s' for <address> 'multifunction' attribute"), + multi); goto cleanup; } if (!virDomainDevicePCIAddressIsValid(addr)) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Insufficient specification for PCI address")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Insufficient specification for PCI address")); goto cleanup; } @@ -2282,29 +2278,29 @@ virDomainDeviceDriveAddressParseXML(xmlNodePtr node, if (controller && virStrToLong_ui(controller, NULL, 10, &addr->controller) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'controller' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'controller' attribute")); goto cleanup; } if (bus && virStrToLong_ui(bus, NULL, 10, &addr->bus) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'bus' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'bus' attribute")); goto cleanup; } if (target && virStrToLong_ui(target, NULL, 10, &addr->target) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'target' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'target' attribute")); goto cleanup; } if (unit && virStrToLong_ui(unit, NULL, 10, &addr->unit) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'unit' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'unit' attribute")); goto cleanup; } @@ -2336,22 +2332,22 @@ virDomainDeviceVirtioSerialAddressParseXML( if (controller && virStrToLong_ui(controller, NULL, 10, &addr->controller) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'controller' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'controller' attribute")); goto cleanup; } if (bus && virStrToLong_ui(bus, NULL, 10, &addr->bus) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'bus' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'bus' attribute")); goto cleanup; } if (port && virStrToLong_ui(port, NULL, 10, &addr->port) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'port' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'port' attribute")); goto cleanup; } @@ -2378,15 +2374,15 @@ virDomainDeviceCcidAddressParseXML(xmlNodePtr node, if (controller && virStrToLong_ui(controller, NULL, 10, &addr->controller) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'controller' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'controller' attribute")); goto cleanup; } if (slot && virStrToLong_ui(slot, NULL, 10, &addr->slot) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'slot' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'slot' attribute")); goto cleanup; } @@ -2416,8 +2412,8 @@ virDomainDeviceUSBAddressParseXML(xmlNodePtr node, (*tmp == '.' && (virStrToLong_ui(tmp + 1, &tmp, 10, &p) < 0 || (*tmp != '\0' && *tmp != '.'))) || (*tmp == '.' && (virStrToLong_ui(tmp + 1, &tmp, 10, &p) < 0 || (*tmp != '\0' && *tmp != '.'))) || (*tmp == '.' && (virStrToLong_ui(tmp + 1, &tmp, 10, &p) < 0 || (*tmp != '\0'))))) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'port' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'port' attribute")); goto cleanup; } @@ -2426,8 +2422,8 @@ virDomainDeviceUSBAddressParseXML(xmlNodePtr node, if (bus && virStrToLong_ui(bus, NULL, 10, &addr->bus) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'bus' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'bus' attribute")); goto cleanup; } @@ -2451,8 +2447,8 @@ virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node, reg = virXMLPropString(node, "reg"); if (reg) { if (virStrToLong_ull(reg, NULL, 16, &addr->reg) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <address> 'reg' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'reg' attribute")); ret = -1; goto cleanup; } @@ -2479,8 +2475,8 @@ virDomainDeviceUSBMasterParseXML(xmlNodePtr node, if (startport && virStrToLong_ui(startport, NULL, 10, &master->startport) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <master> 'startport' attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <master> 'startport' attribute")); goto cleanup; } @@ -2502,26 +2498,26 @@ virDomainDeviceBootParseXML(xmlNodePtr node, order = virXMLPropString(node, "order"); if (!order) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing boot order attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing boot order attribute")); goto cleanup; } else if (virStrToLong_i(order, NULL, 10, &boot) < 0 || boot <= 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("incorrect boot order '%s', expecting positive integer"), - order); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("incorrect boot order '%s', expecting positive integer"), + order); goto cleanup; } if (bootMap) { bool set; if (virBitmapGetBit(bootMap, boot - 1, &set) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("boot orders have to be contiguous and starting from 1")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("boot orders have to be contiguous and starting from 1")); goto cleanup; } else if (set) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("boot order %d used for more than one device"), boot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("boot order %d used for more than one device"), boot); goto cleanup; } ignore_value(virBitmapSetBit(bootMap, boot - 1)); @@ -2599,8 +2595,8 @@ virDomainDeviceInfoParseXML(xmlNodePtr node, char *rombar = virXMLPropString(rom, "bar"); if (rombar && ((info->rombar = virDomainPciRombarModeTypeFromString(rombar)) <= 0)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown rom bar value '%s'"), rombar); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown rom bar value '%s'"), rombar); VIR_FREE(rombar); goto cleanup; } @@ -2615,13 +2611,13 @@ virDomainDeviceInfoParseXML(xmlNodePtr node, if (type) { if ((info->type = virDomainDeviceAddressTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown address type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown address type '%s'"), type); goto cleanup; } } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("No type specified for device address")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("No type specified for device address")); goto cleanup; } @@ -2659,8 +2655,8 @@ virDomainDeviceInfoParseXML(xmlNodePtr node, default: /* Should not happen */ - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unknown device address type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unknown device address type")); goto cleanup; } @@ -2715,15 +2711,15 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node, got_vendor = 1; if (virStrToLong_ui(vendor, NULL, 0, &def->source.subsys.u.usb.vendor) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vendor id %s"), vendor); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse vendor id %s"), vendor); VIR_FREE(vendor); goto out; } VIR_FREE(vendor); } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("usb vendor needs id")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("usb vendor needs id")); goto out; } } else if (xmlStrEqual(cur->name, BAD_CAST "product")) { @@ -2733,16 +2729,16 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node, got_product = 1; if (virStrToLong_ui(product, NULL, 0, &def->source.subsys.u.usb.product) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse product %s"), - product); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse product %s"), + product); VIR_FREE(product); goto out; } VIR_FREE(product); } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("usb product needs id")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("usb product needs id")); goto out; } } else if (xmlStrEqual(cur->name, BAD_CAST "address")) { @@ -2752,15 +2748,15 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node, if (bus) { if (virStrToLong_ui(bus, NULL, 0, &def->source.subsys.u.usb.bus) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse bus %s"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse bus %s"), bus); VIR_FREE(bus); goto out; } VIR_FREE(bus); } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("usb address needs bus id")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("usb address needs bus id")); goto out; } @@ -2768,22 +2764,22 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node, if (device) { if (virStrToLong_ui(device, NULL, 0, &def->source.subsys.u.usb.device) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse device %s"), - device); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse device %s"), + device); VIR_FREE(device); goto out; } VIR_FREE(device); } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("usb address needs device id")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("usb address needs device id")); goto out; } } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown usb source type '%s'"), - cur->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown usb source type '%s'"), + cur->name); goto out; } } @@ -2791,19 +2787,19 @@ virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node, } if (got_vendor && def->source.subsys.u.usb.vendor == 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("vendor cannot be 0.")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("vendor cannot be 0.")); goto out; } if (!got_vendor && got_product) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing vendor")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing vendor")); goto out; } if (got_vendor && !got_product) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing product")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing product")); goto out; } @@ -2836,9 +2832,9 @@ virDomainHostdevSubsysPciOrigStatesDefParseXML(const xmlNodePtr node, } else if (xmlStrEqual(cur->name, BAD_CAST "reprobe")) { def->states.pci.reprobe = 1; } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported element '%s' of 'origstates'"), - cur->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported element '%s' of 'origstates'"), + cur->name); return -1; } } @@ -2872,9 +2868,9 @@ virDomainHostdevSubsysPciDefParseXML(const xmlNodePtr node, if (devaddr && virDomainParseLegacyDeviceAddress(devaddr, &def->info->addr.pci) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse devaddr parameter '%s'"), - devaddr); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to parse devaddr parameter '%s'"), + devaddr); VIR_FREE(devaddr); goto out; } @@ -2885,9 +2881,9 @@ virDomainHostdevSubsysPciDefParseXML(const xmlNodePtr node, if (virDomainHostdevSubsysPciOrigStatesDefParseXML(cur, states) < 0) goto out; } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pci source type '%s'"), - cur->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown pci source type '%s'"), + cur->name); goto out; } } @@ -2917,8 +2913,8 @@ virDomainHostdevPartsParse(xmlNodePtr node, */ if (mode) { if ((def->mode=virDomainHostdevModeTypeFromString(mode)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown hostdev mode '%s'"), mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown hostdev mode '%s'"), mode); goto error; } } else { @@ -2946,20 +2942,20 @@ virDomainHostdevPartsParse(xmlNodePtr node, if (type) { if ((def->source.subsys.type = virDomainHostdevSubsysTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown host device source address type '%s'"), - type); + virReportError(VIR_ERR_XML_ERROR, + _("unknown host device source address type '%s'"), + type); goto error; } } else { - virDomainReportError(VIR_ERR_XML_ERROR, - "%s", _("missing source address type")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing source address type")); goto error; } if (!(sourcenode = virXPathNode("./source", ctxt))) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing <source> element in hostdev device")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Missing <source> element in hostdev device")); goto error; } switch (def->source.subsys.type) { @@ -2972,9 +2968,9 @@ virDomainHostdevPartsParse(xmlNodePtr node, goto error; break; default: - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("address type='%s' not supported in hostdev interfaces"), - virDomainHostdevSubsysTypeToString(def->source.subsys.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("address type='%s' not supported in hostdev interfaces"), + virDomainHostdevSubsysTypeToString(def->source.subsys.type)); goto error; } ret = 0; @@ -3088,8 +3084,8 @@ virSecurityLabelDefParseXML(virSecurityLabelDefPtr def, def->type = virDomainSeclabelTypeFromString(p); VIR_FREE(p); if (def->type <= 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - "%s", _("invalid security type")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("invalid security type")); goto error; } } @@ -3102,22 +3098,22 @@ virSecurityLabelDefParseXML(virSecurityLabelDefPtr def, } else if (STREQ(p, "no")) { def->norelabel = true; } else { - virDomainReportError(VIR_ERR_XML_ERROR, - _("invalid security relabel value %s"), p); + virReportError(VIR_ERR_XML_ERROR, + _("invalid security relabel value %s"), p); VIR_FREE(p); goto error; } VIR_FREE(p); if (def->type == VIR_DOMAIN_SECLABEL_DYNAMIC && def->norelabel) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("dynamic label type must use resource relabeling")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("dynamic label type must use resource relabeling")); goto error; } if (def->type == VIR_DOMAIN_SECLABEL_NONE && !def->norelabel) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("resource relabeling is not compatible with 'none' label type")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("resource relabeling is not compatible with 'none' label type")); goto error; } } else { @@ -3137,8 +3133,8 @@ virSecurityLabelDefParseXML(virSecurityLabelDefPtr def, p = virXPathStringLimit("string(./seclabel/label[1])", VIR_SECURITY_LABEL_BUFLEN-1, ctxt); if (p == NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, - "%s", _("security label is missing")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("security label is missing")); goto error; } @@ -3152,8 +3148,8 @@ virSecurityLabelDefParseXML(virSecurityLabelDefPtr def, p = virXPathStringLimit("string(./seclabel/imagelabel[1])", VIR_SECURITY_LABEL_BUFLEN-1, ctxt); if (p == NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, - "%s", _("security imagelabel is missing")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("security imagelabel is missing")); goto error; } def->imagelabel = p; @@ -3176,8 +3172,8 @@ virSecurityLabelDefParseXML(virSecurityLabelDefPtr def, p = virXPathStringLimit("string(./seclabel/@model)", VIR_SECURITY_MODEL_BUFLEN-1, ctxt); if (p == NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, - "%s", _("missing security model")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing security model")); goto error; } def->model = p; @@ -3205,9 +3201,9 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr *def, /* Can't use overrides if top-level doesn't allow relabeling. */ if (vmDef && vmDef->norelabel) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("label overrides require relabeling to be " - "enabled at the domain level")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("label overrides require relabeling to be " + "enabled at the domain level")); return -1; } @@ -3224,8 +3220,8 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr *def, } else if (STREQ(p, "no")) { (*def)->norelabel = true; } else { - virDomainReportError(VIR_ERR_XML_ERROR, - _("invalid security relabel value %s"), p); + virReportError(VIR_ERR_XML_ERROR, + _("invalid security relabel value %s"), p); VIR_FREE(p); VIR_FREE(*def); return -1; @@ -3240,8 +3236,8 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr *def, (*def)->label = p; if ((*def)->label && (*def)->norelabel) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("Cannot specify a label if relabelling is turned off")); + virReportError(VIR_ERR_XML_ERROR, + _("Cannot specify a label if relabelling is turned off")); VIR_FREE((*def)->label); VIR_FREE(*def); return -1; @@ -3286,20 +3282,20 @@ virDomainLeaseDefParseXML(xmlNodePtr node) } if (!key) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing 'key' element for lease")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Missing 'key' element for lease")); goto error; } if (!path) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing 'target' element for lease")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Missing 'target' element for lease")); goto error; } if (offset && virStrToLong_ull(offset, NULL, 10, &def->offset) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("Malformed lease target offset %s"), offset); + virReportError(VIR_ERR_XML_ERROR, + _("Malformed lease target offset %s"), offset); goto error; } @@ -3380,8 +3376,8 @@ virDomainDiskDefParseXML(virCapsPtr caps, type = virXMLPropString(node, "type"); if (type) { if ((def->type = virDomainDiskTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk type '%s'"), type); goto error; } } else { @@ -3414,21 +3410,21 @@ virDomainDiskDefParseXML(virCapsPtr caps, case VIR_DOMAIN_DISK_TYPE_NETWORK: protocol = virXMLPropString(cur, "protocol"); if (protocol == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing protocol type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing protocol type")); goto error; } def->protocol = virDomainDiskProtocolTypeFromString(protocol); if (def->protocol < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown protocol type '%s'"), - protocol); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown protocol type '%s'"), + protocol); goto error; } if (!(source = virXMLPropString(cur, "name")) && def->protocol != VIR_DOMAIN_DISK_PROTOCOL_NBD) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("missing name for disk source")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing name for disk source")); goto error; } child = cur->children; @@ -3445,14 +3441,14 @@ virDomainDiskDefParseXML(virCapsPtr caps, hosts[nhosts - 1].name = virXMLPropString(child, "name"); if (!hosts[nhosts - 1].name) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing name for host")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing name for host")); goto error; } hosts[nhosts - 1].port = virXMLPropString(child, "port"); if (!hosts[nhosts - 1].port) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing port for host")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing port for host")); goto error; } } @@ -3460,9 +3456,9 @@ virDomainDiskDefParseXML(virCapsPtr caps, } break; default: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk type %s"), - virDomainDiskTypeToString(def->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk type %s"), + virDomainDiskTypeToString(def->type)); goto error; } @@ -3500,8 +3496,8 @@ virDomainDiskDefParseXML(virCapsPtr caps, char *ready; mirror = virXMLPropString(cur, "file"); if (!mirror) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("mirror requires file name")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("mirror requires file name")); goto error; } mirrorFormat = virXMLPropString(cur, "format"); @@ -3513,8 +3509,8 @@ virDomainDiskDefParseXML(virCapsPtr caps, } else if (xmlStrEqual(cur->name, BAD_CAST "auth")) { authUsername = virXMLPropString(cur, "username"); if (authUsername == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("missing username for auth")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing username for auth")); goto error; } @@ -3525,15 +3521,15 @@ virDomainDiskDefParseXML(virCapsPtr caps, xmlStrEqual(child->name, BAD_CAST "secret")) { usageType = virXMLPropString(child, "type"); if (usageType == NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("missing type for secret")); + virReportError(VIR_ERR_XML_ERROR, + _("missing type for secret")); goto error; } if (virSecretUsageTypeTypeFromString(usageType) != VIR_SECRET_USAGE_TYPE_CEPH) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("invalid secret type %s"), - usageType); + virReportError(VIR_ERR_XML_ERROR, + _("invalid secret type %s"), + usageType); goto error; } @@ -3541,17 +3537,17 @@ virDomainDiskDefParseXML(virCapsPtr caps, authUsage = virXMLPropString(child, "usage"); if (authUUID != NULL && authUsage != NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("only one of uuid and usage can be specified")); + virReportError(VIR_ERR_XML_ERROR, + _("only one of uuid and usage can be specified")); goto error; } if (authUUID != NULL) { def->auth.secretType = VIR_DOMAIN_DISK_SECRET_TYPE_UUID; if (virUUIDParse(authUUID, def->auth.secret.uuid) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("malformed uuid %s"), - authUUID); + virReportError(VIR_ERR_XML_ERROR, + _("malformed uuid %s"), + authUUID); goto error; } } else if (authUsage != NULL) { @@ -3603,9 +3599,9 @@ virDomainDiskDefParseXML(virCapsPtr caps, def->blkdeviotune.read_bytes_sec) || (def->blkdeviotune.total_bytes_sec && def->blkdeviotune.write_bytes_sec)) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("total and read/write bytes_sec " - "cannot be set at the same time")); + virReportError(VIR_ERR_XML_ERROR, + _("total and read/write bytes_sec " + "cannot be set at the same time")); goto error; } @@ -3613,9 +3609,9 @@ virDomainDiskDefParseXML(virCapsPtr caps, def->blkdeviotune.read_iops_sec) || (def->blkdeviotune.total_iops_sec && def->blkdeviotune.write_iops_sec)) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("total and read/write iops_sec " - "cannot be set at the same time")); + virReportError(VIR_ERR_XML_ERROR, + _("total and read/write iops_sec " + "cannot be set at the same time")); goto error; } } else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) { @@ -3647,8 +3643,8 @@ virDomainDiskDefParseXML(virCapsPtr caps, device = virXMLPropString(node, "device"); if (device) { if ((def->device = virDomainDiskDeviceTypeFromString(device)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk device '%s'"), device); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk device '%s'"), device); goto error; } } else { @@ -3660,8 +3656,8 @@ virDomainDiskDefParseXML(virCapsPtr caps, if (source == NULL && hosts == NULL && def->device != VIR_DOMAIN_DISK_DEVICE_CDROM && def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) { - virDomainReportError(VIR_ERR_NO_SOURCE, - target ? "%s" : NULL, target); + virReportError(VIR_ERR_NO_SOURCE, + target ? "%s" : NULL, target); goto error; } @@ -3677,15 +3673,15 @@ virDomainDiskDefParseXML(virCapsPtr caps, } if (target == NULL) { - virDomainReportError(VIR_ERR_NO_TARGET, - source ? "%s" : NULL, source); + virReportError(VIR_ERR_NO_TARGET, + source ? "%s" : NULL, source); goto error; } if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY && !STRPREFIX(target, "fd")) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid floppy device name: %s"), target); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid floppy device name: %s"), target); goto error; } @@ -3700,17 +3696,17 @@ virDomainDiskDefParseXML(virCapsPtr caps, !STRPREFIX((const char *)target, "vd") && !STRPREFIX((const char *)target, "xvd") && !STRPREFIX((const char *)target, "ubd")) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid harddisk device name: %s"), target); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid harddisk device name: %s"), target); goto error; } if (snapshot) { def->snapshot = virDomainDiskSnapshotTypeFromString(snapshot); if (def->snapshot <= 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk snapshot setting '%s'"), - snapshot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk snapshot setting '%s'"), + snapshot); goto error; } } else if (def->readonly) { @@ -3725,22 +3721,22 @@ virDomainDiskDefParseXML(virCapsPtr caps, } else if (STREQ(rawio, "no")) { def->rawio = 0; } else { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown disk rawio setting '%s'"), - rawio); + virReportError(VIR_ERR_XML_ERROR, + _("unknown disk rawio setting '%s'"), + rawio); goto error; } } else { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("rawio can be used only with device='lun'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("rawio can be used only with device='lun'")); goto error; } } if (bus) { if ((def->bus = virDomainDiskBusTypeFromString(bus)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk bus type '%s'"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk bus type '%s'"), bus); goto error; } } else { @@ -3764,15 +3760,15 @@ virDomainDiskDefParseXML(virCapsPtr caps, if (tray) { if ((def->tray_status = virDomainDiskTrayTypeFromString(tray)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown disk tray status '%s'"), tray); + virReportError(VIR_ERR_XML_ERROR, + _("unknown disk tray status '%s'"), tray); goto error; } if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY && def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("tray is only valid for cdrom and floppy")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("tray is only valid for cdrom and floppy")); goto error; } } else { @@ -3783,28 +3779,28 @@ virDomainDiskDefParseXML(virCapsPtr caps, if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY && def->bus != VIR_DOMAIN_DISK_BUS_FDC) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid bus type '%s' for floppy disk"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid bus type '%s' for floppy disk"), bus); goto error; } if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY && def->bus == VIR_DOMAIN_DISK_BUS_FDC) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid bus type '%s' for disk"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid bus type '%s' for disk"), bus); goto error; } if (cachetag && (def->cachemode = virDomainDiskCacheTypeFromString(cachetag)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk cache mode '%s'"), cachetag); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk cache mode '%s'"), cachetag); goto error; } if (error_policy && (def->error_policy = virDomainDiskErrorPolicyTypeFromString(error_policy)) <= 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk error policy '%s'"), error_policy); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk error policy '%s'"), error_policy); goto error; } @@ -3812,34 +3808,34 @@ virDomainDiskDefParseXML(virCapsPtr caps, (((def->rerror_policy = virDomainDiskErrorPolicyTypeFromString(rerror_policy)) <= 0) || (def->rerror_policy == VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE))) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk read error policy '%s'"), - rerror_policy); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk read error policy '%s'"), + rerror_policy); goto error; } if (iotag) { if ((def->iomode = virDomainDiskIoTypeFromString(iotag)) < 0 || def->iomode == VIR_DOMAIN_DISK_IO_DEFAULT) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk io mode '%s'"), iotag); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk io mode '%s'"), iotag); goto error; } } if (ioeventfd) { if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk ioeventfd mode supported " - "only for virtio bus")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk ioeventfd mode supported " + "only for virtio bus")); goto error; } int i; if ((i = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk ioeventfd mode '%s'"), - ioeventfd); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown disk ioeventfd mode '%s'"), + ioeventfd); goto error; } def->ioeventfd=i; @@ -3847,17 +3843,17 @@ virDomainDiskDefParseXML(virCapsPtr caps, if (event_idx) { if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk event_idx mode supported " - "only for virtio bus")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk event_idx mode supported " + "only for virtio bus")); goto error; } int idx; if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk event_idx mode '%s'"), - event_idx); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown disk event_idx mode '%s'"), + event_idx); goto error; } def->event_idx = idx; @@ -3866,9 +3862,9 @@ virDomainDiskDefParseXML(virCapsPtr caps, if (copy_on_read) { int cor; if ((cor = virDomainDiskCopyOnReadTypeFromString(copy_on_read)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk copy_on_read mode '%s'"), - copy_on_read); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown disk copy_on_read mode '%s'"), + copy_on_read); goto error; } def->copy_on_read = cor; @@ -3877,9 +3873,9 @@ virDomainDiskDefParseXML(virCapsPtr caps, if (devaddr) { if (virDomainParseLegacyDeviceAddress(devaddr, &def->info.addr.pci) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse devaddr parameter '%s'"), - devaddr); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to parse devaddr parameter '%s'"), + devaddr); goto error; } def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; @@ -3893,18 +3889,18 @@ virDomainDiskDefParseXML(virCapsPtr caps, int i; if ((i = virDomainStartupPolicyTypeFromString(startupPolicy)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown startupPolicy value '%s'"), - startupPolicy); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown startupPolicy value '%s'"), + startupPolicy); goto error; } if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM && def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) { - virDomainReportError(VIR_ERR_INVALID_ARG, - _("Setting disk %s is allowed only for " - "cdrom or floppy"), - startupPolicy); + virReportError(VIR_ERR_INVALID_ARG, + _("Setting disk %s is allowed only for " + "cdrom or floppy"), + startupPolicy); goto error; } def->startupPolicy = i; @@ -4034,8 +4030,8 @@ virDomainControllerDefParseXML(xmlNodePtr node, type = virXMLPropString(node, "type"); if (type) { if ((def->type = virDomainControllerTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown controller type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown controller type '%s'"), type); goto error; } } @@ -4043,8 +4039,8 @@ virDomainControllerDefParseXML(xmlNodePtr node, idx = virXMLPropString(node, "index"); if (idx) { if (virStrToLong_i(idx, NULL, 10, &def->idx) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse controller index %s"), idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot parse controller index %s"), idx); goto error; } } @@ -4052,8 +4048,8 @@ virDomainControllerDefParseXML(xmlNodePtr node, model = virXMLPropString(node, "model"); if (model) { if ((def->model = virDomainControllerModelTypeFromString(def, model)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown model type '%s'"), model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown model type '%s'"), model); goto error; } } else { @@ -4070,8 +4066,8 @@ virDomainControllerDefParseXML(xmlNodePtr node, int r = virStrToLong_i(ports, NULL, 10, &def->opts.vioserial.ports); if (r != 0 || def->opts.vioserial.ports < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid ports: %s"), ports); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid ports: %s"), ports); VIR_FREE(ports); goto error; } @@ -4085,8 +4081,8 @@ virDomainControllerDefParseXML(xmlNodePtr node, int r = virStrToLong_i(vectors, NULL, 10, &def->opts.vioserial.vectors); if (r != 0 || def->opts.vioserial.vectors < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid vectors: %s"), vectors); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid vectors: %s"), vectors); VIR_FREE(vectors); goto error; } @@ -4127,8 +4123,8 @@ virDomainControllerDefParseXML(xmlNodePtr node, def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Controllers must use the 'pci' address type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Controllers must use the 'pci' address type")); goto error; } @@ -4171,13 +4167,13 @@ virDomainParseScaledValue(const char *xpath, ret = virXPathULongLong(xpath_full, ctxt, &bytes); if (ret < 0) { if (ret == -2) - virDomainReportError(VIR_ERR_XML_ERROR, - _("could not parse element %s"), - xpath); + virReportError(VIR_ERR_XML_ERROR, + _("could not parse element %s"), + xpath); else if (required) - virDomainReportError(VIR_ERR_XML_ERROR, - _("missing element %s"), - xpath); + virReportError(VIR_ERR_XML_ERROR, + _("missing element %s"), + xpath); else ret = 0; goto cleanup; @@ -4230,8 +4226,8 @@ virDomainFSDefParseXML(xmlNodePtr node, type = virXMLPropString(node, "type"); if (type) { if ((def->type = virDomainFSTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown filesystem type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown filesystem type '%s'"), type); goto error; } } else { @@ -4241,8 +4237,8 @@ virDomainFSDefParseXML(xmlNodePtr node, accessmode = virXMLPropString(node, "accessmode"); if (accessmode) { if ((def->accessmode = virDomainFSAccessModeTypeFromString(accessmode)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown accessmode '%s'"), accessmode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown accessmode '%s'"), accessmode); goto error; } } else { @@ -4293,16 +4289,16 @@ virDomainFSDefParseXML(xmlNodePtr node, if (fsdriver) { if ((def->fsdriver = virDomainFSDriverTypeTypeFromString(fsdriver)) <= 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown fs driver type '%s'"), fsdriver); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown fs driver type '%s'"), fsdriver); goto error; } } if (wrpolicy) { if ((def->wrpolicy = virDomainFSWrpolicyTypeFromString(wrpolicy)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown filesystem write policy '%s'"), wrpolicy); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown filesystem write policy '%s'"), wrpolicy); goto error; } } else { @@ -4311,27 +4307,27 @@ virDomainFSDefParseXML(xmlNodePtr node, if (source == NULL && def->type != VIR_DOMAIN_FS_TYPE_RAM) { - virDomainReportError(VIR_ERR_NO_SOURCE, - target ? "%s" : NULL, target); + virReportError(VIR_ERR_NO_SOURCE, + target ? "%s" : NULL, target); goto error; } if (target == NULL) { - virDomainReportError(VIR_ERR_NO_TARGET, - source ? "%s" : NULL, source); + virReportError(VIR_ERR_NO_TARGET, + source ? "%s" : NULL, source); goto error; } if (def->type == VIR_DOMAIN_FS_TYPE_RAM) { if (!usage) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("missing 'usage' attribute for RAM filesystem")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing 'usage' attribute for RAM filesystem")); goto error; } if (virStrToLong_ull(usage, NULL, 10, &def->usage) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("cannot parse usage '%s' for RAM filesystem"), - usage); + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse usage '%s' for RAM filesystem"), + usage); goto error; } if (unit && @@ -4391,22 +4387,22 @@ virDomainActualNetDefParseXML(xmlNodePtr node, type = virXMLPropString(node, "type"); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing type attribute in interface's <actual> element")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing type attribute in interface's <actual> element")); goto error; } if ((actual->type = virDomainNetTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown type '%s' in interface's <actual> element"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown type '%s' in interface's <actual> element"), type); goto error; } if (actual->type != VIR_DOMAIN_NET_TYPE_BRIDGE && actual->type != VIR_DOMAIN_NET_TYPE_DIRECT && actual->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && actual->type != VIR_DOMAIN_NET_TYPE_NETWORK) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported type '%s' in interface's <actual> element"), - type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported type '%s' in interface's <actual> element"), + type); goto error; } @@ -4425,9 +4421,9 @@ virDomainActualNetDefParseXML(xmlNodePtr node, if (mode) { int m; if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unkown mode '%s' in interface <actual> element"), - mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unkown mode '%s' in interface <actual> element"), + mode); goto error; } actual->data.direct.mode = m; @@ -4540,8 +4536,8 @@ virDomainNetDefParseXML(virCapsPtr caps, type = virXMLPropString(node, "type"); if (type != NULL) { if ((int)(def->type = virDomainNetTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown interface type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown interface type '%s'"), type); goto error; } } else { @@ -4642,15 +4638,15 @@ virDomainNetDefParseXML(virCapsPtr caps, if (macaddr) { if (virMacAddrParse((const char *)macaddr, &def->mac) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unable to parse mac address '%s'"), - (const char *)macaddr); + virReportError(VIR_ERR_XML_ERROR, + _("unable to parse mac address '%s'"), + (const char *)macaddr); goto error; } if (virMacAddrIsMulticast(&def->mac)) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("expected unicast mac address, found multicast '%s'"), - (const char *)macaddr); + virReportError(VIR_ERR_XML_ERROR, + _("expected unicast mac address, found multicast '%s'"), + (const char *)macaddr); goto error; } } else { @@ -4660,9 +4656,9 @@ virDomainNetDefParseXML(virCapsPtr caps, if (devaddr) { if (virDomainParseLegacyDeviceAddress(devaddr, &def->info.addr.pci) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse devaddr parameter '%s'"), - devaddr); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to parse devaddr parameter '%s'"), + devaddr); goto error; } def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; @@ -4679,16 +4675,17 @@ virDomainNetDefParseXML(virCapsPtr caps, def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Network interfaces must use 'pci' address type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Network interfaces must use 'pci' address type")); goto error; } switch (def->type) { case VIR_DOMAIN_NET_TYPE_NETWORK: if (network == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("No <source> 'network' attribute specified with <interface type='network'/>")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <source> 'network' attribute " + "specified with <interface type='network'/>")); goto error; } def->data.network.name = network; @@ -4714,8 +4711,9 @@ virDomainNetDefParseXML(virCapsPtr caps, case VIR_DOMAIN_NET_TYPE_BRIDGE: if (bridge == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("No <source> 'bridge' attribute specified with <interface type='bridge'/>")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <source> 'bridge' attribute " + "specified with <interface type='bridge'/>")); goto error; } def->data.bridge.brname = bridge; @@ -4732,21 +4730,24 @@ virDomainNetDefParseXML(virCapsPtr caps, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_MCAST: if (port == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("No <source> 'port' attribute specified with socket interface")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <source> 'port' attribute " + "specified with socket interface")); goto error; } if (virStrToLong_i(port, NULL, 10, &def->data.socket.port) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse <source> 'port' attribute with socket interface")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <source> 'port' attribute " + "with socket interface")); goto error; } if (address == NULL) { if (def->type == VIR_DOMAIN_NET_TYPE_CLIENT || def->type == VIR_DOMAIN_NET_TYPE_MCAST) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("No <source> 'address' attribute specified with socket interface")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <source> 'address' attribute " + "specified with socket interface")); goto error; } } else { @@ -4757,8 +4758,9 @@ virDomainNetDefParseXML(virCapsPtr caps, case VIR_DOMAIN_NET_TYPE_INTERNAL: if (internal == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("No <source> 'name' attribute specified with <interface type='internal'/>")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <source> 'name' attribute specified " + "with <interface type='internal'/>")); goto error; } def->data.internal.name = internal; @@ -4767,16 +4769,17 @@ virDomainNetDefParseXML(virCapsPtr caps, case VIR_DOMAIN_NET_TYPE_DIRECT: if (dev == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("No <source> 'dev' attribute specified with <interface type='direct'/>")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No <source> 'dev' attribute specified " + "with <interface type='direct'/>")); goto error; } if (mode != NULL) { int m; if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unkown mode has been specified")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unkown mode has been specified")); goto error; } def->data.direct.mode = m; @@ -4840,8 +4843,8 @@ virDomainNetDefParseXML(virCapsPtr caps, */ if (model != NULL) { if (strspn(model, NET_MODEL_CHARS) < strlen(model)) { - virDomainReportError(VIR_ERR_INVALID_ARG, "%s", - _("Model name contains invalid characters")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Model name contains invalid characters")); goto error; } def->model = model; @@ -4853,10 +4856,10 @@ virDomainNetDefParseXML(virCapsPtr caps, int name; if ((name = virDomainNetBackendTypeFromString(backend)) < 0 || name == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown interface <driver name='%s'> " - "has been specified"), - backend); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown interface <driver name='%s'> " + "has been specified"), + backend); goto error; } def->driver.virtio.name = name; @@ -4865,10 +4868,10 @@ virDomainNetDefParseXML(virCapsPtr caps, int m; if ((m = virDomainNetVirtioTxModeTypeFromString(txmode)) < 0 || m == VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown interface <driver txmode='%s'> " - "has been specified"), - txmode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown interface <driver txmode='%s'> " + "has been specified"), + txmode); goto error; } def->driver.virtio.txmode = m; @@ -4876,9 +4879,9 @@ virDomainNetDefParseXML(virCapsPtr caps, if (ioeventfd) { int i; if ((i = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown interface ioeventfd mode '%s'"), - ioeventfd); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown interface ioeventfd mode '%s'"), + ioeventfd); goto error; } def->driver.virtio.ioeventfd = i; @@ -4886,9 +4889,9 @@ virDomainNetDefParseXML(virCapsPtr caps, if (event_idx) { int idx; if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown interface event_idx mode '%s'"), - event_idx); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown interface event_idx mode '%s'"), + event_idx); goto error; } def->driver.virtio.event_idx = idx; @@ -4898,9 +4901,9 @@ virDomainNetDefParseXML(virCapsPtr caps, def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT; if (linkstate != NULL) { if ((def->linkstate = virDomainNetInterfaceLinkStateTypeFromString(linkstate)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown interface link state '%s'"), - linkstate); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown interface link state '%s'"), + linkstate); goto error; } } @@ -4924,8 +4927,8 @@ virDomainNetDefParseXML(virCapsPtr caps, if (ret >= 0) { def->tune.sndbuf_specified = true; } else if (ret == -2) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("sndbuf must be a positive integer")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("sndbuf must be a positive integer")); goto error; } @@ -4973,15 +4976,15 @@ virDomainChrDefaultTargetType(virCapsPtr caps, switch (devtype) { case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: - virDomainReportError(VIR_ERR_XML_ERROR, - _("target type must be specified for %s device"), - virDomainChrDeviceTypeToString(devtype)); + virReportError(VIR_ERR_XML_ERROR, + _("target type must be specified for %s device"), + virDomainChrDeviceTypeToString(devtype)); break; case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: if (!caps->defaultConsoleTargetType) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Driver does not have a default console type set")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Driver does not have a default console type set")); return -1; } target = caps->defaultConsoleTargetType(def->os.type); @@ -5048,9 +5051,9 @@ virDomainChrDefParseTargetXML(virCapsPtr caps, if ((def->targetType = virDomainChrTargetTypeFromString(caps, vmdef, def->deviceType, targetType)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown target type '%s' specified for character device"), - targetType); + virReportError(VIR_ERR_XML_ERROR, + _("unknown target type '%s' specified for character device"), + targetType); goto error; } @@ -5062,9 +5065,9 @@ virDomainChrDefParseTargetXML(virCapsPtr caps, portStr = virXMLPropString(cur, "port"); if (addrStr == NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("guestfwd channel does not " - "define a target address")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("guestfwd channel does not " + "define a target address")); goto error; } @@ -5077,23 +5080,23 @@ virDomainChrDefParseTargetXML(virCapsPtr caps, goto error; if (def->target.addr->data.stor.ss_family != AF_INET) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("guestfwd channel only supports " - "IPv4 addresses")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("guestfwd channel only supports " + "IPv4 addresses")); goto error; } if (portStr == NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("guestfwd channel does " - "not define a target port")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("guestfwd channel does " + "not define a target port")); goto error; } if (virStrToLong_ui(portStr, NULL, 10, &port) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("Invalid port number: %s"), - portStr); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid port number: %s"), + portStr); goto error; } @@ -5115,9 +5118,9 @@ virDomainChrDefParseTargetXML(virCapsPtr caps, } if (virStrToLong_ui(portStr, NULL, 10, &port) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("Invalid port number: %s"), - portStr); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid port number: %s"), + portStr); goto error; } def->target.port = port; @@ -5187,9 +5190,9 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, if (bindService == NULL) bindService = virXMLPropString(cur, "service"); } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown source mode '%s'"), - mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown source mode '%s'"), + mode); goto error; } @@ -5220,8 +5223,8 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, case VIR_DOMAIN_CHR_TYPE_PIPE: if (path == NULL && def->type != VIR_DOMAIN_CHR_TYPE_PTY) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing source path attribute for char device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing source path attribute for char device")); goto error; } @@ -5238,13 +5241,13 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, if (mode == NULL || STREQ(mode, "connect")) { if (connectHost == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing source host attribute for char device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing source host attribute for char device")); goto error; } if (connectService == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing source service attribute for char device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing source service attribute for char device")); goto error; } @@ -5255,13 +5258,13 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, def->data.tcp.listen = false; } else { if (bindHost == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing source host attribute for char device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing source host attribute for char device")); goto error; } if (bindService == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing source service attribute for char device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing source service attribute for char device")); goto error; } @@ -5276,8 +5279,8 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW; else if ((def->data.tcp.protocol = virDomainChrTcpProtocolTypeFromString(protocol)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown protocol '%s'"), protocol); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown protocol '%s'"), protocol); goto error; } @@ -5285,8 +5288,8 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, case VIR_DOMAIN_CHR_TYPE_UDP: if (connectService == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing source service attribute for char device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing source service attribute for char device")); goto error; } @@ -5303,8 +5306,8 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, case VIR_DOMAIN_CHR_TYPE_UNIX: if (path == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing source path attribute for char device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing source path attribute for char device")); goto error; } @@ -5406,17 +5409,17 @@ virDomainChrDefParseXML(virCapsPtr caps, if (type == NULL) { def->source.type = VIR_DOMAIN_CHR_TYPE_PTY; } else if ((def->source.type = virDomainChrTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown type presented to host for character device: %s"), - type); + virReportError(VIR_ERR_XML_ERROR, + _("unknown type presented to host for character device: %s"), + type); goto error; } nodeName = (const char *) node->name; if ((def->deviceType = virDomainChrDeviceTypeFromString(nodeName)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown character device type: %s"), - nodeName); + virReportError(VIR_ERR_XML_ERROR, + _("unknown character device type: %s"), + nodeName); } cur = node->children; @@ -5443,9 +5446,9 @@ virDomainChrDefParseXML(virCapsPtr caps, if (def->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) { if (def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("spicevmc device type only supports " - "virtio")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("spicevmc device type only supports " + "virtio")); goto error; } else { def->source.data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_VDAGENT; @@ -5483,14 +5486,14 @@ virDomainSmartcardDefParseXML(xmlNodePtr node, mode = virXMLPropString(node, "mode"); if (mode == NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("missing smartcard device mode")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing smartcard device mode")); goto error; } if ((def->type = virDomainSmartcardTypeFromString(mode)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown smartcard device mode: %s"), - mode); + virReportError(VIR_ERR_XML_ERROR, + _("unknown smartcard device mode: %s"), + mode); goto error; } @@ -5505,9 +5508,9 @@ virDomainSmartcardDefParseXML(xmlNodePtr node, if (cur->type == XML_ELEMENT_NODE && xmlStrEqual(cur->name, BAD_CAST "certificate")) { if (i == 3) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("host-certificates mode needs " - "exactly three certificates")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("host-certificates mode needs " + "exactly three certificates")); goto error; } def->data.cert.file[i] = (char *)xmlNodeGetContent(cur); @@ -5525,18 +5528,18 @@ virDomainSmartcardDefParseXML(xmlNodePtr node, goto error; } if (*def->data.cert.database != '/') { - virDomainReportError(VIR_ERR_XML_ERROR, - _("expecting absolute path: %s"), - def->data.cert.database); + virReportError(VIR_ERR_XML_ERROR, + _("expecting absolute path: %s"), + def->data.cert.database); goto error; } } cur = cur->next; } if (i < 3) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("host-certificates mode needs " - "exactly three certificates")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("host-certificates mode needs " + "exactly three certificates")); goto error; } break; @@ -5544,15 +5547,15 @@ virDomainSmartcardDefParseXML(xmlNodePtr node, case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: type = virXMLPropString(node, "type"); if (type == NULL) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("passthrough mode requires a character " - "device type attribute")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("passthrough mode requires a character " + "device type attribute")); goto error; } if ((def->data.passthru.type = virDomainChrTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown type presented to host for " - "character device: %s"), type); + virReportError(VIR_ERR_XML_ERROR, + _("unknown type presented to host for " + "character device: %s"), type); goto error; } @@ -5568,8 +5571,8 @@ virDomainSmartcardDefParseXML(xmlNodePtr node, break; default: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unknown smartcard mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unknown smartcard mode")); goto error; } @@ -5577,8 +5580,8 @@ virDomainSmartcardDefParseXML(xmlNodePtr node, goto error; if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Controllers must use the 'ccid' address type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Controllers must use the 'ccid' address type")); goto error; } @@ -5613,48 +5616,48 @@ virDomainInputDefParseXML(const char *ostype, bus = virXMLPropString(node, "bus"); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing input device type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing input device type")); goto error; } if ((def->type = virDomainInputTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown input device type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown input device type '%s'"), type); goto error; } if (bus) { if ((def->bus = virDomainInputBusTypeFromString(bus)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown input bus type '%s'"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown input bus type '%s'"), bus); goto error; } if (STREQ(ostype, "hvm")) { if (def->bus == VIR_DOMAIN_INPUT_BUS_PS2 && /* Only allow mouse for ps2 */ def->type != VIR_DOMAIN_INPUT_TYPE_MOUSE) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("ps2 bus does not support %s input device"), - type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("ps2 bus does not support %s input device"), + type); goto error; } if (def->bus == VIR_DOMAIN_INPUT_BUS_XEN) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported input bus %s"), - bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported input bus %s"), + bus); goto error; } } else { if (def->bus != VIR_DOMAIN_INPUT_BUS_XEN) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported input bus %s"), - bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported input bus %s"), + bus); } if (def->type != VIR_DOMAIN_INPUT_TYPE_MOUSE) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("xen bus does not support %s input device"), - type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("xen bus does not support %s input device"), + type); goto error; } } @@ -5675,8 +5678,8 @@ virDomainInputDefParseXML(const char *ostype, if (def->bus == VIR_DOMAIN_INPUT_BUS_USB && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid address for a USB device")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Invalid address for a USB device")); goto error; } @@ -5708,14 +5711,14 @@ virDomainHubDefParseXML(xmlNodePtr node, unsigned int flags) type = virXMLPropString(node, "type"); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing hub device type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing hub device type")); goto error; } if ((def->type = virDomainHubTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown hub device type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown hub device type '%s'"), type); goto error; } @@ -5759,13 +5762,13 @@ virDomainTimerDefParseXML(const xmlNodePtr node, name = virXMLPropString(node, "name"); if (name == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing timer name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing timer name")); goto error; } if ((def->name = virDomainTimerNameTypeFromString(name)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown timer name '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown timer name '%s'"), name); goto error; } @@ -5776,8 +5779,8 @@ virDomainTimerDefParseXML(const xmlNodePtr node, } else if (STREQ(present, "no")) { def->present = 0; } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown timer present value '%s'"), present); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown timer present value '%s'"), present); goto error; } } @@ -5786,8 +5789,8 @@ virDomainTimerDefParseXML(const xmlNodePtr node, tickpolicy = virXMLPropString(node, "tickpolicy"); if (tickpolicy != NULL) { if ((def->tickpolicy = virDomainTimerTickpolicyTypeFromString(tickpolicy)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown timer tickpolicy '%s'"), tickpolicy); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown timer tickpolicy '%s'"), tickpolicy); goto error; } } @@ -5796,8 +5799,8 @@ virDomainTimerDefParseXML(const xmlNodePtr node, track = virXMLPropString(node, "track"); if (track != NULL) { if ((def->track = virDomainTimerTrackTypeFromString(track)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown timer track '%s'"), track); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown timer track '%s'"), track); goto error; } } @@ -5806,8 +5809,8 @@ virDomainTimerDefParseXML(const xmlNodePtr node, if (ret == -1) { def->frequency = 0; } else if (ret < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid timer frequency")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid timer frequency")); goto error; } @@ -5815,8 +5818,8 @@ virDomainTimerDefParseXML(const xmlNodePtr node, mode = virXMLPropString(node, "mode"); if (mode != NULL) { if ((def->mode = virDomainTimerModeTypeFromString(mode)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown timer mode '%s'"), mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown timer mode '%s'"), mode); goto error; } } @@ -5828,8 +5831,8 @@ virDomainTimerDefParseXML(const xmlNodePtr node, if (ret == -1) { def->catchup.threshold = 0; } else if (ret < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid catchup threshold")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid catchup threshold")); goto error; } @@ -5837,8 +5840,8 @@ virDomainTimerDefParseXML(const xmlNodePtr node, if (ret == -1) { def->catchup.slew = 0; } else if (ret < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid catchup slew")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid catchup slew")); goto error; } @@ -5846,8 +5849,8 @@ virDomainTimerDefParseXML(const xmlNodePtr node, if (ret == -1) { def->catchup.limit = 0; } else if (ret < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid catchup limit")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid catchup limit")); goto error; } } @@ -5899,9 +5902,9 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, virStrToLong_i(tmp+1, &tmp, 10, &tm.tm_min) < 0 || *tmp != ':' || /* second */ virStrToLong_i(tmp+1, &tmp, 10, &tm.tm_sec) < 0 || *tmp != '\0') { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse password validity time '%s', expect YYYY-MM-DDTHH:MM:SS"), - validTo); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse password validity time '%s', expect YYYY-MM-DDTHH:MM:SS"), + validTo); VIR_FREE(validTo); VIR_FREE(def->passwd); return -1; @@ -5918,9 +5921,9 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, if (connected) { int action = virDomainGraphicsAuthConnectedTypeFromString(connected); if (action <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown connected value %s"), - connected); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown connected value %s"), + connected); VIR_FREE(connected); return -1; } @@ -5929,8 +5932,8 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, /* VNC supports connected='keep' only */ if (type == VIR_DOMAIN_GRAPHICS_TYPE_VNC && action != VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_KEEP) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("VNC supports connected='keep' only")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VNC supports connected='keep' only")); return -1; } @@ -5951,14 +5954,14 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, char *network = virXMLPropString(node, "network"); if (!type) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("graphics listen type must be specified")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("graphics listen type must be specified")); goto error; } if ((def->type = virDomainGraphicsListenTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown graphics listen type '%s'"), type); + virReportError(VIR_ERR_XML_ERROR, + _("unknown graphics listen type '%s'"), type); goto error; } @@ -5977,8 +5980,8 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def, if (def->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) { /* network='xxx' never makes sense with anything except * type='address' */ - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("network attribute not allowed when listen type is not network")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("network attribute not allowed when listen type is not network")); goto error; } def->network = network; @@ -6019,14 +6022,14 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, type = virXMLPropString(node, "type"); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing graphics device type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing graphics device type")); goto error; } if ((def->type = virDomainGraphicsTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown graphics device type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown graphics device type '%s'"), type); goto error; } @@ -6092,10 +6095,10 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, } } if (!matched) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("graphics listen attribute %s must match address " - "attribute of first listen element (found %s)"), - listenAddr, found ? found : "none"); + virReportError(VIR_ERR_XML_ERROR, + _("graphics listen attribute %s must match address " + "attribute of first listen element (found %s)"), + listenAddr, found ? found : "none"); goto error; } } @@ -6108,8 +6111,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, if (port) { if (virStrToLong_i(port, NULL, 10, &def->data.vnc.port) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vnc port %s"), port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse vnc port %s"), port); VIR_FREE(port); goto error; } @@ -6149,8 +6152,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, } else if (STREQ(fullscreen, "no")) { def->data.sdl.fullscreen = 0; } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown fullscreen value '%s'"), fullscreen); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown fullscreen value '%s'"), fullscreen); VIR_FREE(fullscreen); goto error; } @@ -6168,8 +6171,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, if (port) { if (virStrToLong_i(port, NULL, 10, &def->data.rdp.port) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse rdp port %s"), port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse rdp port %s"), port); VIR_FREE(port); goto error; } @@ -6216,8 +6219,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, } else if (STREQ(fullscreen, "no")) { def->data.desktop.fullscreen = 0; } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown fullscreen value '%s'"), fullscreen); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown fullscreen value '%s'"), fullscreen); VIR_FREE(fullscreen); goto error; } @@ -6237,8 +6240,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, if (port) { if (virStrToLong_i(port, NULL, 10, &def->data.spice.port) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse spice port %s"), port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse spice port %s"), port); VIR_FREE(port); goto error; } @@ -6250,8 +6253,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, tlsPort = virXMLPropString(node, "tlsPort"); if (tlsPort) { if (virStrToLong_i(tlsPort, NULL, 10, &def->data.spice.tlsPort) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse spice tlsPort %s"), tlsPort); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse spice tlsPort %s"), tlsPort); VIR_FREE(tlsPort); goto error; } @@ -6270,9 +6273,9 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, if ((defaultMode = virXMLPropString(node, "defaultMode")) != NULL) { if ((defaultModeVal = virDomainGraphicsSpiceChannelModeTypeFromString(defaultMode)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown default spice channel mode %s"), - defaultMode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown default spice channel mode %s"), + defaultMode); VIR_FREE(defaultMode); goto error; } @@ -6306,25 +6309,25 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, mode = virXMLPropString(cur, "mode"); if (!name || !mode) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice channel missing name/mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("spice channel missing name/mode")); VIR_FREE(name); VIR_FREE(mode); goto error; } if ((nameval = virDomainGraphicsSpiceChannelNameTypeFromString(name)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown spice channel name %s"), - name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown spice channel name %s"), + name); VIR_FREE(name); VIR_FREE(mode); goto error; } if ((modeval = virDomainGraphicsSpiceChannelModeTypeFromString(mode)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown spice channel mode %s"), - mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown spice channel mode %s"), + mode); VIR_FREE(name); VIR_FREE(mode); goto error; @@ -6338,16 +6341,16 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int compressionVal; if (!compression) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice image missing compression")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("spice image missing compression")); goto error; } if ((compressionVal = virDomainGraphicsSpiceImageCompressionTypeFromString(compression)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice image compression %s"), - compression); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown spice image compression %s"), + compression); VIR_FREE(compression); goto error; } @@ -6359,16 +6362,16 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int compressionVal; if (!compression) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice jpeg missing compression")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("spice jpeg missing compression")); goto error; } if ((compressionVal = virDomainGraphicsSpiceJpegCompressionTypeFromString(compression)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice jpeg compression %s"), - compression); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown spice jpeg compression %s"), + compression); VIR_FREE(compression); goto error; } @@ -6380,16 +6383,16 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int compressionVal; if (!compression) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice zlib missing compression")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("spice zlib missing compression")); goto error; } if ((compressionVal = virDomainGraphicsSpiceZlibCompressionTypeFromString(compression)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice zlib compression %s"), - compression); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown spice zlib compression %s"), + compression); VIR_FREE(compression); goto error; } @@ -6401,15 +6404,15 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int compressionVal; if (!compression) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("spice playback missing compression")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("spice playback missing compression")); goto error; } if ((compressionVal = virDomainGraphicsSpicePlaybackCompressionTypeFromString(compression)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice playback compression")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown spice playback compression")); VIR_FREE(compression); goto error; @@ -6422,14 +6425,14 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int modeVal; if (!mode) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("spice streaming missing mode")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("spice streaming missing mode")); goto error; } if ((modeVal = virDomainGraphicsSpiceStreamingModeTypeFromString(mode)) <= 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown spice streaming mode")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown spice streaming mode")); VIR_FREE(mode); goto error; @@ -6442,15 +6445,15 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int copypasteVal; if (!copypaste) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("spice clipboard missing copypaste")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("spice clipboard missing copypaste")); goto error; } if ((copypasteVal = virDomainGraphicsSpiceClipboardCopypasteTypeFromString(copypaste)) <= 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown copypaste value '%s'"), copypaste); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown copypaste value '%s'"), copypaste); VIR_FREE(copypaste); goto error; } @@ -6462,15 +6465,15 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int modeVal; if (!mode) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("spice mouse missing mode")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("spice mouse missing mode")); goto error; } if ((modeVal = virDomainGraphicsSpiceMouseModeTypeFromString(mode)) <= 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown mouse mode value '%s'"), - mode); + virReportError(VIR_ERR_XML_ERROR, + _("unknown mouse mode value '%s'"), + mode); VIR_FREE(mode); goto error; } @@ -6511,8 +6514,8 @@ virDomainSoundCodecDefParseXML(const xmlNodePtr node) type = virXMLPropString(node, "type"); if ((def->type = virDomainSoundCodecTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown codec type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown codec type '%s'"), type); goto error; } @@ -6546,8 +6549,8 @@ virDomainSoundDefParseXML(const xmlNodePtr node, model = virXMLPropString(node, "model"); if ((def->model = virDomainSoundModelTypeFromString(model)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown sound model '%s'"), model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown sound model '%s'"), model); goto error; } @@ -6613,14 +6616,14 @@ virDomainWatchdogDefParseXML(const xmlNodePtr node, model = virXMLPropString (node, "model"); if (model == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("watchdog must contain model name")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("watchdog must contain model name")); goto error; } def->model = virDomainWatchdogModelTypeFromString (model); if (def->model < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown watchdog model '%s'"), model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown watchdog model '%s'"), model); goto error; } @@ -6630,8 +6633,8 @@ virDomainWatchdogDefParseXML(const xmlNodePtr node, else { def->action = virDomainWatchdogActionTypeFromString (action); if (def->action < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown watchdog action '%s'"), action); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown watchdog action '%s'"), action); goto error; } } @@ -6666,13 +6669,13 @@ virDomainMemballoonDefParseXML(const xmlNodePtr node, model = virXMLPropString(node, "model"); if (model == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("balloon memory must contain model name")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("balloon memory must contain model name")); goto error; } if ((def->model = virDomainMemballoonModelTypeFromString(model)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown memory balloon model '%s'"), model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown memory balloon model '%s'"), model); goto error; } @@ -6698,8 +6701,8 @@ virSysinfoParseXML(const xmlNodePtr node, char *type; if (!xmlStrEqual(node->name, BAD_CAST "sysinfo")) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("XML does not contain expected 'sysinfo' element")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("XML does not contain expected 'sysinfo' element")); return NULL; } @@ -6710,13 +6713,13 @@ virSysinfoParseXML(const xmlNodePtr node, type = virXMLPropString(node, "type"); if (type == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("sysinfo must contain a type attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("sysinfo must contain a type attribute")); goto error; } if ((def->type = virSysinfoTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown sysinfo type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown sysinfo type '%s'"), type); goto error; } @@ -6893,22 +6896,22 @@ virDomainVideoDefParseXML(const xmlNodePtr node, if (type) { if ((def->type = virDomainVideoTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown video model '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown video model '%s'"), type); goto error; } } else { if ((def->type = virDomainVideoDefaultType(dom)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing video model and cannot determine default")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing video model and cannot determine default")); goto error; } } if (vram) { if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse video ram '%s'"), vram); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse video ram '%s'"), vram); goto error; } } else { @@ -6917,8 +6920,8 @@ virDomainVideoDefParseXML(const xmlNodePtr node, if (heads) { if (virStrToLong_ui(heads, NULL, 10, &def->heads) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse video heads '%s'"), heads); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse video heads '%s'"), heads); goto error; } } else { @@ -6974,8 +6977,8 @@ virDomainHostdevDefParseXML(const xmlNodePtr node, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: if (def->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("PCI host devices must use 'pci' address type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("PCI host devices must use 'pci' address type")); goto error; } break; @@ -7011,8 +7014,8 @@ virDomainRedirdevDefParseXML(const xmlNodePtr node, bus = virXMLPropString(node, "bus"); if (bus) { if ((def->bus = virDomainRedirdevBusTypeFromString(bus)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown redirdev bus '%s'"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown redirdev bus '%s'"), bus); goto error; } } else { @@ -7022,13 +7025,13 @@ virDomainRedirdevDefParseXML(const xmlNodePtr node, type = virXMLPropString(node, "type"); if (type) { if ((def->source.chr.type = virDomainChrTypeFromString(type)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown redirdev character device type '%s'"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown redirdev character device type '%s'"), type); goto error; } } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing type in redirdev")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing type in redirdev")); goto error; } @@ -7056,8 +7059,8 @@ virDomainRedirdevDefParseXML(const xmlNodePtr node, if (def->bus == VIR_DOMAIN_REDIRDEV_BUS_USB && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid address for a USB device")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Invalid address for a USB device")); goto error; } @@ -7085,8 +7088,8 @@ static int virDomainLifecycleParseXML(xmlXPathContextPtr ctxt, } else { *val = convFunc(tmp); if (*val < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown lifecycle action %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown lifecycle action %s"), tmp); VIR_FREE(tmp); return -1; } @@ -7172,8 +7175,8 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps, if (!(dev->data.redirdev = virDomainRedirdevDefParseXML(node, flags))) goto error; } else { - virDomainReportError(VIR_ERR_XML_ERROR, - "%s", _("unknown device type")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("unknown device type")); goto error; } @@ -7643,8 +7646,8 @@ static char *virDomainDefDefaultEmulator(virDomainDefPtr def, type = virDomainVirtTypeToString(def->virtType); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unknown virt type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unknown virt type")); return NULL; } @@ -7654,9 +7657,9 @@ static char *virDomainDefDefaultEmulator(virDomainDefPtr def, type); if (!emulator) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("no emulator for domain %s os type %s on architecture %s"), - type, def->os.type, def->os.arch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no emulator for domain %s os type %s on architecture %s"), + type, def->os.type, def->os.arch); return NULL; } @@ -7682,8 +7685,8 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, if (virXPathULong("count(./devices/disk[boot]" "|./devices/interface[boot]" "|./devices/hostdev[boot])", ctxt, &deviceBoot) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot count boot devices")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot count boot devices")); goto cleanup; } @@ -7693,9 +7696,9 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, } if (n > 0 && deviceBoot) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("per-device boot elements cannot be used" - " together with os/boot elements")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("per-device boot elements cannot be used" + " together with os/boot elements")); goto cleanup; } @@ -7703,14 +7706,14 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, int val; char *dev = virXMLPropString(nodes[i], "dev"); if (!dev) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing boot device")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing boot device")); goto cleanup; } if ((val = virDomainBootTypeFromString(dev)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown boot device '%s'"), - dev); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown boot device '%s'"), + dev); VIR_FREE(dev); goto cleanup; } @@ -7736,9 +7739,9 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, if (STREQ(useserial, "yes")) { if (virXPathULong("count(./devices/serial)", ctxt, &serialPorts) < 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("need at least one serial port " - "for useserial")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("need at least one serial port " + "for useserial")); goto cleanup; } def->os.bios.useserial = VIR_DOMAIN_BIOS_USESERIAL_YES; @@ -7777,18 +7780,18 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node, ret = virXPathUInt("string(./@vcpu)", ctxt, &vcpuid); if (ret == -2) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("vcpu id must be an unsigned integer")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("vcpu id must be an unsigned integer")); goto error; } else if (ret == -1) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("can't parse vcpupin node")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("can't parse vcpupin node")); goto error; } if (vcpuid >= maxvcpus) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("vcpu id must be less than maxvcpus")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("vcpu id must be less than maxvcpus")); goto error; } @@ -7809,8 +7812,8 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node, goto error; VIR_FREE(tmp); } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing cpuset for vcpupin")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing cpuset for vcpupin")); goto error; } @@ -7927,24 +7930,24 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, /* Find out what type of virtualization to use */ if (!(tmp = virXPathString("string(./@type)", ctxt))) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing domain type attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing domain type attribute")); goto error; } if ((def->virtType = virDomainVirtTypeFromString(tmp)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid domain type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid domain type %s"), tmp); goto error; } VIR_FREE(tmp); if ((expectedVirtTypes & (1 << def->virtType)) == 0) { if (count_one_bits(expectedVirtTypes) == 1) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected domain type %s, expecting %s"), - virDomainVirtTypeToString(def->virtType), - virDomainVirtTypeToString(ffs(expectedVirtTypes) - 1)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected domain type %s, expecting %s"), + virDomainVirtTypeToString(def->virtType), + virDomainVirtTypeToString(ffs(expectedVirtTypes) - 1)); } else { virBuffer buffer = VIR_BUFFER_INITIALIZER; char *string; @@ -7966,11 +7969,11 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, string = virBufferContentAndReset(&buffer); - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected domain type %s, " - "expecting one of these: %s"), - virDomainVirtTypeToString(def->virtType), - string); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected domain type %s, " + "expecting one of these: %s"), + virDomainVirtTypeToString(def->virtType), + string); VIR_FREE(string); } @@ -7980,7 +7983,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, /* Extract domain name */ if (!(def->name = virXPathString("string(./name[1])", ctxt))) { - virDomainReportError(VIR_ERR_NO_NAME, NULL); + virReportError(VIR_ERR_NO_NAME, NULL); goto error; } @@ -7990,15 +7993,15 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, tmp = virXPathString("string(./uuid[1])", ctxt); if (!tmp) { if (virUUIDGenerate(def->uuid)) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to generate UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate UUID")); goto error; } uuid_generated = true; } else { if (virUUIDParse(tmp, def->uuid) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed uuid element")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed uuid element")); goto error; } VIR_FREE(tmp); @@ -8007,8 +8010,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, /* Extract short description of domain (title) */ def->title = virXPathString("string(./title[1])", ctxt); if (def->title && strchr(def->title, '\n')) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("Domain title can't contain newlines")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Domain title can't contain newlines")); goto error; } @@ -8035,10 +8038,10 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, * round down, otherwise we flag the issue. */ if (VIR_DIV_UP(def->mem.cur_balloon, 1024) > VIR_DIV_UP(def->mem.max_balloon, 1024)) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("current memory '%lluk' exceeds " - "maximum '%lluk'"), - def->mem.cur_balloon, def->mem.max_balloon); + virReportError(VIR_ERR_XML_ERROR, + _("current memory '%lluk' exceeds " + "maximum '%lluk'"), + def->mem.cur_balloon, def->mem.max_balloon); goto error; } else { VIR_DEBUG("Truncating current %lluk to maximum %lluk", @@ -8059,8 +8062,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, def->blkio.weight = 0; if ((n = virXPathNodeSet("./blkiotune/device", ctxt, &nodes)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot extract blkiotune nodes")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot extract blkiotune nodes")); goto error; } if (n && VIR_ALLOC_N(def->blkio.devices, n) < 0) @@ -8075,9 +8078,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, for (j = 0; j < i; j++) { if (STREQ(def->blkio.devices[j].path, def->blkio.devices[i].path)) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("duplicate device weight path '%s'"), - def->blkio.devices[i].path); + virReportError(VIR_ERR_XML_ERROR, + _("duplicate device weight path '%s'"), + def->blkio.devices[i].path); goto error; } } @@ -8103,39 +8106,39 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, n = virXPathULong("string(./vcpu[1])", ctxt, &count); if (n == -2) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("maximum vcpus must be an integer")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("maximum vcpus must be an integer")); goto error; } else if (n < 0) { def->maxvcpus = 1; } else { def->maxvcpus = count; if (count == 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("invalid maxvcpus %lu"), count); + virReportError(VIR_ERR_XML_ERROR, + _("invalid maxvcpus %lu"), count); goto error; } } n = virXPathULong("string(./vcpu[1]/@current)", ctxt, &count); if (n == -2) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("current vcpus must be an integer")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("current vcpus must be an integer")); goto error; } else if (n < 0) { def->vcpus = def->maxvcpus; } else { def->vcpus = count; if (count == 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("invalid current vcpus %lu"), count); + virReportError(VIR_ERR_XML_ERROR, + _("invalid current vcpus %lu"), count); goto error; } if (def->maxvcpus < count) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("maxvcpus must not be less than current vcpus (%d < %lu)"), - def->maxvcpus, count); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("maxvcpus must not be less than current vcpus (%d < %lu)"), + def->maxvcpus, count); goto error; } } @@ -8144,9 +8147,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (tmp) { if ((def->placement_mode = virDomainCpuPlacementModeTypeFromString(tmp)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("Unsupported CPU placement mode '%s'"), - tmp); + virReportError(VIR_ERR_XML_ERROR, + _("Unsupported CPU placement mode '%s'"), + tmp); VIR_FREE(tmp); goto error; } @@ -8191,8 +8194,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, goto no_memory; if (n > def->maxvcpus) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("vcpupin nodes must be less than maxvcpus")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("vcpupin nodes must be less than maxvcpus")); goto error; } @@ -8206,8 +8209,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (virDomainVcpuPinIsDuplicate(def->cputune.vcpupin, def->cputune.nvcpupin, vcpupin->vcpuid)) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("duplicate vcpupin for same vcpu")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("duplicate vcpupin for same vcpu")); VIR_FREE(vcpupin); goto error; } @@ -8218,14 +8221,14 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, /* Extract numatune if exists. */ if ((n = virXPathNodeSet("./numatune", ctxt, &nodes)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot extract numatune nodes")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot extract numatune nodes")); goto error; } if (n > 1) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("only one numatune is supported")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("only one numatune is supported")); VIR_FREE(nodes); goto error; } @@ -8243,10 +8246,10 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (mode) { if ((def->numatune.memory.mode = virDomainNumatuneMemModeTypeFromString(mode)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("Unsupported NUMA memory " - "tuning mode '%s'"), - mode); + virReportError(VIR_ERR_XML_ERROR, + _("Unsupported NUMA memory " + "tuning mode '%s'"), + mode); VIR_FREE(mode); goto error; } @@ -8281,9 +8284,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (placement) { if ((placement_mode = virDomainNumatuneMemPlacementModeTypeFromString(placement)) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("Unsupported memory placement " - "mode '%s'"), placement); + virReportError(VIR_ERR_XML_ERROR, + _("Unsupported memory placement " + "mode '%s'"), placement); VIR_FREE(placement); goto error; } @@ -8303,9 +8306,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (placement_mode == VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_STATIC && !def->numatune.memory.nodemask) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("nodeset for NUMA memory tuning must be set " - "if 'placement' is 'static'")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("nodeset for NUMA memory tuning must be set " + "if 'placement' is 'static'")); goto error; } @@ -8322,9 +8325,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, def->numatune.memory.placement_mode = placement_mode; } else { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unsupported XML element %s"), - (const char *)cur->name); + virReportError(VIR_ERR_XML_ERROR, + _("unsupported XML element %s"), + (const char *)cur->name); goto error; } } @@ -8348,9 +8351,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, for (i = 0 ; i < n ; i++) { int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name); if (val < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected feature %s"), - nodes[i]->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected feature %s"), + nodes[i]->name); goto error; } def->features |= (1 << val); @@ -8377,8 +8380,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, tmp = virXPathString("string(./clock/@offset)", ctxt); if (tmp) { if ((def->clock.offset = virDomainClockOffsetTypeFromString(tmp)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown clock offset '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown clock offset '%s'"), tmp); goto error; } VIR_FREE(tmp); @@ -8395,9 +8398,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, } else { if (virStrToLong_ll(tmp, NULL, 10, &def->clock.data.variable.adjustment) < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unknown clock adjustment '%s'"), - tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unknown clock adjustment '%s'"), + tmp); goto error; } switch (def->clock.offset) { @@ -8423,8 +8426,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, tmp = virXPathString("string(./clock/@basis)", ctxt); if (tmp) { if ((def->clock.data.variable.basis = virDomainClockBasisTypeFromString(tmp)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown clock basis '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown clock basis '%s'"), tmp); goto error; } VIR_FREE(tmp); @@ -8436,8 +8439,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE: def->clock.data.timezone = virXPathString("string(./clock/@timezone)", ctxt); if (!def->clock.data.timezone) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing 'timezone' attribute for clock with offset='timezone'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing 'timezone' attribute for clock with offset='timezone'")); goto error; } break; @@ -8469,8 +8472,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, goto no_memory; } } else { - virDomainReportError(VIR_ERR_OS_TYPE, - "%s", _("no OS type")); + virReportError(VIR_ERR_OS_TYPE, + "%s", _("no OS type")); goto error; } } @@ -8488,34 +8491,34 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, } if (!virCapabilitiesSupportsGuestOSType(caps, def->os.type)) { - virDomainReportError(VIR_ERR_OS_TYPE, - "%s", def->os.type); + virReportError(VIR_ERR_OS_TYPE, + "%s", def->os.type); goto error; } def->os.arch = virXPathString("string(./os/type[1]/@arch)", ctxt); if (def->os.arch) { if (!virCapabilitiesSupportsGuestArch(caps, def->os.arch)) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("No guest options available for arch '%s'"), - def->os.arch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No guest options available for arch '%s'"), + def->os.arch); goto error; } if (!virCapabilitiesSupportsGuestOSTypeArch(caps, def->os.type, def->os.arch)) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("No os type '%s' available for arch '%s'"), - def->os.type, def->os.arch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No os type '%s' available for arch '%s'"), + def->os.type, def->os.arch); goto error; } } else { const char *defaultArch = virCapabilitiesDefaultGuestArch(caps, def->os.type, virDomainVirtTypeToString(def->virtType)); if (defaultArch == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("no supported architecture for os type '%s'"), - def->os.type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no supported architecture for os type '%s'"), + def->os.type); goto error; } if (!(def->os.arch = strdup(defaultArch))) { @@ -8554,8 +8557,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, goto no_memory; } } else { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("init binary must be specified")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("init binary must be specified")); goto error; } } @@ -8570,8 +8573,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, for (i = 0 ; i < n ; i++) { if (!nodes[i]->children || !nodes[i]->children->content) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("No data supplied for <initarg> element")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("No data supplied for <initarg> element")); goto error; } if (!(def->os.initargv[i] = strdup((const char*)nodes[i]->children->content))) @@ -8649,8 +8652,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, /* analysis of the resource leases */ if ((n = virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot extract device leases")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot extract device leases")); goto error; } if (n && VIR_ALLOC_N(def->leases, n) < 0) @@ -8780,8 +8783,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, VIR_FREE(nodes); if ((n = virXPathNodeSet("./devices/console", ctxt, &nodes)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot extract console devices")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot extract console devices")); goto error; } if (n && VIR_ALLOC_N(def->consoles, n) < 0) @@ -8817,8 +8820,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (STREQ(def->os.type, "hvm") && (chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL)) { if (i != 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Only the first console can be a serial port")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only the first console can be a serial port")); virDomainChrDefFree(chr); goto error; } @@ -9011,8 +9014,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, goto no_memory; video->type = virDomainVideoDefaultType(def); if (video->type < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot determine default video type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot determine default video type")); VIR_FREE(video); goto error; } @@ -9048,8 +9051,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, goto error; } if (n > 1) { - virDomainReportError (VIR_ERR_INTERNAL_ERROR, - "%s", _("only a single watchdog device is supported")); + virReportError (VIR_ERR_INTERNAL_ERROR, + "%s", _("only a single watchdog device is supported")); goto error; } if (n > 0) { @@ -9068,8 +9071,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, goto error; } if (n > 1) { - virDomainReportError (VIR_ERR_INTERNAL_ERROR, - "%s", _("only a single memory balloon device is supported")); + virReportError (VIR_ERR_INTERNAL_ERROR, + "%s", _("only a single memory balloon device is supported")); goto error; } if (n > 0) { @@ -9140,15 +9143,15 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (def->cpu->sockets && def->maxvcpus > def->cpu->sockets * def->cpu->cores * def->cpu->threads) { - virDomainReportError(VIR_ERR_XML_DETAIL, "%s", - _("Maximum CPUs greater than topology limit")); + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("Maximum CPUs greater than topology limit")); goto error; } if (def->cpu->cells_cpus > def->maxvcpus) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Number of CPUs in <numa> exceeds the" - " <vcpu> count")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Number of CPUs in <numa> exceeds the" + " <vcpu> count")); goto error; } } @@ -9164,16 +9167,16 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (def->sysinfo->system_uuid != NULL) { unsigned char uuidbuf[VIR_UUID_BUFLEN]; if (virUUIDParse(def->sysinfo->system_uuid, uuidbuf) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed uuid element")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed uuid element")); goto error; } if (uuid_generated) memcpy(def->uuid, uuidbuf, VIR_UUID_BUFLEN); else if (memcmp(def->uuid, uuidbuf, VIR_UUID_BUFLEN) != 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("UUID mismatch between <uuid> and " - "<sysinfo>")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("UUID mismatch between <uuid> and " + "<sysinfo>")); goto error; } } @@ -9183,8 +9186,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, int mode; if ((mode = virDomainSmbiosModeTypeFromString(tmp)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown smbios mode '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown smbios mode '%s'"), tmp); goto error; } def->os.smbios_mode = mode; @@ -9250,8 +9253,8 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps, return NULL; if (!(config = virXPathNode("./domain", ctxt))) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no domain config")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no domain config")); goto error; } @@ -9264,13 +9267,13 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps, goto error; if (!(tmp = virXPathString("string(./@state)", ctxt))) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing domain state")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing domain state")); goto error; } if ((state = virDomainStateTypeFromString(tmp)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid domain state '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid domain state '%s'"), tmp); VIR_FREE(tmp); goto error; } @@ -9278,8 +9281,8 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps, if ((tmp = virXPathString("string(./@reason)", ctxt))) { if ((reason = virDomainStateReasonFromString(state, tmp)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid domain state reason '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid domain state reason '%s'"), tmp); VIR_FREE(tmp); goto error; } @@ -9289,8 +9292,8 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps, virDomainObjSetState(obj, state, reason); if (virXPathLong("string(./@pid)", ctxt, &val) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid pid")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid pid")); goto error; } obj->pid = (pid_t)val; @@ -9303,8 +9306,8 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps, if (str) { int flag = virDomainTaintTypeFromString(str); if (flag < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown taint flag %s"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown taint flag %s"), str); VIR_FREE(str); goto error; } @@ -9376,10 +9379,10 @@ virDomainDefPtr virDomainDefParseNode(virCapsPtr caps, virDomainDefPtr def = NULL; if (!xmlStrEqual(root->name, BAD_CAST "domain")) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unexpected root element <%s>, " - "expecting <domain>"), - root->name); + virReportError(VIR_ERR_XML_ERROR, + _("unexpected root element <%s>, " + "expecting <domain>"), + root->name); goto cleanup; } @@ -9409,10 +9412,10 @@ virDomainObjParseNode(virCapsPtr caps, virDomainObjPtr obj = NULL; if (!xmlStrEqual(root->name, BAD_CAST "domstatus")) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("unexpected root element <%s>, " - "expecting <domstatus>"), - root->name); + virReportError(VIR_ERR_XML_ERROR, + _("unexpected root element <%s>, " + "expecting <domstatus>"), + root->name); goto cleanup; } @@ -9459,33 +9462,33 @@ static bool virDomainTimerDefCheckABIStability(virDomainTimerDefPtr src, bool identical = false; if (src->name != dst->name) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target timer %s does not match source %s"), - virDomainTimerNameTypeToString(dst->name), - virDomainTimerNameTypeToString(src->name)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target timer %s does not match source %s"), + virDomainTimerNameTypeToString(dst->name), + virDomainTimerNameTypeToString(src->name)); goto cleanup; } if (src->present != dst->present) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target timer presence %d does not match source %d"), - dst->present, src->present); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target timer presence %d does not match source %d"), + dst->present, src->present); goto cleanup; } if (src->name == VIR_DOMAIN_TIMER_NAME_TSC) { if (src->frequency != dst->frequency) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target TSC frequency %lu does not match source %lu"), - dst->frequency, src->frequency); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target TSC frequency %lu does not match source %lu"), + dst->frequency, src->frequency); goto cleanup; } if (src->mode != dst->mode) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target TSC mode %s does not match source %s"), - virDomainTimerModeTypeToString(dst->mode), - virDomainTimerModeTypeToString(src->mode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target TSC mode %s does not match source %s"), + virDomainTimerModeTypeToString(dst->mode), + virDomainTimerModeTypeToString(src->mode)); goto cleanup; } } @@ -9503,10 +9506,10 @@ static bool virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src, bool identical = false; if (src->type != dst->type) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target device address type %s does not match source %s"), - virDomainDeviceAddressTypeToString(dst->type), - virDomainDeviceAddressTypeToString(src->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device address type %s does not match source %s"), + virDomainDeviceAddressTypeToString(dst->type), + virDomainDeviceAddressTypeToString(src->type)); goto cleanup; } @@ -9516,12 +9519,12 @@ static bool virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src, src->addr.pci.bus != dst->addr.pci.bus || src->addr.pci.slot != dst->addr.pci.slot || src->addr.pci.function != dst->addr.pci.function) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target device PCI address %04x:%02x:%02x.%02x does not match source %04x:%02x:%02x.%02x"), - dst->addr.pci.domain, dst->addr.pci.bus, - dst->addr.pci.slot, dst->addr.pci.function, - src->addr.pci.domain, src->addr.pci.bus, - src->addr.pci.slot, src->addr.pci.function); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device PCI address %04x:%02x:%02x.%02x does not match source %04x:%02x:%02x.%02x"), + dst->addr.pci.domain, dst->addr.pci.bus, + dst->addr.pci.slot, dst->addr.pci.function, + src->addr.pci.domain, src->addr.pci.bus, + src->addr.pci.slot, src->addr.pci.function); goto cleanup; } break; @@ -9530,12 +9533,12 @@ static bool virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src, if (src->addr.drive.controller != dst->addr.drive.controller || src->addr.drive.bus != dst->addr.drive.bus || src->addr.drive.unit != dst->addr.drive.unit) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target device drive address %d:%d:%d does not match source %d:%d:%d"), - dst->addr.drive.controller, dst->addr.drive.bus, - dst->addr.drive.unit, - src->addr.drive.controller, src->addr.drive.bus, - src->addr.drive.unit); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device drive address %d:%d:%d does not match source %d:%d:%d"), + dst->addr.drive.controller, dst->addr.drive.bus, + dst->addr.drive.unit, + src->addr.drive.controller, src->addr.drive.bus, + src->addr.drive.unit); goto cleanup; } break; @@ -9544,12 +9547,12 @@ static bool virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src, if (src->addr.vioserial.controller != dst->addr.vioserial.controller || src->addr.vioserial.bus != dst->addr.vioserial.bus || src->addr.vioserial.port != dst->addr.vioserial.port) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target device virtio serial address %d:%d:%d does not match source %d:%d:%d"), - dst->addr.vioserial.controller, dst->addr.vioserial.bus, - dst->addr.vioserial.port, - src->addr.vioserial.controller, src->addr.vioserial.bus, - src->addr.vioserial.port); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device virtio serial address %d:%d:%d does not match source %d:%d:%d"), + dst->addr.vioserial.controller, dst->addr.vioserial.bus, + dst->addr.vioserial.port, + src->addr.vioserial.controller, src->addr.vioserial.bus, + src->addr.vioserial.port); goto cleanup; } break; @@ -9557,12 +9560,12 @@ static bool virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src, case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID: if (src->addr.ccid.controller != dst->addr.ccid.controller || src->addr.ccid.slot != dst->addr.ccid.slot) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target device ccid address %d:%d does not match source %d:%d"), - dst->addr.ccid.controller, - dst->addr.ccid.slot, - src->addr.ccid.controller, - src->addr.ccid.slot); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device ccid address %d:%d does not match source %d:%d"), + dst->addr.ccid.controller, + dst->addr.ccid.slot, + src->addr.ccid.controller, + src->addr.ccid.slot); goto cleanup; } break; @@ -9581,38 +9584,38 @@ static bool virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src, bool identical = false; if (src->device != dst->device) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target disk device %s does not match source %s"), - virDomainDiskDeviceTypeToString(dst->device), - virDomainDiskDeviceTypeToString(src->device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target disk device %s does not match source %s"), + virDomainDiskDeviceTypeToString(dst->device), + virDomainDiskDeviceTypeToString(src->device)); goto cleanup; } if (src->bus != dst->bus) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target disk bus %s does not match source %s"), - virDomainDiskBusTypeToString(dst->bus), - virDomainDiskBusTypeToString(src->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target disk bus %s does not match source %s"), + virDomainDiskBusTypeToString(dst->bus), + virDomainDiskBusTypeToString(src->bus)); goto cleanup; } if (STRNEQ(src->dst, dst->dst)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target disk %s does not match source %s"), - dst->dst, src->dst); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target disk %s does not match source %s"), + dst->dst, src->dst); goto cleanup; } if (STRNEQ_NULLABLE(src->serial, dst->serial)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target disk serial %s does not match source %s"), - NULLSTR(dst->serial), NULLSTR(src->serial)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target disk serial %s does not match source %s"), + NULLSTR(dst->serial), NULLSTR(src->serial)); goto cleanup; } if (src->readonly != dst->readonly || src->shared != dst->shared) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Target disk access mode does not match source")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target disk access mode does not match source")); goto cleanup; } @@ -9632,39 +9635,39 @@ static bool virDomainControllerDefCheckABIStability(virDomainControllerDefPtr sr bool identical = false; if (src->type != dst->type) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target controller type %s does not match source %s"), - virDomainControllerTypeToString(dst->type), - virDomainControllerTypeToString(src->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target controller type %s does not match source %s"), + virDomainControllerTypeToString(dst->type), + virDomainControllerTypeToString(src->type)); goto cleanup; } if (src->idx != dst->idx) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target controller index %d does not match source %d"), - dst->idx, src->idx); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target controller index %d does not match source %d"), + dst->idx, src->idx); goto cleanup; } if (src->model != dst->model) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target controller model %d does not match source %d"), - dst->model, src->model); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target controller model %d does not match source %d"), + dst->model, src->model); goto cleanup; } if (src->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) { if (src->opts.vioserial.ports != dst->opts.vioserial.ports) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target controller ports %d does not match source %d"), - dst->opts.vioserial.ports, src->opts.vioserial.ports); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target controller ports %d does not match source %d"), + dst->opts.vioserial.ports, src->opts.vioserial.ports); goto cleanup; } if (src->opts.vioserial.vectors != dst->opts.vioserial.vectors) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target controller vectors %d does not match source %d"), - dst->opts.vioserial.vectors, src->opts.vioserial.vectors); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target controller vectors %d does not match source %d"), + dst->opts.vioserial.vectors, src->opts.vioserial.vectors); goto cleanup; } } @@ -9685,15 +9688,15 @@ static bool virDomainFsDefCheckABIStability(virDomainFSDefPtr src, bool identical = false; if (STRNEQ(src->dst, dst->dst)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target filesystem guest target %s does not match source %s"), - dst->dst, src->dst); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target filesystem guest target %s does not match source %s"), + dst->dst, src->dst); goto cleanup; } if (src->readonly != dst->readonly) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Target filesystem access mode does not match source")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target filesystem access mode does not match source")); goto cleanup; } @@ -9713,20 +9716,20 @@ static bool virDomainNetDefCheckABIStability(virDomainNetDefPtr src, bool identical = false; if (virMacAddrCmp(&src->mac, &dst->mac) != 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target network card mac %02x:%02x:%02x:%02x:%02x:%02x" - "does not match source %02x:%02x:%02x:%02x:%02x:%02x"), - dst->mac.addr[0], dst->mac.addr[1], dst->mac.addr[2], - dst->mac.addr[3], dst->mac.addr[4], dst->mac.addr[5], - src->mac.addr[0], src->mac.addr[1], src->mac.addr[2], - src->mac.addr[3], src->mac.addr[4], src->mac.addr[5]); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target network card mac %02x:%02x:%02x:%02x:%02x:%02x" + "does not match source %02x:%02x:%02x:%02x:%02x:%02x"), + dst->mac.addr[0], dst->mac.addr[1], dst->mac.addr[2], + dst->mac.addr[3], dst->mac.addr[4], dst->mac.addr[5], + src->mac.addr[0], src->mac.addr[1], src->mac.addr[2], + src->mac.addr[3], src->mac.addr[4], src->mac.addr[5]); goto cleanup; } if (STRNEQ_NULLABLE(src->model, dst->model)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target network card model %s does not match source %s"), - NULLSTR(dst->model), NULLSTR(src->model)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target network card model %s does not match source %s"), + NULLSTR(dst->model), NULLSTR(src->model)); goto cleanup; } @@ -9746,18 +9749,18 @@ static bool virDomainInputDefCheckABIStability(virDomainInputDefPtr src, bool identical = false; if (src->type != dst->type) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target input device type %s does not match source %s"), - virDomainInputTypeToString(dst->type), - virDomainInputTypeToString(src->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target input device type %s does not match source %s"), + virDomainInputTypeToString(dst->type), + virDomainInputTypeToString(src->type)); goto cleanup; } if (src->bus != dst->bus) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target input device bus %s does not match source %s"), - virDomainInputBusTypeToString(dst->bus), - virDomainInputBusTypeToString(src->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target input device bus %s does not match source %s"), + virDomainInputBusTypeToString(dst->bus), + virDomainInputBusTypeToString(src->bus)); goto cleanup; } @@ -9777,10 +9780,10 @@ static bool virDomainSoundDefCheckABIStability(virDomainSoundDefPtr src, bool identical = false; if (src->model != dst->model) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target sound card model %s does not match source %s"), - virDomainSoundModelTypeToString(dst->model), - virDomainSoundModelTypeToString(src->model)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target sound card model %s does not match source %s"), + virDomainSoundModelTypeToString(dst->model), + virDomainSoundModelTypeToString(src->model)); goto cleanup; } @@ -9800,46 +9803,46 @@ static bool virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src, bool identical = false; if (src->type != dst->type) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target video card model %s does not match source %s"), - virDomainVideoTypeToString(dst->type), - virDomainVideoTypeToString(src->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target video card model %s does not match source %s"), + virDomainVideoTypeToString(dst->type), + virDomainVideoTypeToString(src->type)); goto cleanup; } if (src->vram != dst->vram) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target video card vram %u does not match source %u"), - dst->vram, src->vram); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target video card vram %u does not match source %u"), + dst->vram, src->vram); goto cleanup; } if (src->heads != dst->heads) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target video card heads %u does not match source %u"), - dst->heads, src->heads); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target video card heads %u does not match source %u"), + dst->heads, src->heads); goto cleanup; } if ((src->accel && !dst->accel) || (!src->accel && dst->accel)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Target video card acceleration does not match source")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target video card acceleration does not match source")); goto cleanup; } if (src->accel) { if (src->accel->support2d != dst->accel->support2d) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target video card 2d accel %u does not match source %u"), - dst->accel->support2d, src->accel->support2d); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target video card 2d accel %u does not match source %u"), + dst->accel->support2d, src->accel->support2d); goto cleanup; } if (src->accel->support3d != dst->accel->support3d) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target video card 3d accel %u does not match source %u"), - dst->accel->support3d, src->accel->support3d); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target video card 3d accel %u does not match source %u"), + dst->accel->support3d, src->accel->support3d); goto cleanup; } } @@ -9860,19 +9863,19 @@ static bool virDomainHostdevDefCheckABIStability(virDomainHostdevDefPtr src, bool identical = false; if (src->mode != dst->mode) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target host device mode %s does not match source %s"), - virDomainHostdevModeTypeToString(dst->mode), - virDomainHostdevModeTypeToString(src->mode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target host device mode %s does not match source %s"), + virDomainHostdevModeTypeToString(dst->mode), + virDomainHostdevModeTypeToString(src->mode)); goto cleanup; } if (src->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) { if (src->source.subsys.type != dst->source.subsys.type) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target host device subsystem %s does not match source %s"), - virDomainHostdevSubsysTypeToString(dst->source.subsys.type), - virDomainHostdevSubsysTypeToString(src->source.subsys.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target host device subsystem %s does not match source %s"), + virDomainHostdevSubsysTypeToString(dst->source.subsys.type), + virDomainHostdevSubsysTypeToString(src->source.subsys.type)); goto cleanup; } } @@ -9908,9 +9911,9 @@ static bool virDomainSerialDefCheckABIStability(virDomainChrDefPtr src, bool identical = false; if (src->target.port != dst->target.port) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target serial port %d does not match source %d"), - dst->target.port, src->target.port); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target serial port %d does not match source %d"), + dst->target.port, src->target.port); goto cleanup; } @@ -9930,9 +9933,9 @@ static bool virDomainParallelDefCheckABIStability(virDomainChrDefPtr src, bool identical = false; if (src->target.port != dst->target.port) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target serial port %d does not match source %d"), - dst->target.port, src->target.port); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target serial port %d does not match source %d"), + dst->target.port, src->target.port); goto cleanup; } @@ -9952,19 +9955,19 @@ static bool virDomainChannelDefCheckABIStability(virDomainChrDefPtr src, bool identical = false; if (src->targetType != dst->targetType) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target channel type %s does not match source %s"), - virDomainChrChannelTargetTypeToString(dst->targetType), - virDomainChrChannelTargetTypeToString(src->targetType)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target channel type %s does not match source %s"), + virDomainChrChannelTargetTypeToString(dst->targetType), + virDomainChrChannelTargetTypeToString(src->targetType)); goto cleanup; } switch (src->targetType) { case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO: if (STRNEQ_NULLABLE(src->target.name, dst->target.name)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target channel name %s does not match source %s"), - NULLSTR(dst->target.name), NULLSTR(src->target.name)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target channel name %s does not match source %s"), + NULLSTR(dst->target.name), NULLSTR(src->target.name)); goto cleanup; } break; @@ -9973,9 +9976,9 @@ static bool virDomainChannelDefCheckABIStability(virDomainChrDefPtr src, sizeof(*src->target.addr)) != 0) { char *saddr = virSocketAddrFormatFull(src->target.addr, true, ":"); char *daddr = virSocketAddrFormatFull(dst->target.addr, true, ":"); - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target channel addr %s does not match source %s"), - NULLSTR(daddr), NULLSTR(saddr)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target channel addr %s does not match source %s"), + NULLSTR(daddr), NULLSTR(saddr)); VIR_FREE(saddr); VIR_FREE(daddr); goto cleanup; @@ -9999,10 +10002,10 @@ static bool virDomainConsoleDefCheckABIStability(virDomainChrDefPtr src, bool identical = false; if (src->targetType != dst->targetType) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target console type %s does not match source %s"), - virDomainChrConsoleTargetTypeToString(dst->targetType), - virDomainChrConsoleTargetTypeToString(src->targetType)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target console type %s does not match source %s"), + virDomainChrConsoleTargetTypeToString(dst->targetType), + virDomainChrConsoleTargetTypeToString(src->targetType)); goto cleanup; } @@ -10022,10 +10025,10 @@ static bool virDomainWatchdogDefCheckABIStability(virDomainWatchdogDefPtr src, bool identical = false; if (src->model != dst->model) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target watchdog model %s does not match source %s"), - virDomainWatchdogModelTypeToString(dst->model), - virDomainWatchdogModelTypeToString(src->model)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target watchdog model %s does not match source %s"), + virDomainWatchdogModelTypeToString(dst->model), + virDomainWatchdogModelTypeToString(src->model)); goto cleanup; } @@ -10045,10 +10048,10 @@ static bool virDomainMemballoonDefCheckABIStability(virDomainMemballoonDefPtr sr bool identical = false; if (src->model != dst->model) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target balloon model %s does not match source %s"), - virDomainMemballoonModelTypeToString(dst->model), - virDomainMemballoonModelTypeToString(src->model)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target balloon model %s does not match source %s"), + virDomainMemballoonModelTypeToString(dst->model), + virDomainMemballoonModelTypeToString(src->model)); goto cleanup; } @@ -10068,10 +10071,10 @@ static bool virDomainHubDefCheckABIStability(virDomainHubDefPtr src, bool identical = false; if (src->type != dst->type) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target hub device type %s does not match source %s"), - virDomainHubTypeToString(dst->type), - virDomainHubTypeToString(src->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target hub device type %s does not match source %s"), + virDomainHubTypeToString(dst->type), + virDomainHubTypeToString(src->type)); goto cleanup; } @@ -10096,10 +10099,10 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, int i; if (src->virtType != dst->virtType) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain virt type %s does not match source %s"), - virDomainVirtTypeToString(dst->virtType), - virDomainVirtTypeToString(src->virtType)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain virt type %s does not match source %s"), + virDomainVirtTypeToString(dst->virtType), + virDomainVirtTypeToString(src->virtType)); goto cleanup; } @@ -10108,82 +10111,82 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, char uuiddst[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(src->uuid, uuidsrc); virUUIDFormat(dst->uuid, uuiddst); - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain uuid %s does not match source %s"), - uuiddst, uuidsrc); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain uuid %s does not match source %s"), + uuiddst, uuidsrc); goto cleanup; } if (src->mem.max_balloon != dst->mem.max_balloon) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain max memory %lld does not match source %lld"), - dst->mem.max_balloon, src->mem.max_balloon); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain max memory %lld does not match source %lld"), + dst->mem.max_balloon, src->mem.max_balloon); goto cleanup; } if (src->mem.cur_balloon != dst->mem.cur_balloon) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain current memory %lld does not match source %lld"), - dst->mem.cur_balloon, src->mem.cur_balloon); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain current memory %lld does not match source %lld"), + dst->mem.cur_balloon, src->mem.cur_balloon); goto cleanup; } if (src->mem.hugepage_backed != dst->mem.hugepage_backed) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain huge page backing %d does not match source %d"), - dst->mem.hugepage_backed, - src->mem.hugepage_backed); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain huge page backing %d does not match source %d"), + dst->mem.hugepage_backed, + src->mem.hugepage_backed); goto cleanup; } if (src->vcpus != dst->vcpus) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain vpu count %d does not match source %d"), - dst->vcpus, src->vcpus); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain vpu count %d does not match source %d"), + dst->vcpus, src->vcpus); goto cleanup; } if (src->maxvcpus != dst->maxvcpus) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain vpu max %d does not match source %d"), - dst->maxvcpus, src->maxvcpus); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain vpu max %d does not match source %d"), + dst->maxvcpus, src->maxvcpus); goto cleanup; } if (STRNEQ(src->os.type, dst->os.type)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain OS type %s does not match source %s"), - dst->os.type, src->os.type); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain OS type %s does not match source %s"), + dst->os.type, src->os.type); goto cleanup; } if (STRNEQ(src->os.arch, dst->os.arch)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain architecture %s does not match source %s"), - dst->os.arch, src->os.arch); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain architecture %s does not match source %s"), + dst->os.arch, src->os.arch); goto cleanup; } if (STRNEQ(src->os.machine, dst->os.machine)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain OS type %s does not match source %s"), - dst->os.machine, src->os.machine); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain OS type %s does not match source %s"), + dst->os.machine, src->os.machine); goto cleanup; } if (src->os.smbios_mode != dst->os.smbios_mode) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain SMBIOS mode %s does not match source %s"), - virDomainSmbiosModeTypeToString(dst->os.smbios_mode), - virDomainSmbiosModeTypeToString(src->os.smbios_mode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain SMBIOS mode %s does not match source %s"), + virDomainSmbiosModeTypeToString(dst->os.smbios_mode), + virDomainSmbiosModeTypeToString(src->os.smbios_mode)); goto cleanup; } if (src->features != dst->features) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain features %d does not match source %d"), - dst->features, src->features); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain features %d does not match source %d"), + dst->features, src->features); goto cleanup; } if (src->clock.ntimers != dst->clock.ntimers) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Target domain timers do not match source")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target domain timers do not match source")); goto cleanup; } @@ -10199,9 +10202,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->ndisks != dst->ndisks) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain disk count %d does not match source %d"), - dst->ndisks, src->ndisks); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain disk count %d does not match source %d"), + dst->ndisks, src->ndisks); goto cleanup; } @@ -10210,9 +10213,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->ncontrollers != dst->ncontrollers) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain disk controller count %d does not match source %d"), - dst->ncontrollers, src->ncontrollers); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain disk controller count %d does not match source %d"), + dst->ncontrollers, src->ncontrollers); goto cleanup; } @@ -10221,9 +10224,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nfss != dst->nfss) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain filesystem count %d does not match source %d"), - dst->nfss, src->nfss); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain filesystem count %d does not match source %d"), + dst->nfss, src->nfss); goto cleanup; } @@ -10232,9 +10235,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nnets != dst->nnets) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain net card count %d does not match source %d"), - dst->nnets, src->nnets); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain net card count %d does not match source %d"), + dst->nnets, src->nnets); goto cleanup; } @@ -10243,9 +10246,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->ninputs != dst->ninputs) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain input device count %d does not match source %d"), - dst->ninputs, src->ninputs); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain input device count %d does not match source %d"), + dst->ninputs, src->ninputs); goto cleanup; } @@ -10254,9 +10257,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nsounds != dst->nsounds) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain sound card count %d does not match source %d"), - dst->nsounds, src->nsounds); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain sound card count %d does not match source %d"), + dst->nsounds, src->nsounds); goto cleanup; } @@ -10265,9 +10268,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nvideos != dst->nvideos) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain video card count %d does not match source %d"), - dst->nvideos, src->nvideos); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain video card count %d does not match source %d"), + dst->nvideos, src->nvideos); goto cleanup; } @@ -10276,9 +10279,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nhostdevs != dst->nhostdevs) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain host device count %d does not match source %d"), - dst->nhostdevs, src->nhostdevs); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain host device count %d does not match source %d"), + dst->nhostdevs, src->nhostdevs); goto cleanup; } @@ -10287,9 +10290,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nsmartcards != dst->nsmartcards) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain smartcard count %d does not match source %d"), - dst->nsmartcards, src->nsmartcards); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain smartcard count %d does not match source %d"), + dst->nsmartcards, src->nsmartcards); goto cleanup; } @@ -10298,9 +10301,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nserials != dst->nserials) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain serial port count %d does not match source %d"), - dst->nserials, src->nserials); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain serial port count %d does not match source %d"), + dst->nserials, src->nserials); goto cleanup; } @@ -10309,9 +10312,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nparallels != dst->nparallels) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain parallel port count %d does not match source %d"), - dst->nparallels, src->nparallels); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain parallel port count %d does not match source %d"), + dst->nparallels, src->nparallels); goto cleanup; } @@ -10320,9 +10323,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nchannels != dst->nchannels) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain channel count %d does not match source %d"), - dst->nchannels, src->nchannels); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain channel count %d does not match source %d"), + dst->nchannels, src->nchannels); goto cleanup; } @@ -10331,9 +10334,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nconsoles != dst->nconsoles) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain console count %d does not match source %d"), - dst->nconsoles, src->nconsoles); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain console count %d does not match source %d"), + dst->nconsoles, src->nconsoles); goto cleanup; } @@ -10342,9 +10345,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, goto cleanup; if (src->nhubs != dst->nhubs) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain hub device count %d does not match source %d"), - dst->nhubs, src->nhubs); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain hub device count %d does not match source %d"), + dst->nhubs, src->nhubs); goto cleanup; } @@ -10355,9 +10358,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, if ((!src->watchdog && dst->watchdog) || (src->watchdog && !dst->watchdog)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain watchdog count %d does not match source %d"), - dst->watchdog ? 1 : 0, src->watchdog ? 1 : 0); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain watchdog count %d does not match source %d"), + dst->watchdog ? 1 : 0, src->watchdog ? 1 : 0); goto cleanup; } @@ -10367,9 +10370,9 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src, if ((!src->memballoon && dst->memballoon) || (src->memballoon && !dst->memballoon)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain memory balloon count %d does not match source %d"), - dst->memballoon ? 1 : 0, src->memballoon ? 1 : 0); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain memory balloon count %d does not match source %d"), + dst->memballoon ? 1 : 0, src->memballoon ? 1 : 0); goto cleanup; } @@ -10714,8 +10717,8 @@ virDomainCpuSetParse(const char *str, char sep, return ret; parse_error: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("topology cpuset syntax error")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("topology cpuset syntax error")); return -1; } @@ -10887,8 +10890,8 @@ virDomainLifecycleDefFormat(virBufferPtr buf, { const char *typeStr = convFunc(type); if (!typeStr) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle type %d"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle type %d"), type); return -1; } @@ -10993,28 +10996,28 @@ virDomainDiskDefFormat(virBufferPtr buf, char uuidstr[VIR_UUID_STRING_BUFLEN]; if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk type %d"), def->type); return -1; } if (!device) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk device %d"), def->device); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk device %d"), def->device); return -1; } if (!bus) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk bus %d"), def->bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk bus %d"), def->bus); return -1; } if (!cachemode) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk cache mode %d"), def->cachemode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk cache mode %d"), def->cachemode); return -1; } if (!iomode) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk io mode %d"), def->iomode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk io mode %d"), def->iomode); return -1; } @@ -11134,9 +11137,9 @@ virDomainDiskDefFormat(virBufferPtr buf, } break; default: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk type %s"), - virDomainDiskTypeToString(def->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk type %s"), + virDomainDiskTypeToString(def->type)); return -1; } } @@ -11249,8 +11252,8 @@ virDomainControllerDefFormat(virBufferPtr buf, const char *model = NULL; if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected controller type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected controller type %d"), def->type); return -1; } @@ -11258,8 +11261,8 @@ virDomainControllerDefFormat(virBufferPtr buf, model = virDomainControllerModelTypeToString(def, def->model); if (!model) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected model type %d"), def->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected model type %d"), def->model); return -1; } } @@ -11327,14 +11330,14 @@ virDomainFSDefFormat(virBufferPtr buf, const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected filesystem type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected filesystem type %d"), def->type); return -1; } if (!accessmode) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected accessmode %d"), def->accessmode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected accessmode %d"), def->accessmode); return -1; } @@ -11452,9 +11455,9 @@ virDomainHostdevSourceFormat(virBufferPtr buf, } break; default: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected hostdev type %d"), - def->source.subsys.type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected hostdev type %d"), + def->source.subsys.type); return -1; } @@ -11476,8 +11479,8 @@ virDomainActualNetDefFormat(virBufferPtr buf, type = virDomainNetTypeToString(def->type); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected net type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected net type %d"), def->type); return ret; } @@ -11508,9 +11511,9 @@ virDomainActualNetDefFormat(virBufferPtr buf, mode = virNetDevMacVLanModeTypeToString(def->data.direct.mode); if (!mode) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected source mode %d"), - def->data.direct.mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected source mode %d"), + def->data.direct.mode); return ret; } virBufferAsprintf(buf, " mode='%s'/>\n", mode); @@ -11536,8 +11539,8 @@ virDomainActualNetDefFormat(virBufferPtr buf, case VIR_DOMAIN_NET_TYPE_NETWORK: break; default: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected net type %s"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected net type %s"), type); goto error; } @@ -11561,8 +11564,8 @@ virDomainNetDefFormat(virBufferPtr buf, const char *type = virDomainNetTypeToString(def->type); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected net type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected net type %d"), def->type); return -1; } @@ -11742,8 +11745,8 @@ virDomainChrSourceDefFormat(virBufferPtr buf, const char *type = virDomainChrTypeToString(def->type); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected char type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected char type %d"), def->type); return -1; } @@ -11843,9 +11846,9 @@ virDomainChrDefFormat(virBufferPtr buf, int ret = 0; if (!elementName) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected char device type %d"), - def->deviceType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected char device type %d"), + def->deviceType); return -1; } @@ -11862,8 +11865,8 @@ virDomainChrDefFormat(virBufferPtr buf, switch (def->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: { if (!targetType) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not format channel target type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not format channel target type")); return -1; } virBufferAsprintf(buf, " <target type='%s'", targetType); @@ -11872,8 +11875,8 @@ virDomainChrDefFormat(virBufferPtr buf, case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD: { int port = virSocketAddrGetPort(def->target.addr); if (port < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to format guestfwd port")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to format guestfwd port")); return -1; } @@ -11932,8 +11935,8 @@ virDomainSmartcardDefFormat(virBufferPtr buf, size_t i; if (!mode) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected smartcard type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected smartcard type %d"), def->type); return -1; } @@ -11963,8 +11966,8 @@ virDomainSmartcardDefFormat(virBufferPtr buf, break; default: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected smartcard type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected smartcard type %d"), def->type); return -1; } if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) @@ -11980,8 +11983,8 @@ virDomainSoundCodecDefFormat(virBufferPtr buf, const char *type = virDomainSoundCodecTypeToString(def->type); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected codec type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected codec type %d"), def->type); return -1; } @@ -12000,8 +12003,8 @@ virDomainSoundDefFormat(virBufferPtr buf, int i; if (!model) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected sound model %d"), def->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected sound model %d"), def->model); return -1; } @@ -12042,8 +12045,8 @@ virDomainMemballoonDefFormat(virBufferPtr buf, const char *model = virDomainMemballoonModelTypeToString(def->model); if (!model) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected memballoon model %d"), def->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected memballoon model %d"), def->model); return -1; } @@ -12082,14 +12085,14 @@ virDomainWatchdogDefFormat(virBufferPtr buf, const char *action = virDomainWatchdogActionTypeToString (def->action); if (!model) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected watchdog model %d"), def->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected watchdog model %d"), def->model); return -1; } if (!action) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected watchdog action %d"), def->action); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected watchdog action %d"), def->action); return -1; } @@ -12129,8 +12132,8 @@ virDomainVideoDefFormat(virBufferPtr buf, const char *model = virDomainVideoTypeToString(def->type); if (!model) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected video model %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected video model %d"), def->type); return -1; } @@ -12166,13 +12169,13 @@ virDomainInputDefFormat(virBufferPtr buf, const char *bus = virDomainInputBusTypeToString(def->bus); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected input type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected input type %d"), def->type); return -1; } if (!bus) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected input bus type %d"), def->bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected input bus type %d"), def->bus); return -1; } @@ -12199,8 +12202,8 @@ virDomainTimerDefFormat(virBufferPtr buf, const char *name = virDomainTimerNameTypeToString(def->name); if (!name) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected timer name %d"), def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected timer name %d"), def->name); return -1; } virBufferAsprintf(buf, " <timer name='%s'", name); @@ -12215,9 +12218,9 @@ virDomainTimerDefFormat(virBufferPtr buf, const char *tickpolicy = virDomainTimerTickpolicyTypeToString(def->tickpolicy); if (!tickpolicy) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected timer tickpolicy %d"), - def->tickpolicy); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected timer tickpolicy %d"), + def->tickpolicy); return -1; } virBufferAsprintf(buf, " tickpolicy='%s'", tickpolicy); @@ -12229,9 +12232,9 @@ virDomainTimerDefFormat(virBufferPtr buf, const char *track = virDomainTimerTrackTypeToString(def->track); if (!track) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected timer track %d"), - def->track); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected timer track %d"), + def->track); return -1; } virBufferAsprintf(buf, " track='%s'", track); @@ -12247,9 +12250,9 @@ virDomainTimerDefFormat(virBufferPtr buf, const char *mode = virDomainTimerModeTypeToString(def->mode); if (!mode) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected timer mode %d"), - def->mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected timer mode %d"), + def->mode); return -1; } virBufferAsprintf(buf, " mode='%s'", mode); @@ -12345,8 +12348,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, int i; if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected net type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected net type %d"), def->type); return -1; } @@ -12538,8 +12541,8 @@ virDomainHostdevDefFormat(virBufferPtr buf, const char *type; if (!mode || def->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected hostdev mode %d"), def->mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected hostdev mode %d"), def->mode); return -1; } @@ -12547,9 +12550,9 @@ virDomainHostdevDefFormat(virBufferPtr buf, if (!type || (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB && def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected hostdev type %d"), - def->source.subsys.type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected hostdev type %d"), + def->source.subsys.type); return -1; } @@ -12598,8 +12601,8 @@ virDomainHubDefFormat(virBufferPtr buf, const char *type = virDomainHubTypeToString(def->type); if (!type) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected hub type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected hub type %d"), def->type); return -1; } @@ -12651,8 +12654,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, -1); if (!(type = virDomainVirtTypeToString(def->virtType))) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected domain type %d"), def->virtType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected domain type %d"), def->virtType); goto cleanup; } @@ -12811,8 +12814,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, VIR_DOMAIN_CPUMASK_LEN); if (cpumask == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to format cpuset for vcpupin")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to format cpuset for vcpupin")); goto cleanup; } @@ -12840,9 +12843,9 @@ virDomainDefFormatInternal(virDomainDefPtr def, nodemask = virDomainCpuSetFormat(def->numatune.memory.nodemask, VIR_DOMAIN_CPUMASK_LEN); if (nodemask == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to format nodeset for " - "NUMA memory tuning")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to format nodeset for " + "NUMA memory tuning")); goto cleanup; } virBufferAsprintf(buf, "nodeset='%s'/>\n", nodemask); @@ -12903,9 +12906,9 @@ virDomainDefFormatInternal(virDomainDefPtr def, const char *boottype = virDomainBootTypeToString(def->os.bootDevs[n]); if (!boottype) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected boot device type %d"), - def->os.bootDevs[n]); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected boot device type %d"), + def->os.bootDevs[n]); goto cleanup; } virBufferAsprintf(buf, " <boot dev='%s'/>\n", boottype); @@ -12931,8 +12934,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, mode = virDomainSmbiosModeTypeToString(def->os.smbios_mode); if (mode == NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected smbios mode %d"), def->os.smbios_mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected smbios mode %d"), def->os.smbios_mode); goto cleanup; } virBufferAsprintf(buf, " <smbios mode='%s'/>\n", mode); @@ -12946,8 +12949,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, if (def->features & (1 << i)) { const char *name = virDomainFeatureTypeToString(i); if (!name) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected feature %d"), i); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected feature %d"), i); goto cleanup; } virBufferAsprintf(buf, " <%s/>\n", name); @@ -13363,9 +13366,9 @@ static virDomainObjPtr virDomainLoadStatus(virCapsPtr caps, virUUIDFormat(obj->def->uuid, uuidstr); if (virHashLookup(doms->objs, uuidstr) != NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected domain %s already exists"), - obj->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected domain %s already exists"), + obj->def->name); goto error; } @@ -13573,18 +13576,18 @@ virDomainObjIsDuplicate(virDomainObjListPtr doms, if (STRNEQ(vm->def->name, def->name)) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(vm->def->uuid, uuidstr); - virDomainReportError(VIR_ERR_OPERATION_FAILED, - _("domain '%s' is already defined with uuid %s"), - vm->def->name, uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("domain '%s' is already defined with uuid %s"), + vm->def->name, uuidstr); goto cleanup; } if (check_active) { /* UUID & name match, but if VM is already active, refuse it */ if (virDomainObjIsActive(vm)) { - virDomainReportError(VIR_ERR_OPERATION_INVALID, - _("domain is already active as '%s'"), - vm->def->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("domain is already active as '%s'"), + vm->def->name); goto cleanup; } } @@ -13596,9 +13599,9 @@ virDomainObjIsDuplicate(virDomainObjListPtr doms, if (vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(vm->def->uuid, uuidstr); - virDomainReportError(VIR_ERR_OPERATION_FAILED, - _("domain '%s' already exists with uuid %s"), - def->name, uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("domain '%s' already exists with uuid %s"), + def->name, uuidstr); goto cleanup; } } @@ -13759,8 +13762,8 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, def->name = virXMLPropString(node, "name"); if (!def->name) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing name from disk snapshot element")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing name from disk snapshot element")); goto cleanup; } @@ -13768,9 +13771,9 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, if (snapshot) { def->snapshot = virDomainDiskSnapshotTypeFromString(snapshot); if (def->snapshot <= 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk snapshot setting '%s'"), - snapshot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk snapshot setting '%s'"), + snapshot); goto cleanup; } } @@ -13835,7 +13838,7 @@ virDomainSnapshotDefParseString(const char *xmlStr, } if (!xmlStrEqual(ctxt->node->name, BAD_CAST "domainsnapshot")) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", _("domainsnapshot")); + virReportError(VIR_ERR_XML_ERROR, "%s", _("domainsnapshot")); goto cleanup; } @@ -13844,8 +13847,8 @@ virDomainSnapshotDefParseString(const char *xmlStr, def->name = virXPathString("string(./name)", ctxt); if (def->name == NULL) { if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) { - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("a redefined snapshot must have a name")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("a redefined snapshot must have a name")); goto cleanup; } else { ignore_value(virAsprintf(&def->name, "%lld", @@ -13863,8 +13866,8 @@ virDomainSnapshotDefParseString(const char *xmlStr, if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) { if (virXPathLongLong("string(./creationTime)", ctxt, &def->creationTime) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing creationTime from existing snapshot")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing creationTime from existing snapshot")); goto cleanup; } @@ -13875,15 +13878,15 @@ virDomainSnapshotDefParseString(const char *xmlStr, /* there was no state in an existing snapshot; this * should never happen */ - virDomainReportError(VIR_ERR_XML_ERROR, "%s", - _("missing state from existing snapshot")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing state from existing snapshot")); goto cleanup; } def->state = virDomainSnapshotStateTypeFromString(state); if (def->state < 0) { - virDomainReportError(VIR_ERR_XML_ERROR, - _("Invalid state '%s' in domain snapshot XML"), - state); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid state '%s' in domain snapshot XML"), + state); goto cleanup; } @@ -13896,8 +13899,8 @@ virDomainSnapshotDefParseString(const char *xmlStr, VIR_FREE(tmp); if (!domainNode) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing domain in snapshot")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing domain in snapshot")); goto cleanup; } def->dom = virDomainDefParseNode(caps, xml, domainNode, @@ -13929,15 +13932,15 @@ virDomainSnapshotDefParseString(const char *xmlStr, } VIR_FREE(nodes); } else if (i) { - virDomainReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("unable to handle disk requests in snapshot")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("unable to handle disk requests in snapshot")); goto cleanup; } if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL) { if (virXPathInt("string(./active)", ctxt, &active) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not find 'active' element")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not find 'active' element")); goto cleanup; } def->current = active != 0; @@ -13987,14 +13990,14 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, bool inuse; if (!def->dom) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing domain in snapshot")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing domain in snapshot")); goto cleanup; } if (def->ndisks > def->dom->ndisks) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("too many disk snapshot requests for domain")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("too many disk snapshot requests for domain")); goto cleanup; } @@ -14016,16 +14019,16 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, int disk_snapshot; if (idx < 0) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("no disk named '%s'"), disk->name); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("no disk named '%s'"), disk->name); goto cleanup; } disk_snapshot = def->dom->disks[idx]->snapshot; if (virBitmapGetBit(map, idx, &inuse) < 0 || inuse) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk '%s' specified twice"), - disk->name); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk '%s' specified twice"), + disk->name); goto cleanup; } ignore_value(virBitmapSetBit(map, idx)); @@ -14037,17 +14040,17 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, } else if (disk_snapshot && require_match && disk->snapshot != disk_snapshot) { const char *tmp = virDomainDiskSnapshotTypeToString(disk_snapshot); - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk '%s' must use snapshot mode '%s'"), - disk->name, tmp); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk '%s' must use snapshot mode '%s'"), + disk->name, tmp); goto cleanup; } if (disk->file && disk->snapshot != VIR_DOMAIN_DISK_SNAPSHOT_EXTERNAL) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("file '%s' for disk '%s' requires " - "use of external snapshot mode"), - disk->file, disk->name); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("file '%s' for disk '%s' requires " + "use of external snapshot mode"), + disk->file, disk->name); goto cleanup; } if (STRNEQ(disk->name, def->dom->disks[idx]->dst)) { @@ -14098,18 +14101,18 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, struct stat sb; if (!original) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("cannot generate external snapshot name " - "for disk '%s' without source"), - disk->name); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot generate external snapshot name " + "for disk '%s' without source"), + disk->name); goto cleanup; } if (stat(original, &sb) < 0 || !S_ISREG(sb.st_mode)) { - virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("source for disk '%s' is not a regular " - "file; refusing to generate external " - "snapshot name"), - disk->name); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("source for disk '%s' is not a regular " + "file; refusing to generate external " + "snapshot name"), + disk->name); goto cleanup; } @@ -14119,8 +14122,8 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, original, def->name)); } else { if ((tmp - original) > INT_MAX) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("integer overflow")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("integer overflow")); goto cleanup; } ignore_value(virAsprintf(&disk->file, "%.*s.%s", @@ -14253,9 +14256,9 @@ virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr s virDomainSnapshotObjPtr snap; if (virHashLookup(snapshots->objs, def->name) != NULL) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected domain snapshot %s already exists"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected domain snapshot %s already exists"), + def->name); return NULL; } @@ -14657,18 +14660,18 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk, formatStr = "raw"; /* Xen compat */ if ((format = virStorageFileFormatTypeFromString(formatStr)) < 0) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk format '%s' for %s"), - disk->driverType, disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk format '%s' for %s"), + disk->driverType, disk->src); goto cleanup; } } else { if (allowProbing) { format = VIR_STORAGE_FILE_AUTO; } else { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("no disk format for %s and probing is disabled"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no disk format for %s and probing is disabled"), + disk->src); goto cleanup; } } @@ -14683,9 +14686,9 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk, goto cleanup; if (virHashLookup(paths, path)) { - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("backing store for %s is self-referential"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("backing store for %s is self-referential"), + disk->src); goto cleanup; } @@ -15237,10 +15240,10 @@ virDomainDeviceDefCopy(virCapsPtr caps, rc = virDomainRedirdevDefFormat(&buf, src->data.redirdev, flags); break; default: - virDomainReportError(VIR_ERR_INTERNAL_ERROR, - _("Copying definition of '%d' type " - "is not implemented yet."), - src->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Copying definition of '%d' type " + "is not implemented yet."), + src->type); goto cleanup; } diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index 8517fb4b6..c2a3127b1 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -31,10 +31,6 @@ #define VIR_FROM_THIS VIR_FROM_NONE -#define eventReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - struct _virDomainMeta { int id; char *name; @@ -196,8 +192,8 @@ virDomainEventCallbackListRemove(virConnectPtr conn, } } - eventReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not find event callback for removal")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not find event callback for removal")); return -1; } @@ -246,8 +242,8 @@ virDomainEventCallbackListRemoveID(virConnectPtr conn, } } - eventReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not find event callback for removal")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not find event callback for removal")); return -1; } @@ -272,8 +268,8 @@ virDomainEventCallbackListMarkDelete(virConnectPtr conn, } } - eventReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not find event callback for deletion")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not find event callback for deletion")); return -1; } @@ -297,8 +293,8 @@ virDomainEventCallbackListMarkDeleteID(virConnectPtr conn, } } - eventReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not find event callback for deletion")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not find event callback for deletion")); return -1; } @@ -372,8 +368,8 @@ virDomainEventCallbackListAddID(virConnectPtr conn, memcmp(cbList->callbacks[i]->dom->uuid, dom->uuid, VIR_UUID_BUFLEN) == 0) || (!dom && !cbList->callbacks[i]->dom))) { - eventReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("event callback already tracked")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("event callback already tracked")); return -1; } } @@ -1456,8 +1452,8 @@ virDomainEventStateRegister(virConnectPtr conn, virDomainEventTimer, state, NULL)) < 0) { - eventReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not initialize domain event timer")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not initialize domain event timer")); goto cleanup; } @@ -1512,8 +1508,8 @@ virDomainEventStateRegisterID(virConnectPtr conn, virDomainEventTimer, state, NULL)) < 0) { - eventReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not initialize domain event timer")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not initialize domain event timer")); goto cleanup; } diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index 0aeb1e2d1..e05421054 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -45,10 +45,6 @@ static int virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDefPtr def, int level); -#define virInterfaceReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_INTERFACE, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - static void virInterfaceIpDefFree(virInterfaceIpDefPtr def) { if (def == NULL) @@ -122,8 +118,8 @@ virInterfaceDefParseName(virInterfaceDefPtr def, tmp = virXPathString("string(./@name)", ctxt); if (tmp == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("interface has no name")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("interface has no name")); return -1; } def->name = tmp; @@ -138,8 +134,8 @@ virInterfaceDefParseMtu(virInterfaceDefPtr def, ret = virXPathULong("string(./mtu/@size)", ctxt, &mtu); if ((ret == -2) || ((ret == 0) && (mtu > 100000))) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("interface mtu value is improper")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("interface mtu value is improper")); return -1; } else if (ret == 0) { def->mtu = (unsigned int) mtu; @@ -162,8 +158,8 @@ virInterfaceDefParseStartMode(virInterfaceDefPtr def, else if (STREQ(tmp, "none")) def->startmode = VIR_INTERFACE_START_NONE; else { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("unknown interface startmode %s"), tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unknown interface startmode %s"), tmp); VIR_FREE(tmp); return -1; } @@ -194,8 +190,8 @@ virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt) { else if (STREQ(tmp, "balance-alb")) ret = VIR_INTERFACE_BOND_BALALB; else { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("unknown bonding mode %s"), tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unknown bonding mode %s"), tmp); ret = -1; } VIR_FREE(tmp); @@ -215,8 +211,8 @@ virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt) { else if (STREQ(tmp, "netif")) ret = VIR_INTERFACE_BOND_MII_NETIF; else { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("unknown mii bonding carrier %s"), tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unknown mii bonding carrier %s"), tmp); ret = -1; } VIR_FREE(tmp); @@ -238,8 +234,8 @@ virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt) { else if (STREQ(tmp, "all")) ret = VIR_INTERFACE_BOND_ARP_ALL; else { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("unknown arp bonding validate %s"), tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unknown arp bonding validate %s"), tmp); ret = -1; } VIR_FREE(tmp); @@ -264,8 +260,8 @@ virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def, else if (STREQ(tmp, "no")) def->peerdns = 0; else { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("unknown dhcp peerdns value %s"), tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unknown dhcp peerdns value %s"), tmp); ret = -1; } VIR_FREE(tmp); @@ -290,8 +286,8 @@ virInterfaceDefParseIp(virInterfaceIpDefPtr def, if (ret == 0) def->prefix = (int) l; else if (ret == -2) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("Invalid ip address prefix value")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("Invalid ip address prefix value")); return -1; } } @@ -450,8 +446,8 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def, ctxt->node = protoNodes[pp]; tmp = virXPathString("string(./@family)", ctxt); if (tmp == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("protocol misses the family attribute")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("protocol misses the family attribute")); virInterfaceProtocolDefFree(proto); goto error; } @@ -469,8 +465,8 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def, goto error; } } else { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("unsupported protocol family '%s'"), tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unsupported protocol family '%s'"), tmp); virInterfaceProtocolDefFree(proto); goto error; } @@ -543,8 +539,8 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def, } if (nbItf == 0) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("bond has no interfaces")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("bond has no interfaces")); ret = -1; goto error; } @@ -592,16 +588,16 @@ virInterfaceDefParseBond(virInterfaceDefPtr def, ret = virXPathULong("string(./miimon/@freq)", ctxt, &tmp); if ((ret == -2) || (ret == -1)) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("bond interface miimon freq missing or invalid")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("bond interface miimon freq missing or invalid")); goto error; } def->data.bond.frequency = (int) tmp; ret = virXPathULong("string(./miimon/@downdelay)", ctxt, &tmp); if (ret == -2) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("bond interface miimon downdelay invalid")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("bond interface miimon downdelay invalid")); goto error; } else if (ret == 0) { def->data.bond.downdelay = (int) tmp; @@ -609,8 +605,8 @@ virInterfaceDefParseBond(virInterfaceDefPtr def, ret = virXPathULong("string(./miimon/@updelay)", ctxt, &tmp); if (ret == -2) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("bond interface miimon updelay invalid")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("bond interface miimon updelay invalid")); goto error; } else if (ret == 0) { def->data.bond.updelay = (int) tmp; @@ -628,8 +624,8 @@ virInterfaceDefParseBond(virInterfaceDefPtr def, ret = virXPathULong("string(./arpmon/@interval)", ctxt, &tmp); if ((ret == -2) || (ret == -1)) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("bond interface arpmon interval missing or invalid")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("bond interface arpmon interval missing or invalid")); goto error; } def->data.bond.interval = (int) tmp; @@ -637,8 +633,8 @@ virInterfaceDefParseBond(virInterfaceDefPtr def, def->data.bond.target = virXPathString("string(./arpmon/@target)", ctxt); if (def->data.bond.target == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("bond interface arpmon target missing")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("bond interface arpmon target missing")); ret = -1; goto error; } @@ -658,16 +654,16 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def, xmlXPathContextPtr ctxt) { def->data.vlan.tag = virXPathString("string(./@tag)", ctxt); if (def->data.vlan.tag == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("vlan interface misses the tag attribute")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("vlan interface misses the tag attribute")); return -1; } def->data.vlan.devname = virXPathString("string(./interface/@name)", ctxt); if (def->data.vlan.devname == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("vlan interface misses name attribute")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("vlan interface misses name attribute")); return -1; } return 0; @@ -683,14 +679,14 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) { /* check @type */ tmp = virXPathString("string(./@type)", ctxt); if (tmp == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("interface misses the type attribute")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("interface misses the type attribute")); return NULL; } type = virInterfaceTypeFromString(tmp); if (type == -1) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("unknown interface type %s"), tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unknown interface type %s"), tmp); VIR_FREE(tmp); return NULL; } @@ -710,9 +706,9 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) { || (parentIfType == VIR_INTERFACE_TYPE_ETHERNET) || (parentIfType == VIR_INTERFACE_TYPE_VLAN)) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("interface has unsupported type '%s'"), - virInterfaceTypeToString(type)); + virReportError(VIR_ERR_XML_ERROR, + _("interface has unsupported type '%s'"), + virInterfaceTypeToString(type)); goto error; } def->type = type; @@ -747,8 +743,8 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) { bridge = virXPathNode("./bridge[1]", ctxt); if (bridge == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("bridge interface misses the bridge element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("bridge interface misses the bridge element")); goto error; } tmp = virXMLPropString(bridge, "stp"); @@ -759,9 +755,9 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) { } else if (STREQ(tmp, "off")) { def->data.bridge.stp = 0; } else { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("bridge interface stp should be on or off got %s"), - tmp); + virReportError(VIR_ERR_XML_ERROR, + _("bridge interface stp should be on or off got %s"), + tmp); VIR_FREE(tmp); goto error; } @@ -790,8 +786,8 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) { bond = virXPathNode("./bond[1]", ctxt); if (bond == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("bond interface misses the bond element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("bond interface misses the bond element")); goto error; } ctxt->node = bond; @@ -811,8 +807,8 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) { goto error; vlan = virXPathNode("./vlan[1]", ctxt); if (vlan == NULL) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - "%s", _("vlan interface misses the vlan element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("vlan interface misses the vlan element")); goto error; } ctxt->node = vlan; @@ -839,10 +835,10 @@ virInterfaceDefPtr virInterfaceDefParseNode(xmlDocPtr xml, virInterfaceDefPtr def = NULL; if (!xmlStrEqual(root->name, BAD_CAST "interface")) { - virInterfaceReportError(VIR_ERR_XML_ERROR, - _("unexpected root element <%s>, " - "expecting <interface>"), - root->name); + virReportError(VIR_ERR_XML_ERROR, + _("unexpected root element <%s>, " + "expecting <interface>"), + root->name); return NULL; } @@ -947,8 +943,8 @@ virInterfaceBondDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } else if (def->data.bond.monit == VIR_INTERFACE_BOND_MONIT_ARP) { if (def->data.bond.target == NULL) { - virInterfaceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("bond arp monitoring has no target")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("bond arp monitoring has no target")); return -1; } virBufferAsprintf(buf, "%*s <arpmon interval='%d' target='%s'", @@ -975,8 +971,8 @@ static int virInterfaceVlanDefFormat(virBufferPtr buf, const virInterfaceDefPtr def, int level) { if (def->data.vlan.tag == NULL) { - virInterfaceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("vlan misses the tag name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("vlan misses the tag name")); return -1; } @@ -1057,8 +1053,8 @@ virInterfaceStartmodeDefFormat(virBufferPtr buf, mode = "hotplug"; break; default: - virInterfaceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("virInterfaceDefFormat unknown startmode")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("virInterfaceDefFormat unknown startmode")); return -1; } virBufferAsprintf(buf, "%*s <start mode='%s'/>\n", level*2, "", mode); @@ -1071,20 +1067,20 @@ virInterfaceDefDevFormat(virBufferPtr buf, const char *type = NULL; if (def == NULL) { - virInterfaceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("virInterfaceDefFormat NULL def")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("virInterfaceDefFormat NULL def")); goto cleanup; } if ((def->name == NULL) && (def->type != VIR_INTERFACE_TYPE_VLAN)) { - virInterfaceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("virInterfaceDefFormat missing interface name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("virInterfaceDefFormat missing interface name")); goto cleanup; } if (!(type = virInterfaceTypeToString(def->type))) { - virInterfaceReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected interface type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected interface type %d"), def->type); goto cleanup; } @@ -1285,8 +1281,8 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces, return NULL; } if (virMutexInit(&iface->lock) < 0) { - virInterfaceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); VIR_FREE(iface); return NULL; } diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c index 24cd13d64..4dbf18d8b 100644 --- a/src/conf/netdev_bandwidth_conf.c +++ b/src/conf/netdev_bandwidth_conf.c @@ -28,10 +28,6 @@ #include "memory.h" #define VIR_FROM_THIS VIR_FROM_NONE -#define virNetDevError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - static int virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate) @@ -42,7 +38,7 @@ virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate) char *burst = NULL; if (!node || !rate) { - virNetDevError(VIR_ERR_INVALID_ARG, "%s", + virReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument supplied")); return -1; } @@ -53,26 +49,26 @@ virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate) if (average) { if (virStrToLong_ull(average, NULL, 10, &rate->average) < 0) { - virNetDevError(VIR_ERR_CONFIG_UNSUPPORTED, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("could not convert %s"), average); goto cleanup; } } else { - virNetDevError(VIR_ERR_XML_DETAIL, "%s", + virReportError(VIR_ERR_XML_DETAIL, "%s", _("Missing mandatory average attribute")); goto cleanup; } if (peak && virStrToLong_ull(peak, NULL, 10, &rate->peak) < 0) { - virNetDevError(VIR_ERR_CONFIG_UNSUPPORTED, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("could not convert %s"), peak); goto cleanup; } if (burst && virStrToLong_ull(burst, NULL, 10, &rate->burst) < 0) { - virNetDevError(VIR_ERR_CONFIG_UNSUPPORTED, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("could not convert %s"), burst); goto cleanup; @@ -109,7 +105,7 @@ virNetDevBandwidthParse(xmlNodePtr node) } if (!node || !xmlStrEqual(node->name, BAD_CAST "bandwidth")) { - virNetDevError(VIR_ERR_INVALID_ARG, "%s", + virReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument supplied")); goto error; } @@ -118,7 +114,7 @@ virNetDevBandwidthParse(xmlNodePtr node) if (cur->type == XML_ELEMENT_NODE) { if (xmlStrEqual(cur->name, BAD_CAST "inbound")) { if (in) { - virNetDevError(VIR_ERR_XML_DETAIL, "%s", + virReportError(VIR_ERR_XML_DETAIL, "%s", _("Only one child <inbound> " "element allowed")); goto error; @@ -126,7 +122,7 @@ virNetDevBandwidthParse(xmlNodePtr node) in = cur; } else if (xmlStrEqual(cur->name, BAD_CAST "outbound")) { if (out) { - virNetDevError(VIR_ERR_XML_DETAIL, "%s", + virReportError(VIR_ERR_XML_DETAIL, "%s", _("Only one child <outbound> " "element allowed")); goto error; diff --git a/src/conf/netdev_vport_profile_conf.c b/src/conf/netdev_vport_profile_conf.c index 6bc29bae9..269931050 100644 --- a/src/conf/netdev_vport_profile_conf.c +++ b/src/conf/netdev_vport_profile_conf.c @@ -27,9 +27,6 @@ #include "memory.h" #define VIR_FROM_THIS VIR_FROM_NONE -#define virNetDevError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) VIR_ENUM_IMPL(virNetDevVPort, VIR_NETDEV_VPORT_PROFILE_LAST, @@ -59,13 +56,13 @@ virNetDevVPortProfileParse(xmlNodePtr node) virtPortType = virXMLPropString(node, "type"); if (!virtPortType) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("missing virtualportprofile type")); goto error; } if ((virtPort->virtPortType = virNetDevVPortTypeFromString(virtPortType)) <= 0) { - virNetDevError(VIR_ERR_XML_ERROR, + virReportError(VIR_ERR_XML_ERROR, _("unknown virtualportprofile type %s"), virtPortType); goto error; } @@ -92,13 +89,13 @@ virNetDevVPortProfileParse(xmlNodePtr node) unsigned int val; if (virStrToLong_ui(virtPortManagerID, NULL, 0, &val)) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse value of managerid parameter")); goto error; } if (val > 0xff) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("value of managerid out of range")); goto error; } @@ -106,13 +103,13 @@ virNetDevVPortProfileParse(xmlNodePtr node) virtPort->u.virtPort8021Qbg.managerID = (uint8_t)val; if (virStrToLong_ui(virtPortTypeID, NULL, 0, &val)) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse value of typeid parameter")); goto error; } if (val > 0xffffff) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("value for typeid out of range")); goto error; } @@ -120,13 +117,13 @@ virNetDevVPortProfileParse(xmlNodePtr node) virtPort->u.virtPort8021Qbg.typeID = (uint32_t)val; if (virStrToLong_ui(virtPortTypeIDVersion, NULL, 0, &val)) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse value of typeidversion parameter")); goto error; } if (val > 0xff) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("value of typeidversion out of range")); goto error; } @@ -136,13 +133,13 @@ virNetDevVPortProfileParse(xmlNodePtr node) if (virtPortInstanceID != NULL) { if (virUUIDParse(virtPortInstanceID, virtPort->u.virtPort8021Qbg.instanceID)) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse instanceid parameter as a uuid")); goto error; } } else { if (virUUIDGenerate(virtPort->u.virtPort8021Qbg.instanceID)) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot generate a random uuid for instanceid")); goto error; } @@ -151,7 +148,7 @@ virNetDevVPortProfileParse(xmlNodePtr node) virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBG; } else { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("a parameter is missing for 802.1Qbg description")); goto error; } @@ -163,12 +160,12 @@ virNetDevVPortProfileParse(xmlNodePtr node) virtPortProfileID) != NULL) { virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBH; } else { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("profileid parameter too long")); goto error; } } else { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("profileid parameter is missing for 802.1Qbh description")); goto error; } @@ -177,13 +174,13 @@ virNetDevVPortProfileParse(xmlNodePtr node) if (virtPortInterfaceID != NULL) { if (virUUIDParse(virtPortInterfaceID, virtPort->u.openvswitch.interfaceID)) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot parse interfaceid parameter as a uuid")); goto error; } } else { if (virUUIDGenerate(virtPort->u.openvswitch.interfaceID)) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("cannot generate a random uuid for interfaceid")); goto error; } @@ -192,7 +189,7 @@ virNetDevVPortProfileParse(xmlNodePtr node) if (virtPortProfileID != NULL) { if (virStrcpyStatic(virtPort->u.openvswitch.profileID, virtPortProfileID) == NULL) { - virNetDevError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_XML_ERROR, "%s", _("profileid parameter too long")); goto error; } @@ -202,7 +199,7 @@ virNetDevVPortProfileParse(xmlNodePtr node) break; default: - virNetDevError(VIR_ERR_XML_ERROR, + virReportError(VIR_ERR_XML_ERROR, _("unexpected virtualport type %d"), virtPort->virtPortType); goto error; } @@ -269,7 +266,7 @@ virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort, break; default: - virNetDevError(VIR_ERR_XML_ERROR, + virReportError(VIR_ERR_XML_ERROR, _("unexpected virtualport type %d"), virtPort->virtPortType); return -1; } diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 8fe1f7025..41864bea6 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -53,10 +53,6 @@ VIR_ENUM_IMPL(virNetworkForward, VIR_NETWORK_FORWARD_LAST, "none", "nat", "route", "bridge", "private", "vepa", "passthrough" ) -#define virNetworkReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_NETWORK, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets, const unsigned char *uuid) { @@ -237,8 +233,8 @@ virNetworkObjPtr virNetworkAssignDef(virNetworkObjListPtr nets, return NULL; } if (virMutexInit(&network->lock) < 0) { - virNetworkReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); VIR_FREE(network); return NULL; } @@ -400,9 +396,9 @@ virNetworkDHCPRangeDefParseXML(const char *networkName, range = virSocketAddrGetRange(&saddr, &eaddr); if (range < 0) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Invalid dhcp range '%s' to '%s' in network '%s'"), - start, end, networkName); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid dhcp range '%s' to '%s' in network '%s'"), + start, end, networkName); VIR_FREE(start); VIR_FREE(end); return -1; @@ -426,25 +422,25 @@ virNetworkDHCPRangeDefParseXML(const char *networkName, mac = virXMLPropString(cur, "mac"); if (mac != NULL) { if (virMacAddrParse(mac, &addr) < 0) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Cannot parse MAC address '%s' in network '%s'"), - mac, networkName); + virReportError(VIR_ERR_XML_ERROR, + _("Cannot parse MAC address '%s' in network '%s'"), + mac, networkName); VIR_FREE(mac); return -1; } if (virMacAddrIsMulticast(&addr)) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("expected unicast mac address, found multicast '%s' in network '%s'"), - (const char *)mac, networkName); + virReportError(VIR_ERR_XML_ERROR, + _("expected unicast mac address, found multicast '%s' in network '%s'"), + (const char *)mac, networkName); VIR_FREE(mac); return -1; } } name = virXMLPropString(cur, "name"); if ((name != NULL) && (!c_isalpha(name[0]))) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Cannot use name address '%s' in network '%s'"), - name, networkName); + virReportError(VIR_ERR_XML_ERROR, + _("Cannot use name address '%s' in network '%s'"), + name, networkName); VIR_FREE(mac); VIR_FREE(name); return -1; @@ -453,17 +449,17 @@ virNetworkDHCPRangeDefParseXML(const char *networkName, * You need at least one MAC address or one host name */ if ((mac == NULL) && (name == NULL)) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Static host definition in network '%s' must have mac or name attribute"), - networkName); + virReportError(VIR_ERR_XML_ERROR, + _("Static host definition in network '%s' must have mac or name attribute"), + networkName); return -1; } ip = virXMLPropString(cur, "ip"); if ((ip == NULL) || (virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Missing IP address in static host definition for network '%s'"), - networkName); + virReportError(VIR_ERR_XML_ERROR, + _("Missing IP address in static host definition for network '%s'"), + networkName); VIR_FREE(ip); VIR_FREE(mac); VIR_FREE(name); @@ -523,8 +519,8 @@ virNetworkDNSHostsDefParseXML(virNetworkDNSDefPtr def, if (!(ip = virXMLPropString(node, "ip")) || (virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) { - virNetworkReportError(VIR_ERR_XML_DETAIL, - _("Missing IP address in DNS host definition")); + virReportError(VIR_ERR_XML_DETAIL, + _("Missing IP address in DNS host definition")); VIR_FREE(ip); goto error; } @@ -584,28 +580,28 @@ virNetworkDNSSrvDefParseXML(virNetworkDNSDefPtr def, int ret = 0; if (!(service = virXMLPropString(cur, "service"))) { - virNetworkReportError(VIR_ERR_XML_DETAIL, - "%s", _("Missing required service attribute in dns srv record")); + virReportError(VIR_ERR_XML_DETAIL, + "%s", _("Missing required service attribute in dns srv record")); goto error; } if (strlen(service) > DNS_RECORD_LENGTH_SRV) { - virNetworkReportError(VIR_ERR_XML_DETAIL, - _("Service name is too long, limit is %d bytes"), - DNS_RECORD_LENGTH_SRV); + virReportError(VIR_ERR_XML_DETAIL, + _("Service name is too long, limit is %d bytes"), + DNS_RECORD_LENGTH_SRV); goto error; } if (!(protocol = virXMLPropString(cur, "protocol"))) { - virNetworkReportError(VIR_ERR_XML_DETAIL, - _("Missing required protocol attribute in dns srv record '%s'"), service); + virReportError(VIR_ERR_XML_DETAIL, + _("Missing required protocol attribute in dns srv record '%s'"), service); goto error; } /* Check whether protocol value is the supported one */ if (STRNEQ(protocol, "tcp") && (STRNEQ(protocol, "udp"))) { - virNetworkReportError(VIR_ERR_XML_DETAIL, - _("Invalid protocol attribute value '%s'"), protocol); + virReportError(VIR_ERR_XML_DETAIL, + _("Invalid protocol attribute value '%s'"), protocol); goto error; } @@ -681,19 +677,19 @@ virNetworkDNSDefParseXML(virNetworkDNSDefPtr *dnsdef, if (cur->type == XML_ELEMENT_NODE && xmlStrEqual(cur->name, BAD_CAST "txt")) { if (!(name = virXMLPropString(cur, "name"))) { - virNetworkReportError(VIR_ERR_XML_DETAIL, - "%s", _("Missing required name attribute in dns txt record")); + virReportError(VIR_ERR_XML_DETAIL, + "%s", _("Missing required name attribute in dns txt record")); goto error; } if (!(value = virXMLPropString(cur, "value"))) { - virNetworkReportError(VIR_ERR_XML_DETAIL, - _("Missing required value attribute in dns txt record '%s'"), name); + virReportError(VIR_ERR_XML_DETAIL, + _("Missing required value attribute in dns txt record '%s'"), name); goto error; } if (strchr(name, ' ') != NULL) { - virNetworkReportError(VIR_ERR_XML_DETAIL, - _("spaces are not allowed in DNS TXT record names (name is '%s')"), name); + virReportError(VIR_ERR_XML_DETAIL, + _("spaces are not allowed in DNS TXT record names (name is '%s')"), name); goto error; } @@ -765,9 +761,9 @@ virNetworkIPParseXML(const char *networkName, if (address) { if (virSocketAddrParse(&def->address, address, AF_UNSPEC) < 0) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Bad address '%s' in definition of network '%s'"), - address, networkName); + virReportError(VIR_ERR_XML_ERROR, + _("Bad address '%s' in definition of network '%s'"), + address, networkName); goto error; } @@ -777,29 +773,29 @@ virNetworkIPParseXML(const char *networkName, if (def->family == NULL) { if (!(VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET) || VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_UNSPEC))) { - virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("no family specified for non-IPv4 address '%s' in network '%s'"), - address, networkName); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("no family specified for non-IPv4 address '%s' in network '%s'"), + address, networkName); goto error; } } else if (STREQ(def->family, "ipv4")) { if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET)) { - virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("family 'ipv4' specified for non-IPv4 address '%s' in network '%s'"), - address, networkName); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("family 'ipv4' specified for non-IPv4 address '%s' in network '%s'"), + address, networkName); goto error; } } else if (STREQ(def->family, "ipv6")) { if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET6)) { - virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("family 'ipv6' specified for non-IPv6 address '%s' in network '%s'"), - address, networkName); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("family 'ipv6' specified for non-IPv6 address '%s' in network '%s'"), + address, networkName); goto error; } } else { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Unrecognized family '%s' in definition of network '%s'"), - def->family, networkName); + virReportError(VIR_ERR_XML_ERROR, + _("Unrecognized family '%s' in definition of network '%s'"), + def->family, networkName); goto error; } @@ -807,24 +803,24 @@ virNetworkIPParseXML(const char *networkName, if (netmask) { if (address == NULL) { /* netmask is meaningless without an address */ - virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("netmask specified without address in network '%s'"), - networkName); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("netmask specified without address in network '%s'"), + networkName); goto error; } if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET)) { - virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("netmask not supported for address '%s' in network '%s' (IPv4 only)"), - address, networkName); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("netmask not supported for address '%s' in network '%s' (IPv4 only)"), + address, networkName); goto error; } if (def->prefix > 0) { /* can't have both netmask and prefix at the same time */ - virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("network '%s' cannot have both prefix='%u' and a netmask"), - networkName, def->prefix); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("network '%s' cannot have both prefix='%u' and a netmask"), + networkName, def->prefix); goto error; } @@ -832,9 +828,9 @@ virNetworkIPParseXML(const char *networkName, goto error; if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->netmask, AF_INET)) { - virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("network '%s' has invalid netmask '%s' for address '%s' (both must be IPv4)"), - networkName, netmask, address); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("network '%s' has invalid netmask '%s' for address '%s' (both must be IPv4)"), + networkName, netmask, address); goto error; } } @@ -951,7 +947,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) /* Extract network name */ def->name = virXPathString("string(./name[1])", ctxt); if (!def->name) { - virNetworkReportError(VIR_ERR_NO_NAME, NULL); + virReportError(VIR_ERR_NO_NAME, NULL); goto error; } @@ -959,15 +955,15 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) tmp = virXPathString("string(./uuid[1])", ctxt); if (!tmp) { if (virUUIDGenerate(def->uuid)) { - virNetworkReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to generate UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate UUID")); goto error; } } else { if (virUUIDParse(tmp, def->uuid) < 0) { VIR_FREE(tmp); - virNetworkReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed uuid element")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed uuid element")); goto error; } VIR_FREE(tmp); @@ -990,16 +986,16 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) tmp = virXPathString("string(./mac[1]/@address)", ctxt); if (tmp) { if (virMacAddrParse(tmp, &def->mac) < 0) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Invalid bridge mac address '%s' in network '%s'"), - tmp, def->name); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid bridge mac address '%s' in network '%s'"), + tmp, def->name); VIR_FREE(tmp); goto error; } if (virMacAddrIsMulticast(&def->mac)) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Invalid multicast bridge mac address '%s' in network '%s'"), - tmp, def->name); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid multicast bridge mac address '%s' in network '%s'"), + tmp, def->name); VIR_FREE(tmp); goto error; } @@ -1073,8 +1069,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) tmp = virXPathString("string(./@mode)", ctxt); if (tmp) { if ((def->forwardType = virNetworkForwardTypeFromString(tmp)) < 0) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("unknown forwarding type '%s'"), tmp); + virReportError(VIR_ERR_XML_ERROR, + _("unknown forwarding type '%s'"), tmp); VIR_FREE(tmp); goto error; } @@ -1090,8 +1086,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) nForwardPfs = virXPathNodeSet("./pf", ctxt, &forwardPfNodes); if (nForwardIfs < 0 || nForwardPfs < 0) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("No interface pool or SRIOV physical device given")); + virReportError(VIR_ERR_XML_ERROR, + _("No interface pool or SRIOV physical device given")); goto error; } @@ -1102,16 +1098,16 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) } if (forwardDev) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("A forward Dev should not be used when using a SRIOV PF")); + virReportError(VIR_ERR_XML_ERROR, + _("A forward Dev should not be used when using a SRIOV PF")); goto error; } forwardDev = virXMLPropString(*forwardPfNodes, "dev"); if (!forwardDev) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Missing required dev attribute in network '%s' pf element"), - def->name); + virReportError(VIR_ERR_XML_ERROR, + _("Missing required dev attribute in network '%s' pf element"), + def->name); goto error; } @@ -1120,8 +1116,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) forwardDev = NULL; def->nForwardPfs++; } else if (nForwardPfs > 1) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Use of more than one physical interface is not allowed")); + virReportError(VIR_ERR_XML_ERROR, + _("Use of more than one physical interface is not allowed")); goto error; } if (nForwardIfs > 0 || forwardDev) { @@ -1144,9 +1140,9 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) for (ii = 0; ii < nForwardIfs; ii++) { forwardDev = virXMLPropString(forwardIfNodes[ii], "dev"); if (!forwardDev) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("Missing required dev attribute in network '%s' forward interface element"), - def->name); + virReportError(VIR_ERR_XML_ERROR, + _("Missing required dev attribute in network '%s' forward interface element"), + def->name); goto error; } @@ -1154,10 +1150,10 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) /* both forwardDev and an interface element are present. * If they don't match, it's an error. */ if (STRNEQ(forwardDev, def->forwardIfs[0].dev)) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("forward dev '%s' must match first interface element dev '%s' in network '%s'"), - def->forwardIfs[0].dev, - forwardDev, def->name); + virReportError(VIR_ERR_XML_ERROR, + _("forward dev '%s' must match first interface element dev '%s' in network '%s'"), + def->forwardIfs[0].dev, + forwardDev, def->name); goto error; } VIR_FREE(forwardDev); @@ -1181,16 +1177,16 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) * the network we're on. */ if (def->nips == 0) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("%s forwarding requested, but no IP address provided for network '%s'"), - virNetworkForwardTypeToString(def->forwardType), - def->name); + virReportError(VIR_ERR_XML_ERROR, + _("%s forwarding requested, but no IP address provided for network '%s'"), + virNetworkForwardTypeToString(def->forwardType), + def->name); goto error; } if (def->nForwardIfs > 1) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("multiple forwarding interfaces specified for network '%s', only one is supported"), - def->name); + virReportError(VIR_ERR_XML_ERROR, + _("multiple forwarding interfaces specified for network '%s', only one is supported"), + def->name); goto error; } def->stp = (stp && STREQ(stp, "off")) ? 0 : 1; @@ -1199,19 +1195,19 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) case VIR_NETWORK_FORWARD_VEPA: case VIR_NETWORK_FORWARD_PASSTHROUGH: if (def->bridge) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("bridge name not allowed in %s mode (network '%s')"), - virNetworkForwardTypeToString(def->forwardType), - def->name); + virReportError(VIR_ERR_XML_ERROR, + _("bridge name not allowed in %s mode (network '%s')"), + virNetworkForwardTypeToString(def->forwardType), + def->name); goto error; } /* fall through to next case */ case VIR_NETWORK_FORWARD_BRIDGE: if (def->delay || stp) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("bridge delay/stp options only allowed in route, nat, and isolated mode, not in %s (network '%s')"), - virNetworkForwardTypeToString(def->forwardType), - def->name); + virReportError(VIR_ERR_XML_ERROR, + _("bridge delay/stp options only allowed in route, nat, and isolated mode, not in %s (network '%s')"), + virNetworkForwardTypeToString(def->forwardType), + def->name); goto error; } break; @@ -1266,10 +1262,10 @@ virNetworkDefPtr virNetworkDefParseNode(xmlDocPtr xml, virNetworkDefPtr def = NULL; if (!xmlStrEqual(root->name, BAD_CAST "network")) { - virNetworkReportError(VIR_ERR_XML_ERROR, - _("unexpected root element <%s>, " - "expecting <network>"), - root->name); + virReportError(VIR_ERR_XML_ERROR, + _("unexpected root element <%s>, " + "expecting <network>"), + root->name); return NULL; } @@ -1476,9 +1472,9 @@ char *virNetworkDefFormat(const virNetworkDefPtr def, unsigned int flags) const char *mode = virNetworkForwardTypeToString(def->forwardType); if (!mode) { - virNetworkReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown forward type %d in network '%s'"), - def->forwardType, def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown forward type %d in network '%s'"), + def->forwardType, def->name); goto error; } virBufferAddLit(&buf, " <forward"); @@ -1644,10 +1640,10 @@ virNetworkObjPtr virNetworkLoadConfig(virNetworkObjListPtr nets, goto error; if (!STREQ(name, def->name)) { - virNetworkReportError(VIR_ERR_INTERNAL_ERROR, - _("Network config filename '%s'" - " does not match network name '%s'"), - configFile, def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Network config filename '%s'" + " does not match network name '%s'"), + configFile, def->name); goto error; } @@ -1806,9 +1802,9 @@ char *virNetworkAllocateBridge(const virNetworkObjListPtr nets, id++; } while (id <= MAX_BRIDGE_ID); - virNetworkReportError(VIR_ERR_INTERNAL_ERROR, - _("Bridge generation exceeded max id %d"), - MAX_BRIDGE_ID); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Bridge generation exceeded max id %d"), + MAX_BRIDGE_ID); return NULL; } @@ -1824,9 +1820,9 @@ int virNetworkSetBridgeName(const virNetworkObjListPtr nets, * defined. */ if (check_collision && virNetworkBridgeInUse(nets, def->bridge, def->name)) { - virNetworkReportError(VIR_ERR_INTERNAL_ERROR, - _("bridge name '%s' already in use."), - def->bridge); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("bridge name '%s' already in use."), + def->bridge); goto error; } } else { @@ -1879,18 +1875,18 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms, if (STRNEQ(vm->def->name, def->name)) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(vm->def->uuid, uuidstr); - virNetworkReportError(VIR_ERR_OPERATION_FAILED, - _("network '%s' is already defined with uuid %s"), - vm->def->name, uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("network '%s' is already defined with uuid %s"), + vm->def->name, uuidstr); goto cleanup; } if (check_active) { /* UUID & name match, but if VM is already active, refuse it */ if (virNetworkObjIsActive(vm)) { - virNetworkReportError(VIR_ERR_OPERATION_INVALID, - _("network is already active as '%s'"), - vm->def->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("network is already active as '%s'"), + vm->def->name); goto cleanup; } } @@ -1902,9 +1898,9 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms, if (vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(vm->def->uuid, uuidstr); - virNetworkReportError(VIR_ERR_OPERATION_FAILED, - _("network '%s' already exists with uuid %s"), - def->name, uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("network '%s' already exists with uuid %s"), + def->name, uuidstr); goto cleanup; } } diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index c21150d77..7144415e5 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -185,8 +185,8 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs, } if (virMutexInit(&device->lock) < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); VIR_FREE(device); return NULL; } @@ -506,9 +506,9 @@ virNodeDevCapsDefParseULong(const char *xpath, ret = virXPathULong(xpath, ctxt, &val); if (ret < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - ret == -1 ? missing_error_fmt : invalid_error_fmt, - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + ret == -1 ? missing_error_fmt : invalid_error_fmt, + def->name); return -1; } @@ -529,9 +529,9 @@ virNodeDevCapsDefParseULongLong(const char *xpath, ret = virXPathULongLong(xpath, ctxt, &val); if (ret < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - ret == -1 ? missing_error_fmt : invalid_error_fmt, - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + ret == -1 ? missing_error_fmt : invalid_error_fmt, + def->name); return -1; } @@ -554,9 +554,9 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, data->storage.block = virXPathString("string(./block[1])", ctxt); if (!data->storage.block) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("no block device path supplied for '%s'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no block device path supplied for '%s'"), + def->name); goto out; } @@ -574,9 +574,9 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, char *type = virXMLPropString(nodes[i], "type"); if (!type) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("missing storage capability type for '%s'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing storage capability type for '%s'"), + def->name); goto out; } @@ -607,9 +607,9 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, ctxt->node = orignode2; } else { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown storage capability type '%s' for '%s'"), - type, def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown storage capability type '%s' for '%s'"), + type, def->name); VIR_FREE(type); goto out; } @@ -692,9 +692,9 @@ virNodeDevCapScsiTargetParseXML(xmlXPathContextPtr ctxt, data->scsi_target.name = virXPathString("string(./name[1])", ctxt); if (!data->scsi_target.name) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("no target name supplied for '%s'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no target name supplied for '%s'"), + def->name); goto out; } @@ -737,9 +737,9 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt, type = virXMLPropString(nodes[i], "type"); if (!type) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("missing SCSI host capability type for '%s'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing SCSI host capability type for '%s'"), + def->name); goto out; } @@ -760,10 +760,10 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt, ctxt, &data->scsi_host.wwnn) < 0) { if (virRandomGenerateWWN(&data->scsi_host.wwnn, virt_type) < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("no WWNN supplied for '%s', and " - "auto-generation failed"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no WWNN supplied for '%s', and " + "auto-generation failed"), + def->name); goto out; } } @@ -772,10 +772,10 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt, ctxt, &data->scsi_host.wwpn) < 0) { if (virRandomGenerateWWN(&data->scsi_host.wwpn, virt_type) < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("no WWPN supplied for '%s', and " - "auto-generation failed"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no WWPN supplied for '%s', and " + "auto-generation failed"), + def->name); goto out; } } @@ -783,9 +783,9 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt, ctxt->node = orignode2; } else { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown SCSI host capability type '%s' for '%s'"), - type, def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown SCSI host capability type '%s' for '%s'"), + type, def->name); goto out; } @@ -817,9 +817,9 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, data->net.ifname = virXPathString("string(./interface[1])", ctxt); if (!data->net.ifname) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("no network interface supplied for '%s'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no network interface supplied for '%s'"), + def->name); goto out; } @@ -832,9 +832,9 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, int val = virNodeDevNetCapTypeFromString(tmp); VIR_FREE(tmp); if (val < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid network type supplied for '%s'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid network type supplied for '%s'"), + def->name); goto out; } data->net.subtype = val; @@ -903,9 +903,9 @@ virNodeDevCapsDefParseHexId(const char *xpath, ret = virXPathULongHex(xpath, ctxt, &val); if (ret < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - ret == -1 ? missing_error_fmt : invalid_error_fmt, - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + ret == -1 ? missing_error_fmt : invalid_error_fmt, + def->name); return -1; } @@ -1036,14 +1036,14 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt, tmp = virXPathString("string(./hardware/uuid[1])", ctxt); if (!tmp) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("no system UUID supplied for '%s'"), def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no system UUID supplied for '%s'"), def->name); goto out; } if (virUUIDParse(tmp, data->system.hardware.uuid) < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("malformed uuid element for '%s'"), def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("malformed uuid element for '%s'"), def->name); VIR_FREE(tmp); goto out; } @@ -1077,14 +1077,14 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, tmp = virXMLPropString(node, "type"); if (!tmp) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing capability type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing capability type")); goto error; } if ((val = virNodeDevCapTypeFromString(tmp)) < 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown capability type '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown capability type '%s'"), tmp); VIR_FREE(tmp); goto error; } @@ -1123,9 +1123,9 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, ret = virNodeDevCapStorageParseXML(ctxt, def, node, &caps->data); break; default: - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown capability type '%d' for '%s'"), - caps->type, def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown capability type '%d' for '%s'"), + caps->type, def->name); ret = -1; break; } @@ -1159,7 +1159,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, def->name = virXPathString("string(./name[1])", ctxt); if (!def->name) { - virNodeDeviceReportError(VIR_ERR_NO_NAME, NULL); + virReportError(VIR_ERR_NO_NAME, NULL); goto error; } } else { @@ -1181,9 +1181,9 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, } if (n == 0) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("no device capabilities for '%s'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no device capabilities for '%s'"), + def->name); goto error; } @@ -1219,10 +1219,10 @@ virNodeDeviceDefParseNode(xmlDocPtr xml, virNodeDeviceDefPtr def = NULL; if (!xmlStrEqual(root->name, BAD_CAST "device")) { - virNodeDeviceReportError(VIR_ERR_XML_ERROR, - _("unexpected root element <%s> " - "expecting <device>"), - root->name); + virReportError(VIR_ERR_XML_ERROR, + _("unexpected root element <%s> " + "expecting <device>"), + root->name); return NULL; } @@ -1298,8 +1298,8 @@ virNodeDeviceGetWWNs(virNodeDeviceDefPtr def, } if (cap == NULL) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Device is not a fibre channel HBA")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Device is not a fibre channel HBA")); ret = -1; } else if (*wwnn == NULL || *wwpn == NULL) { /* Free the other one, if allocated... */ @@ -1327,9 +1327,9 @@ virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs, parent = virNodeDeviceFindByName(devs, parent_name); if (parent == NULL) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find parent device for '%s'"), - dev_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find parent device for '%s'"), + dev_name); ret = -1; goto out; } @@ -1347,10 +1347,10 @@ virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs, } if (cap == NULL) { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - _("Parent device %s is not capable " - "of vport operations"), - parent->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parent device %s is not capable " + "of vport operations"), + parent->def->name); ret = -1; } diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 4aaf4c878..ddf5fca23 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -212,9 +212,6 @@ struct _virDeviceMonitorState { void *privateData; /* driver-specific private data */ }; -# define virNodeDeviceReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_NODEDEV, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) int virNodeDeviceHasCap(const virNodeDeviceObjPtr dev, const char *cap); diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index a13f705d5..70fadaadc 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -1007,8 +1007,8 @@ ipsetValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val, return true; arg_err_exit: - virNWFilterReportError(VIR_ERR_INVALID_ARG, - "%s", errmsg); + virReportError(VIR_ERR_INVALID_ARG, + "%s", errmsg); return false; } @@ -1053,8 +1053,8 @@ ipsetFlagsValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val return true; arg_err_exit: - virNWFilterReportError(VIR_ERR_INVALID_ARG, - "%s", errmsg); + virReportError(VIR_ERR_INVALID_ARG, + "%s", errmsg); return false; } @@ -2014,9 +2014,9 @@ virNWFilterRuleDetailsParse(xmlNodePtr node, } if (!found || rc) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("%s has illegal value %s"), - att[idx].name, prop); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s has illegal value %s"), + att[idx].name, prop); rc = -1; } VIR_FREE(prop); @@ -2048,9 +2048,9 @@ virNWFilterIncludeParse(xmlNodePtr cur) ret->filterref = virXMLPropString(cur, "filter"); if (!ret->filterref) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("rule node requires action attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("rule node requires action attribute")); goto err_exit; } @@ -2316,30 +2316,30 @@ virNWFilterRuleParse(xmlNodePtr node) statematch= virXMLPropString(node, "statematch"); if (!action) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("rule node requires action attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("rule node requires action attribute")); goto err_exit; } if ((ret->action = virNWFilterRuleActionTypeFromString(action)) < 0) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("unknown rule action attribute value")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("unknown rule action attribute value")); goto err_exit; } if (!direction) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("rule node requires direction attribute")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("rule node requires direction attribute")); goto err_exit; } if ((ret->tt = virNWFilterRuleDirectionTypeFromString(direction)) < 0) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("unknown rule direction attribute value")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("unknown rule direction attribute value")); goto err_exit; } @@ -2415,16 +2415,16 @@ static bool virNWFilterIsValidChainName(const char *chainname) { if (strlen(chainname) > MAX_CHAIN_SUFFIX_SIZE) { - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Name of chain is longer than " - "%u characters"), - MAX_CHAIN_SUFFIX_SIZE); + virReportError(VIR_ERR_INVALID_ARG, + _("Name of chain is longer than " + "%u characters"), + MAX_CHAIN_SUFFIX_SIZE); return false; } if (chainname[strspn(chainname, VALID_CHAINNAME)] != 0) { - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Chain name contains invalid characters")); + virReportError(VIR_ERR_INVALID_ARG, + _("Chain name contains invalid characters")); return false; } @@ -2483,7 +2483,7 @@ virNWFilterIsAllowedChain(const char *chainname) msg = virBufferContentAndReset(&buf); - virNWFilterReportError(VIR_ERR_INVALID_ARG, "%s", msg); + virReportError(VIR_ERR_INVALID_ARG, "%s", msg); VIR_FREE(msg); err_exit: @@ -2508,27 +2508,27 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt) { ret->name = virXPathString("string(./@name)", ctxt); if (!ret->name) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("filter has no name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("filter has no name")); goto cleanup; } chain_pri_s = virXPathString("string(./@priority)", ctxt); if (chain_pri_s) { if (virStrToLong_i(chain_pri_s, NULL, 10, &chain_priority) < 0) { - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Could not parse chain priority '%s'"), - chain_pri_s); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not parse chain priority '%s'"), + chain_pri_s); goto cleanup; } if (chain_priority < NWFILTER_MIN_FILTER_PRIORITY || chain_priority > NWFILTER_MAX_FILTER_PRIORITY) { - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Priority '%d' is outside valid " - "range of [%d,%d]"), - chain_priority, - NWFILTER_MIN_FILTER_PRIORITY, - NWFILTER_MAX_FILTER_PRIORITY); + virReportError(VIR_ERR_INVALID_ARG, + _("Priority '%d' is outside valid " + "range of [%d,%d]"), + chain_priority, + NWFILTER_MIN_FILTER_PRIORITY, + NWFILTER_MAX_FILTER_PRIORITY); goto cleanup; } } @@ -2565,14 +2565,14 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt) { uuid = virXPathString("string(./uuid)", ctxt); if (uuid == NULL) { if (virUUIDGenerate(ret->uuid) < 0) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unable to generate uuid")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unable to generate uuid")); goto cleanup; } } else { if (virUUIDParse(uuid, ret->uuid) < 0) { - virNWFilterReportError(VIR_ERR_XML_ERROR, - "%s", _("malformed uuid element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("malformed uuid element")); goto cleanup; } VIR_FREE(uuid); @@ -2627,9 +2627,9 @@ virNWFilterDefParseNode(xmlDocPtr xml, virNWFilterDefPtr def = NULL; if (STRNEQ((const char *)root->name, "filter")) { - virNWFilterReportError(VIR_ERR_XML_ERROR, - "%s", - _("unknown root element for nw filter")); + virReportError(VIR_ERR_XML_ERROR, + "%s", + _("unknown root element for nw filter")); goto cleanup; } @@ -2976,10 +2976,10 @@ virNWFilterObjAssignDef(virConnectPtr conn, if (nwfilter) { if (!STREQ(def->name, nwfilter->def->name)) { - virNWFilterReportError(VIR_ERR_OPERATION_FAILED, - _("filter with same UUID but different name " - "('%s') already exists"), - nwfilter->def->name); + virReportError(VIR_ERR_OPERATION_FAILED, + _("filter with same UUID but different name " + "('%s') already exists"), + nwfilter->def->name); virNWFilterObjUnlock(nwfilter); return NULL; } @@ -2987,8 +2987,8 @@ virNWFilterObjAssignDef(virConnectPtr conn, } if (virNWFilterDefLoopDetect(conn, nwfilters, def) < 0) { - virNWFilterReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("filter would introduce a loop")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("filter would introduce a loop")); return NULL; } @@ -3027,8 +3027,8 @@ virNWFilterObjAssignDef(virConnectPtr conn, } if (virMutexInitRecursive(&nwfilter->lock) < 0) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); VIR_FREE(nwfilter); return NULL; } @@ -3063,9 +3063,9 @@ virNWFilterObjLoad(virConnectPtr conn, } if (!virFileMatchesNameSuffix(file, def->name, ".xml")) { - virNWFilterReportError(VIR_ERR_XML_ERROR, - _("network filter config filename '%s' does not match name '%s'"), - path, def->name); + virReportError(VIR_ERR_XML_ERROR, + _("network filter config filename '%s' does not match name '%s'"), + path, def->name); virNWFilterDefFree(def); return NULL; } @@ -3153,8 +3153,8 @@ virNWFilterObjSaveDef(virNWFilterDriverStatePtr driver, } if (!(xml = virNWFilterDefFormat(def))) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to generate XML")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to generate XML")); return -1; } @@ -3169,15 +3169,15 @@ int virNWFilterObjDeleteDef(virNWFilterObjPtr nwfilter) { if (!nwfilter->configFile) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("no config file for %s"), nwfilter->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no config file for %s"), nwfilter->def->name); return -1; } if (unlink(nwfilter->configFile) < 0) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot remove config for %s"), - nwfilter->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot remove config for %s"), + nwfilter->def->name); return -1; } @@ -3248,10 +3248,10 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, att[i].name); if (att[i].formatter && !(flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) { if (!att[i].formatter(buf, def, item)) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("formatter for %s %s reported error"), - type, - att[i].name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("formatter for %s %s reported error"), + type, + att[i].name); goto err_exit; } } else if ((flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) { diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h index ad4a175fb..5cffded7d 100644 --- a/src/conf/nwfilter_conf.h +++ b/src/conf/nwfilter_conf.h @@ -731,10 +731,6 @@ void virNWFilterConfLayerShutdown(void); int virNWFilterInstFiltersOnAllVMs(virConnectPtr conn); -# define virNWFilterReportError(code, fmt...) \ - virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) - typedef int (*virNWFilterRebuild)(virConnectPtr conn, virHashIterator, void *data); diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c index 79f780048..d08e86099 100644 --- a/src/conf/nwfilter_params.c +++ b/src/conf/nwfilter_params.c @@ -113,8 +113,8 @@ virNWFilterVarValueCreateSimple(char *value) virNWFilterVarValuePtr val; if (!isValidVarValue(value)) { - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Variable value contains invalid character")); + virReportError(VIR_ERR_INVALID_ARG, + _("Variable value contains invalid character")); return NULL; } @@ -324,9 +324,9 @@ virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie, varValue = virHashLookup(hash->hashTable, varName); if (varValue == NULL) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find value for variable '%s'"), - varName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find value for variable '%s'"), + varName); return -1; } @@ -349,10 +349,10 @@ virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie, cie->curValue = minValue; } else { if (cie->maxValue != maxValue) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("Cardinality of list items must be " - "the same for processing them in " - "parallel")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cardinality of list items must be " + "the same for processing them in " + "parallel")); return -1; } } @@ -541,9 +541,9 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci, iterId = virNWFilterVarAccessGetIterId(vap); iterIndex = virNWFilterVarCombIterGetIndexByIterId(ci, iterId); if (iterIndex < 0) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get iterator index for " - "iterator ID %u"), iterId); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get iterator index for " + "iterator ID %u"), iterId); return NULL; } break; @@ -551,9 +551,9 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci, iterId = virNWFilterVarAccessGetIntIterId(vap); iterIndex = virNWFilterVarCombIterGetIndexByIterId(ci, iterId); if (iterIndex < 0) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get iterator index for " - "(internal) iterator ID %u"), iterId); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get iterator index for " + "(internal) iterator ID %u"), iterId); return NULL; } break; @@ -569,26 +569,26 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci, } if (!found) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find variable '%s' in iterator"), - varName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find variable '%s' in iterator"), + varName); return NULL; } value = virHashLookup(ci->hashTable->hashTable, varName); if (!value) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find value for variable '%s'"), - varName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find value for variable '%s'"), + varName); return NULL; } res = virNWFilterVarValueGetNthValue(value, ci->iter[iterIndex].curValue); if (!res) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get nth (%u) value of " - "variable '%s'"), - ci->iter[iterIndex].curValue, varName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get nth (%u) value of " + "variable '%s'"), + ci->iter[iterIndex].curValue, varName); return NULL; } @@ -736,9 +736,9 @@ addToTable(void *payload, const void *name, void *data) } if (virNWFilterHashTablePut(atts->target, (const char *)name, val, 1) < 0){ - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not put variable '%s' into hashmap"), - (const char *)name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not put variable '%s' into hashmap"), + (const char *)name); atts->errOccurred = 1; virNWFilterVarValueFree(val); } @@ -863,8 +863,8 @@ virNWFilterFormatParamAttributes(virBufferPtr buf, numKeys = virHashSize(table->hashTable); if (numKeys < 0) { - virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing filter parameter table")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing filter parameter table")); return -1; } @@ -998,11 +998,11 @@ virNWFilterVarAccessParse(const char *varAccess) } if (parseError) { if (dest->accessType == VIR_NWFILTER_VAR_ACCESS_ELEMENT) - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Malformatted array index")); + virReportError(VIR_ERR_INVALID_ARG, + _("Malformatted array index")); else - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Malformatted iterator id")); + virReportError(VIR_ERR_INVALID_ARG, + _("Malformatted iterator id")); goto err_exit; } @@ -1013,9 +1013,9 @@ virNWFilterVarAccessParse(const char *varAccess) break; case VIR_NWFILTER_VAR_ACCESS_ITERATOR: if (result > VIR_NWFILTER_MAX_ITERID) { - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Iterator ID exceeds maximum ID " - "of %u"), VIR_NWFILTER_MAX_ITERID); + virReportError(VIR_ERR_INVALID_ARG, + _("Iterator ID exceeds maximum ID " + "of %u"), VIR_NWFILTER_MAX_ITERID); goto err_exit; } dest->u.iterId = result; @@ -1026,8 +1026,8 @@ virNWFilterVarAccessParse(const char *varAccess) return dest; } else { - virNWFilterReportError(VIR_ERR_INVALID_ARG, - _("Malformatted variable")); + virReportError(VIR_ERR_INVALID_ARG, + _("Malformatted variable")); } err_exit: diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c index 6e80733dd..0f72596dc 100644 --- a/src/conf/secret_conf.c +++ b/src/conf/secret_conf.c @@ -73,14 +73,14 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt, type_str = virXPathString("string(./usage/@type)", ctxt); if (type_str == NULL) { - virSecretReportError(VIR_ERR_XML_ERROR, "%s", - _("unknown secret usage type")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("unknown secret usage type")); return -1; } type = virSecretUsageTypeTypeFromString(type_str); if (type < 0) { - virSecretReportError(VIR_ERR_XML_ERROR, - _("unknown secret usage type %s"), type_str); + virReportError(VIR_ERR_XML_ERROR, + _("unknown secret usage type %s"), type_str); VIR_FREE(type_str); return -1; } @@ -93,8 +93,8 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt, case VIR_SECRET_USAGE_TYPE_VOLUME: def->usage.volume = virXPathString("string(./usage/volume)", ctxt); if (!def->usage.volume) { - virSecretReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("volume usage specified, but volume path is missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("volume usage specified, but volume path is missing")); return -1; } break; @@ -102,16 +102,16 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt, case VIR_SECRET_USAGE_TYPE_CEPH: def->usage.ceph = virXPathString("string(./usage/name)", ctxt); if (!def->usage.ceph) { - virSecretReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Ceph usage specified, but name is missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Ceph usage specified, but name is missing")); return -1; } break; default: - virSecretReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected secret usage type %d"), - def->usage_type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected secret usage type %d"), + def->usage_type); return -1; } return 0; @@ -126,10 +126,10 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root) char *uuidstr = NULL; if (!xmlStrEqual(root->name, BAD_CAST "secret")) { - virSecretReportError(VIR_ERR_XML_ERROR, - _("unexpected root element <%s>, " - "expecting <secret>"), - root->name); + virReportError(VIR_ERR_XML_ERROR, + _("unexpected root element <%s>, " + "expecting <secret>"), + root->name); goto cleanup; } @@ -152,8 +152,8 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root) else if (STREQ(prop, "no")) def->ephemeral = 0; else { - virSecretReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid value of 'ephemeral'")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid value of 'ephemeral'")); goto cleanup; } VIR_FREE(prop); @@ -166,8 +166,8 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root) else if (STREQ(prop, "no")) def->private = 0; else { - virSecretReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid value of 'private'")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid value of 'private'")); goto cleanup; } VIR_FREE(prop); @@ -176,14 +176,14 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root) uuidstr = virXPathString("string(./uuid)", ctxt); if (!uuidstr) { if (virUUIDGenerate(def->uuid)) { - virSecretReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to generate UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate UUID")); goto cleanup; } } else { if (virUUIDParse(uuidstr, def->uuid) < 0) { - virSecretReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed uuid element")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed uuid element")); goto cleanup; } VIR_FREE(uuidstr); @@ -239,9 +239,9 @@ virSecretDefFormatUsage(virBufferPtr buf, type = virSecretUsageTypeTypeToString(def->usage_type); if (type == NULL) { - virSecretReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected secret usage type %d"), - def->usage_type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected secret usage type %d"), + def->usage_type); return -1; } virBufferAsprintf(buf, " <usage type='%s'>\n", type); @@ -263,9 +263,9 @@ virSecretDefFormatUsage(virBufferPtr buf, break; default: - virSecretReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected secret usage type %d"), - def->usage_type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected secret usage type %d"), + def->usage_type); return -1; } virBufferAddLit(buf, " </usage>\n"); diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h index b5d72d4d9..854b380c1 100644 --- a/src/conf/secret_conf.h +++ b/src/conf/secret_conf.h @@ -26,10 +26,6 @@ # include "internal.h" # include "util.h" -# define virSecretReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_SECRET, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - VIR_ENUM_DECL(virSecretUsageType) typedef struct _virSecretDef virSecretDef; diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 36a3bb91c..44387b263 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -236,8 +236,8 @@ virStoragePoolTypeInfoLookup(int type) { if (poolTypeInfo[i].poolType == type) return &poolTypeInfo[i]; - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - _("missing backend for pool type %d"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing backend for pool type %d"), type); return NULL; } @@ -402,15 +402,15 @@ virStoragePoolDefParseAuthChap(xmlXPathContextPtr ctxt, virStoragePoolAuthChapPtr auth) { auth->login = virXPathString("string(./auth/@login)", ctxt); if (auth->login == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing auth host attribute")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing auth host attribute")); return -1; } auth->passwd = virXPathString("string(./auth/@passwd)", ctxt); if (auth->passwd == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing auth passwd attribute")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing auth passwd attribute")); return -1; } @@ -423,22 +423,22 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt, char *uuid = NULL; auth->username = virXPathString("string(./auth/@username)", ctxt); if (auth->username == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing auth username attribute")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing auth username attribute")); return -1; } uuid = virXPathString("string(./auth/secret/@uuid)", ctxt); auth->secret.usage = virXPathString("string(./auth/secret/@usage)", ctxt); if (uuid == NULL && auth->secret.usage == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, "%s", - _("missing auth secret uuid or usage attribute")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing auth secret uuid or usage attribute")); return -1; } if (virUUIDParse(uuid, auth->secret.uuid) < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("invalid auth secret uuid")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("invalid auth secret uuid")); return -1; } @@ -467,8 +467,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, source->name = virXPathString("string(./name)", ctxt); if (pool_type == VIR_STORAGE_POOL_RBD && source->name == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, "%s", - _("missing mandatory 'name' field for RBD pool name")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing mandatory 'name' field for RBD pool name")); goto cleanup; } @@ -480,8 +480,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, source->format = options->formatFromString(format); if (source->format < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - _("unknown pool format type %s"), format); + virReportError(VIR_ERR_XML_ERROR, + _("unknown pool format type %s"), format); VIR_FREE(format); goto cleanup; } @@ -499,8 +499,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, for (i = 0 ; i < source->nhost ; i++) { name = virXMLPropString(nodeset[i], "name"); if (name == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing storage pool host name")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing storage pool host name")); goto cleanup; } source->hosts[i].name = name; @@ -508,9 +508,9 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, port = virXMLPropString(nodeset[i], "port"); if (port) { if (virStrToLong_i(port, NULL, 10, &source->hosts[i].port) < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - _("Invalid port number: %s"), - port); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid port number: %s"), + port); goto cleanup; } } @@ -535,8 +535,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, char *path = virXMLPropString(nodeset[i], "path"); if (path == NULL) { VIR_FREE(nodeset); - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing storage pool source device path")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing storage pool source device path")); goto cleanup; } source->devices[i].path = path; @@ -556,9 +556,9 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, } else if (STREQ(authType, "ceph")) { source->authType = VIR_STORAGE_POOL_AUTH_CEPHX; } else { - virStorageReportError(VIR_ERR_XML_ERROR, - _("unknown auth type '%s'"), - (const char *)authType); + virReportError(VIR_ERR_XML_ERROR, + _("unknown auth type '%s'"), + (const char *)authType); goto cleanup; } } @@ -606,8 +606,8 @@ virStoragePoolDefParseSourceString(const char *srcSpec, } if (!(node = virXPathNode("/source", xpath_ctxt))) { - virStorageReportError(VIR_ERR_XML_ERROR, "%s", - _("root element was not source")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("root element was not source")); goto cleanup; } @@ -656,8 +656,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt, if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) { VIR_FREE(mode); - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("malformed octal mode")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("malformed octal mode")); goto error; } perms->mode = tmp; @@ -668,8 +668,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt, perms->uid = -1; } else { if (virXPathLong("number(./owner)", ctxt, &v) < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("malformed owner element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("malformed owner element")); goto error; } perms->uid = (int)v; @@ -679,8 +679,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt, perms->gid = -1; } else { if (virXPathLong("number(./group)", ctxt, &v) < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("malformed group element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("malformed group element")); goto error; } perms->gid = (int)v; @@ -711,8 +711,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) { type = virXPathString("string(./@type)", ctxt); if ((ret->type = virStoragePoolTypeFromString((const char *)type)) < 0) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown storage pool type %s"), (const char*)type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown storage pool type %s"), (const char*)type); goto cleanup; } @@ -735,22 +735,22 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) { options->flags & VIR_STORAGE_POOL_SOURCE_NAME) ret->name = ret->source.name; if (ret->name == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing pool source name element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing pool source name element")); goto cleanup; } uuid = virXPathString("string(./uuid)", ctxt); if (uuid == NULL) { if (virUUIDGenerate(ret->uuid) < 0) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unable to generate uuid")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unable to generate uuid")); goto cleanup; } } else { if (virUUIDParse(uuid, ret->uuid) < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("malformed uuid element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("malformed uuid element")); goto cleanup; } VIR_FREE(uuid); @@ -758,17 +758,17 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) { if (options->flags & VIR_STORAGE_POOL_SOURCE_HOST) { if (!ret->source.nhost) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", - _("missing storage pool source host name")); + virReportError(VIR_ERR_XML_ERROR, + "%s", + _("missing storage pool source host name")); goto cleanup; } } if (options->flags & VIR_STORAGE_POOL_SOURCE_DIR) { if (!ret->source.dir) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing storage pool source path")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing storage pool source path")); goto cleanup; } } @@ -785,8 +785,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) { if (options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER) { if (!ret->source.adapter) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing storage pool source adapter name")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing storage pool source adapter name")); goto cleanup; } } @@ -794,8 +794,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) { /* If DEVICE is the only source type, then its required */ if (options->flags == VIR_STORAGE_POOL_SOURCE_DEVICE) { if (!ret->source.ndevice) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing storage pool source device name")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing storage pool source device name")); goto cleanup; } } @@ -804,8 +804,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) { * path and permissions */ if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) { if ((tmppath = virXPathString("string(./target/path)", ctxt)) == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing storage pool target path")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing storage pool target path")); goto cleanup; } ret->target.path = virFileSanitizePath(tmppath); @@ -835,8 +835,8 @@ virStoragePoolDefParseNode(xmlDocPtr xml, virStoragePoolDefPtr def = NULL; if (STRNEQ((const char *)root->name, "pool")) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("unknown root element for storage pool")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("unknown root element for storage pool")); goto cleanup; } @@ -935,9 +935,9 @@ virStoragePoolSourceFormat(virBufferPtr buf, if (options->formatToString) { const char *format = (options->formatToString)(src->format); if (!format) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pool format number %d"), - src->format); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown pool format number %d"), + src->format); return -1; } virBufferAsprintf(buf," <format type='%s'/>\n", format); @@ -994,8 +994,8 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) { type = virStoragePoolTypeToString(def->type); if (!type) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unexpected pool type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unexpected pool type")); goto cleanup; } virBufferAsprintf(&buf, "<pool type='%s'>\n", type); @@ -1058,8 +1058,8 @@ virStorageSize(const char *unit, unsigned long long *ret) { if (virStrToLong_ull(val, NULL, 10, ret) < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("malformed capacity element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("malformed capacity element")); return -1; } /* off_t is signed, so you cannot create a file larger than 2**63 @@ -1091,8 +1091,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, ret->name = virXPathString("string(./name)", ctxt); if (ret->name == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing volume name element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing volume name element")); goto cleanup; } @@ -1102,8 +1102,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, capacity = virXPathString("string(./capacity)", ctxt); unit = virXPathString("string(./capacity/@unit)", ctxt); if (capacity == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("missing capacity element")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("missing capacity element")); goto cleanup; } if (virStorageSize(unit, capacity, &ret->capacity) < 0) @@ -1131,8 +1131,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, ret->target.format = (options->formatFromString)(format); if (ret->target.format < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - _("unknown volume format type %s"), format); + virReportError(VIR_ERR_XML_ERROR, + _("unknown volume format type %s"), format); VIR_FREE(format); goto cleanup; } @@ -1163,8 +1163,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, ret->backingStore.format = (options->formatFromString)(format); if (ret->backingStore.format < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - _("unknown volume format type %s"), format); + virReportError(VIR_ERR_XML_ERROR, + _("unknown volume format type %s"), format); VIR_FREE(format); goto cleanup; } @@ -1194,8 +1194,8 @@ virStorageVolDefParseNode(virStoragePoolDefPtr pool, virStorageVolDefPtr def = NULL; if (STRNEQ((const char *)root->name, "volume")) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("unknown root element for storage vol")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("unknown root element for storage vol")); goto cleanup; } @@ -1254,9 +1254,9 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, if (options->formatToString) { const char *format = (options->formatToString)(def->format); if (!format) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown volume format number %d"), - def->format); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown volume format number %d"), + def->format); return -1; } virBufferAsprintf(buf," <format type='%s'/>\n", format); @@ -1471,8 +1471,8 @@ virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools, } if (virMutexInit(&pool->lock) < 0) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); VIR_FREE(pool); return NULL; } @@ -1505,9 +1505,9 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools, } if (!virFileMatchesNameSuffix(file, def->name, ".xml")) { - virStorageReportError(VIR_ERR_XML_ERROR, - _("Storage pool config filename '%s' does not match pool name '%s'"), - path, def->name); + virReportError(VIR_ERR_XML_ERROR, + _("Storage pool config filename '%s' does not match pool name '%s'"), + path, def->name); virStoragePoolDefFree(def); return NULL; } @@ -1617,8 +1617,8 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr driver, } if (!(xml = virStoragePoolDefFormat(def))) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to generate XML")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to generate XML")); return -1; } @@ -1631,15 +1631,15 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr driver, int virStoragePoolObjDeleteDef(virStoragePoolObjPtr pool) { if (!pool->configFile) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - _("no config file for %s"), pool->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no config file for %s"), pool->def->name); return -1; } if (unlink(pool->configFile) < 0) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot remove config for %s"), - pool->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot remove config for %s"), + pool->def->name); return -1; } @@ -1675,8 +1675,8 @@ char *virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def) type = virStoragePoolTypeToString(def->type); if (!type) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unexpected pool type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unexpected pool type")); goto cleanup; } @@ -1726,18 +1726,18 @@ int virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools, if (STRNEQ(pool->def->name, def->name)) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(pool->def->uuid, uuidstr); - virStorageReportError(VIR_ERR_OPERATION_FAILED, - _("pool '%s' is already defined with uuid %s"), - pool->def->name, uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("pool '%s' is already defined with uuid %s"), + pool->def->name, uuidstr); goto cleanup; } if (check_active) { /* UUID & name match, but if Pool is already active, refuse it */ if (virStoragePoolObjIsActive(pool)) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, - _("pool is already active as '%s'"), - pool->def->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("pool is already active as '%s'"), + pool->def->name); goto cleanup; } } @@ -1749,9 +1749,9 @@ int virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools, if (pool) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(pool->def->uuid, uuidstr); - virStorageReportError(VIR_ERR_OPERATION_FAILED, - _("pool '%s' already exists with uuid %s"), - def->name, uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("pool '%s' already exists with uuid %s"), + def->name, uuidstr); goto cleanup; } } @@ -1831,9 +1831,9 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, } if (matchpool) { - virStorageReportError(VIR_ERR_OPERATION_FAILED, - _("Storage source conflict with pool: '%s'"), - matchpool->def->name); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Storage source conflict with pool: '%s'"), + matchpool->def->name); ret = -1; } return ret; diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index 5733b575b..6e6367132 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -336,10 +336,6 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) { return pool->active; } -# define virStorageReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_STORAGE, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - int virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools, const char *configDir, const char *autostartDir); diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c index 32083339c..63cb7f4b1 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -88,15 +88,15 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt, type_str = virXPathString("string(./@type)", ctxt); if (type_str == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, "%s", - _("unknown volume encryption secret type")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("unknown volume encryption secret type")); goto cleanup; } type = virStorageEncryptionSecretTypeTypeFromString(type_str); if (type < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - _("unknown volume encryption secret type %s"), - type_str); + virReportError(VIR_ERR_XML_ERROR, + _("unknown volume encryption secret type %s"), + type_str); VIR_FREE(type_str); goto cleanup; } @@ -106,15 +106,15 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt, uuidstr = virXPathString("string(./@uuid)", ctxt); if (uuidstr) { if (virUUIDParse(uuidstr, ret->uuid) < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - _("malformed volume encryption uuid '%s'"), - uuidstr); + virReportError(VIR_ERR_XML_ERROR, + _("malformed volume encryption uuid '%s'"), + uuidstr); goto cleanup; } VIR_FREE(uuidstr); } else { - virStorageReportError(VIR_ERR_XML_ERROR, "%s", - _("missing volume encryption uuid")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing volume encryption uuid")); goto cleanup; } ctxt->node = old_node; @@ -142,15 +142,15 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt) format_str = virXPathString("string(./@format)", ctxt); if (format_str == NULL) { - virStorageReportError(VIR_ERR_XML_ERROR, "%s", - _("unknown volume encryption format")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("unknown volume encryption format")); goto cleanup; } format = virStorageEncryptionFormatTypeFromString(format_str); if (format < 0) { - virStorageReportError(VIR_ERR_XML_ERROR, - _("unknown volume encryption format type %s"), - format_str); + virReportError(VIR_ERR_XML_ERROR, + _("unknown volume encryption format type %s"), + format_str); VIR_FREE(format_str); goto cleanup; } @@ -188,9 +188,9 @@ virStorageEncryptionParseNode(xmlDocPtr xml, xmlNodePtr root) virStorageEncryptionPtr enc = NULL; if (STRNEQ((const char *) root->name, "encryption")) { - virStorageReportError(VIR_ERR_XML_ERROR, - "%s", _("unknown root element for volume " - "encryption information")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("unknown root element for volume " + "encryption information")); goto cleanup; } @@ -218,8 +218,8 @@ virStorageEncryptionSecretFormat(virBufferPtr buf, type = virStorageEncryptionSecretTypeTypeToString(secret->type); if (!type) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected volume encryption secret type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected volume encryption secret type")); return -1; } @@ -238,8 +238,8 @@ virStorageEncryptionFormat(virBufferPtr buf, format = virStorageEncryptionFormatTypeToString(enc->format); if (!format) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unexpected encryption format")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unexpected encryption format")); return -1; } virBufferAsprintf(buf, "<encryption format='%s'>\n", format); @@ -265,8 +265,8 @@ virStorageGenerateQcowPassphrase(unsigned char *dest) unpleasant surprises with the qemu monitor input mechanism. */ fd = open("/dev/urandom", O_RDONLY); if (fd < 0) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot open /dev/urandom")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot open /dev/urandom")); return -1; } i = 0; @@ -276,8 +276,8 @@ virStorageGenerateQcowPassphrase(unsigned char *dest) while ((r = read(fd, dest + i, 1)) == -1 && errno == EINTR) ; if (r <= 0) { - virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot read from /dev/urandom")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot read from /dev/urandom")); VIR_FORCE_CLOSE(fd); return -1; } diff --git a/src/conf/virconsole.c b/src/conf/virconsole.c index 443d80d44..fe470399b 100644 --- a/src/conf/virconsole.c +++ b/src/conf/virconsole.c @@ -39,9 +39,6 @@ #include "virfile.h" #define VIR_FROM_THIS VIR_FROM_NONE -#define virConsoleError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) /* structure holding information about consoles * open in a given domain */ @@ -127,10 +124,10 @@ static int virConsoleLockFileCreate(const char *pty) /* check if a log file and process holding the lock still exists */ if (virPidFileReadPathIfAlive(path, &pid, NULL) == 0 && pid >= 0) { /* the process exists, the lockfile is valid */ - virConsoleError(VIR_ERR_OPERATION_FAILED, - _("Requested console pty '%s' is locked by " - "lock file '%s' held by process %lld"), - pty, path, (long long) pid); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Requested console pty '%s' is locked by " + "lock file '%s' held by process %lld"), + pty, path, (long long) pid); goto cleanup; } else { /* clean up the stale/corrupted/nonexistent lockfile */ diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_device_driver.h index 673e95b3a..c94e8706c 100644 --- a/src/node_device/node_device_driver.h +++ b/src/node_device/node_device_driver.h @@ -28,6 +28,10 @@ # include "driver.h" # include "node_device_conf.h" +# define virNodeDeviceReportError(code, ...) \ + virReportErrorHelper(VIR_FROM_NODEDEV, code, __FILE__, \ + __FUNCTION__, __LINE__, __VA_ARGS__) + # define LINUX_SYSFS_SCSI_HOST_PREFIX "/sys/class/scsi_host/" # define LINUX_SYSFS_SCSI_HOST_POSTFIX "device" # define LINUX_SYSFS_FC_HOST_PREFIX "/sys/class/fc_host/" diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index b38e78055..db367e1fd 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -69,6 +69,10 @@ #define VIR_FROM_THIS VIR_FROM_NWFILTER +#define virNWFilterReportError(code, fmt...) \ + virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \ + __FUNCTION__, __LINE__, fmt) + #ifdef HAVE_LIBPCAP # define LEASEFILE LOCALSTATEDIR "/run/libvirt/network/nwfilter.leases" diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index e24cd26dc..52560b7f5 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -44,6 +44,9 @@ #include "nwfilter_learnipaddr.h" #define VIR_FROM_THIS VIR_FROM_NWFILTER +#define virNWFilterReportError(code, fmt...) \ + virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \ + __FUNCTION__, __LINE__, fmt) static virNWFilterDriverStatePtr driverState; diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 3ef627da1..cbf6d1474 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -45,7 +45,9 @@ #define VIR_FROM_THIS VIR_FROM_NWFILTER - +#define virNWFilterReportError(code, fmt...) \ + virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \ + __FUNCTION__, __LINE__, fmt) #define EBTABLES_CHAIN_INCOMING "PREROUTING" #define EBTABLES_CHAIN_OUTGOING "POSTROUTING" diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index 0dd1aa242..fb13fbe5d 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -39,6 +39,9 @@ #include "datatypes.h" #define VIR_FROM_THIS VIR_FROM_NWFILTER +#define virNWFilterReportError(code, fmt...) \ + virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \ + __FUNCTION__, __LINE__, fmt) #define NWFILTER_STD_VAR_MAC NWFILTER_VARNAME_MAC diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index a04057f77..d5005ebd6 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -56,6 +56,9 @@ #include "nwfilter_learnipaddr.h" #define VIR_FROM_THIS VIR_FROM_NWFILTER +#define virNWFilterReportError(code, fmt...) \ + virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \ + __FUNCTION__, __LINE__, fmt) #define IFINDEX2STR(VARNAME, ifindex) \ char VARNAME[INT_BUFSIZE_BOUND(ifindex)]; \ diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index 49ca29b6e..cf2315a55 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -45,6 +45,10 @@ #define VIR_FROM_THIS VIR_FROM_SECRET +#define virSecretReportError(code, ...) \ + virReportErrorHelper(VIR_FROM_SECRET, code, __FILE__, \ + __FUNCTION__, __LINE__, __VA_ARGS__) + enum { SECRET_MAX_XML_FILE = 10*1024*1024 }; /* Internal driver state */ diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index 4c371fbcf..66a2d7840 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -29,6 +29,10 @@ # include "storage_conf.h" # include "command.h" +# define virStorageReportError(code, ...) \ + virReportErrorHelper(VIR_FROM_STORAGE, code, __FILE__, \ + __FUNCTION__, __LINE__, __VA_ARGS__) + typedef char * (*virStorageBackendFindPoolSources)(virConnectPtr conn, const char *srcSpec, unsigned int flags); typedef int (*virStorageBackendCheckPool)(virConnectPtr conn, virStoragePoolObjPtr pool, bool *active); typedef int (*virStorageBackendStartPool)(virConnectPtr conn, virStoragePoolObjPtr pool); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index c3bad788d..061f68737 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5129,7 +5129,7 @@ testNodeDeviceLookupByName(virConnectPtr conn, const char *name) testDriverUnlock(driver); if (!obj) { - virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL); + testError(VIR_ERR_NO_NODE_DEVICE, NULL); goto cleanup; } @@ -5156,9 +5156,9 @@ testNodeDeviceGetXMLDesc(virNodeDevicePtr dev, testDriverUnlock(driver); if (!obj) { - virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, - _("no node device with matching name '%s'"), - dev->name); + testError(VIR_ERR_NO_NODE_DEVICE, + _("no node device with matching name '%s'"), + dev->name); goto cleanup; } @@ -5182,9 +5182,9 @@ testNodeDeviceGetParent(virNodeDevicePtr dev) testDriverUnlock(driver); if (!obj) { - virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, - _("no node device with matching name '%s'"), - dev->name); + testError(VIR_ERR_NO_NODE_DEVICE, + _("no node device with matching name '%s'"), + dev->name); goto cleanup; } @@ -5193,8 +5193,8 @@ testNodeDeviceGetParent(virNodeDevicePtr dev) if (!ret) virReportOOMError(); } else { - virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no parent for this device")); + testError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no parent for this device")); } cleanup: @@ -5218,9 +5218,9 @@ testNodeDeviceNumOfCaps(virNodeDevicePtr dev) testDriverUnlock(driver); if (!obj) { - virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, - _("no node device with matching name '%s'"), - dev->name); + testError(VIR_ERR_NO_NODE_DEVICE, + _("no node device with matching name '%s'"), + dev->name); goto cleanup; } @@ -5249,9 +5249,9 @@ testNodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames) testDriverUnlock(driver); if (!obj) { - virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, - _("no node device with matching name '%s'"), - dev->name); + testError(VIR_ERR_NO_NODE_DEVICE, + _("no node device with matching name '%s'"), + dev->name); goto cleanup; } @@ -5356,7 +5356,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev) testDriverUnlock(driver); if (!obj) { - virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL); + testError(VIR_ERR_NO_NODE_DEVICE, NULL); goto out; } |