mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
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>
This commit is contained in:
parent
7c7d01e15f
commit
1e0bb184a7
4
cfg.mk
4
cfg.mk
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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/"
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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)]; \
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user