mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
interface: reformat error logs
It was suggested during review of a different patch that the libvirt interface driver API's should have "netcf:" in their log messages. This patch eliminates that from all interface driver API functions, and also eliminates the extra " - " in the case that netcf returns no details in its error info (which *never* happens at present, but could happen sometime in the future.
This commit is contained in:
parent
88c5b97f7c
commit
ecbe86c0c5
@ -107,8 +107,9 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf, virInterfac
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("couldn't find interface named '%s' (netcf: %s - %s)"),
|
_("couldn't find interface named '%s': %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
} else {
|
} else {
|
||||||
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
||||||
_("couldn't find interface named '%s'"),
|
_("couldn't find interface named '%s'"),
|
||||||
@ -188,8 +189,8 @@ static int interfaceNumOfInterfaces(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);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to get number of interfaces on host (netcf: %s - %s)"),
|
_("failed to get number of interfaces on host: %s%s%s"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? " - " : "", details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -208,8 +209,9 @@ static int interfaceListInterfaces(virConnectPtr conn, char **const names, int n
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to list host interfaces (netcf: %s - %s)"),
|
_("failed to list host interfaces: %s%s%s"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -228,8 +230,9 @@ static int interfaceNumOfDefinedInterfaces(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);
|
||||||
interfaceReportError(netcf_to_vir_err(errcode),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to get number of defined interfaces on host (netcf: %s - %s)"),
|
_("failed to get number of defined interfaces on host: %s%s%s"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -248,8 +251,9 @@ static int interfaceListDefinedInterfaces(virConnectPtr conn, char **const names
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to list host defined interfaces (netcf: %s - %s)"),
|
_("failed to list host defined interfaces: %s%s%s"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -271,8 +275,9 @@ static virInterfacePtr interfaceLookupByName(virConnectPtr conn,
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("couldn't find interface named '%s' (netcf: %s - %s)"),
|
_("couldn't find interface named '%s': %s%s%s"),
|
||||||
name, errmsg, details ? details : "");
|
name, errmsg,
|
||||||
|
details ? " - " : "", details ? details : "");
|
||||||
} else {
|
} else {
|
||||||
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
interfaceReportError(VIR_ERR_NO_INTERFACE,
|
||||||
_("couldn't find interface named '%s'"), name);
|
_("couldn't find interface named '%s'"), name);
|
||||||
@ -303,8 +308,9 @@ static virInterfacePtr interfaceLookupByMACString(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);
|
||||||
interfaceReportError(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': %s%s%s"),
|
||||||
macstr, errmsg, details ? details : "");
|
macstr, errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (niface == 0) {
|
if (niface == 0) {
|
||||||
@ -353,8 +359,9 @@ static char *interfaceGetXMLDesc(virInterfacePtr ifinfo,
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("could not get interface XML description (netcf: %s - %s)"),
|
_("could not get interface XML description: %s%s%s"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,8 +414,9 @@ static virInterfacePtr interfaceDefineXML(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);
|
||||||
interfaceReportError(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: %s%s%s"),
|
||||||
errmsg, details ? details : "");
|
errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,8 +448,9 @@ static int interfaceUndefine(virInterfacePtr ifinfo) {
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to undefine interface %s (netcf: %s - %s)"),
|
_("failed to undefine interface %s: %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,8 +480,9 @@ static int interfaceCreate(virInterfacePtr ifinfo,
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to create (start) interface %s (netcf: %s - %s)"),
|
_("failed to create (start) interface %s: %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,8 +512,9 @@ static int interfaceDestroy(virInterfacePtr ifinfo,
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to destroy (stop) interface %s (netcf: %s - %s)"),
|
_("failed to destroy (stop) interface %s: %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,8 +543,9 @@ static int interfaceIsActive(virInterfacePtr ifinfo)
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to get status of interface %s (netcf: %s - %s)"),
|
_("failed to get status of interface %s: %s%s%s"),
|
||||||
ifinfo->name, errmsg, details ? details : "");
|
ifinfo->name, errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,8 +572,9 @@ static int interfaceChangeBegin(virConnectPtr conn, unsigned int flags)
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to begin transaction: %s%s%s)"),
|
_("failed to begin transaction: %s%s%s"),
|
||||||
errmsg, details ? " - " : "", details ? details : "");
|
errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -582,8 +595,9 @@ static int interfaceChangeCommit(virConnectPtr conn, unsigned int flags)
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to commit transaction: %s%s%s)"),
|
_("failed to commit transaction: %s%s%s"),
|
||||||
errmsg, details ? " - " : "", details ? details : "");
|
errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
@ -604,8 +618,9 @@ static int interfaceChangeRollback(virConnectPtr conn, unsigned int flags)
|
|||||||
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),
|
interfaceReportError(netcf_to_vir_err(errcode),
|
||||||
_("failed to rollback transaction: %s%s%s)"),
|
_("failed to rollback transaction: %s%s%s"),
|
||||||
errmsg, details ? " - " : "", details ? details : "");
|
errmsg, details ? " - " : "",
|
||||||
|
details ? details : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaceDriverUnlock(driver);
|
interfaceDriverUnlock(driver);
|
||||||
|
Loading…
Reference in New Issue
Block a user