[libvirt] [PATCH] Improve error reporting for virConnectGetHostname calls

Cole Robinson crobinso at redhat.com
Wed Oct 28 14:47:27 UTC 2009


On 10/28/2009 10:44 AM, Daniel P. Berrange wrote:
> On Wed, Oct 28, 2009 at 03:32:32PM +0100, Chris Lalancette wrote:
>> Cole Robinson wrote:
>>
>>>  
>>>  static int umlListDomains(virConnectPtr conn, int *ids, int nids) {
>>> diff --git a/src/util/util.c b/src/util/util.c
>>> index 98f8a14..49eac6d 100644
>>> --- a/src/util/util.c
>>> +++ b/src/util/util.c
>>> @@ -1804,30 +1804,42 @@ int virDiskNameToIndex(const char *name) {
>>>  #define AI_CANONIDN 0
>>>  #endif
>>>  
>>> -char *virGetHostname(void)
>>> +char *virGetHostname(virConnectPtr conn)
>>
>> To be honest, I'm not sure we even need to add the "conn" parameter here.  I
>> seem to remember DanB saying that it was only needed in very few circumstances
>> anymore.  Can't we just call "virReportSystemError(NULL)", etc?  That keeps this
>> function signature a bit simpler.  (It's not a deal-breaker in any case, just
>> nice to not have to require this parameter)
> 
> That's correct, we should avoid  adding virConnectPtr to any new /existing
> internal APIs where-ever  possible. The only real exception is if the
> internal function needs to invoke one of the other public driver APis
> directly.
> 

Ahh, I wasn't aware. I'll respin the patch with Chris' recommendations.

- Cole




More information about the libvir-list mailing list