[libvirt] [PATCH v2 6/9] admin: Add URI support and introduce virAdmGetDefaultURI

Erik Skultety eskultet at redhat.com
Thu Nov 5 07:16:58 UTC 2015



On 05/11/15 00:11, John Ferlan wrote:
> 
> 
> On 10/16/2015 02:12 PM, Erik Skultety wrote:
>> Since virt-admin should be able to connect to various admin servers
>> on hosted different daemons, we need to provide URI support to
>> libvirt-admin.
>> ---
>>  include/libvirt/libvirt-admin.h |   2 +
>>  src/datatypes.c                 |   2 +
>>  src/datatypes.h                 |   1 +
>>  src/libvirt-admin.c             | 132 +++++++++++++++++++++++++++++++---------
>>  src/libvirt_admin_public.syms   |   1 +
>>  tools/virt-admin.c              |  39 ++++++++++++
>>  6 files changed, 147 insertions(+), 30 deletions(-)
>>
> 
> Ran the series through the Coverity checks...
> 
> [...]
> 
>>  /**
>>   * virAdmConnectOpen:
>>   * @name: uri of the daemon to connect to, NULL for default
>> @@ -170,6 +199,7 @@ virAdmConnectOpen(const char *name, unsigned int flags)
>>  {
>>      char *sock_path = NULL;
>>      virAdmConnectPtr conn = NULL;
>> +    virConfPtr conf = NULL;
>>  
>>      if (virAdmInitialize() < 0)
>>          goto error;
>> @@ -180,7 +210,18 @@ virAdmConnectOpen(const char *name, unsigned int flags)
>>      if (!(conn = virAdmConnectNew()))
>>          goto error;
>>  
>> -    if (!(sock_path = getSocketPath(name)))
>> +    if (virGetLibvirtConfigFile(&conf) < 0)
>> +        goto error;
>> +
> 
> conf is allocated now and will need to be free'd/cleaned appropriately
> via virConfFree() @ error:
> 
> John

Luckily, I figured that out when I was playing with URI aliases support
(coming in v3), but still, thank you very much for noticing :).

Erik




More information about the libvir-list mailing list