VIR_ERR_INVALID_* is meant for invalid pointers only.
---
src/conf/nwfilter_conf.c | 6 +++---
src/conf/storage_conf.c | 2 +-
src/network/bridge_driver.c | 20 ++++++++++----------
src/nwfilter/nwfilter_driver.c | 6 +++---
src/nwfilter/nwfilter_ebiptables_driver.c | 20 ++++++++++----------
src/qemu/qemu_driver.c | 4 ++--
src/storage/storage_backend.c | 2 +-
src/test/test_driver.c | 20 ++++++++++----------
8 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 0346471..dbb72b2 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2366,7 +2366,7 @@ virNWFilterObjAssignDef(virConnectPtr conn,
if (nwfilter) {
if (!STREQ(def->name, nwfilter->def->name)) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_OPERATION_FAILED,
_("filter with same UUID but different name
"
"('%s') already exists"),
nwfilter->def->name);
@@ -2377,7 +2377,7 @@ virNWFilterObjAssignDef(virConnectPtr conn,
}
if (virNWFilterDefLoopDetect(conn, nwfilters, def)) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("filter would introduce a
loop"));
return NULL;
}
@@ -2442,7 +2442,7 @@ virNWFilterObjLoad(virConnectPtr conn,
}
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_XML_ERROR,
_("network filter config filename '%s' does not match name
'%s'"),
path, def->name);
virNWFilterDefFree(def);
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index f7f471e..0c37dc6 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1423,7 +1423,7 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
}
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
- virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
+ virStorageReportError(VIR_ERR_XML_ERROR,
_("Storage pool config filename '%s' does not
match pool name '%s'"),
path, def->name);
virStoragePoolDefFree(def);
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 4c64a74..3f63afd 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2059,13 +2059,13 @@ static int networkUndefine(virNetworkPtr net) {
network = virNetworkFindByUUID(&driver->networks, net->uuid);
if (!network) {
- networkReportError(VIR_ERR_INVALID_NETWORK,
+ networkReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching
uuid"));
goto cleanup;
}
if (virNetworkObjIsActive(network)) {
- networkReportError(VIR_ERR_INTERNAL_ERROR,
+ networkReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("network is still active"));
goto cleanup;
}
@@ -2138,7 +2138,7 @@ static int networkStart(virNetworkPtr net) {
network = virNetworkFindByUUID(&driver->networks, net->uuid);
if (!network) {
- networkReportError(VIR_ERR_INVALID_NETWORK,
+ networkReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching
uuid"));
goto cleanup;
}
@@ -2161,13 +2161,13 @@ static int networkDestroy(virNetworkPtr net) {
network = virNetworkFindByUUID(&driver->networks, net->uuid);
if (!network) {
- networkReportError(VIR_ERR_INVALID_NETWORK,
+ networkReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching
uuid"));
goto cleanup;
}
if (!virNetworkObjIsActive(network)) {
- networkReportError(VIR_ERR_INTERNAL_ERROR,
+ networkReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("network is not active"));
goto cleanup;
}
@@ -2196,7 +2196,7 @@ static char *networkDumpXML(virNetworkPtr net, int flags
ATTRIBUTE_UNUSED) {
networkDriverUnlock(driver);
if (!network) {
- networkReportError(VIR_ERR_INVALID_NETWORK,
+ networkReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching
uuid"));
goto cleanup;
}
@@ -2219,7 +2219,7 @@ static char *networkGetBridgeName(virNetworkPtr net) {
networkDriverUnlock(driver);
if (!network) {
- networkReportError(VIR_ERR_INVALID_NETWORK,
+ networkReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching id"));
goto cleanup;
}
@@ -2251,7 +2251,7 @@ static int networkGetAutostart(virNetworkPtr net,
network = virNetworkFindByUUID(&driver->networks, net->uuid);
networkDriverUnlock(driver);
if (!network) {
- networkReportError(VIR_ERR_INVALID_NETWORK,
+ networkReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching
uuid"));
goto cleanup;
}
@@ -2276,13 +2276,13 @@ static int networkSetAutostart(virNetworkPtr net,
network = virNetworkFindByUUID(&driver->networks, net->uuid);
if (!network) {
- networkReportError(VIR_ERR_INVALID_NETWORK,
+ networkReportError(VIR_ERR_NO_NETWORK,
"%s", _("no network with matching
uuid"));
goto cleanup;
}
if (!network->persistent) {
- networkReportError(VIR_ERR_INTERNAL_ERROR,
+ networkReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot set autostart for transient
network"));
goto cleanup;
}
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index fa72a5f..f903311 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -372,13 +372,13 @@ nwfilterUndefine(virNWFilterPtr obj) {
nwfilter = virNWFilterObjFindByUUID(&driver->nwfilters, obj->uuid);
if (!nwfilter) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_NO_NWFILTER,
"%s", _("no nwfilter with matching
uuid"));
goto cleanup;
}
if (virNWFilterTestUnassignDef(obj->conn, nwfilter)) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_OPERATION_INVALID,
"%s",
_("nwfilter is in use"));
goto cleanup;
@@ -417,7 +417,7 @@ nwfilterDumpXML(virNWFilterPtr obj,
nwfilterDriverUnlock(driver);
if (!nwfilter) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_NO_NWFILTER,
"%s", _("no nwfilter with matching
uuid"));
goto cleanup;
}
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c
b/src/nwfilter/nwfilter_ebiptables_driver.c
index 9b7a7c8..91a9159 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -157,14 +157,14 @@ printVar(virNWFilterHashTablePtr vars,
if ((item->flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) {
char *val = (char *)virHashLookup(vars->hashTable, item->var);
if (!val) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find value for '%s'"),
item->var);
return 1;
}
if (!virStrcpy(buf, val, bufsize)) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("Buffer to small to print MAC address "
"'%s' into"),
item->var);
@@ -223,7 +223,7 @@ _printDataType(virNWFilterHashTablePtr vars,
case DATATYPE_MACADDR:
case DATATYPE_MACMASK:
if (bufsize < VIR_MAC_STRING_BUFLEN) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Buffer too small for MAC address"));
return 1;
}
@@ -235,7 +235,7 @@ _printDataType(virNWFilterHashTablePtr vars,
case DATATYPE_IPMASK:
if (snprintf(buf, bufsize, "%d",
item->u.u8) >= bufsize) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Buffer too small for uint8 type"));
return 1;
}
@@ -245,7 +245,7 @@ _printDataType(virNWFilterHashTablePtr vars,
case DATATYPE_UINT16_HEX:
if (snprintf(buf, bufsize, asHex ? "0x%x" : "%d",
item->u.u16) >= bufsize) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Buffer too small for uint16 type"));
return 1;
}
@@ -255,14 +255,14 @@ _printDataType(virNWFilterHashTablePtr vars,
case DATATYPE_UINT8_HEX:
if (snprintf(buf, bufsize, asHex ? "0x%x" : "%d",
item->u.u8) >= bufsize) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER, "%s",
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Buffer too small for uint8 type"));
return 1;
}
break;
default:
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("Unhandled datatype %x"), item->datatype);
return 1;
break;
@@ -2356,7 +2356,7 @@ ebiptablesCreateRuleInstance(virConnectPtr conn ATTRIBUTE_UNUSED,
case VIR_NWFILTER_RULE_PROTOCOL_IGMP:
case VIR_NWFILTER_RULE_PROTOCOL_ALL:
if (nettype == VIR_DOMAIN_NET_TYPE_DIRECT) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
_("'%s' protocol not support for net type
'%s'"),
virNWFilterRuleProtocolTypeToString(rule->prtclType),
virDomainNetTypeToString(nettype));
@@ -2380,7 +2380,7 @@ ebiptablesCreateRuleInstance(virConnectPtr conn ATTRIBUTE_UNUSED,
case VIR_NWFILTER_RULE_PROTOCOL_ICMPV6:
case VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6:
if (nettype == VIR_DOMAIN_NET_TYPE_DIRECT) {
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_OPERATION_FAILED,
_("'%s' protocol not support for net type
'%s'"),
virNWFilterRuleProtocolTypeToString(rule->prtclType),
virDomainNetTypeToString(nettype));
@@ -2396,7 +2396,7 @@ ebiptablesCreateRuleInstance(virConnectPtr conn ATTRIBUTE_UNUSED,
break;
case VIR_NWFILTER_RULE_PROTOCOL_LAST:
- virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
+ virNWFilterReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("illegal protocol type"));
rc = 1;
break;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 395f72f..be0c231 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -467,7 +467,7 @@ getVolumeQcowPassphrase(virConnectPtr conn,
enc->nsecrets != 1 ||
enc->secrets[0]->type !=
VIR_STORAGE_ENCRYPTION_SECRET_TYPE_PASSPHRASE) {
- qemuReportError(VIR_ERR_INVALID_DOMAIN,
+ qemuReportError(VIR_ERR_XML_ERROR,
_("invalid <encryption> for volume %s"),
disk->src);
goto cleanup;
}
@@ -485,7 +485,7 @@ getVolumeQcowPassphrase(virConnectPtr conn,
if (memchr(data, '\0', size) != NULL) {
memset(data, 0, size);
VIR_FREE(data);
- qemuReportError(VIR_ERR_INVALID_SECRET,
+ qemuReportError(VIR_ERR_XML_ERROR,
_("format='qcow' passphrase for %s must not contain
a "
"'\\0'"), disk->src);
goto cleanup;
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index ee08a4a..bfe1172 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -713,7 +713,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
return -1;
}
if (enc->nsecrets > 1) {
- virStorageReportError(VIR_ERR_INVALID_STORAGE_VOL, "%s",
+ virStorageReportError(VIR_ERR_XML_ERROR, "%s",
_("too many secrets for qcow encryption"));
return -1;
}
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ddff160..601ecf8 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4356,7 +4356,7 @@ testStorageVolumeLookupByName(virStoragePoolPtr pool,
privvol = virStorageVolDefFindByName(privpool, name);
if (!privvol) {
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"), name);
goto cleanup;
}
@@ -4399,7 +4399,7 @@ testStorageVolumeLookupByKey(virConnectPtr conn,
testDriverUnlock(privconn);
if (!ret)
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching key '%s'"), key);
return ret;
@@ -4433,7 +4433,7 @@ testStorageVolumeLookupByPath(virConnectPtr conn,
testDriverUnlock(privconn);
if (!ret)
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching path '%s'"), path);
return ret;
@@ -4469,7 +4469,7 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool,
goto cleanup;
if (virStorageVolDefFindByName(privpool, privvol->name)) {
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_OPERATION_FAILED,
"%s", _("storage vol already exists"));
goto cleanup;
}
@@ -4550,14 +4550,14 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool,
goto cleanup;
if (virStorageVolDefFindByName(privpool, privvol->name)) {
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_OPERATION_FAILED,
"%s", _("storage vol already exists"));
goto cleanup;
}
origvol = virStorageVolDefFindByName(privpool, clonevol->name);
if (!origvol) {
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
clonevol->name);
goto cleanup;
@@ -4633,7 +4633,7 @@ testStorageVolumeDelete(virStorageVolPtr vol,
privvol = virStorageVolDefFindByName(privpool, vol->name);
if (privvol == NULL) {
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vol->name);
goto cleanup;
@@ -4711,7 +4711,7 @@ testStorageVolumeGetInfo(virStorageVolPtr vol,
privvol = virStorageVolDefFindByName(privpool, vol->name);
if (privvol == NULL) {
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vol->name);
goto cleanup;
@@ -4756,7 +4756,7 @@ testStorageVolumeGetXMLDesc(virStorageVolPtr vol,
privvol = virStorageVolDefFindByName(privpool, vol->name);
if (privvol == NULL) {
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vol->name);
goto cleanup;
@@ -4796,7 +4796,7 @@ testStorageVolumeGetPath(virStorageVolPtr vol) {
privvol = virStorageVolDefFindByName(privpool, vol->name);
if (privvol == NULL) {
- testError(VIR_ERR_INVALID_STORAGE_VOL,
+ testError(VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vol->name);
goto cleanup;
--
1.7.0.4