mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
netcf: Remove virConnectPtr from interfaceReportError
This commit is contained in:
parent
7ece483dce
commit
8bd8bcaca8
@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_INTERFACE
|
#define VIR_FROM_THIS VIR_FROM_INTERFACE
|
||||||
|
|
||||||
#define interfaceReportError(conn, dom, net, code, ...) \
|
#define interfaceReportError(code, ...) \
|
||||||
virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \
|
virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||||
|
|
||||||
/* Main driver state */
|
/* Main driver state */
|
||||||
@ -101,11 +101,11 @@ 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(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"couldn't find interface named '%s' (netcf: %s - %s)",
|
"couldn't find interface named '%s' (netcf: %s - %s)",
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? details : "");
|
||||||
} else {
|
} else {
|
||||||
interfaceReportError(ifinfo->conn, NULL, ifinfo, VIR_ERR_NO_INTERFACE,
|
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
||||||
"couldn't find interface named '%s'", ifinfo->name);
|
"couldn't find interface named '%s'", ifinfo->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ 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(conn, NULL, NULL, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"%s (netcf: %s - %s)",
|
"%s (netcf: %s - %s)",
|
||||||
_("failed to get number of interfaces on host"),
|
_("failed to get number of interfaces on host"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? details : "");
|
||||||
@ -202,7 +202,7 @@ 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(conn, NULL, NULL, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"%s (netcf: %s - %s)",
|
"%s (netcf: %s - %s)",
|
||||||
_("failed to list host interfaces"),
|
_("failed to list host interfaces"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? details : "");
|
||||||
@ -223,7 +223,7 @@ 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(conn, NULL, NULL, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"%s (netcf: %s - %s)",
|
"%s (netcf: %s - %s)",
|
||||||
_("failed to get number of defined interfaces on host"),
|
_("failed to get number of defined interfaces on host"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? details : "");
|
||||||
@ -244,7 +244,7 @@ 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(conn, NULL, NULL, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"%s (netcf: %s - %s)",
|
"%s (netcf: %s - %s)",
|
||||||
_("failed to list host defined interfaces"),
|
_("failed to list host defined interfaces"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? details : "");
|
||||||
@ -268,11 +268,11 @@ 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(conn, NULL, NULL, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"couldn't find interface named '%s' (netcf: %s - %s)",
|
"couldn't find interface named '%s' (netcf: %s - %s)",
|
||||||
name, errmsg, details ? details : "");
|
name, errmsg, details ? details : "");
|
||||||
} else {
|
} else {
|
||||||
interfaceReportError(conn, NULL, NULL, VIR_ERR_NO_INTERFACE,
|
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
||||||
"couldn't find interface named '%s'", name);
|
"couldn't find interface named '%s'", name);
|
||||||
}
|
}
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -300,19 +300,19 @@ 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(conn, NULL, NULL, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"couldn't find interface with MAC address '%s' (netcf: %s - %s)",
|
"couldn't find interface with MAC address '%s' (netcf: %s - %s)",
|
||||||
macstr, errmsg, details ? details : "");
|
macstr, errmsg, details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (niface == 0) {
|
if (niface == 0) {
|
||||||
interfaceReportError(conn, NULL, NULL, VIR_ERR_NO_INTERFACE,
|
interfaceReportError(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(conn, NULL, NULL, VIR_ERR_MULTIPLE_INTERFACES,
|
interfaceReportError(VIR_ERR_MULTIPLE_INTERFACES,
|
||||||
"%s", _("multiple interfaces with matching MAC address"));
|
"%s", _("multiple interfaces with matching MAC address"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -350,7 +350,7 @@ 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(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"could not get interface XML description (netcf: %s - %s)",
|
"could not get interface XML description (netcf: %s - %s)",
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -404,7 +404,7 @@ 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(conn, NULL, NULL, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"could not get interface XML description (netcf: %s - %s)",
|
"could not get interface XML description (netcf: %s - %s)",
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -437,7 +437,7 @@ 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(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"failed to undefine interface %s (netcf: %s - %s)",
|
"failed to undefine interface %s (netcf: %s - %s)",
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -468,7 +468,7 @@ 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(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"failed to create (start) interface %s (netcf: %s - %s)",
|
"failed to create (start) interface %s (netcf: %s - %s)",
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -499,7 +499,7 @@ 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(ifinfo->conn, NULL, ifinfo, netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
"failed to destroy (stop) interface %s (netcf: %s - %s)",
|
"failed to destroy (stop) interface %s (netcf: %s - %s)",
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user