[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 06/24] maint: reset error on entrance to public API



On 01/02/2014 12:11 PM, John Ferlan wrote:
> 
> 
> On 12/28/2013 11:11 AM, Eric Blake wrote:
>> We document that calling any public API wipes out all prior
>> libvirt errors in the same thread; but weren't obeying this
>> style in a few functions.
>>
>> * src/libvirt.c (virGetVersion, virConnectRef, virDomainRef)
>> (virDomainGetSecurityLabel, virDomainGetSecurityLabelList)
>> (virDomainSetMetadata, virDomainGetMetadata)
>> (virNodeGetSecurityModel, virNetworkRef, virInterfaceRef)
>> (virStoragePoolRef, virStorageVolRef, virNodeDeviceGetName)
>> (virNodeDeviceRef, virSecretRef, virStreamRef, virNWFilterRef)
>> (virDomainSnapshotRef): Reset error on entrance.
>> (do_open): Drop redundant error reset.
>> * src/libvirt-qemu.c (virDomainQemuAgentCommand): Likewise.
>> * src/libvirt-lxc.c (virDomainLxcEnterNamespace)
>> (virDomainLxcEnterSecurityLabel): Likewise.
>>
>> Signed-off-by: Eric Blake <eblake redhat com>
>> ---
>>  src/libvirt-lxc.c  |  4 ++++
>>  src/libvirt-qemu.c |  4 ++++
>>  src/libvirt.c      | 37 +++++++++++++++++++++++++++++++++++--
>>  3 files changed, 43 insertions(+), 2 deletions(-)
>>
> 
> ACK
> 
> just making sure - is there any side effect to calls to virConnectRef()
> being called through the lxc reboot or qemu reconnect paths?

Wow, I didn't even think to grep for those.  And you are right - those
are cases of nested public API calls (which we want to avoid where
possible); they should ideally be using virObjectRef() instead of the
public call (it still doesn't help our nested use of virConnectOpen() in
those same functions, but fixing that is a bigger task that would need a
separate patch, if we decide it is needed).  For this particular patch,
there is no change in behavior (we only attempt the virConnectOpen() if
we have been successful to that point, so resetting errors has no
impact), so I pushed it as is, after tweaking the commit message to
mention this discussion.  But I'll add a followup patch to my v2 series
that tries to clean up this and other nested of
virConnectRef/virConnectClose to instead use virObjectRef/virObjectUnref.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]