[libvirt] [PATCH] Bug 1086726: Reworked error messages in libvirt.c, libvirt-domain.c removing uses of __FUNCTION__, except one

--- src/libvirt-domain.c | 13 +++++++------ src/libvirt.c | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index f1608dc..4a45b9e 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -2613,7 +2613,7 @@ virDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) if ((conn->flags & VIR_CONNECT_RO) && (flags & (VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_MIGRATABLE))) { virReportError(VIR_ERR_OPERATION_DENIED, "%s", - _("virDomainGetXMLDesc with secure flag")); + _("Invalid secure flag for XML domain description")); goto error; } @@ -2793,7 +2793,7 @@ virDomainMigrateVersion1(virDomainPtr domain, if (uri == NULL && uri_out == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domainMigratePrepare did not set uri")); + _("unset uri for domain migration preparation")); goto done; } if (uri_out) @@ -2916,7 +2916,7 @@ virDomainMigrateVersion2(virDomainPtr domain, if (uri == NULL && uri_out == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domainMigratePrepare2 did not set uri")); + _("unset uri for domain migration preparation2")); cancelled = 1; /* Make sure Finish doesn't overwrite the error */ orig_err = virSaveLastError(); @@ -3124,7 +3124,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain, virTypedParamsGetString(params, nparams, VIR_MIGRATE_PARAM_URI, &uri) <= 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domainMigratePrepare3 did not set uri")); + _("unset uri for domain migration preparation3")); cancelled = 1; orig_err = virSaveLastError(); goto finish; @@ -11285,7 +11285,7 @@ virDomainListGetStats(virDomainPtr *doms, if (!*doms) { virReportError(VIR_ERR_INVALID_ARG, - _("doms array in %s must contain at least one domain"), + _("doms array must contain at least one domain in %s"), __FUNCTION__); goto cleanup; } @@ -11503,7 +11503,8 @@ virDomainInterfaceAddresses(virDomainPtr dom, return ret; } - virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("No interface address support for domain object")); error: virDispatchError(dom->conn); diff --git a/src/libvirt.c b/src/libvirt.c index c8a5834..0109734 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -558,7 +558,7 @@ virSetSharedInterfaceDriver(virInterfaceDriverPtr driver) if (virSharedInterfaceDriver) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("A interface driver is already registered")); + _("An interface driver is already registered")); return -1; } @@ -1211,7 +1211,7 @@ do_open(const char *name, if (!ret->driver) { /* If we reach here, then all drivers declined the connection. */ - virReportError(VIR_ERR_NO_CONNECT, "%s", NULLSTR(name)); + virReportError(VIR_ERR_NO_CONNECT, "%s", _("All device drivers decline connection")); goto failed; } -- 2.1.0

On 01.04.2015 12:13, Noella Ashu wrote:
We tend to do different formatting of commit messages. If you do 'git log' you'll immediately get a picture.
--- src/libvirt-domain.c | 13 +++++++------ src/libvirt.c | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index f1608dc..4a45b9e 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -2613,7 +2613,7 @@ virDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) if ((conn->flags & VIR_CONNECT_RO) && (flags & (VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_MIGRATABLE))) { virReportError(VIR_ERR_OPERATION_DENIED, "%s", - _("virDomainGetXMLDesc with secure flag")); + _("Invalid secure flag for XML domain description"));
This actually was a correct message: virsh > dumpxml --security-info $dom error: operation forbidden: virDomainGetXMLDesc with secure flag The idea of the bug report is to do something like this: diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 4a45b9e..c39590d 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -385,9 +385,7 @@ virDomainLookupByUUIDString(virConnectPtr conn, const char *uuidstr) virCheckNonNullArgGoto(uuidstr, error); if (virUUIDParse(uuidstr, uuid) < 0) { - virReportInvalidArg(uuidstr, - _("uuidstr in %s must be a valid UUID"), - __FUNCTION__); + virReportInvalidArg(uuidstr, "%s", _("invalid UUID")); goto error; } @@ -2180,9 +2178,8 @@ virDomainGetMemoryParameters(virDomainPtr domain, if ((flags & VIR_DOMAIN_AFFECT_LIVE) && (flags & VIR_DOMAIN_AFFECT_CONFIG)) { virReportInvalidArg(flags, - _("flags 'affect live' and 'affect config' in %s " - "are mutually exclusive"), - __FUNCTION__); + _("flags 'affect live' and 'affect config' " + "are mutually exclusive")); goto error; } conn = domain->conn; And so on. Michal

Hello,
We tend to do different formatting of commit messages. If you do 'git log' you'll immediately get a picture.
I see, forgot to check the previous commits first before doing mine. My bad, will do better next time.
The idea of the bug report is to do something like this:
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 4a45b9e..c39590d 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -385,9 +385,7 @@ virDomainLookupByUUIDString(virConnectPtr conn, const char *uuidstr) virCheckNonNullArgGoto(uuidstr, error);
if (virUUIDParse(uuidstr, uuid) < 0) { - virReportInvalidArg(uuidstr, - _("uuidstr in %s must be a valid UUID"), - __FUNCTION__); + virReportInvalidArg(uuidstr, "%s", _("invalid UUID")); goto error; }
@@ -2180,9 +2178,8 @@ virDomainGetMemoryParameters(virDomainPtr domain, if ((flags & VIR_DOMAIN_AFFECT_LIVE) && (flags & VIR_DOMAIN_AFFECT_CONFIG)) { virReportInvalidArg(flags, - _("flags 'affect live' and 'affect config' in %s " - "are mutually exclusive"), - __FUNCTION__); + _("flags 'affect live' and 'affect config' " + "are mutually exclusive")); goto error; } conn = domain->con
I see. I'll get it then, and re-send. Thanks, And so on. Noella
participants (2)
-
Michal Privoznik
-
Noella Ashu