mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +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 += VIR_ERROR
|
||||||
msg_gen_function += VMX_ERROR
|
msg_gen_function += VMX_ERROR
|
||||||
msg_gen_function += XENXS_ERROR
|
msg_gen_function += XENXS_ERROR
|
||||||
msg_gen_function += eventReportError
|
|
||||||
msg_gen_function += interfaceReportError
|
msg_gen_function += interfaceReportError
|
||||||
msg_gen_function += lxcError
|
msg_gen_function += lxcError
|
||||||
msg_gen_function += libxlError
|
msg_gen_function += libxlError
|
||||||
@ -531,9 +530,7 @@ msg_gen_function += vah_warning
|
|||||||
msg_gen_function += vboxError
|
msg_gen_function += vboxError
|
||||||
msg_gen_function += virConfError
|
msg_gen_function += virConfError
|
||||||
msg_gen_function += virCPUReportError
|
msg_gen_function += virCPUReportError
|
||||||
msg_gen_function += virDomainReportError
|
|
||||||
msg_gen_function += virGenericReportError
|
msg_gen_function += virGenericReportError
|
||||||
msg_gen_function += virInterfaceReportError
|
|
||||||
msg_gen_function += virLibConnError
|
msg_gen_function += virLibConnError
|
||||||
msg_gen_function += virLibDomainError
|
msg_gen_function += virLibDomainError
|
||||||
msg_gen_function += virLibDomainSnapshotError
|
msg_gen_function += virLibDomainSnapshotError
|
||||||
@ -544,7 +541,6 @@ msg_gen_function += virLibNWFilterError
|
|||||||
msg_gen_function += virLibSecretError
|
msg_gen_function += virLibSecretError
|
||||||
msg_gen_function += virLibStoragePoolError
|
msg_gen_function += virLibStoragePoolError
|
||||||
msg_gen_function += virLibStorageVolError
|
msg_gen_function += virLibStorageVolError
|
||||||
msg_gen_function += virNetworkReportError
|
|
||||||
msg_gen_function += virNodeDeviceReportError
|
msg_gen_function += virNodeDeviceReportError
|
||||||
msg_gen_function += virNWFilterReportError
|
msg_gen_function += virNWFilterReportError
|
||||||
msg_gen_function += virRaiseError
|
msg_gen_function += virRaiseError
|
||||||
|
@ -32,10 +32,6 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_CPU
|
#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,
|
VIR_ENUM_IMPL(virCPU, VIR_CPU_TYPE_LAST,
|
||||||
"host", "guest", "auto")
|
"host", "guest", "auto")
|
||||||
|
|
||||||
@ -201,7 +197,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
char *cpuMode;
|
char *cpuMode;
|
||||||
|
|
||||||
if (!xmlStrEqual(node->name, BAD_CAST "cpu")) {
|
if (!xmlStrEqual(node->name, BAD_CAST "cpu")) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s",
|
"%s",
|
||||||
_("XML does not contain expected 'cpu' element"));
|
_("XML does not contain expected 'cpu' element"));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -215,7 +211,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
if (mode == VIR_CPU_TYPE_AUTO) {
|
if (mode == VIR_CPU_TYPE_AUTO) {
|
||||||
if (virXPathBoolean("boolean(./arch)", ctxt)) {
|
if (virXPathBoolean("boolean(./arch)", ctxt)) {
|
||||||
if (virXPathBoolean("boolean(./@match)", ctxt)) {
|
if (virXPathBoolean("boolean(./@match)", ctxt)) {
|
||||||
virCPUReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("'arch' element element cannot be used inside 'cpu'"
|
_("'arch' element element cannot be used inside 'cpu'"
|
||||||
" element with 'match' attribute'"));
|
" element with 'match' attribute'"));
|
||||||
goto error;
|
goto error;
|
||||||
@ -231,14 +227,14 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
if ((cpuMode = virXMLPropString(node, "mode"))) {
|
if ((cpuMode = virXMLPropString(node, "mode"))) {
|
||||||
if (def->type == VIR_CPU_TYPE_HOST) {
|
if (def->type == VIR_CPU_TYPE_HOST) {
|
||||||
VIR_FREE(cpuMode);
|
VIR_FREE(cpuMode);
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Attribute mode is only allowed for guest CPU"));
|
_("Attribute mode is only allowed for guest CPU"));
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
def->mode = virCPUModeTypeFromString(cpuMode);
|
def->mode = virCPUModeTypeFromString(cpuMode);
|
||||||
|
|
||||||
if (def->mode < 0) {
|
if (def->mode < 0) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Invalid mode attribute '%s'"),
|
_("Invalid mode attribute '%s'"),
|
||||||
cpuMode);
|
cpuMode);
|
||||||
VIR_FREE(cpuMode);
|
VIR_FREE(cpuMode);
|
||||||
@ -266,7 +262,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
VIR_FREE(match);
|
VIR_FREE(match);
|
||||||
|
|
||||||
if (def->match < 0) {
|
if (def->match < 0) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Invalid match attribute for CPU specification"));
|
"%s", _("Invalid match attribute for CPU specification"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -276,7 +272,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
if (def->type == VIR_CPU_TYPE_HOST) {
|
if (def->type == VIR_CPU_TYPE_HOST) {
|
||||||
def->arch = virXPathString("string(./arch[1])", ctxt);
|
def->arch = virXPathString("string(./arch[1])", ctxt);
|
||||||
if (!def->arch) {
|
if (!def->arch) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing CPU architecture"));
|
"%s", _("Missing CPU architecture"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -284,7 +280,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
|
|
||||||
if (!(def->model = virXPathString("string(./model[1])", ctxt)) &&
|
if (!(def->model = virXPathString("string(./model[1])", ctxt)) &&
|
||||||
def->type == VIR_CPU_TYPE_HOST) {
|
def->type == VIR_CPU_TYPE_HOST) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing CPU model name"));
|
"%s", _("Missing CPU model name"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -300,7 +296,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
def->fallback = virCPUFallbackTypeFromString(fallback);
|
def->fallback = virCPUFallbackTypeFromString(fallback);
|
||||||
VIR_FREE(fallback);
|
VIR_FREE(fallback);
|
||||||
if (def->fallback < 0) {
|
if (def->fallback < 0) {
|
||||||
virCPUReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("Invalid fallback attribute"));
|
_("Invalid fallback attribute"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -313,7 +309,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
ctxt);
|
ctxt);
|
||||||
if (!vendor_id ||
|
if (!vendor_id ||
|
||||||
strlen(vendor_id) != VIR_CPU_VENDOR_ID_LENGTH) {
|
strlen(vendor_id) != VIR_CPU_VENDOR_ID_LENGTH) {
|
||||||
virCPUReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("vendor_id must be exactly"
|
_("vendor_id must be exactly"
|
||||||
" %d characters long"),
|
" %d characters long"),
|
||||||
VIR_CPU_VENDOR_ID_LENGTH);
|
VIR_CPU_VENDOR_ID_LENGTH);
|
||||||
@ -323,7 +319,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
/* ensure that the string can be passed to qemu*/
|
/* ensure that the string can be passed to qemu*/
|
||||||
for (i = 0; i < strlen(vendor_id); i++) {
|
for (i = 0; i < strlen(vendor_id); i++) {
|
||||||
if (vendor_id[i]==',') {
|
if (vendor_id[i]==',') {
|
||||||
virCPUReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("vendor id is invalid"));
|
_("vendor id is invalid"));
|
||||||
VIR_FREE(vendor_id);
|
VIR_FREE(vendor_id);
|
||||||
goto error;
|
goto error;
|
||||||
@ -336,7 +332,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
|
|
||||||
def->vendor = virXPathString("string(./vendor[1])", ctxt);
|
def->vendor = virXPathString("string(./vendor[1])", ctxt);
|
||||||
if (def->vendor && !def->model) {
|
if (def->vendor && !def->model) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("CPU vendor specified without CPU model"));
|
"%s", _("CPU vendor specified without CPU model"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -348,7 +344,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
ret = virXPathULong("string(./topology[1]/@sockets)",
|
ret = virXPathULong("string(./topology[1]/@sockets)",
|
||||||
ctxt, &ul);
|
ctxt, &ul);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing 'sockets' attribute in CPU topology"));
|
"%s", _("Missing 'sockets' attribute in CPU topology"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -357,7 +353,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
ret = virXPathULong("string(./topology[1]/@cores)",
|
ret = virXPathULong("string(./topology[1]/@cores)",
|
||||||
ctxt, &ul);
|
ctxt, &ul);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing 'cores' attribute in CPU topology"));
|
"%s", _("Missing 'cores' attribute in CPU topology"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -366,14 +362,14 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
ret = virXPathULong("string(./topology[1]/@threads)",
|
ret = virXPathULong("string(./topology[1]/@threads)",
|
||||||
ctxt, &ul);
|
ctxt, &ul);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing 'threads' attribute in CPU topology"));
|
"%s", _("Missing 'threads' attribute in CPU topology"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
def->threads = (unsigned int) ul;
|
def->threads = (unsigned int) ul;
|
||||||
|
|
||||||
if (!def->sockets || !def->cores || !def->threads) {
|
if (!def->sockets || !def->cores || !def->threads) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Invalid CPU topology"));
|
"%s", _("Invalid CPU topology"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -385,7 +381,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
if (!def->model) {
|
if (!def->model) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Non-empty feature list specified without CPU model"));
|
"%s", _("Non-empty feature list specified without CPU model"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -412,7 +408,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
VIR_FREE(strpolicy);
|
VIR_FREE(strpolicy);
|
||||||
|
|
||||||
if (policy < 0) {
|
if (policy < 0) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Invalid CPU feature policy"));
|
"%s", _("Invalid CPU feature policy"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -422,14 +418,14 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
|
|
||||||
if (!(name = virXMLPropString(nodes[i], "name")) || *name == 0) {
|
if (!(name = virXMLPropString(nodes[i], "name")) || *name == 0) {
|
||||||
VIR_FREE(name);
|
VIR_FREE(name);
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Invalid CPU feature name"));
|
"%s", _("Invalid CPU feature name"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0 ; j < i ; j++) {
|
for (j = 0 ; j < i ; j++) {
|
||||||
if (STREQ(name, def->features[j].name)) {
|
if (STREQ(name, def->features[j].name)) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("CPU feature `%s' specified more than once"),
|
_("CPU feature `%s' specified more than once"),
|
||||||
name);
|
name);
|
||||||
VIR_FREE(name);
|
VIR_FREE(name);
|
||||||
@ -445,7 +441,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
n = virXPathNodeSet("./numa[1]/cell", ctxt, &nodes);
|
n = virXPathNodeSet("./numa[1]/cell", ctxt, &nodes);
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("NUMA topology defined without NUMA cells"));
|
"%s", _("NUMA topology defined without NUMA cells"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -464,7 +460,7 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
def->cells[i].cellid = i;
|
def->cells[i].cellid = i;
|
||||||
cpus = virXMLPropString(nodes[i], "cpus");
|
cpus = virXMLPropString(nodes[i], "cpus");
|
||||||
if (!cpus) {
|
if (!cpus) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing 'cpus' attribute in NUMA cell"));
|
"%s", _("Missing 'cpus' attribute in NUMA cell"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -481,14 +477,14 @@ virCPUDefParseXML(const xmlNodePtr node,
|
|||||||
|
|
||||||
memory = virXMLPropString(nodes[i], "memory");
|
memory = virXMLPropString(nodes[i], "memory");
|
||||||
if (!memory) {
|
if (!memory) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing 'memory' attribute in NUMA cell"));
|
"%s", _("Missing 'memory' attribute in NUMA cell"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = virStrToLong_ui(memory, NULL, 10, &def->cells[i].mem);
|
ret = virStrToLong_ui(memory, NULL, 10, &def->cells[i].mem);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Invalid 'memory' attribute in NUMA cell"));
|
"%s", _("Invalid 'memory' attribute in NUMA cell"));
|
||||||
VIR_FREE(memory);
|
VIR_FREE(memory);
|
||||||
goto error;
|
goto error;
|
||||||
@ -547,7 +543,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
|
|||||||
|
|
||||||
if (def->mode != VIR_CPU_MODE_CUSTOM || def->model) {
|
if (def->mode != VIR_CPU_MODE_CUSTOM || def->model) {
|
||||||
if (!(tmp = virCPUModeTypeToString(def->mode))) {
|
if (!(tmp = virCPUModeTypeToString(def->mode))) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unexpected CPU mode %d"), def->mode);
|
_("Unexpected CPU mode %d"), def->mode);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -558,7 +554,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
|
|||||||
(def->mode == VIR_CPU_MODE_CUSTOM ||
|
(def->mode == VIR_CPU_MODE_CUSTOM ||
|
||||||
(flags & VIR_DOMAIN_XML_UPDATE_CPU))) {
|
(flags & VIR_DOMAIN_XML_UPDATE_CPU))) {
|
||||||
if (!(tmp = virCPUMatchTypeToString(def->match))) {
|
if (!(tmp = virCPUMatchTypeToString(def->match))) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unexpected CPU match policy %d"),
|
_("Unexpected CPU match policy %d"),
|
||||||
def->match);
|
def->match);
|
||||||
return -1;
|
return -1;
|
||||||
@ -600,7 +596,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
|||||||
(def->mode == VIR_CPU_MODE_CUSTOM && def->model)));
|
(def->mode == VIR_CPU_MODE_CUSTOM && def->model)));
|
||||||
|
|
||||||
if (!def->model && def->nfeatures) {
|
if (!def->model && def->nfeatures) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Non-empty feature list specified without CPU model"));
|
"%s", _("Non-empty feature list specified without CPU model"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -612,7 +608,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
|||||||
|
|
||||||
fallback = virCPUFallbackTypeToString(def->fallback);
|
fallback = virCPUFallbackTypeToString(def->fallback);
|
||||||
if (!fallback) {
|
if (!fallback) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unexpected CPU fallback value: %d"),
|
_("Unexpected CPU fallback value: %d"),
|
||||||
def->fallback);
|
def->fallback);
|
||||||
return -1;
|
return -1;
|
||||||
@ -644,7 +640,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
|||||||
virCPUFeatureDefPtr feature = def->features + i;
|
virCPUFeatureDefPtr feature = def->features + i;
|
||||||
|
|
||||||
if (!feature->name) {
|
if (!feature->name) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing CPU feature name"));
|
"%s", _("Missing CPU feature name"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -654,7 +650,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
|||||||
|
|
||||||
policy = virCPUFeaturePolicyTypeToString(feature->policy);
|
policy = virCPUFeaturePolicyTypeToString(feature->policy);
|
||||||
if (!policy) {
|
if (!policy) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unexpected CPU feature policy %d"),
|
_("Unexpected CPU feature policy %d"),
|
||||||
feature->policy);
|
feature->policy);
|
||||||
return -1;
|
return -1;
|
||||||
@ -691,7 +687,7 @@ virCPUDefAddFeature(virCPUDefPtr def,
|
|||||||
|
|
||||||
for (i = 0 ; i < def->nfeatures ; i++) {
|
for (i = 0 ; i < def->nfeatures ; i++) {
|
||||||
if (STREQ(name, def->features[i].name)) {
|
if (STREQ(name, def->features[i].name)) {
|
||||||
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("CPU feature `%s' specified more than once"), name);
|
_("CPU feature `%s' specified more than once"), name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -728,13 +724,13 @@ virCPUDefIsEqual(virCPUDefPtr src,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ((src && !dst) || (!src && dst)) {
|
if ((src && !dst) || (!src && dst)) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Target CPU does not match source"));
|
_("Target CPU does not match source"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->type != dst->type) {
|
if (src->type != dst->type) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU type %s does not match source %s"),
|
_("Target CPU type %s does not match source %s"),
|
||||||
virCPUTypeToString(dst->type),
|
virCPUTypeToString(dst->type),
|
||||||
virCPUTypeToString(src->type));
|
virCPUTypeToString(src->type));
|
||||||
@ -742,7 +738,7 @@ virCPUDefIsEqual(virCPUDefPtr src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (src->mode != dst->mode) {
|
if (src->mode != dst->mode) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU mode %s does not match source %s"),
|
_("Target CPU mode %s does not match source %s"),
|
||||||
virCPUModeTypeToString(dst->mode),
|
virCPUModeTypeToString(dst->mode),
|
||||||
virCPUModeTypeToString(src->mode));
|
virCPUModeTypeToString(src->mode));
|
||||||
@ -750,56 +746,56 @@ virCPUDefIsEqual(virCPUDefPtr src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (STRNEQ_NULLABLE(src->arch, dst->arch)) {
|
if (STRNEQ_NULLABLE(src->arch, dst->arch)) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU arch %s does not match source %s"),
|
_("Target CPU arch %s does not match source %s"),
|
||||||
NULLSTR(dst->arch), NULLSTR(src->arch));
|
NULLSTR(dst->arch), NULLSTR(src->arch));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STRNEQ_NULLABLE(src->model, dst->model)) {
|
if (STRNEQ_NULLABLE(src->model, dst->model)) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU model %s does not match source %s"),
|
_("Target CPU model %s does not match source %s"),
|
||||||
NULLSTR(dst->model), NULLSTR(src->model));
|
NULLSTR(dst->model), NULLSTR(src->model));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STRNEQ_NULLABLE(src->vendor, dst->vendor)) {
|
if (STRNEQ_NULLABLE(src->vendor, dst->vendor)) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU vendor %s does not match source %s"),
|
_("Target CPU vendor %s does not match source %s"),
|
||||||
NULLSTR(dst->vendor), NULLSTR(src->vendor));
|
NULLSTR(dst->vendor), NULLSTR(src->vendor));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STRNEQ_NULLABLE(src->vendor_id, dst->vendor_id)) {
|
if (STRNEQ_NULLABLE(src->vendor_id, dst->vendor_id)) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU model %s does not match source %s"),
|
_("Target CPU model %s does not match source %s"),
|
||||||
NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id));
|
NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->sockets != dst->sockets) {
|
if (src->sockets != dst->sockets) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU sockets %d does not match source %d"),
|
_("Target CPU sockets %d does not match source %d"),
|
||||||
dst->sockets, src->sockets);
|
dst->sockets, src->sockets);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->cores != dst->cores) {
|
if (src->cores != dst->cores) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU cores %d does not match source %d"),
|
_("Target CPU cores %d does not match source %d"),
|
||||||
dst->cores, src->cores);
|
dst->cores, src->cores);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->threads != dst->threads) {
|
if (src->threads != dst->threads) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU threads %d does not match source %d"),
|
_("Target CPU threads %d does not match source %d"),
|
||||||
dst->threads, src->threads);
|
dst->threads, src->threads);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->nfeatures != dst->nfeatures) {
|
if (src->nfeatures != dst->nfeatures) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU feature count %zu does not match source %zu"),
|
_("Target CPU feature count %zu does not match source %zu"),
|
||||||
dst->nfeatures, src->nfeatures);
|
dst->nfeatures, src->nfeatures);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -807,14 +803,14 @@ virCPUDefIsEqual(virCPUDefPtr src,
|
|||||||
|
|
||||||
for (i = 0 ; i < src->nfeatures ; i++) {
|
for (i = 0 ; i < src->nfeatures ; i++) {
|
||||||
if (STRNEQ(src->features[i].name, dst->features[i].name)) {
|
if (STRNEQ(src->features[i].name, dst->features[i].name)) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU feature %s does not match source %s"),
|
_("Target CPU feature %s does not match source %s"),
|
||||||
dst->features[i].name, src->features[i].name);
|
dst->features[i].name, src->features[i].name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->features[i].policy != dst->features[i].policy) {
|
if (src->features[i].policy != dst->features[i].policy) {
|
||||||
virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target CPU feature policy %s does not match source %s"),
|
_("Target CPU feature policy %s does not match source %s"),
|
||||||
virCPUFeaturePolicyTypeToString(dst->features[i].policy),
|
virCPUFeaturePolicyTypeToString(dst->features[i].policy),
|
||||||
virCPUFeaturePolicyTypeToString(src->features[i].policy));
|
virCPUFeaturePolicyTypeToString(src->features[i].policy));
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -31,10 +31,6 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||||
|
|
||||||
#define eventReportError(code, ...) \
|
|
||||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
struct _virDomainMeta {
|
struct _virDomainMeta {
|
||||||
int id;
|
int id;
|
||||||
char *name;
|
char *name;
|
||||||
@ -196,7 +192,7 @@ virDomainEventCallbackListRemove(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("could not find event callback for removal"));
|
_("could not find event callback for removal"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -246,7 +242,7 @@ virDomainEventCallbackListRemoveID(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("could not find event callback for removal"));
|
_("could not find event callback for removal"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -272,7 +268,7 @@ virDomainEventCallbackListMarkDelete(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("could not find event callback for deletion"));
|
_("could not find event callback for deletion"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -297,7 +293,7 @@ virDomainEventCallbackListMarkDeleteID(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("could not find event callback for deletion"));
|
_("could not find event callback for deletion"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -372,7 +368,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
|
|||||||
memcmp(cbList->callbacks[i]->dom->uuid,
|
memcmp(cbList->callbacks[i]->dom->uuid,
|
||||||
dom->uuid, VIR_UUID_BUFLEN) == 0) ||
|
dom->uuid, VIR_UUID_BUFLEN) == 0) ||
|
||||||
(!dom && !cbList->callbacks[i]->dom))) {
|
(!dom && !cbList->callbacks[i]->dom))) {
|
||||||
eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("event callback already tracked"));
|
_("event callback already tracked"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1456,7 +1452,7 @@ virDomainEventStateRegister(virConnectPtr conn,
|
|||||||
virDomainEventTimer,
|
virDomainEventTimer,
|
||||||
state,
|
state,
|
||||||
NULL)) < 0) {
|
NULL)) < 0) {
|
||||||
eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("could not initialize domain event timer"));
|
_("could not initialize domain event timer"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1512,7 +1508,7 @@ virDomainEventStateRegisterID(virConnectPtr conn,
|
|||||||
virDomainEventTimer,
|
virDomainEventTimer,
|
||||||
state,
|
state,
|
||||||
NULL)) < 0) {
|
NULL)) < 0) {
|
||||||
eventReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("could not initialize domain event timer"));
|
_("could not initialize domain event timer"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,6 @@ static int
|
|||||||
virInterfaceDefDevFormat(virBufferPtr buf,
|
virInterfaceDefDevFormat(virBufferPtr buf,
|
||||||
const virInterfaceDefPtr def, int level);
|
const virInterfaceDefPtr def, int level);
|
||||||
|
|
||||||
#define virInterfaceReportError(code, ...) \
|
|
||||||
virReportErrorHelper(VIR_FROM_INTERFACE, code, __FILE__, \
|
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void virInterfaceIpDefFree(virInterfaceIpDefPtr def) {
|
void virInterfaceIpDefFree(virInterfaceIpDefPtr def) {
|
||||||
if (def == NULL)
|
if (def == NULL)
|
||||||
@ -122,7 +118,7 @@ virInterfaceDefParseName(virInterfaceDefPtr def,
|
|||||||
|
|
||||||
tmp = virXPathString("string(./@name)", ctxt);
|
tmp = virXPathString("string(./@name)", ctxt);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("interface has no name"));
|
"%s", _("interface has no name"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -138,7 +134,7 @@ virInterfaceDefParseMtu(virInterfaceDefPtr def,
|
|||||||
|
|
||||||
ret = virXPathULong("string(./mtu/@size)", ctxt, &mtu);
|
ret = virXPathULong("string(./mtu/@size)", ctxt, &mtu);
|
||||||
if ((ret == -2) || ((ret == 0) && (mtu > 100000))) {
|
if ((ret == -2) || ((ret == 0) && (mtu > 100000))) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("interface mtu value is improper"));
|
"%s", _("interface mtu value is improper"));
|
||||||
return -1;
|
return -1;
|
||||||
} else if (ret == 0) {
|
} else if (ret == 0) {
|
||||||
@ -162,7 +158,7 @@ virInterfaceDefParseStartMode(virInterfaceDefPtr def,
|
|||||||
else if (STREQ(tmp, "none"))
|
else if (STREQ(tmp, "none"))
|
||||||
def->startmode = VIR_INTERFACE_START_NONE;
|
def->startmode = VIR_INTERFACE_START_NONE;
|
||||||
else {
|
else {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown interface startmode %s"), tmp);
|
_("unknown interface startmode %s"), tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
return -1;
|
return -1;
|
||||||
@ -194,7 +190,7 @@ virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt) {
|
|||||||
else if (STREQ(tmp, "balance-alb"))
|
else if (STREQ(tmp, "balance-alb"))
|
||||||
ret = VIR_INTERFACE_BOND_BALALB;
|
ret = VIR_INTERFACE_BOND_BALALB;
|
||||||
else {
|
else {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown bonding mode %s"), tmp);
|
_("unknown bonding mode %s"), tmp);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
@ -215,7 +211,7 @@ virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt) {
|
|||||||
else if (STREQ(tmp, "netif"))
|
else if (STREQ(tmp, "netif"))
|
||||||
ret = VIR_INTERFACE_BOND_MII_NETIF;
|
ret = VIR_INTERFACE_BOND_MII_NETIF;
|
||||||
else {
|
else {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown mii bonding carrier %s"), tmp);
|
_("unknown mii bonding carrier %s"), tmp);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
@ -238,7 +234,7 @@ virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt) {
|
|||||||
else if (STREQ(tmp, "all"))
|
else if (STREQ(tmp, "all"))
|
||||||
ret = VIR_INTERFACE_BOND_ARP_ALL;
|
ret = VIR_INTERFACE_BOND_ARP_ALL;
|
||||||
else {
|
else {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown arp bonding validate %s"), tmp);
|
_("unknown arp bonding validate %s"), tmp);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
@ -264,7 +260,7 @@ virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
|
|||||||
else if (STREQ(tmp, "no"))
|
else if (STREQ(tmp, "no"))
|
||||||
def->peerdns = 0;
|
def->peerdns = 0;
|
||||||
else {
|
else {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown dhcp peerdns value %s"), tmp);
|
_("unknown dhcp peerdns value %s"), tmp);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
@ -290,7 +286,7 @@ virInterfaceDefParseIp(virInterfaceIpDefPtr def,
|
|||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
def->prefix = (int) l;
|
def->prefix = (int) l;
|
||||||
else if (ret == -2) {
|
else if (ret == -2) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("Invalid ip address prefix value"));
|
"%s", _("Invalid ip address prefix value"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -450,7 +446,7 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
|
|||||||
ctxt->node = protoNodes[pp];
|
ctxt->node = protoNodes[pp];
|
||||||
tmp = virXPathString("string(./@family)", ctxt);
|
tmp = virXPathString("string(./@family)", ctxt);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("protocol misses the family attribute"));
|
"%s", _("protocol misses the family attribute"));
|
||||||
virInterfaceProtocolDefFree(proto);
|
virInterfaceProtocolDefFree(proto);
|
||||||
goto error;
|
goto error;
|
||||||
@ -469,7 +465,7 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unsupported protocol family '%s'"), tmp);
|
_("unsupported protocol family '%s'"), tmp);
|
||||||
virInterfaceProtocolDefFree(proto);
|
virInterfaceProtocolDefFree(proto);
|
||||||
goto error;
|
goto error;
|
||||||
@ -543,7 +539,7 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nbItf == 0) {
|
if (nbItf == 0) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("bond has no interfaces"));
|
"%s", _("bond has no interfaces"));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error;
|
goto error;
|
||||||
@ -592,7 +588,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
|
|||||||
|
|
||||||
ret = virXPathULong("string(./miimon/@freq)", ctxt, &tmp);
|
ret = virXPathULong("string(./miimon/@freq)", ctxt, &tmp);
|
||||||
if ((ret == -2) || (ret == -1)) {
|
if ((ret == -2) || (ret == -1)) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("bond interface miimon freq missing or invalid"));
|
"%s", _("bond interface miimon freq missing or invalid"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -600,7 +596,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
|
|||||||
|
|
||||||
ret = virXPathULong("string(./miimon/@downdelay)", ctxt, &tmp);
|
ret = virXPathULong("string(./miimon/@downdelay)", ctxt, &tmp);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("bond interface miimon downdelay invalid"));
|
"%s", _("bond interface miimon downdelay invalid"));
|
||||||
goto error;
|
goto error;
|
||||||
} else if (ret == 0) {
|
} else if (ret == 0) {
|
||||||
@ -609,7 +605,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
|
|||||||
|
|
||||||
ret = virXPathULong("string(./miimon/@updelay)", ctxt, &tmp);
|
ret = virXPathULong("string(./miimon/@updelay)", ctxt, &tmp);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("bond interface miimon updelay invalid"));
|
"%s", _("bond interface miimon updelay invalid"));
|
||||||
goto error;
|
goto error;
|
||||||
} else if (ret == 0) {
|
} else if (ret == 0) {
|
||||||
@ -628,7 +624,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
|
|||||||
|
|
||||||
ret = virXPathULong("string(./arpmon/@interval)", ctxt, &tmp);
|
ret = virXPathULong("string(./arpmon/@interval)", ctxt, &tmp);
|
||||||
if ((ret == -2) || (ret == -1)) {
|
if ((ret == -2) || (ret == -1)) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("bond interface arpmon interval missing or invalid"));
|
"%s", _("bond interface arpmon interval missing or invalid"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -637,7 +633,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
|
|||||||
def->data.bond.target =
|
def->data.bond.target =
|
||||||
virXPathString("string(./arpmon/@target)", ctxt);
|
virXPathString("string(./arpmon/@target)", ctxt);
|
||||||
if (def->data.bond.target == NULL) {
|
if (def->data.bond.target == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("bond interface arpmon target missing"));
|
"%s", _("bond interface arpmon target missing"));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error;
|
goto error;
|
||||||
@ -658,7 +654,7 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def,
|
|||||||
xmlXPathContextPtr ctxt) {
|
xmlXPathContextPtr ctxt) {
|
||||||
def->data.vlan.tag = virXPathString("string(./@tag)", ctxt);
|
def->data.vlan.tag = virXPathString("string(./@tag)", ctxt);
|
||||||
if (def->data.vlan.tag == NULL) {
|
if (def->data.vlan.tag == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("vlan interface misses the tag attribute"));
|
"%s", _("vlan interface misses the tag attribute"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -666,7 +662,7 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def,
|
|||||||
def->data.vlan.devname =
|
def->data.vlan.devname =
|
||||||
virXPathString("string(./interface/@name)", ctxt);
|
virXPathString("string(./interface/@name)", ctxt);
|
||||||
if (def->data.vlan.devname == NULL) {
|
if (def->data.vlan.devname == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("vlan interface misses name attribute"));
|
"%s", _("vlan interface misses name attribute"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -683,13 +679,13 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
|
|||||||
/* check @type */
|
/* check @type */
|
||||||
tmp = virXPathString("string(./@type)", ctxt);
|
tmp = virXPathString("string(./@type)", ctxt);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("interface misses the type attribute"));
|
"%s", _("interface misses the type attribute"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
type = virInterfaceTypeFromString(tmp);
|
type = virInterfaceTypeFromString(tmp);
|
||||||
if (type == -1) {
|
if (type == -1) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown interface type %s"), tmp);
|
_("unknown interface type %s"), tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -710,7 +706,7 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
|
|||||||
|| (parentIfType == VIR_INTERFACE_TYPE_ETHERNET)
|
|| (parentIfType == VIR_INTERFACE_TYPE_ETHERNET)
|
||||||
|| (parentIfType == VIR_INTERFACE_TYPE_VLAN))
|
|| (parentIfType == VIR_INTERFACE_TYPE_VLAN))
|
||||||
{
|
{
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("interface has unsupported type '%s'"),
|
_("interface has unsupported type '%s'"),
|
||||||
virInterfaceTypeToString(type));
|
virInterfaceTypeToString(type));
|
||||||
goto error;
|
goto error;
|
||||||
@ -747,7 +743,7 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
|
|||||||
|
|
||||||
bridge = virXPathNode("./bridge[1]", ctxt);
|
bridge = virXPathNode("./bridge[1]", ctxt);
|
||||||
if (bridge == NULL) {
|
if (bridge == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("bridge interface misses the bridge element"));
|
"%s", _("bridge interface misses the bridge element"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -759,7 +755,7 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
|
|||||||
} else if (STREQ(tmp, "off")) {
|
} else if (STREQ(tmp, "off")) {
|
||||||
def->data.bridge.stp = 0;
|
def->data.bridge.stp = 0;
|
||||||
} else {
|
} else {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("bridge interface stp should be on or off got %s"),
|
_("bridge interface stp should be on or off got %s"),
|
||||||
tmp);
|
tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
@ -790,7 +786,7 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
|
|||||||
|
|
||||||
bond = virXPathNode("./bond[1]", ctxt);
|
bond = virXPathNode("./bond[1]", ctxt);
|
||||||
if (bond == NULL) {
|
if (bond == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("bond interface misses the bond element"));
|
"%s", _("bond interface misses the bond element"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -811,7 +807,7 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
|
|||||||
goto error;
|
goto error;
|
||||||
vlan = virXPathNode("./vlan[1]", ctxt);
|
vlan = virXPathNode("./vlan[1]", ctxt);
|
||||||
if (vlan == NULL) {
|
if (vlan == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("vlan interface misses the vlan element"));
|
"%s", _("vlan interface misses the vlan element"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -839,7 +835,7 @@ virInterfaceDefPtr virInterfaceDefParseNode(xmlDocPtr xml,
|
|||||||
virInterfaceDefPtr def = NULL;
|
virInterfaceDefPtr def = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "interface")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "interface")) {
|
||||||
virInterfaceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unexpected root element <%s>, "
|
_("unexpected root element <%s>, "
|
||||||
"expecting <interface>"),
|
"expecting <interface>"),
|
||||||
root->name);
|
root->name);
|
||||||
@ -947,7 +943,7 @@ virInterfaceBondDefFormat(virBufferPtr buf,
|
|||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
} else if (def->data.bond.monit == VIR_INTERFACE_BOND_MONIT_ARP) {
|
} else if (def->data.bond.monit == VIR_INTERFACE_BOND_MONIT_ARP) {
|
||||||
if (def->data.bond.target == NULL) {
|
if (def->data.bond.target == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("bond arp monitoring has no target"));
|
"%s", _("bond arp monitoring has no target"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -975,7 +971,7 @@ static int
|
|||||||
virInterfaceVlanDefFormat(virBufferPtr buf,
|
virInterfaceVlanDefFormat(virBufferPtr buf,
|
||||||
const virInterfaceDefPtr def, int level) {
|
const virInterfaceDefPtr def, int level) {
|
||||||
if (def->data.vlan.tag == NULL) {
|
if (def->data.vlan.tag == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("vlan misses the tag name"));
|
"%s", _("vlan misses the tag name"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1057,7 +1053,7 @@ virInterfaceStartmodeDefFormat(virBufferPtr buf,
|
|||||||
mode = "hotplug";
|
mode = "hotplug";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("virInterfaceDefFormat unknown startmode"));
|
"%s", _("virInterfaceDefFormat unknown startmode"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1071,19 +1067,19 @@ virInterfaceDefDevFormat(virBufferPtr buf,
|
|||||||
const char *type = NULL;
|
const char *type = NULL;
|
||||||
|
|
||||||
if (def == NULL) {
|
if (def == NULL) {
|
||||||
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("virInterfaceDefFormat NULL def"));
|
"%s", _("virInterfaceDefFormat NULL def"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((def->name == NULL) && (def->type != VIR_INTERFACE_TYPE_VLAN)) {
|
if ((def->name == NULL) && (def->type != VIR_INTERFACE_TYPE_VLAN)) {
|
||||||
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("virInterfaceDefFormat missing interface name"));
|
"%s", _("virInterfaceDefFormat missing interface name"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(type = virInterfaceTypeToString(def->type))) {
|
if (!(type = virInterfaceTypeToString(def->type))) {
|
||||||
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected interface type %d"), def->type);
|
_("unexpected interface type %d"), def->type);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1285,7 +1281,7 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (virMutexInit(&iface->lock) < 0) {
|
if (virMutexInit(&iface->lock) < 0) {
|
||||||
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("cannot initialize mutex"));
|
"%s", _("cannot initialize mutex"));
|
||||||
VIR_FREE(iface);
|
VIR_FREE(iface);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -28,10 +28,6 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||||
#define virNetDevError(code, ...) \
|
|
||||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate)
|
virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate)
|
||||||
@ -42,7 +38,7 @@ virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate)
|
|||||||
char *burst = NULL;
|
char *burst = NULL;
|
||||||
|
|
||||||
if (!node || !rate) {
|
if (!node || !rate) {
|
||||||
virNetDevError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("invalid argument supplied"));
|
_("invalid argument supplied"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -53,26 +49,26 @@ virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate)
|
|||||||
|
|
||||||
if (average) {
|
if (average) {
|
||||||
if (virStrToLong_ull(average, NULL, 10, &rate->average) < 0) {
|
if (virStrToLong_ull(average, NULL, 10, &rate->average) < 0) {
|
||||||
virNetDevError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("could not convert %s"),
|
_("could not convert %s"),
|
||||||
average);
|
average);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virNetDevError(VIR_ERR_XML_DETAIL, "%s",
|
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||||
_("Missing mandatory average attribute"));
|
_("Missing mandatory average attribute"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peak && virStrToLong_ull(peak, NULL, 10, &rate->peak) < 0) {
|
if (peak && virStrToLong_ull(peak, NULL, 10, &rate->peak) < 0) {
|
||||||
virNetDevError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("could not convert %s"),
|
_("could not convert %s"),
|
||||||
peak);
|
peak);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (burst && virStrToLong_ull(burst, NULL, 10, &rate->burst) < 0) {
|
if (burst && virStrToLong_ull(burst, NULL, 10, &rate->burst) < 0) {
|
||||||
virNetDevError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("could not convert %s"),
|
_("could not convert %s"),
|
||||||
burst);
|
burst);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -109,7 +105,7 @@ virNetDevBandwidthParse(xmlNodePtr node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!node || !xmlStrEqual(node->name, BAD_CAST "bandwidth")) {
|
if (!node || !xmlStrEqual(node->name, BAD_CAST "bandwidth")) {
|
||||||
virNetDevError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("invalid argument supplied"));
|
_("invalid argument supplied"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -118,7 +114,7 @@ virNetDevBandwidthParse(xmlNodePtr node)
|
|||||||
if (cur->type == XML_ELEMENT_NODE) {
|
if (cur->type == XML_ELEMENT_NODE) {
|
||||||
if (xmlStrEqual(cur->name, BAD_CAST "inbound")) {
|
if (xmlStrEqual(cur->name, BAD_CAST "inbound")) {
|
||||||
if (in) {
|
if (in) {
|
||||||
virNetDevError(VIR_ERR_XML_DETAIL, "%s",
|
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||||
_("Only one child <inbound> "
|
_("Only one child <inbound> "
|
||||||
"element allowed"));
|
"element allowed"));
|
||||||
goto error;
|
goto error;
|
||||||
@ -126,7 +122,7 @@ virNetDevBandwidthParse(xmlNodePtr node)
|
|||||||
in = cur;
|
in = cur;
|
||||||
} else if (xmlStrEqual(cur->name, BAD_CAST "outbound")) {
|
} else if (xmlStrEqual(cur->name, BAD_CAST "outbound")) {
|
||||||
if (out) {
|
if (out) {
|
||||||
virNetDevError(VIR_ERR_XML_DETAIL, "%s",
|
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||||
_("Only one child <outbound> "
|
_("Only one child <outbound> "
|
||||||
"element allowed"));
|
"element allowed"));
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
#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,
|
VIR_ENUM_IMPL(virNetDevVPort, VIR_NETDEV_VPORT_PROFILE_LAST,
|
||||||
@ -59,13 +56,13 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
|
|
||||||
virtPortType = virXMLPropString(node, "type");
|
virtPortType = virXMLPropString(node, "type");
|
||||||
if (!virtPortType) {
|
if (!virtPortType) {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("missing virtualportprofile type"));
|
_("missing virtualportprofile type"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((virtPort->virtPortType = virNetDevVPortTypeFromString(virtPortType)) <= 0) {
|
if ((virtPort->virtPortType = virNetDevVPortTypeFromString(virtPortType)) <= 0) {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown virtualportprofile type %s"), virtPortType);
|
_("unknown virtualportprofile type %s"), virtPortType);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -92,13 +89,13 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
if (virStrToLong_ui(virtPortManagerID, NULL, 0, &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"));
|
_("cannot parse value of managerid parameter"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val > 0xff) {
|
if (val > 0xff) {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("value of managerid out of range"));
|
_("value of managerid out of range"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -106,13 +103,13 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
virtPort->u.virtPort8021Qbg.managerID = (uint8_t)val;
|
virtPort->u.virtPort8021Qbg.managerID = (uint8_t)val;
|
||||||
|
|
||||||
if (virStrToLong_ui(virtPortTypeID, NULL, 0, &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"));
|
_("cannot parse value of typeid parameter"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val > 0xffffff) {
|
if (val > 0xffffff) {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("value for typeid out of range"));
|
_("value for typeid out of range"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -120,13 +117,13 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
virtPort->u.virtPort8021Qbg.typeID = (uint32_t)val;
|
virtPort->u.virtPort8021Qbg.typeID = (uint32_t)val;
|
||||||
|
|
||||||
if (virStrToLong_ui(virtPortTypeIDVersion, NULL, 0, &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"));
|
_("cannot parse value of typeidversion parameter"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val > 0xff) {
|
if (val > 0xff) {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("value of typeidversion out of range"));
|
_("value of typeidversion out of range"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -136,13 +133,13 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
if (virtPortInstanceID != NULL) {
|
if (virtPortInstanceID != NULL) {
|
||||||
if (virUUIDParse(virtPortInstanceID,
|
if (virUUIDParse(virtPortInstanceID,
|
||||||
virtPort->u.virtPort8021Qbg.instanceID)) {
|
virtPort->u.virtPort8021Qbg.instanceID)) {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("cannot parse instanceid parameter as a uuid"));
|
_("cannot parse instanceid parameter as a uuid"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virUUIDGenerate(virtPort->u.virtPort8021Qbg.instanceID)) {
|
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"));
|
_("cannot generate a random uuid for instanceid"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -151,7 +148,7 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBG;
|
virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBG;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("a parameter is missing for 802.1Qbg description"));
|
_("a parameter is missing for 802.1Qbg description"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -163,12 +160,12 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
virtPortProfileID) != NULL) {
|
virtPortProfileID) != NULL) {
|
||||||
virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBH;
|
virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBH;
|
||||||
} else {
|
} else {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("profileid parameter too long"));
|
_("profileid parameter too long"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("profileid parameter is missing for 802.1Qbh description"));
|
_("profileid parameter is missing for 802.1Qbh description"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -177,13 +174,13 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
if (virtPortInterfaceID != NULL) {
|
if (virtPortInterfaceID != NULL) {
|
||||||
if (virUUIDParse(virtPortInterfaceID,
|
if (virUUIDParse(virtPortInterfaceID,
|
||||||
virtPort->u.openvswitch.interfaceID)) {
|
virtPort->u.openvswitch.interfaceID)) {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("cannot parse interfaceid parameter as a uuid"));
|
_("cannot parse interfaceid parameter as a uuid"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virUUIDGenerate(virtPort->u.openvswitch.interfaceID)) {
|
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"));
|
_("cannot generate a random uuid for interfaceid"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -192,7 +189,7 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
if (virtPortProfileID != NULL) {
|
if (virtPortProfileID != NULL) {
|
||||||
if (virStrcpyStatic(virtPort->u.openvswitch.profileID,
|
if (virStrcpyStatic(virtPort->u.openvswitch.profileID,
|
||||||
virtPortProfileID) == NULL) {
|
virtPortProfileID) == NULL) {
|
||||||
virNetDevError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("profileid parameter too long"));
|
_("profileid parameter too long"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -202,7 +199,7 @@ virNetDevVPortProfileParse(xmlNodePtr node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
virNetDevError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unexpected virtualport type %d"), virtPort->virtPortType);
|
_("unexpected virtualport type %d"), virtPort->virtPortType);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -269,7 +266,7 @@ virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
virNetDevError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unexpected virtualport type %d"), virtPort->virtPortType);
|
_("unexpected virtualport type %d"), virtPort->virtPortType);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,6 @@ VIR_ENUM_IMPL(virNetworkForward,
|
|||||||
VIR_NETWORK_FORWARD_LAST,
|
VIR_NETWORK_FORWARD_LAST,
|
||||||
"none", "nat", "route", "bridge", "private", "vepa", "passthrough" )
|
"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,
|
virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets,
|
||||||
const unsigned char *uuid)
|
const unsigned char *uuid)
|
||||||
{
|
{
|
||||||
@ -237,7 +233,7 @@ virNetworkObjPtr virNetworkAssignDef(virNetworkObjListPtr nets,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (virMutexInit(&network->lock) < 0) {
|
if (virMutexInit(&network->lock) < 0) {
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("cannot initialize mutex"));
|
"%s", _("cannot initialize mutex"));
|
||||||
VIR_FREE(network);
|
VIR_FREE(network);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -400,7 +396,7 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
|
|||||||
|
|
||||||
range = virSocketAddrGetRange(&saddr, &eaddr);
|
range = virSocketAddrGetRange(&saddr, &eaddr);
|
||||||
if (range < 0) {
|
if (range < 0) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Invalid dhcp range '%s' to '%s' in network '%s'"),
|
_("Invalid dhcp range '%s' to '%s' in network '%s'"),
|
||||||
start, end, networkName);
|
start, end, networkName);
|
||||||
VIR_FREE(start);
|
VIR_FREE(start);
|
||||||
@ -426,14 +422,14 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
|
|||||||
mac = virXMLPropString(cur, "mac");
|
mac = virXMLPropString(cur, "mac");
|
||||||
if (mac != NULL) {
|
if (mac != NULL) {
|
||||||
if (virMacAddrParse(mac, &addr) < 0) {
|
if (virMacAddrParse(mac, &addr) < 0) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Cannot parse MAC address '%s' in network '%s'"),
|
_("Cannot parse MAC address '%s' in network '%s'"),
|
||||||
mac, networkName);
|
mac, networkName);
|
||||||
VIR_FREE(mac);
|
VIR_FREE(mac);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (virMacAddrIsMulticast(&addr)) {
|
if (virMacAddrIsMulticast(&addr)) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("expected unicast mac address, found multicast '%s' in network '%s'"),
|
_("expected unicast mac address, found multicast '%s' in network '%s'"),
|
||||||
(const char *)mac, networkName);
|
(const char *)mac, networkName);
|
||||||
VIR_FREE(mac);
|
VIR_FREE(mac);
|
||||||
@ -442,7 +438,7 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
|
|||||||
}
|
}
|
||||||
name = virXMLPropString(cur, "name");
|
name = virXMLPropString(cur, "name");
|
||||||
if ((name != NULL) && (!c_isalpha(name[0]))) {
|
if ((name != NULL) && (!c_isalpha(name[0]))) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Cannot use name address '%s' in network '%s'"),
|
_("Cannot use name address '%s' in network '%s'"),
|
||||||
name, networkName);
|
name, networkName);
|
||||||
VIR_FREE(mac);
|
VIR_FREE(mac);
|
||||||
@ -453,7 +449,7 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
|
|||||||
* You need at least one MAC address or one host name
|
* You need at least one MAC address or one host name
|
||||||
*/
|
*/
|
||||||
if ((mac == NULL) && (name == NULL)) {
|
if ((mac == NULL) && (name == NULL)) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Static host definition in network '%s' must have mac or name attribute"),
|
_("Static host definition in network '%s' must have mac or name attribute"),
|
||||||
networkName);
|
networkName);
|
||||||
return -1;
|
return -1;
|
||||||
@ -461,7 +457,7 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
|
|||||||
ip = virXMLPropString(cur, "ip");
|
ip = virXMLPropString(cur, "ip");
|
||||||
if ((ip == NULL) ||
|
if ((ip == NULL) ||
|
||||||
(virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) {
|
(virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Missing IP address in static host definition for network '%s'"),
|
_("Missing IP address in static host definition for network '%s'"),
|
||||||
networkName);
|
networkName);
|
||||||
VIR_FREE(ip);
|
VIR_FREE(ip);
|
||||||
@ -523,7 +519,7 @@ virNetworkDNSHostsDefParseXML(virNetworkDNSDefPtr def,
|
|||||||
|
|
||||||
if (!(ip = virXMLPropString(node, "ip")) ||
|
if (!(ip = virXMLPropString(node, "ip")) ||
|
||||||
(virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) {
|
(virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) {
|
||||||
virNetworkReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
_("Missing IP address in DNS host definition"));
|
_("Missing IP address in DNS host definition"));
|
||||||
VIR_FREE(ip);
|
VIR_FREE(ip);
|
||||||
goto error;
|
goto error;
|
||||||
@ -584,27 +580,27 @@ virNetworkDNSSrvDefParseXML(virNetworkDNSDefPtr def,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!(service = virXMLPropString(cur, "service"))) {
|
if (!(service = virXMLPropString(cur, "service"))) {
|
||||||
virNetworkReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
"%s", _("Missing required service attribute in dns srv record"));
|
"%s", _("Missing required service attribute in dns srv record"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(service) > DNS_RECORD_LENGTH_SRV) {
|
if (strlen(service) > DNS_RECORD_LENGTH_SRV) {
|
||||||
virNetworkReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
_("Service name is too long, limit is %d bytes"),
|
_("Service name is too long, limit is %d bytes"),
|
||||||
DNS_RECORD_LENGTH_SRV);
|
DNS_RECORD_LENGTH_SRV);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(protocol = virXMLPropString(cur, "protocol"))) {
|
if (!(protocol = virXMLPropString(cur, "protocol"))) {
|
||||||
virNetworkReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
_("Missing required protocol attribute in dns srv record '%s'"), service);
|
_("Missing required protocol attribute in dns srv record '%s'"), service);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check whether protocol value is the supported one */
|
/* Check whether protocol value is the supported one */
|
||||||
if (STRNEQ(protocol, "tcp") && (STRNEQ(protocol, "udp"))) {
|
if (STRNEQ(protocol, "tcp") && (STRNEQ(protocol, "udp"))) {
|
||||||
virNetworkReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
_("Invalid protocol attribute value '%s'"), protocol);
|
_("Invalid protocol attribute value '%s'"), protocol);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -681,18 +677,18 @@ virNetworkDNSDefParseXML(virNetworkDNSDefPtr *dnsdef,
|
|||||||
if (cur->type == XML_ELEMENT_NODE &&
|
if (cur->type == XML_ELEMENT_NODE &&
|
||||||
xmlStrEqual(cur->name, BAD_CAST "txt")) {
|
xmlStrEqual(cur->name, BAD_CAST "txt")) {
|
||||||
if (!(name = virXMLPropString(cur, "name"))) {
|
if (!(name = virXMLPropString(cur, "name"))) {
|
||||||
virNetworkReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
"%s", _("Missing required name attribute in dns txt record"));
|
"%s", _("Missing required name attribute in dns txt record"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (!(value = virXMLPropString(cur, "value"))) {
|
if (!(value = virXMLPropString(cur, "value"))) {
|
||||||
virNetworkReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
_("Missing required value attribute in dns txt record '%s'"), name);
|
_("Missing required value attribute in dns txt record '%s'"), name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strchr(name, ' ') != NULL) {
|
if (strchr(name, ' ') != NULL) {
|
||||||
virNetworkReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
_("spaces are not allowed in DNS TXT record names (name is '%s')"), name);
|
_("spaces are not allowed in DNS TXT record names (name is '%s')"), name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -765,7 +761,7 @@ virNetworkIPParseXML(const char *networkName,
|
|||||||
|
|
||||||
if (address) {
|
if (address) {
|
||||||
if (virSocketAddrParse(&def->address, address, AF_UNSPEC) < 0) {
|
if (virSocketAddrParse(&def->address, address, AF_UNSPEC) < 0) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Bad address '%s' in definition of network '%s'"),
|
_("Bad address '%s' in definition of network '%s'"),
|
||||||
address, networkName);
|
address, networkName);
|
||||||
goto error;
|
goto error;
|
||||||
@ -777,27 +773,27 @@ virNetworkIPParseXML(const char *networkName,
|
|||||||
if (def->family == NULL) {
|
if (def->family == NULL) {
|
||||||
if (!(VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET) ||
|
if (!(VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET) ||
|
||||||
VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_UNSPEC))) {
|
VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_UNSPEC))) {
|
||||||
virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("no family specified for non-IPv4 address '%s' in network '%s'"),
|
_("no family specified for non-IPv4 address '%s' in network '%s'"),
|
||||||
address, networkName);
|
address, networkName);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (STREQ(def->family, "ipv4")) {
|
} else if (STREQ(def->family, "ipv4")) {
|
||||||
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET)) {
|
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET)) {
|
||||||
virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("family 'ipv4' specified for non-IPv4 address '%s' in network '%s'"),
|
_("family 'ipv4' specified for non-IPv4 address '%s' in network '%s'"),
|
||||||
address, networkName);
|
address, networkName);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (STREQ(def->family, "ipv6")) {
|
} else if (STREQ(def->family, "ipv6")) {
|
||||||
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET6)) {
|
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET6)) {
|
||||||
virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("family 'ipv6' specified for non-IPv6 address '%s' in network '%s'"),
|
_("family 'ipv6' specified for non-IPv6 address '%s' in network '%s'"),
|
||||||
address, networkName);
|
address, networkName);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Unrecognized family '%s' in definition of network '%s'"),
|
_("Unrecognized family '%s' in definition of network '%s'"),
|
||||||
def->family, networkName);
|
def->family, networkName);
|
||||||
goto error;
|
goto error;
|
||||||
@ -807,14 +803,14 @@ virNetworkIPParseXML(const char *networkName,
|
|||||||
if (netmask) {
|
if (netmask) {
|
||||||
if (address == NULL) {
|
if (address == NULL) {
|
||||||
/* netmask is meaningless without an address */
|
/* netmask is meaningless without an address */
|
||||||
virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("netmask specified without address in network '%s'"),
|
_("netmask specified without address in network '%s'"),
|
||||||
networkName);
|
networkName);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET)) {
|
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET)) {
|
||||||
virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("netmask not supported for address '%s' in network '%s' (IPv4 only)"),
|
_("netmask not supported for address '%s' in network '%s' (IPv4 only)"),
|
||||||
address, networkName);
|
address, networkName);
|
||||||
goto error;
|
goto error;
|
||||||
@ -822,7 +818,7 @@ virNetworkIPParseXML(const char *networkName,
|
|||||||
|
|
||||||
if (def->prefix > 0) {
|
if (def->prefix > 0) {
|
||||||
/* can't have both netmask and prefix at the same time */
|
/* can't have both netmask and prefix at the same time */
|
||||||
virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("network '%s' cannot have both prefix='%u' and a netmask"),
|
_("network '%s' cannot have both prefix='%u' and a netmask"),
|
||||||
networkName, def->prefix);
|
networkName, def->prefix);
|
||||||
goto error;
|
goto error;
|
||||||
@ -832,7 +828,7 @@ virNetworkIPParseXML(const char *networkName,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->netmask, AF_INET)) {
|
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->netmask, AF_INET)) {
|
||||||
virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("network '%s' has invalid netmask '%s' for address '%s' (both must be IPv4)"),
|
_("network '%s' has invalid netmask '%s' for address '%s' (both must be IPv4)"),
|
||||||
networkName, netmask, address);
|
networkName, netmask, address);
|
||||||
goto error;
|
goto error;
|
||||||
@ -951,7 +947,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
/* Extract network name */
|
/* Extract network name */
|
||||||
def->name = virXPathString("string(./name[1])", ctxt);
|
def->name = virXPathString("string(./name[1])", ctxt);
|
||||||
if (!def->name) {
|
if (!def->name) {
|
||||||
virNetworkReportError(VIR_ERR_NO_NAME, NULL);
|
virReportError(VIR_ERR_NO_NAME, NULL);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,14 +955,14 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
tmp = virXPathString("string(./uuid[1])", ctxt);
|
tmp = virXPathString("string(./uuid[1])", ctxt);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
if (virUUIDGenerate(def->uuid)) {
|
if (virUUIDGenerate(def->uuid)) {
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Failed to generate UUID"));
|
"%s", _("Failed to generate UUID"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virUUIDParse(tmp, def->uuid) < 0) {
|
if (virUUIDParse(tmp, def->uuid) < 0) {
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("malformed uuid element"));
|
"%s", _("malformed uuid element"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -990,14 +986,14 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
tmp = virXPathString("string(./mac[1]/@address)", ctxt);
|
tmp = virXPathString("string(./mac[1]/@address)", ctxt);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (virMacAddrParse(tmp, &def->mac) < 0) {
|
if (virMacAddrParse(tmp, &def->mac) < 0) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Invalid bridge mac address '%s' in network '%s'"),
|
_("Invalid bridge mac address '%s' in network '%s'"),
|
||||||
tmp, def->name);
|
tmp, def->name);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (virMacAddrIsMulticast(&def->mac)) {
|
if (virMacAddrIsMulticast(&def->mac)) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Invalid multicast bridge mac address '%s' in network '%s'"),
|
_("Invalid multicast bridge mac address '%s' in network '%s'"),
|
||||||
tmp, def->name);
|
tmp, def->name);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
@ -1073,7 +1069,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
tmp = virXPathString("string(./@mode)", ctxt);
|
tmp = virXPathString("string(./@mode)", ctxt);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if ((def->forwardType = virNetworkForwardTypeFromString(tmp)) < 0) {
|
if ((def->forwardType = virNetworkForwardTypeFromString(tmp)) < 0) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown forwarding type '%s'"), tmp);
|
_("unknown forwarding type '%s'"), tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1090,7 +1086,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
nForwardPfs = virXPathNodeSet("./pf", ctxt, &forwardPfNodes);
|
nForwardPfs = virXPathNodeSet("./pf", ctxt, &forwardPfNodes);
|
||||||
|
|
||||||
if (nForwardIfs < 0 || nForwardPfs < 0) {
|
if (nForwardIfs < 0 || nForwardPfs < 0) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("No interface pool or SRIOV physical device given"));
|
_("No interface pool or SRIOV physical device given"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -1102,14 +1098,14 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (forwardDev) {
|
if (forwardDev) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("A forward Dev should not be used when using a SRIOV PF"));
|
_("A forward Dev should not be used when using a SRIOV PF"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
forwardDev = virXMLPropString(*forwardPfNodes, "dev");
|
forwardDev = virXMLPropString(*forwardPfNodes, "dev");
|
||||||
if (!forwardDev) {
|
if (!forwardDev) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Missing required dev attribute in network '%s' pf element"),
|
_("Missing required dev attribute in network '%s' pf element"),
|
||||||
def->name);
|
def->name);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1120,7 +1116,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
forwardDev = NULL;
|
forwardDev = NULL;
|
||||||
def->nForwardPfs++;
|
def->nForwardPfs++;
|
||||||
} else if (nForwardPfs > 1) {
|
} else if (nForwardPfs > 1) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Use of more than one physical interface is not allowed"));
|
_("Use of more than one physical interface is not allowed"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -1144,7 +1140,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
for (ii = 0; ii < nForwardIfs; ii++) {
|
for (ii = 0; ii < nForwardIfs; ii++) {
|
||||||
forwardDev = virXMLPropString(forwardIfNodes[ii], "dev");
|
forwardDev = virXMLPropString(forwardIfNodes[ii], "dev");
|
||||||
if (!forwardDev) {
|
if (!forwardDev) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Missing required dev attribute in network '%s' forward interface element"),
|
_("Missing required dev attribute in network '%s' forward interface element"),
|
||||||
def->name);
|
def->name);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1154,7 +1150,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
/* both forwardDev and an interface element are present.
|
/* both forwardDev and an interface element are present.
|
||||||
* If they don't match, it's an error. */
|
* If they don't match, it's an error. */
|
||||||
if (STRNEQ(forwardDev, def->forwardIfs[0].dev)) {
|
if (STRNEQ(forwardDev, def->forwardIfs[0].dev)) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("forward dev '%s' must match first interface element dev '%s' in network '%s'"),
|
_("forward dev '%s' must match first interface element dev '%s' in network '%s'"),
|
||||||
def->forwardIfs[0].dev,
|
def->forwardIfs[0].dev,
|
||||||
forwardDev, def->name);
|
forwardDev, def->name);
|
||||||
@ -1181,14 +1177,14 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
* the network we're on.
|
* the network we're on.
|
||||||
*/
|
*/
|
||||||
if (def->nips == 0) {
|
if (def->nips == 0) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("%s forwarding requested, but no IP address provided for network '%s'"),
|
_("%s forwarding requested, but no IP address provided for network '%s'"),
|
||||||
virNetworkForwardTypeToString(def->forwardType),
|
virNetworkForwardTypeToString(def->forwardType),
|
||||||
def->name);
|
def->name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (def->nForwardIfs > 1) {
|
if (def->nForwardIfs > 1) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("multiple forwarding interfaces specified for network '%s', only one is supported"),
|
_("multiple forwarding interfaces specified for network '%s', only one is supported"),
|
||||||
def->name);
|
def->name);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1199,7 +1195,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
case VIR_NETWORK_FORWARD_VEPA:
|
case VIR_NETWORK_FORWARD_VEPA:
|
||||||
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||||
if (def->bridge) {
|
if (def->bridge) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("bridge name not allowed in %s mode (network '%s')"),
|
_("bridge name not allowed in %s mode (network '%s')"),
|
||||||
virNetworkForwardTypeToString(def->forwardType),
|
virNetworkForwardTypeToString(def->forwardType),
|
||||||
def->name);
|
def->name);
|
||||||
@ -1208,7 +1204,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
/* fall through to next case */
|
/* fall through to next case */
|
||||||
case VIR_NETWORK_FORWARD_BRIDGE:
|
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||||
if (def->delay || stp) {
|
if (def->delay || stp) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("bridge delay/stp options only allowed in route, nat, and isolated mode, not in %s (network '%s')"),
|
_("bridge delay/stp options only allowed in route, nat, and isolated mode, not in %s (network '%s')"),
|
||||||
virNetworkForwardTypeToString(def->forwardType),
|
virNetworkForwardTypeToString(def->forwardType),
|
||||||
def->name);
|
def->name);
|
||||||
@ -1266,7 +1262,7 @@ virNetworkDefPtr virNetworkDefParseNode(xmlDocPtr xml,
|
|||||||
virNetworkDefPtr def = NULL;
|
virNetworkDefPtr def = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "network")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "network")) {
|
||||||
virNetworkReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unexpected root element <%s>, "
|
_("unexpected root element <%s>, "
|
||||||
"expecting <network>"),
|
"expecting <network>"),
|
||||||
root->name);
|
root->name);
|
||||||
@ -1476,7 +1472,7 @@ char *virNetworkDefFormat(const virNetworkDefPtr def, unsigned int flags)
|
|||||||
const char *mode = virNetworkForwardTypeToString(def->forwardType);
|
const char *mode = virNetworkForwardTypeToString(def->forwardType);
|
||||||
|
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unknown forward type %d in network '%s'"),
|
_("Unknown forward type %d in network '%s'"),
|
||||||
def->forwardType, def->name);
|
def->forwardType, def->name);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1644,7 +1640,7 @@ virNetworkObjPtr virNetworkLoadConfig(virNetworkObjListPtr nets,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!STREQ(name, def->name)) {
|
if (!STREQ(name, def->name)) {
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Network config filename '%s'"
|
_("Network config filename '%s'"
|
||||||
" does not match network name '%s'"),
|
" does not match network name '%s'"),
|
||||||
configFile, def->name);
|
configFile, def->name);
|
||||||
@ -1806,7 +1802,7 @@ char *virNetworkAllocateBridge(const virNetworkObjListPtr nets,
|
|||||||
id++;
|
id++;
|
||||||
} while (id <= MAX_BRIDGE_ID);
|
} while (id <= MAX_BRIDGE_ID);
|
||||||
|
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Bridge generation exceeded max id %d"),
|
_("Bridge generation exceeded max id %d"),
|
||||||
MAX_BRIDGE_ID);
|
MAX_BRIDGE_ID);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1824,7 +1820,7 @@ int virNetworkSetBridgeName(const virNetworkObjListPtr nets,
|
|||||||
* defined. */
|
* defined. */
|
||||||
if (check_collision &&
|
if (check_collision &&
|
||||||
virNetworkBridgeInUse(nets, def->bridge, def->name)) {
|
virNetworkBridgeInUse(nets, def->bridge, def->name)) {
|
||||||
virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("bridge name '%s' already in use."),
|
_("bridge name '%s' already in use."),
|
||||||
def->bridge);
|
def->bridge);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1879,7 +1875,7 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
|||||||
if (STRNEQ(vm->def->name, def->name)) {
|
if (STRNEQ(vm->def->name, def->name)) {
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
virUUIDFormat(vm->def->uuid, uuidstr);
|
virUUIDFormat(vm->def->uuid, uuidstr);
|
||||||
virNetworkReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("network '%s' is already defined with uuid %s"),
|
_("network '%s' is already defined with uuid %s"),
|
||||||
vm->def->name, uuidstr);
|
vm->def->name, uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1888,7 +1884,7 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
|||||||
if (check_active) {
|
if (check_active) {
|
||||||
/* UUID & name match, but if VM is already active, refuse it */
|
/* UUID & name match, but if VM is already active, refuse it */
|
||||||
if (virNetworkObjIsActive(vm)) {
|
if (virNetworkObjIsActive(vm)) {
|
||||||
virNetworkReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
_("network is already active as '%s'"),
|
_("network is already active as '%s'"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1902,7 +1898,7 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
|||||||
if (vm) {
|
if (vm) {
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
virUUIDFormat(vm->def->uuid, uuidstr);
|
virUUIDFormat(vm->def->uuid, uuidstr);
|
||||||
virNetworkReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("network '%s' already exists with uuid %s"),
|
_("network '%s' already exists with uuid %s"),
|
||||||
def->name, uuidstr);
|
def->name, uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -185,7 +185,7 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virMutexInit(&device->lock) < 0) {
|
if (virMutexInit(&device->lock) < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("cannot initialize mutex"));
|
"%s", _("cannot initialize mutex"));
|
||||||
VIR_FREE(device);
|
VIR_FREE(device);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -506,7 +506,7 @@ virNodeDevCapsDefParseULong(const char *xpath,
|
|||||||
|
|
||||||
ret = virXPathULong(xpath, ctxt, &val);
|
ret = virXPathULong(xpath, ctxt, &val);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
ret == -1 ? missing_error_fmt : invalid_error_fmt,
|
ret == -1 ? missing_error_fmt : invalid_error_fmt,
|
||||||
def->name);
|
def->name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -529,7 +529,7 @@ virNodeDevCapsDefParseULongLong(const char *xpath,
|
|||||||
|
|
||||||
ret = virXPathULongLong(xpath, ctxt, &val);
|
ret = virXPathULongLong(xpath, ctxt, &val);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
ret == -1 ? missing_error_fmt : invalid_error_fmt,
|
ret == -1 ? missing_error_fmt : invalid_error_fmt,
|
||||||
def->name);
|
def->name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -554,7 +554,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
data->storage.block = virXPathString("string(./block[1])", ctxt);
|
data->storage.block = virXPathString("string(./block[1])", ctxt);
|
||||||
if (!data->storage.block) {
|
if (!data->storage.block) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no block device path supplied for '%s'"),
|
_("no block device path supplied for '%s'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto out;
|
goto out;
|
||||||
@ -574,7 +574,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
|
|||||||
char *type = virXMLPropString(nodes[i], "type");
|
char *type = virXMLPropString(nodes[i], "type");
|
||||||
|
|
||||||
if (!type) {
|
if (!type) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("missing storage capability type for '%s'"),
|
_("missing storage capability type for '%s'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto out;
|
goto out;
|
||||||
@ -607,7 +607,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
ctxt->node = orignode2;
|
ctxt->node = orignode2;
|
||||||
} else {
|
} else {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown storage capability type '%s' for '%s'"),
|
_("unknown storage capability type '%s' for '%s'"),
|
||||||
type, def->name);
|
type, def->name);
|
||||||
VIR_FREE(type);
|
VIR_FREE(type);
|
||||||
@ -692,7 +692,7 @@ virNodeDevCapScsiTargetParseXML(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
data->scsi_target.name = virXPathString("string(./name[1])", ctxt);
|
data->scsi_target.name = virXPathString("string(./name[1])", ctxt);
|
||||||
if (!data->scsi_target.name) {
|
if (!data->scsi_target.name) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no target name supplied for '%s'"),
|
_("no target name supplied for '%s'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto out;
|
goto out;
|
||||||
@ -737,7 +737,7 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
|
|||||||
type = virXMLPropString(nodes[i], "type");
|
type = virXMLPropString(nodes[i], "type");
|
||||||
|
|
||||||
if (!type) {
|
if (!type) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("missing SCSI host capability type for '%s'"),
|
_("missing SCSI host capability type for '%s'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto out;
|
goto out;
|
||||||
@ -760,7 +760,7 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
|
|||||||
ctxt,
|
ctxt,
|
||||||
&data->scsi_host.wwnn) < 0) {
|
&data->scsi_host.wwnn) < 0) {
|
||||||
if (virRandomGenerateWWN(&data->scsi_host.wwnn, virt_type) < 0) {
|
if (virRandomGenerateWWN(&data->scsi_host.wwnn, virt_type) < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no WWNN supplied for '%s', and "
|
_("no WWNN supplied for '%s', and "
|
||||||
"auto-generation failed"),
|
"auto-generation failed"),
|
||||||
def->name);
|
def->name);
|
||||||
@ -772,7 +772,7 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
|
|||||||
ctxt,
|
ctxt,
|
||||||
&data->scsi_host.wwpn) < 0) {
|
&data->scsi_host.wwpn) < 0) {
|
||||||
if (virRandomGenerateWWN(&data->scsi_host.wwpn, virt_type) < 0) {
|
if (virRandomGenerateWWN(&data->scsi_host.wwpn, virt_type) < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no WWPN supplied for '%s', and "
|
_("no WWPN supplied for '%s', and "
|
||||||
"auto-generation failed"),
|
"auto-generation failed"),
|
||||||
def->name);
|
def->name);
|
||||||
@ -783,7 +783,7 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
|
|||||||
ctxt->node = orignode2;
|
ctxt->node = orignode2;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown SCSI host capability type '%s' for '%s'"),
|
_("unknown SCSI host capability type '%s' for '%s'"),
|
||||||
type, def->name);
|
type, def->name);
|
||||||
goto out;
|
goto out;
|
||||||
@ -817,7 +817,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
data->net.ifname = virXPathString("string(./interface[1])", ctxt);
|
data->net.ifname = virXPathString("string(./interface[1])", ctxt);
|
||||||
if (!data->net.ifname) {
|
if (!data->net.ifname) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no network interface supplied for '%s'"),
|
_("no network interface supplied for '%s'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto out;
|
goto out;
|
||||||
@ -832,7 +832,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
|
|||||||
int val = virNodeDevNetCapTypeFromString(tmp);
|
int val = virNodeDevNetCapTypeFromString(tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("invalid network type supplied for '%s'"),
|
_("invalid network type supplied for '%s'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto out;
|
goto out;
|
||||||
@ -903,7 +903,7 @@ virNodeDevCapsDefParseHexId(const char *xpath,
|
|||||||
|
|
||||||
ret = virXPathULongHex(xpath, ctxt, &val);
|
ret = virXPathULongHex(xpath, ctxt, &val);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
ret == -1 ? missing_error_fmt : invalid_error_fmt,
|
ret == -1 ? missing_error_fmt : invalid_error_fmt,
|
||||||
def->name);
|
def->name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1036,13 +1036,13 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
tmp = virXPathString("string(./hardware/uuid[1])", ctxt);
|
tmp = virXPathString("string(./hardware/uuid[1])", ctxt);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no system UUID supplied for '%s'"), def->name);
|
_("no system UUID supplied for '%s'"), def->name);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virUUIDParse(tmp, data->system.hardware.uuid) < 0) {
|
if (virUUIDParse(tmp, data->system.hardware.uuid) < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("malformed uuid element for '%s'"), def->name);
|
_("malformed uuid element for '%s'"), def->name);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
goto out;
|
goto out;
|
||||||
@ -1077,13 +1077,13 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
tmp = virXMLPropString(node, "type");
|
tmp = virXMLPropString(node, "type");
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("missing capability type"));
|
"%s", _("missing capability type"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((val = virNodeDevCapTypeFromString(tmp)) < 0) {
|
if ((val = virNodeDevCapTypeFromString(tmp)) < 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown capability type '%s'"), tmp);
|
_("unknown capability type '%s'"), tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1123,7 +1123,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
ret = virNodeDevCapStorageParseXML(ctxt, def, node, &caps->data);
|
ret = virNodeDevCapStorageParseXML(ctxt, def, node, &caps->data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown capability type '%d' for '%s'"),
|
_("unknown capability type '%d' for '%s'"),
|
||||||
caps->type, def->name);
|
caps->type, def->name);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -1159,7 +1159,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
def->name = virXPathString("string(./name[1])", ctxt);
|
def->name = virXPathString("string(./name[1])", ctxt);
|
||||||
|
|
||||||
if (!def->name) {
|
if (!def->name) {
|
||||||
virNodeDeviceReportError(VIR_ERR_NO_NAME, NULL);
|
virReportError(VIR_ERR_NO_NAME, NULL);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1181,7 +1181,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no device capabilities for '%s'"),
|
_("no device capabilities for '%s'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1219,7 +1219,7 @@ virNodeDeviceDefParseNode(xmlDocPtr xml,
|
|||||||
virNodeDeviceDefPtr def = NULL;
|
virNodeDeviceDefPtr def = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "device")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "device")) {
|
||||||
virNodeDeviceReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unexpected root element <%s> "
|
_("unexpected root element <%s> "
|
||||||
"expecting <device>"),
|
"expecting <device>"),
|
||||||
root->name);
|
root->name);
|
||||||
@ -1298,7 +1298,7 @@ virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cap == NULL) {
|
if (cap == NULL) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Device is not a fibre channel HBA"));
|
"%s", _("Device is not a fibre channel HBA"));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
} else if (*wwnn == NULL || *wwpn == NULL) {
|
} else if (*wwnn == NULL || *wwpn == NULL) {
|
||||||
@ -1327,7 +1327,7 @@ virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
parent = virNodeDeviceFindByName(devs, parent_name);
|
parent = virNodeDeviceFindByName(devs, parent_name);
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not find parent device for '%s'"),
|
_("Could not find parent device for '%s'"),
|
||||||
dev_name);
|
dev_name);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -1347,7 +1347,7 @@ virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cap == NULL) {
|
if (cap == NULL) {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Parent device %s is not capable "
|
_("Parent device %s is not capable "
|
||||||
"of vport operations"),
|
"of vport operations"),
|
||||||
parent->def->name);
|
parent->def->name);
|
||||||
|
@ -212,9 +212,6 @@ struct _virDeviceMonitorState {
|
|||||||
void *privateData; /* driver-specific private data */
|
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);
|
int virNodeDeviceHasCap(const virNodeDeviceObjPtr dev, const char *cap);
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ ipsetValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
arg_err_exit:
|
arg_err_exit:
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
"%s", errmsg);
|
"%s", errmsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1053,7 +1053,7 @@ ipsetFlagsValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
arg_err_exit:
|
arg_err_exit:
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
"%s", errmsg);
|
"%s", errmsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2014,7 +2014,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!found || rc) {
|
if (!found || rc) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("%s has illegal value %s"),
|
_("%s has illegal value %s"),
|
||||||
att[idx].name, prop);
|
att[idx].name, prop);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
@ -2048,7 +2048,7 @@ virNWFilterIncludeParse(xmlNodePtr cur)
|
|||||||
|
|
||||||
ret->filterref = virXMLPropString(cur, "filter");
|
ret->filterref = virXMLPropString(cur, "filter");
|
||||||
if (!ret->filterref) {
|
if (!ret->filterref) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s",
|
"%s",
|
||||||
_("rule node requires action attribute"));
|
_("rule node requires action attribute"));
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
@ -2316,28 +2316,28 @@ virNWFilterRuleParse(xmlNodePtr node)
|
|||||||
statematch= virXMLPropString(node, "statematch");
|
statematch= virXMLPropString(node, "statematch");
|
||||||
|
|
||||||
if (!action) {
|
if (!action) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s",
|
"%s",
|
||||||
_("rule node requires action attribute"));
|
_("rule node requires action attribute"));
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret->action = virNWFilterRuleActionTypeFromString(action)) < 0) {
|
if ((ret->action = virNWFilterRuleActionTypeFromString(action)) < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s",
|
"%s",
|
||||||
_("unknown rule action attribute value"));
|
_("unknown rule action attribute value"));
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!direction) {
|
if (!direction) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s",
|
"%s",
|
||||||
_("rule node requires direction attribute"));
|
_("rule node requires direction attribute"));
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret->tt = virNWFilterRuleDirectionTypeFromString(direction)) < 0) {
|
if ((ret->tt = virNWFilterRuleDirectionTypeFromString(direction)) < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s",
|
"%s",
|
||||||
_("unknown rule direction attribute value"));
|
_("unknown rule direction attribute value"));
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
@ -2415,7 +2415,7 @@ static bool
|
|||||||
virNWFilterIsValidChainName(const char *chainname)
|
virNWFilterIsValidChainName(const char *chainname)
|
||||||
{
|
{
|
||||||
if (strlen(chainname) > MAX_CHAIN_SUFFIX_SIZE) {
|
if (strlen(chainname) > MAX_CHAIN_SUFFIX_SIZE) {
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Name of chain is longer than "
|
_("Name of chain is longer than "
|
||||||
"%u characters"),
|
"%u characters"),
|
||||||
MAX_CHAIN_SUFFIX_SIZE);
|
MAX_CHAIN_SUFFIX_SIZE);
|
||||||
@ -2423,7 +2423,7 @@ virNWFilterIsValidChainName(const char *chainname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (chainname[strspn(chainname, VALID_CHAINNAME)] != 0) {
|
if (chainname[strspn(chainname, VALID_CHAINNAME)] != 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Chain name contains invalid characters"));
|
_("Chain name contains invalid characters"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2483,7 +2483,7 @@ virNWFilterIsAllowedChain(const char *chainname)
|
|||||||
|
|
||||||
msg = virBufferContentAndReset(&buf);
|
msg = virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG, "%s", msg);
|
virReportError(VIR_ERR_INVALID_ARG, "%s", msg);
|
||||||
VIR_FREE(msg);
|
VIR_FREE(msg);
|
||||||
|
|
||||||
err_exit:
|
err_exit:
|
||||||
@ -2508,7 +2508,7 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
|
|
||||||
ret->name = virXPathString("string(./@name)", ctxt);
|
ret->name = virXPathString("string(./@name)", ctxt);
|
||||||
if (!ret->name) {
|
if (!ret->name) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("filter has no name"));
|
"%s", _("filter has no name"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2516,14 +2516,14 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
chain_pri_s = virXPathString("string(./@priority)", ctxt);
|
chain_pri_s = virXPathString("string(./@priority)", ctxt);
|
||||||
if (chain_pri_s) {
|
if (chain_pri_s) {
|
||||||
if (virStrToLong_i(chain_pri_s, NULL, 10, &chain_priority) < 0) {
|
if (virStrToLong_i(chain_pri_s, NULL, 10, &chain_priority) < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Could not parse chain priority '%s'"),
|
_("Could not parse chain priority '%s'"),
|
||||||
chain_pri_s);
|
chain_pri_s);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (chain_priority < NWFILTER_MIN_FILTER_PRIORITY ||
|
if (chain_priority < NWFILTER_MIN_FILTER_PRIORITY ||
|
||||||
chain_priority > NWFILTER_MAX_FILTER_PRIORITY) {
|
chain_priority > NWFILTER_MAX_FILTER_PRIORITY) {
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Priority '%d' is outside valid "
|
_("Priority '%d' is outside valid "
|
||||||
"range of [%d,%d]"),
|
"range of [%d,%d]"),
|
||||||
chain_priority,
|
chain_priority,
|
||||||
@ -2565,13 +2565,13 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
uuid = virXPathString("string(./uuid)", ctxt);
|
uuid = virXPathString("string(./uuid)", ctxt);
|
||||||
if (uuid == NULL) {
|
if (uuid == NULL) {
|
||||||
if (virUUIDGenerate(ret->uuid) < 0) {
|
if (virUUIDGenerate(ret->uuid) < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("unable to generate uuid"));
|
"%s", _("unable to generate uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virUUIDParse(uuid, ret->uuid) < 0) {
|
if (virUUIDParse(uuid, ret->uuid) < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("malformed uuid element"));
|
"%s", _("malformed uuid element"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2627,7 +2627,7 @@ virNWFilterDefParseNode(xmlDocPtr xml,
|
|||||||
virNWFilterDefPtr def = NULL;
|
virNWFilterDefPtr def = NULL;
|
||||||
|
|
||||||
if (STRNEQ((const char *)root->name, "filter")) {
|
if (STRNEQ((const char *)root->name, "filter")) {
|
||||||
virNWFilterReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s",
|
"%s",
|
||||||
_("unknown root element for nw filter"));
|
_("unknown root element for nw filter"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2976,7 +2976,7 @@ virNWFilterObjAssignDef(virConnectPtr conn,
|
|||||||
|
|
||||||
if (nwfilter) {
|
if (nwfilter) {
|
||||||
if (!STREQ(def->name, nwfilter->def->name)) {
|
if (!STREQ(def->name, nwfilter->def->name)) {
|
||||||
virNWFilterReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("filter with same UUID but different name "
|
_("filter with same UUID but different name "
|
||||||
"('%s') already exists"),
|
"('%s') already exists"),
|
||||||
nwfilter->def->name);
|
nwfilter->def->name);
|
||||||
@ -2987,7 +2987,7 @@ virNWFilterObjAssignDef(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virNWFilterDefLoopDetect(conn, nwfilters, def) < 0) {
|
if (virNWFilterDefLoopDetect(conn, nwfilters, def) < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
"%s", _("filter would introduce a loop"));
|
"%s", _("filter would introduce a loop"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -3027,7 +3027,7 @@ virNWFilterObjAssignDef(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virMutexInitRecursive(&nwfilter->lock) < 0) {
|
if (virMutexInitRecursive(&nwfilter->lock) < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("cannot initialize mutex"));
|
"%s", _("cannot initialize mutex"));
|
||||||
VIR_FREE(nwfilter);
|
VIR_FREE(nwfilter);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -3063,7 +3063,7 @@ virNWFilterObjLoad(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
|
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
|
||||||
virNWFilterReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("network filter config filename '%s' does not match name '%s'"),
|
_("network filter config filename '%s' does not match name '%s'"),
|
||||||
path, def->name);
|
path, def->name);
|
||||||
virNWFilterDefFree(def);
|
virNWFilterDefFree(def);
|
||||||
@ -3153,7 +3153,7 @@ virNWFilterObjSaveDef(virNWFilterDriverStatePtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(xml = virNWFilterDefFormat(def))) {
|
if (!(xml = virNWFilterDefFormat(def))) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("failed to generate XML"));
|
"%s", _("failed to generate XML"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3169,13 +3169,13 @@ int
|
|||||||
virNWFilterObjDeleteDef(virNWFilterObjPtr nwfilter)
|
virNWFilterObjDeleteDef(virNWFilterObjPtr nwfilter)
|
||||||
{
|
{
|
||||||
if (!nwfilter->configFile) {
|
if (!nwfilter->configFile) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no config file for %s"), nwfilter->def->name);
|
_("no config file for %s"), nwfilter->def->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlink(nwfilter->configFile) < 0) {
|
if (unlink(nwfilter->configFile) < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("cannot remove config for %s"),
|
_("cannot remove config for %s"),
|
||||||
nwfilter->def->name);
|
nwfilter->def->name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -3248,7 +3248,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
|
|||||||
att[i].name);
|
att[i].name);
|
||||||
if (att[i].formatter && !(flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) {
|
if (att[i].formatter && !(flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) {
|
||||||
if (!att[i].formatter(buf, def, item)) {
|
if (!att[i].formatter(buf, def, item)) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("formatter for %s %s reported error"),
|
_("formatter for %s %s reported error"),
|
||||||
type,
|
type,
|
||||||
att[i].name);
|
att[i].name);
|
||||||
|
@ -731,10 +731,6 @@ void virNWFilterConfLayerShutdown(void);
|
|||||||
|
|
||||||
int virNWFilterInstFiltersOnAllVMs(virConnectPtr conn);
|
int virNWFilterInstFiltersOnAllVMs(virConnectPtr conn);
|
||||||
|
|
||||||
# define virNWFilterReportError(code, fmt...) \
|
|
||||||
virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \
|
|
||||||
__FUNCTION__, __LINE__, fmt)
|
|
||||||
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRebuild)(virConnectPtr conn,
|
typedef int (*virNWFilterRebuild)(virConnectPtr conn,
|
||||||
virHashIterator, void *data);
|
virHashIterator, void *data);
|
||||||
|
@ -113,7 +113,7 @@ virNWFilterVarValueCreateSimple(char *value)
|
|||||||
virNWFilterVarValuePtr val;
|
virNWFilterVarValuePtr val;
|
||||||
|
|
||||||
if (!isValidVarValue(value)) {
|
if (!isValidVarValue(value)) {
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Variable value contains invalid character"));
|
_("Variable value contains invalid character"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
|
|||||||
|
|
||||||
varValue = virHashLookup(hash->hashTable, varName);
|
varValue = virHashLookup(hash->hashTable, varName);
|
||||||
if (varValue == NULL) {
|
if (varValue == NULL) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not find value for variable '%s'"),
|
_("Could not find value for variable '%s'"),
|
||||||
varName);
|
varName);
|
||||||
return -1;
|
return -1;
|
||||||
@ -349,7 +349,7 @@ virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
|
|||||||
cie->curValue = minValue;
|
cie->curValue = minValue;
|
||||||
} else {
|
} else {
|
||||||
if (cie->maxValue != maxValue) {
|
if (cie->maxValue != maxValue) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Cardinality of list items must be "
|
_("Cardinality of list items must be "
|
||||||
"the same for processing them in "
|
"the same for processing them in "
|
||||||
"parallel"));
|
"parallel"));
|
||||||
@ -541,7 +541,7 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
|
|||||||
iterId = virNWFilterVarAccessGetIterId(vap);
|
iterId = virNWFilterVarAccessGetIterId(vap);
|
||||||
iterIndex = virNWFilterVarCombIterGetIndexByIterId(ci, iterId);
|
iterIndex = virNWFilterVarCombIterGetIndexByIterId(ci, iterId);
|
||||||
if (iterIndex < 0) {
|
if (iterIndex < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not get iterator index for "
|
_("Could not get iterator index for "
|
||||||
"iterator ID %u"), iterId);
|
"iterator ID %u"), iterId);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -551,7 +551,7 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
|
|||||||
iterId = virNWFilterVarAccessGetIntIterId(vap);
|
iterId = virNWFilterVarAccessGetIntIterId(vap);
|
||||||
iterIndex = virNWFilterVarCombIterGetIndexByIterId(ci, iterId);
|
iterIndex = virNWFilterVarCombIterGetIndexByIterId(ci, iterId);
|
||||||
if (iterIndex < 0) {
|
if (iterIndex < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not get iterator index for "
|
_("Could not get iterator index for "
|
||||||
"(internal) iterator ID %u"), iterId);
|
"(internal) iterator ID %u"), iterId);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -569,7 +569,7 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not find variable '%s' in iterator"),
|
_("Could not find variable '%s' in iterator"),
|
||||||
varName);
|
varName);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -577,7 +577,7 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
|
|||||||
|
|
||||||
value = virHashLookup(ci->hashTable->hashTable, varName);
|
value = virHashLookup(ci->hashTable->hashTable, varName);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not find value for variable '%s'"),
|
_("Could not find value for variable '%s'"),
|
||||||
varName);
|
varName);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -585,7 +585,7 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
|
|||||||
|
|
||||||
res = virNWFilterVarValueGetNthValue(value, ci->iter[iterIndex].curValue);
|
res = virNWFilterVarValueGetNthValue(value, ci->iter[iterIndex].curValue);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not get nth (%u) value of "
|
_("Could not get nth (%u) value of "
|
||||||
"variable '%s'"),
|
"variable '%s'"),
|
||||||
ci->iter[iterIndex].curValue, varName);
|
ci->iter[iterIndex].curValue, varName);
|
||||||
@ -736,7 +736,7 @@ addToTable(void *payload, const void *name, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virNWFilterHashTablePut(atts->target, (const char *)name, val, 1) < 0){
|
if (virNWFilterHashTablePut(atts->target, (const char *)name, val, 1) < 0){
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not put variable '%s' into hashmap"),
|
_("Could not put variable '%s' into hashmap"),
|
||||||
(const char *)name);
|
(const char *)name);
|
||||||
atts->errOccurred = 1;
|
atts->errOccurred = 1;
|
||||||
@ -863,7 +863,7 @@ virNWFilterFormatParamAttributes(virBufferPtr buf,
|
|||||||
numKeys = virHashSize(table->hashTable);
|
numKeys = virHashSize(table->hashTable);
|
||||||
|
|
||||||
if (numKeys < 0) {
|
if (numKeys < 0) {
|
||||||
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("missing filter parameter table"));
|
_("missing filter parameter table"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -998,10 +998,10 @@ virNWFilterVarAccessParse(const char *varAccess)
|
|||||||
}
|
}
|
||||||
if (parseError) {
|
if (parseError) {
|
||||||
if (dest->accessType == VIR_NWFILTER_VAR_ACCESS_ELEMENT)
|
if (dest->accessType == VIR_NWFILTER_VAR_ACCESS_ELEMENT)
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Malformatted array index"));
|
_("Malformatted array index"));
|
||||||
else
|
else
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Malformatted iterator id"));
|
_("Malformatted iterator id"));
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
@ -1013,7 +1013,7 @@ virNWFilterVarAccessParse(const char *varAccess)
|
|||||||
break;
|
break;
|
||||||
case VIR_NWFILTER_VAR_ACCESS_ITERATOR:
|
case VIR_NWFILTER_VAR_ACCESS_ITERATOR:
|
||||||
if (result > VIR_NWFILTER_MAX_ITERID) {
|
if (result > VIR_NWFILTER_MAX_ITERID) {
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Iterator ID exceeds maximum ID "
|
_("Iterator ID exceeds maximum ID "
|
||||||
"of %u"), VIR_NWFILTER_MAX_ITERID);
|
"of %u"), VIR_NWFILTER_MAX_ITERID);
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
@ -1026,7 +1026,7 @@ virNWFilterVarAccessParse(const char *varAccess)
|
|||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
} else {
|
} else {
|
||||||
virNWFilterReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Malformatted variable"));
|
_("Malformatted variable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,13 +73,13 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
type_str = virXPathString("string(./usage/@type)", ctxt);
|
type_str = virXPathString("string(./usage/@type)", ctxt);
|
||||||
if (type_str == NULL) {
|
if (type_str == NULL) {
|
||||||
virSecretReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("unknown secret usage type"));
|
_("unknown secret usage type"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
type = virSecretUsageTypeTypeFromString(type_str);
|
type = virSecretUsageTypeTypeFromString(type_str);
|
||||||
if (type < 0) {
|
if (type < 0) {
|
||||||
virSecretReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown secret usage type %s"), type_str);
|
_("unknown secret usage type %s"), type_str);
|
||||||
VIR_FREE(type_str);
|
VIR_FREE(type_str);
|
||||||
return -1;
|
return -1;
|
||||||
@ -93,7 +93,7 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
|
|||||||
case VIR_SECRET_USAGE_TYPE_VOLUME:
|
case VIR_SECRET_USAGE_TYPE_VOLUME:
|
||||||
def->usage.volume = virXPathString("string(./usage/volume)", ctxt);
|
def->usage.volume = virXPathString("string(./usage/volume)", ctxt);
|
||||||
if (!def->usage.volume) {
|
if (!def->usage.volume) {
|
||||||
virSecretReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("volume usage specified, but volume path is missing"));
|
_("volume usage specified, but volume path is missing"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -102,14 +102,14 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
|
|||||||
case VIR_SECRET_USAGE_TYPE_CEPH:
|
case VIR_SECRET_USAGE_TYPE_CEPH:
|
||||||
def->usage.ceph = virXPathString("string(./usage/name)", ctxt);
|
def->usage.ceph = virXPathString("string(./usage/name)", ctxt);
|
||||||
if (!def->usage.ceph) {
|
if (!def->usage.ceph) {
|
||||||
virSecretReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Ceph usage specified, but name is missing"));
|
_("Ceph usage specified, but name is missing"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
virSecretReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected secret usage type %d"),
|
_("unexpected secret usage type %d"),
|
||||||
def->usage_type);
|
def->usage_type);
|
||||||
return -1;
|
return -1;
|
||||||
@ -126,7 +126,7 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
|
|||||||
char *uuidstr = NULL;
|
char *uuidstr = NULL;
|
||||||
|
|
||||||
if (!xmlStrEqual(root->name, BAD_CAST "secret")) {
|
if (!xmlStrEqual(root->name, BAD_CAST "secret")) {
|
||||||
virSecretReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unexpected root element <%s>, "
|
_("unexpected root element <%s>, "
|
||||||
"expecting <secret>"),
|
"expecting <secret>"),
|
||||||
root->name);
|
root->name);
|
||||||
@ -152,7 +152,7 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
|
|||||||
else if (STREQ(prop, "no"))
|
else if (STREQ(prop, "no"))
|
||||||
def->ephemeral = 0;
|
def->ephemeral = 0;
|
||||||
else {
|
else {
|
||||||
virSecretReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("invalid value of 'ephemeral'"));
|
_("invalid value of 'ephemeral'"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
|
|||||||
else if (STREQ(prop, "no"))
|
else if (STREQ(prop, "no"))
|
||||||
def->private = 0;
|
def->private = 0;
|
||||||
else {
|
else {
|
||||||
virSecretReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("invalid value of 'private'"));
|
_("invalid value of 'private'"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -176,13 +176,13 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
|
|||||||
uuidstr = virXPathString("string(./uuid)", ctxt);
|
uuidstr = virXPathString("string(./uuid)", ctxt);
|
||||||
if (!uuidstr) {
|
if (!uuidstr) {
|
||||||
if (virUUIDGenerate(def->uuid)) {
|
if (virUUIDGenerate(def->uuid)) {
|
||||||
virSecretReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Failed to generate UUID"));
|
"%s", _("Failed to generate UUID"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virUUIDParse(uuidstr, def->uuid) < 0) {
|
if (virUUIDParse(uuidstr, def->uuid) < 0) {
|
||||||
virSecretReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("malformed uuid element"));
|
"%s", _("malformed uuid element"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ virSecretDefFormatUsage(virBufferPtr buf,
|
|||||||
|
|
||||||
type = virSecretUsageTypeTypeToString(def->usage_type);
|
type = virSecretUsageTypeTypeToString(def->usage_type);
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
virSecretReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected secret usage type %d"),
|
_("unexpected secret usage type %d"),
|
||||||
def->usage_type);
|
def->usage_type);
|
||||||
return -1;
|
return -1;
|
||||||
@ -263,7 +263,7 @@ virSecretDefFormatUsage(virBufferPtr buf,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
virSecretReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected secret usage type %d"),
|
_("unexpected secret usage type %d"),
|
||||||
def->usage_type);
|
def->usage_type);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -26,10 +26,6 @@
|
|||||||
# include "internal.h"
|
# include "internal.h"
|
||||||
# include "util.h"
|
# include "util.h"
|
||||||
|
|
||||||
# define virSecretReportError(code, ...) \
|
|
||||||
virReportErrorHelper(VIR_FROM_SECRET, code, __FILE__, \
|
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
VIR_ENUM_DECL(virSecretUsageType)
|
VIR_ENUM_DECL(virSecretUsageType)
|
||||||
|
|
||||||
typedef struct _virSecretDef virSecretDef;
|
typedef struct _virSecretDef virSecretDef;
|
||||||
|
@ -236,7 +236,7 @@ virStoragePoolTypeInfoLookup(int type) {
|
|||||||
if (poolTypeInfo[i].poolType == type)
|
if (poolTypeInfo[i].poolType == type)
|
||||||
return &poolTypeInfo[i];
|
return &poolTypeInfo[i];
|
||||||
|
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("missing backend for pool type %d"), type);
|
_("missing backend for pool type %d"), type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -402,14 +402,14 @@ virStoragePoolDefParseAuthChap(xmlXPathContextPtr ctxt,
|
|||||||
virStoragePoolAuthChapPtr auth) {
|
virStoragePoolAuthChapPtr auth) {
|
||||||
auth->login = virXPathString("string(./auth/@login)", ctxt);
|
auth->login = virXPathString("string(./auth/@login)", ctxt);
|
||||||
if (auth->login == NULL) {
|
if (auth->login == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing auth host attribute"));
|
"%s", _("missing auth host attribute"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
auth->passwd = virXPathString("string(./auth/@passwd)", ctxt);
|
auth->passwd = virXPathString("string(./auth/@passwd)", ctxt);
|
||||||
if (auth->passwd == NULL) {
|
if (auth->passwd == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing auth passwd attribute"));
|
"%s", _("missing auth passwd attribute"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
|
|||||||
char *uuid = NULL;
|
char *uuid = NULL;
|
||||||
auth->username = virXPathString("string(./auth/@username)", ctxt);
|
auth->username = virXPathString("string(./auth/@username)", ctxt);
|
||||||
if (auth->username == NULL) {
|
if (auth->username == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing auth username attribute"));
|
"%s", _("missing auth username attribute"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -431,13 +431,13 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
|
|||||||
uuid = virXPathString("string(./auth/secret/@uuid)", ctxt);
|
uuid = virXPathString("string(./auth/secret/@uuid)", ctxt);
|
||||||
auth->secret.usage = virXPathString("string(./auth/secret/@usage)", ctxt);
|
auth->secret.usage = virXPathString("string(./auth/secret/@usage)", ctxt);
|
||||||
if (uuid == NULL && auth->secret.usage == NULL) {
|
if (uuid == NULL && auth->secret.usage == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("missing auth secret uuid or usage attribute"));
|
_("missing auth secret uuid or usage attribute"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virUUIDParse(uuid, auth->secret.uuid) < 0) {
|
if (virUUIDParse(uuid, auth->secret.uuid) < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("invalid auth secret uuid"));
|
"%s", _("invalid auth secret uuid"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -467,7 +467,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
source->name = virXPathString("string(./name)", ctxt);
|
source->name = virXPathString("string(./name)", ctxt);
|
||||||
if (pool_type == VIR_STORAGE_POOL_RBD && source->name == NULL) {
|
if (pool_type == VIR_STORAGE_POOL_RBD && source->name == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("missing mandatory 'name' field for RBD pool name"));
|
_("missing mandatory 'name' field for RBD pool name"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
source->format = options->formatFromString(format);
|
source->format = options->formatFromString(format);
|
||||||
|
|
||||||
if (source->format < 0) {
|
if (source->format < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown pool format type %s"), format);
|
_("unknown pool format type %s"), format);
|
||||||
VIR_FREE(format);
|
VIR_FREE(format);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -499,7 +499,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
for (i = 0 ; i < source->nhost ; i++) {
|
for (i = 0 ; i < source->nhost ; i++) {
|
||||||
name = virXMLPropString(nodeset[i], "name");
|
name = virXMLPropString(nodeset[i], "name");
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing storage pool host name"));
|
"%s", _("missing storage pool host name"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -508,7 +508,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
port = virXMLPropString(nodeset[i], "port");
|
port = virXMLPropString(nodeset[i], "port");
|
||||||
if (port) {
|
if (port) {
|
||||||
if (virStrToLong_i(port, NULL, 10, &source->hosts[i].port) < 0) {
|
if (virStrToLong_i(port, NULL, 10, &source->hosts[i].port) < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Invalid port number: %s"),
|
_("Invalid port number: %s"),
|
||||||
port);
|
port);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -535,7 +535,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
char *path = virXMLPropString(nodeset[i], "path");
|
char *path = virXMLPropString(nodeset[i], "path");
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
VIR_FREE(nodeset);
|
VIR_FREE(nodeset);
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing storage pool source device path"));
|
"%s", _("missing storage pool source device path"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -556,7 +556,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
} else if (STREQ(authType, "ceph")) {
|
} else if (STREQ(authType, "ceph")) {
|
||||||
source->authType = VIR_STORAGE_POOL_AUTH_CEPHX;
|
source->authType = VIR_STORAGE_POOL_AUTH_CEPHX;
|
||||||
} else {
|
} else {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown auth type '%s'"),
|
_("unknown auth type '%s'"),
|
||||||
(const char *)authType);
|
(const char *)authType);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -606,7 +606,7 @@ virStoragePoolDefParseSourceString(const char *srcSpec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(node = virXPathNode("/source", xpath_ctxt))) {
|
if (!(node = virXPathNode("/source", xpath_ctxt))) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("root element was not source"));
|
_("root element was not source"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -656,7 +656,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) {
|
if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) {
|
||||||
VIR_FREE(mode);
|
VIR_FREE(mode);
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("malformed octal mode"));
|
"%s", _("malformed octal mode"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -668,7 +668,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
|
|||||||
perms->uid = -1;
|
perms->uid = -1;
|
||||||
} else {
|
} else {
|
||||||
if (virXPathLong("number(./owner)", ctxt, &v) < 0) {
|
if (virXPathLong("number(./owner)", ctxt, &v) < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("malformed owner element"));
|
"%s", _("malformed owner element"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -679,7 +679,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
|
|||||||
perms->gid = -1;
|
perms->gid = -1;
|
||||||
} else {
|
} else {
|
||||||
if (virXPathLong("number(./group)", ctxt, &v) < 0) {
|
if (virXPathLong("number(./group)", ctxt, &v) < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("malformed group element"));
|
"%s", _("malformed group element"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -711,7 +711,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
|
|
||||||
type = virXPathString("string(./@type)", ctxt);
|
type = virXPathString("string(./@type)", ctxt);
|
||||||
if ((ret->type = virStoragePoolTypeFromString((const char *)type)) < 0) {
|
if ((ret->type = virStoragePoolTypeFromString((const char *)type)) < 0) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown storage pool type %s"), (const char*)type);
|
_("unknown storage pool type %s"), (const char*)type);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -735,7 +735,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
options->flags & VIR_STORAGE_POOL_SOURCE_NAME)
|
options->flags & VIR_STORAGE_POOL_SOURCE_NAME)
|
||||||
ret->name = ret->source.name;
|
ret->name = ret->source.name;
|
||||||
if (ret->name == NULL) {
|
if (ret->name == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing pool source name element"));
|
"%s", _("missing pool source name element"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -743,13 +743,13 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
uuid = virXPathString("string(./uuid)", ctxt);
|
uuid = virXPathString("string(./uuid)", ctxt);
|
||||||
if (uuid == NULL) {
|
if (uuid == NULL) {
|
||||||
if (virUUIDGenerate(ret->uuid) < 0) {
|
if (virUUIDGenerate(ret->uuid) < 0) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("unable to generate uuid"));
|
"%s", _("unable to generate uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virUUIDParse(uuid, ret->uuid) < 0) {
|
if (virUUIDParse(uuid, ret->uuid) < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("malformed uuid element"));
|
"%s", _("malformed uuid element"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -758,7 +758,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
|
|
||||||
if (options->flags & VIR_STORAGE_POOL_SOURCE_HOST) {
|
if (options->flags & VIR_STORAGE_POOL_SOURCE_HOST) {
|
||||||
if (!ret->source.nhost) {
|
if (!ret->source.nhost) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s",
|
"%s",
|
||||||
_("missing storage pool source host name"));
|
_("missing storage pool source host name"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -767,7 +767,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
|
|
||||||
if (options->flags & VIR_STORAGE_POOL_SOURCE_DIR) {
|
if (options->flags & VIR_STORAGE_POOL_SOURCE_DIR) {
|
||||||
if (!ret->source.dir) {
|
if (!ret->source.dir) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing storage pool source path"));
|
"%s", _("missing storage pool source path"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -785,7 +785,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
|
|
||||||
if (options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER) {
|
if (options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER) {
|
||||||
if (!ret->source.adapter) {
|
if (!ret->source.adapter) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing storage pool source adapter name"));
|
"%s", _("missing storage pool source adapter name"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -794,7 +794,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
/* If DEVICE is the only source type, then its required */
|
/* If DEVICE is the only source type, then its required */
|
||||||
if (options->flags == VIR_STORAGE_POOL_SOURCE_DEVICE) {
|
if (options->flags == VIR_STORAGE_POOL_SOURCE_DEVICE) {
|
||||||
if (!ret->source.ndevice) {
|
if (!ret->source.ndevice) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing storage pool source device name"));
|
"%s", _("missing storage pool source device name"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -804,7 +804,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
* path and permissions */
|
* path and permissions */
|
||||||
if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) {
|
if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) {
|
||||||
if ((tmppath = virXPathString("string(./target/path)", ctxt)) == NULL) {
|
if ((tmppath = virXPathString("string(./target/path)", ctxt)) == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing storage pool target path"));
|
"%s", _("missing storage pool target path"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -835,7 +835,7 @@ virStoragePoolDefParseNode(xmlDocPtr xml,
|
|||||||
virStoragePoolDefPtr def = NULL;
|
virStoragePoolDefPtr def = NULL;
|
||||||
|
|
||||||
if (STRNEQ((const char *)root->name, "pool")) {
|
if (STRNEQ((const char *)root->name, "pool")) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("unknown root element for storage pool"));
|
"%s", _("unknown root element for storage pool"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -935,7 +935,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
|
|||||||
if (options->formatToString) {
|
if (options->formatToString) {
|
||||||
const char *format = (options->formatToString)(src->format);
|
const char *format = (options->formatToString)(src->format);
|
||||||
if (!format) {
|
if (!format) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown pool format number %d"),
|
_("unknown pool format number %d"),
|
||||||
src->format);
|
src->format);
|
||||||
return -1;
|
return -1;
|
||||||
@ -994,7 +994,7 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
|
|||||||
|
|
||||||
type = virStoragePoolTypeToString(def->type);
|
type = virStoragePoolTypeToString(def->type);
|
||||||
if (!type) {
|
if (!type) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("unexpected pool type"));
|
"%s", _("unexpected pool type"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1058,7 +1058,7 @@ virStorageSize(const char *unit,
|
|||||||
unsigned long long *ret)
|
unsigned long long *ret)
|
||||||
{
|
{
|
||||||
if (virStrToLong_ull(val, NULL, 10, ret) < 0) {
|
if (virStrToLong_ull(val, NULL, 10, ret) < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("malformed capacity element"));
|
"%s", _("malformed capacity element"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1091,7 +1091,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
|
|
||||||
ret->name = virXPathString("string(./name)", ctxt);
|
ret->name = virXPathString("string(./name)", ctxt);
|
||||||
if (ret->name == NULL) {
|
if (ret->name == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing volume name element"));
|
"%s", _("missing volume name element"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1102,7 +1102,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
capacity = virXPathString("string(./capacity)", ctxt);
|
capacity = virXPathString("string(./capacity)", ctxt);
|
||||||
unit = virXPathString("string(./capacity/@unit)", ctxt);
|
unit = virXPathString("string(./capacity/@unit)", ctxt);
|
||||||
if (capacity == NULL) {
|
if (capacity == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing capacity element"));
|
"%s", _("missing capacity element"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1131,7 +1131,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
ret->target.format = (options->formatFromString)(format);
|
ret->target.format = (options->formatFromString)(format);
|
||||||
|
|
||||||
if (ret->target.format < 0) {
|
if (ret->target.format < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown volume format type %s"), format);
|
_("unknown volume format type %s"), format);
|
||||||
VIR_FREE(format);
|
VIR_FREE(format);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1163,7 +1163,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
ret->backingStore.format = (options->formatFromString)(format);
|
ret->backingStore.format = (options->formatFromString)(format);
|
||||||
|
|
||||||
if (ret->backingStore.format < 0) {
|
if (ret->backingStore.format < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown volume format type %s"), format);
|
_("unknown volume format type %s"), format);
|
||||||
VIR_FREE(format);
|
VIR_FREE(format);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1194,7 +1194,7 @@ virStorageVolDefParseNode(virStoragePoolDefPtr pool,
|
|||||||
virStorageVolDefPtr def = NULL;
|
virStorageVolDefPtr def = NULL;
|
||||||
|
|
||||||
if (STRNEQ((const char *)root->name, "volume")) {
|
if (STRNEQ((const char *)root->name, "volume")) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("unknown root element for storage vol"));
|
"%s", _("unknown root element for storage vol"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1254,7 +1254,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
|
|||||||
if (options->formatToString) {
|
if (options->formatToString) {
|
||||||
const char *format = (options->formatToString)(def->format);
|
const char *format = (options->formatToString)(def->format);
|
||||||
if (!format) {
|
if (!format) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unknown volume format number %d"),
|
_("unknown volume format number %d"),
|
||||||
def->format);
|
def->format);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1471,7 +1471,7 @@ virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virMutexInit(&pool->lock) < 0) {
|
if (virMutexInit(&pool->lock) < 0) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("cannot initialize mutex"));
|
"%s", _("cannot initialize mutex"));
|
||||||
VIR_FREE(pool);
|
VIR_FREE(pool);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1505,7 +1505,7 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
|
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Storage pool config filename '%s' does not match pool name '%s'"),
|
_("Storage pool config filename '%s' does not match pool name '%s'"),
|
||||||
path, def->name);
|
path, def->name);
|
||||||
virStoragePoolDefFree(def);
|
virStoragePoolDefFree(def);
|
||||||
@ -1617,7 +1617,7 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(xml = virStoragePoolDefFormat(def))) {
|
if (!(xml = virStoragePoolDefFormat(def))) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("failed to generate XML"));
|
"%s", _("failed to generate XML"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1631,13 +1631,13 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
|
|||||||
int
|
int
|
||||||
virStoragePoolObjDeleteDef(virStoragePoolObjPtr pool) {
|
virStoragePoolObjDeleteDef(virStoragePoolObjPtr pool) {
|
||||||
if (!pool->configFile) {
|
if (!pool->configFile) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("no config file for %s"), pool->def->name);
|
_("no config file for %s"), pool->def->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlink(pool->configFile) < 0) {
|
if (unlink(pool->configFile) < 0) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("cannot remove config for %s"),
|
_("cannot remove config for %s"),
|
||||||
pool->def->name);
|
pool->def->name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1675,7 +1675,7 @@ char *virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
|
|||||||
|
|
||||||
type = virStoragePoolTypeToString(def->type);
|
type = virStoragePoolTypeToString(def->type);
|
||||||
if (!type) {
|
if (!type) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("unexpected pool type"));
|
"%s", _("unexpected pool type"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1726,7 +1726,7 @@ int virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
|||||||
if (STRNEQ(pool->def->name, def->name)) {
|
if (STRNEQ(pool->def->name, def->name)) {
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
virUUIDFormat(pool->def->uuid, uuidstr);
|
virUUIDFormat(pool->def->uuid, uuidstr);
|
||||||
virStorageReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("pool '%s' is already defined with uuid %s"),
|
_("pool '%s' is already defined with uuid %s"),
|
||||||
pool->def->name, uuidstr);
|
pool->def->name, uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1735,7 +1735,7 @@ int virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
|||||||
if (check_active) {
|
if (check_active) {
|
||||||
/* UUID & name match, but if Pool is already active, refuse it */
|
/* UUID & name match, but if Pool is already active, refuse it */
|
||||||
if (virStoragePoolObjIsActive(pool)) {
|
if (virStoragePoolObjIsActive(pool)) {
|
||||||
virStorageReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
_("pool is already active as '%s'"),
|
_("pool is already active as '%s'"),
|
||||||
pool->def->name);
|
pool->def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1749,7 +1749,7 @@ int virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
|||||||
if (pool) {
|
if (pool) {
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
virUUIDFormat(pool->def->uuid, uuidstr);
|
virUUIDFormat(pool->def->uuid, uuidstr);
|
||||||
virStorageReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("pool '%s' already exists with uuid %s"),
|
_("pool '%s' already exists with uuid %s"),
|
||||||
def->name, uuidstr);
|
def->name, uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1831,7 +1831,7 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (matchpool) {
|
if (matchpool) {
|
||||||
virStorageReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("Storage source conflict with pool: '%s'"),
|
_("Storage source conflict with pool: '%s'"),
|
||||||
matchpool->def->name);
|
matchpool->def->name);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
@ -336,10 +336,6 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) {
|
|||||||
return pool->active;
|
return pool->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
# define virStorageReportError(code, ...) \
|
|
||||||
virReportErrorHelper(VIR_FROM_STORAGE, code, __FILE__, \
|
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
int virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
|
int virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
|
||||||
const char *configDir,
|
const char *configDir,
|
||||||
const char *autostartDir);
|
const char *autostartDir);
|
||||||
|
@ -88,13 +88,13 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
type_str = virXPathString("string(./@type)", ctxt);
|
type_str = virXPathString("string(./@type)", ctxt);
|
||||||
if (type_str == NULL) {
|
if (type_str == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("unknown volume encryption secret type"));
|
_("unknown volume encryption secret type"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
type = virStorageEncryptionSecretTypeTypeFromString(type_str);
|
type = virStorageEncryptionSecretTypeTypeFromString(type_str);
|
||||||
if (type < 0) {
|
if (type < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown volume encryption secret type %s"),
|
_("unknown volume encryption secret type %s"),
|
||||||
type_str);
|
type_str);
|
||||||
VIR_FREE(type_str);
|
VIR_FREE(type_str);
|
||||||
@ -106,14 +106,14 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
|
|||||||
uuidstr = virXPathString("string(./@uuid)", ctxt);
|
uuidstr = virXPathString("string(./@uuid)", ctxt);
|
||||||
if (uuidstr) {
|
if (uuidstr) {
|
||||||
if (virUUIDParse(uuidstr, ret->uuid) < 0) {
|
if (virUUIDParse(uuidstr, ret->uuid) < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("malformed volume encryption uuid '%s'"),
|
_("malformed volume encryption uuid '%s'"),
|
||||||
uuidstr);
|
uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
VIR_FREE(uuidstr);
|
VIR_FREE(uuidstr);
|
||||||
} else {
|
} else {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("missing volume encryption uuid"));
|
_("missing volume encryption uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -142,13 +142,13 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
|
|||||||
|
|
||||||
format_str = virXPathString("string(./@format)", ctxt);
|
format_str = virXPathString("string(./@format)", ctxt);
|
||||||
if (format_str == NULL) {
|
if (format_str == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("unknown volume encryption format"));
|
_("unknown volume encryption format"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
format = virStorageEncryptionFormatTypeFromString(format_str);
|
format = virStorageEncryptionFormatTypeFromString(format_str);
|
||||||
if (format < 0) {
|
if (format < 0) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown volume encryption format type %s"),
|
_("unknown volume encryption format type %s"),
|
||||||
format_str);
|
format_str);
|
||||||
VIR_FREE(format_str);
|
VIR_FREE(format_str);
|
||||||
@ -188,7 +188,7 @@ virStorageEncryptionParseNode(xmlDocPtr xml, xmlNodePtr root)
|
|||||||
virStorageEncryptionPtr enc = NULL;
|
virStorageEncryptionPtr enc = NULL;
|
||||||
|
|
||||||
if (STRNEQ((const char *) root->name, "encryption")) {
|
if (STRNEQ((const char *) root->name, "encryption")) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("unknown root element for volume "
|
"%s", _("unknown root element for volume "
|
||||||
"encryption information"));
|
"encryption information"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -218,7 +218,7 @@ virStorageEncryptionSecretFormat(virBufferPtr buf,
|
|||||||
|
|
||||||
type = virStorageEncryptionSecretTypeTypeToString(secret->type);
|
type = virStorageEncryptionSecretTypeTypeToString(secret->type);
|
||||||
if (!type) {
|
if (!type) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("unexpected volume encryption secret type"));
|
_("unexpected volume encryption secret type"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -238,7 +238,7 @@ virStorageEncryptionFormat(virBufferPtr buf,
|
|||||||
|
|
||||||
format = virStorageEncryptionFormatTypeToString(enc->format);
|
format = virStorageEncryptionFormatTypeToString(enc->format);
|
||||||
if (!format) {
|
if (!format) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("unexpected encryption format"));
|
"%s", _("unexpected encryption format"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ virStorageGenerateQcowPassphrase(unsigned char *dest)
|
|||||||
unpleasant surprises with the qemu monitor input mechanism. */
|
unpleasant surprises with the qemu monitor input mechanism. */
|
||||||
fd = open("/dev/urandom", O_RDONLY);
|
fd = open("/dev/urandom", O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Cannot open /dev/urandom"));
|
_("Cannot open /dev/urandom"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ virStorageGenerateQcowPassphrase(unsigned char *dest)
|
|||||||
while ((r = read(fd, dest + i, 1)) == -1 && errno == EINTR)
|
while ((r = read(fd, dest + i, 1)) == -1 && errno == EINTR)
|
||||||
;
|
;
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Cannot read from /dev/urandom"));
|
_("Cannot read from /dev/urandom"));
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -39,9 +39,6 @@
|
|||||||
#include "virfile.h"
|
#include "virfile.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
#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
|
/* structure holding information about consoles
|
||||||
* open in a given domain */
|
* open in a given domain */
|
||||||
@ -127,7 +124,7 @@ static int virConsoleLockFileCreate(const char *pty)
|
|||||||
/* check if a log file and process holding the lock still exists */
|
/* check if a log file and process holding the lock still exists */
|
||||||
if (virPidFileReadPathIfAlive(path, &pid, NULL) == 0 && pid >= 0) {
|
if (virPidFileReadPathIfAlive(path, &pid, NULL) == 0 && pid >= 0) {
|
||||||
/* the process exists, the lockfile is valid */
|
/* the process exists, the lockfile is valid */
|
||||||
virConsoleError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("Requested console pty '%s' is locked by "
|
_("Requested console pty '%s' is locked by "
|
||||||
"lock file '%s' held by process %lld"),
|
"lock file '%s' held by process %lld"),
|
||||||
pty, path, (long long) pid);
|
pty, path, (long long) pid);
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
# include "driver.h"
|
# include "driver.h"
|
||||||
# include "node_device_conf.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_PREFIX "/sys/class/scsi_host/"
|
||||||
# define LINUX_SYSFS_SCSI_HOST_POSTFIX "device"
|
# define LINUX_SYSFS_SCSI_HOST_POSTFIX "device"
|
||||||
# define LINUX_SYSFS_FC_HOST_PREFIX "/sys/class/fc_host/"
|
# define LINUX_SYSFS_FC_HOST_PREFIX "/sys/class/fc_host/"
|
||||||
|
@ -69,6 +69,10 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
||||||
|
|
||||||
|
#define virNWFilterReportError(code, fmt...) \
|
||||||
|
virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \
|
||||||
|
__FUNCTION__, __LINE__, fmt)
|
||||||
|
|
||||||
#ifdef HAVE_LIBPCAP
|
#ifdef HAVE_LIBPCAP
|
||||||
|
|
||||||
# define LEASEFILE LOCALSTATEDIR "/run/libvirt/network/nwfilter.leases"
|
# define LEASEFILE LOCALSTATEDIR "/run/libvirt/network/nwfilter.leases"
|
||||||
|
@ -44,6 +44,9 @@
|
|||||||
#include "nwfilter_learnipaddr.h"
|
#include "nwfilter_learnipaddr.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
||||||
|
#define virNWFilterReportError(code, fmt...) \
|
||||||
|
virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \
|
||||||
|
__FUNCTION__, __LINE__, fmt)
|
||||||
|
|
||||||
static virNWFilterDriverStatePtr driverState;
|
static virNWFilterDriverStatePtr driverState;
|
||||||
|
|
||||||
|
@ -45,7 +45,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
#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_INCOMING "PREROUTING"
|
||||||
#define EBTABLES_CHAIN_OUTGOING "POSTROUTING"
|
#define EBTABLES_CHAIN_OUTGOING "POSTROUTING"
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
#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
|
#define NWFILTER_STD_VAR_MAC NWFILTER_VARNAME_MAC
|
||||||
|
@ -56,6 +56,9 @@
|
|||||||
#include "nwfilter_learnipaddr.h"
|
#include "nwfilter_learnipaddr.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
||||||
|
#define virNWFilterReportError(code, fmt...) \
|
||||||
|
virReportErrorHelper(VIR_FROM_NWFILTER, code, __FILE__, \
|
||||||
|
__FUNCTION__, __LINE__, fmt)
|
||||||
|
|
||||||
#define IFINDEX2STR(VARNAME, ifindex) \
|
#define IFINDEX2STR(VARNAME, ifindex) \
|
||||||
char VARNAME[INT_BUFSIZE_BOUND(ifindex)]; \
|
char VARNAME[INT_BUFSIZE_BOUND(ifindex)]; \
|
||||||
|
@ -45,6 +45,10 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_SECRET
|
#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 };
|
enum { SECRET_MAX_XML_FILE = 10*1024*1024 };
|
||||||
|
|
||||||
/* Internal driver state */
|
/* Internal driver state */
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
# include "storage_conf.h"
|
# include "storage_conf.h"
|
||||||
# include "command.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 char * (*virStorageBackendFindPoolSources)(virConnectPtr conn, const char *srcSpec, unsigned int flags);
|
||||||
typedef int (*virStorageBackendCheckPool)(virConnectPtr conn, virStoragePoolObjPtr pool, bool *active);
|
typedef int (*virStorageBackendCheckPool)(virConnectPtr conn, virStoragePoolObjPtr pool, bool *active);
|
||||||
typedef int (*virStorageBackendStartPool)(virConnectPtr conn, virStoragePoolObjPtr pool);
|
typedef int (*virStorageBackendStartPool)(virConnectPtr conn, virStoragePoolObjPtr pool);
|
||||||
|
@ -5129,7 +5129,7 @@ testNodeDeviceLookupByName(virConnectPtr conn, const char *name)
|
|||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
|
testError(VIR_ERR_NO_NODE_DEVICE, NULL);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5156,7 +5156,7 @@ testNodeDeviceGetXMLDesc(virNodeDevicePtr dev,
|
|||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
|
testError(VIR_ERR_NO_NODE_DEVICE,
|
||||||
_("no node device with matching name '%s'"),
|
_("no node device with matching name '%s'"),
|
||||||
dev->name);
|
dev->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5182,7 +5182,7 @@ testNodeDeviceGetParent(virNodeDevicePtr dev)
|
|||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
|
testError(VIR_ERR_NO_NODE_DEVICE,
|
||||||
_("no node device with matching name '%s'"),
|
_("no node device with matching name '%s'"),
|
||||||
dev->name);
|
dev->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5193,7 +5193,7 @@ testNodeDeviceGetParent(virNodeDevicePtr dev)
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
} else {
|
} else {
|
||||||
virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
|
testError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("no parent for this device"));
|
"%s", _("no parent for this device"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5218,7 +5218,7 @@ testNodeDeviceNumOfCaps(virNodeDevicePtr dev)
|
|||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
|
testError(VIR_ERR_NO_NODE_DEVICE,
|
||||||
_("no node device with matching name '%s'"),
|
_("no node device with matching name '%s'"),
|
||||||
dev->name);
|
dev->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5249,7 +5249,7 @@ testNodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
|
|||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
|
testError(VIR_ERR_NO_NODE_DEVICE,
|
||||||
_("no node device with matching name '%s'"),
|
_("no node device with matching name '%s'"),
|
||||||
dev->name);
|
dev->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5356,7 +5356,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
|
|||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
|
testError(VIR_ERR_NO_NODE_DEVICE, NULL);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user