Re: [libvirt] [PATCH 28/30] remote: Replace some virRaiseError with remoteError

2010-04-08 Thread Matthias Bolte
2010/4/5 Eric Blake :
> On 04/04/2010 11:36 AM, Matthias Bolte wrote:
>> ---
>>  src/remote/remote_driver.c |   29 -
>>  1 files changed, 12 insertions(+), 17 deletions(-)
>>
>> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
>> index 19a4c03..16ffe21 100644
>> --- a/src/remote/remote_driver.c
>> +++ b/src/remote/remote_driver.c
>> @@ -6583,11 +6583,9 @@ static char *addrToString(struct sockaddr_storage 
>> *sa, socklen_t salen)
>>                             host, sizeof(host),
>>                             port, sizeof(port),
>>                             NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
>> -        virRaiseError (VIR_FROM_REMOTE,
>> -                       VIR_ERR_UNKNOWN_HOST, VIR_ERR_ERROR,
>> -                       NULL, NULL, NULL, 0, 0,
>> -                       _("Cannot resolve address %d: %s"),
>> -                       err, gai_strerror(err));
>> +        remoteError(VIR_ERR_UNKNOWN_HOST,
>> +                    _("Cannot resolve address %d: %s"),
>> +                    err, gai_strerror(err));
>
> Unrelated to your patch, but it seems like %d err is less than helpful
> here, particularly given that we immediately translate it into a string
> with gai_strerror(err).  More useful would be "Cannot resolve address
> %s: %s", some_conversion_to_string(host, port), to let the user know
> what address could not be translated.
>
> At any rate, ACK to this patch.
>

Thanks, pushed.

Matthias

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 28/30] remote: Replace some virRaiseError with remoteError

2010-04-05 Thread Eric Blake
On 04/04/2010 11:36 AM, Matthias Bolte wrote:
> ---
>  src/remote/remote_driver.c |   29 -
>  1 files changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 19a4c03..16ffe21 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -6583,11 +6583,9 @@ static char *addrToString(struct sockaddr_storage *sa, 
> socklen_t salen)
> host, sizeof(host),
> port, sizeof(port),
> NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
> -virRaiseError (VIR_FROM_REMOTE,
> -   VIR_ERR_UNKNOWN_HOST, VIR_ERR_ERROR,
> -   NULL, NULL, NULL, 0, 0,
> -   _("Cannot resolve address %d: %s"),
> -   err, gai_strerror(err));
> +remoteError(VIR_ERR_UNKNOWN_HOST,
> +_("Cannot resolve address %d: %s"),
> +err, gai_strerror(err));

Unrelated to your patch, but it seems like %d err is less than helpful
here, particularly given that we immediately translate it into a string
with gai_strerror(err).  More useful would be "Cannot resolve address
%s: %s", some_conversion_to_string(host, port), to let the user know
what address could not be translated.

At any rate, ACK to this patch.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 28/30] remote: Replace some virRaiseError with remoteError

2010-04-04 Thread Matthias Bolte
---
 src/remote/remote_driver.c |   29 -
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 19a4c03..16ffe21 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6583,11 +6583,9 @@ static char *addrToString(struct sockaddr_storage *sa, 
socklen_t salen)
host, sizeof(host),
port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
-virRaiseError (VIR_FROM_REMOTE,
-   VIR_ERR_UNKNOWN_HOST, VIR_ERR_ERROR,
-   NULL, NULL, NULL, 0, 0,
-   _("Cannot resolve address %d: %s"),
-   err, gai_strerror(err));
+remoteError(VIR_ERR_UNKNOWN_HOST,
+_("Cannot resolve address %d: %s"),
+err, gai_strerror(err));
 return NULL;
 }
 
@@ -8882,10 +8880,9 @@ processCallDispatch(virConnectPtr conn, struct 
private_data *priv,
 break;
 
 default:
- virRaiseError (VIR_FROM_REMOTE,
-VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-_("got unexpected RPC call %d from server"),
-hdr.proc);
+remoteError(VIR_ERR_RPC,
+_("got unexpected RPC call %d from server"),
+hdr.proc);
 rv = -1;
 break;
 }
@@ -8911,18 +8908,16 @@ processCallDispatchReply(virConnectPtr conn 
ATTRIBUTE_UNUSED,
 thecall = thecall->next;
 
 if (!thecall) {
-virRaiseError (VIR_FROM_REMOTE,
-   VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-   _("no call waiting for reply with serial %d"),
-   hdr->serial);
+remoteError(VIR_ERR_RPC,
+_("no call waiting for reply with serial %d"),
+hdr->serial);
 return -1;
 }
 
 if (hdr->proc != thecall->proc_nr) {
-virRaiseError (VIR_FROM_REMOTE,
-   VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-   _("unknown procedure (received %x, expected %x)"),
-   hdr->proc, thecall->proc_nr);
+remoteError(VIR_ERR_RPC,
+_("unknown procedure (received %x, expected %x)"),
+hdr->proc, thecall->proc_nr);
 return -1;
 }
 
-- 
1.6.3.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list