mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
Replace use of interfaceReportError with virReportError
Update the netcf driver to use virReportError instead of the interfaceReportError custom macro
This commit is contained in:
parent
fa7ebc174f
commit
4423f3bece
1
cfg.mk
1
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 += interfaceReportError
|
|
||||||
msg_gen_function += lxcError
|
msg_gen_function += lxcError
|
||||||
msg_gen_function += libxlError
|
msg_gen_function += libxlError
|
||||||
msg_gen_function += networkReportError
|
msg_gen_function += networkReportError
|
||||||
|
@ -33,10 +33,6 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_INTERFACE
|
#define VIR_FROM_THIS VIR_FROM_INTERFACE
|
||||||
|
|
||||||
#define interfaceReportError(code, ...) \
|
|
||||||
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
|
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
|
||||||
|
|
||||||
/* Main driver state */
|
/* Main driver state */
|
||||||
struct interface_driver
|
struct interface_driver
|
||||||
{
|
{
|
||||||
@ -106,14 +102,14 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf, virInterfac
|
|||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(ncf, &errmsg, &details);
|
int errcode = ncf_error(ncf, &errmsg, &details);
|
||||||
if (errcode != NETCF_NOERROR) {
|
if (errcode != NETCF_NOERROR) {
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("couldn't find interface named '%s': %s%s%s"),
|
_("couldn't find interface named '%s': %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? " - " : "",
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
} else {
|
} else {
|
||||||
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
virReportError(VIR_ERR_NO_INTERFACE,
|
||||||
_("couldn't find interface named '%s'"),
|
_("couldn't find interface named '%s'"),
|
||||||
ifinfo->name);
|
ifinfo->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return iface;
|
return iface;
|
||||||
@ -190,9 +186,9 @@ static int interfaceNumOfInterfaces(virConnectPtr conn)
|
|||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to get number of interfaces on host: %s%s%s"),
|
_("failed to get number of interfaces on host: %s%s%s"),
|
||||||
errmsg, details ? " - " : "", details ? details : "");
|
errmsg, details ? " - " : "", details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -210,10 +206,10 @@ static int interfaceListInterfaces(virConnectPtr conn, char **const names, int n
|
|||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to list host interfaces: %s%s%s"),
|
_("failed to list host interfaces: %s%s%s"),
|
||||||
errmsg, details ? " - " : "",
|
errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -231,10 +227,10 @@ static int interfaceNumOfDefinedInterfaces(virConnectPtr conn)
|
|||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to get number of defined interfaces on host: %s%s%s"),
|
_("failed to get number of defined interfaces on host: %s%s%s"),
|
||||||
errmsg, details ? " - " : "",
|
errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -252,10 +248,10 @@ static int interfaceListDefinedInterfaces(virConnectPtr conn, char **const names
|
|||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to list host defined interfaces: %s%s%s"),
|
_("failed to list host defined interfaces: %s%s%s"),
|
||||||
errmsg, details ? " - " : "",
|
errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -276,13 +272,13 @@ static virInterfacePtr interfaceLookupByName(virConnectPtr conn,
|
|||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
if (errcode != NETCF_NOERROR) {
|
if (errcode != NETCF_NOERROR) {
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("couldn't find interface named '%s': %s%s%s"),
|
_("couldn't find interface named '%s': %s%s%s"),
|
||||||
name, errmsg,
|
name, errmsg,
|
||||||
details ? " - " : "", details ? details : "");
|
details ? " - " : "", details ? details : "");
|
||||||
} else {
|
} else {
|
||||||
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
virReportError(VIR_ERR_NO_INTERFACE,
|
||||||
_("couldn't find interface named '%s'"), name);
|
_("couldn't find interface named '%s'"), name);
|
||||||
}
|
}
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -309,21 +305,21 @@ static virInterfacePtr interfaceLookupByMACString(virConnectPtr conn,
|
|||||||
if (niface < 0) {
|
if (niface < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("couldn't find interface with MAC address '%s': %s%s%s"),
|
_("couldn't find interface with MAC address '%s': %s%s%s"),
|
||||||
macstr, errmsg, details ? " - " : "",
|
macstr, errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (niface == 0) {
|
if (niface == 0) {
|
||||||
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
virReportError(VIR_ERR_NO_INTERFACE,
|
||||||
_("couldn't find interface with MAC address '%s'"),
|
_("couldn't find interface with MAC address '%s'"),
|
||||||
macstr);
|
macstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (niface > 1) {
|
if (niface > 1) {
|
||||||
interfaceReportError(VIR_ERR_MULTIPLE_INTERFACES,
|
virReportError(VIR_ERR_MULTIPLE_INTERFACES,
|
||||||
"%s", _("multiple interfaces with matching MAC address"));
|
"%s", _("multiple interfaces with matching MAC address"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,10 +358,10 @@ static char *interfaceGetXMLDesc(virInterfacePtr ifinfo,
|
|||||||
if (!xmlstr) {
|
if (!xmlstr) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("could not get interface XML description: %s%s%s"),
|
_("could not get interface XML description: %s%s%s"),
|
||||||
errmsg, details ? " - " : "",
|
errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,10 +415,10 @@ static virInterfacePtr interfaceDefineXML(virConnectPtr conn,
|
|||||||
if (!iface) {
|
if (!iface) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("could not get interface XML description: %s%s%s"),
|
_("could not get interface XML description: %s%s%s"),
|
||||||
errmsg, details ? " - " : "",
|
errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,10 +449,10 @@ static int interfaceUndefine(virInterfacePtr ifinfo) {
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to undefine interface %s: %s%s%s"),
|
_("failed to undefine interface %s: %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? " - " : "",
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,10 +483,10 @@ static int interfaceCreate(virInterfacePtr ifinfo,
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to create (start) interface %s: %s%s%s"),
|
_("failed to create (start) interface %s: %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? " - " : "",
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,10 +517,10 @@ static int interfaceDestroy(virInterfacePtr ifinfo,
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to destroy (stop) interface %s: %s%s%s"),
|
_("failed to destroy (stop) interface %s: %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? " - " : "",
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,10 +548,10 @@ static int interfaceIsActive(virInterfacePtr ifinfo)
|
|||||||
if (ncf_if_status(iface, &flags) < 0) {
|
if (ncf_if_status(iface, &flags) < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to get status of interface %s: %s%s%s"),
|
_("failed to get status of interface %s: %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? " - " : "",
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,10 +577,10 @@ static int interfaceChangeBegin(virConnectPtr conn, unsigned int flags)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to begin transaction: %s%s%s"),
|
_("failed to begin transaction: %s%s%s"),
|
||||||
errmsg, details ? " - " : "",
|
errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -604,10 +600,10 @@ static int interfaceChangeCommit(virConnectPtr conn, unsigned int flags)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to commit transaction: %s%s%s"),
|
_("failed to commit transaction: %s%s%s"),
|
||||||
errmsg, details ? " - " : "",
|
errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -627,10 +623,10 @@ static int interfaceChangeRollback(virConnectPtr conn, unsigned int flags)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
const char *errmsg, *details;
|
const char *errmsg, *details;
|
||||||
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
int errcode = ncf_error(driver->netcf, &errmsg, &details);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
virReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to rollback transaction: %s%s%s"),
|
_("failed to rollback transaction: %s%s%s"),
|
||||||
errmsg, details ? " - " : "",
|
errmsg, details ? " - " : "",
|
||||||
details ? details : "");
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
|
Loading…
Reference in New Issue
Block a user