Re: [PATCH 15/19] storage: Introduce virStoragePoolObjForEachVolume

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

 




On 05/19/2017 06:46 AM, Peter Krempa wrote:
> On Tue, May 09, 2017 at 11:30:22 -0400, John Ferlan wrote:
>> Create/Use API to "walk" the storage pool object volume list.
>>
>> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
>> ---
>>  src/conf/virstorageobj.c           | 10 ++++++++++
>>  src/conf/virstorageobj.h           |  4 ++++
>>  src/libvirt_private.syms           |  1 +
>>  src/storage/storage_backend_disk.c | 26 +++++++++++++++-----------
>>  4 files changed, 30 insertions(+), 11 deletions(-)
>>
>> diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
>> index cc3464e..14feecb 100644
>> --- a/src/conf/virstorageobj.c
>> +++ b/src/conf/virstorageobj.c
>> @@ -343,6 +343,16 @@ virStoragePoolObjGetVolumesCount(virStoragePoolObjPtr obj)
>>  
>>  
>>  virStorageVolDefPtr
>> +virStoragePoolObjForEachVolume(virStoragePoolObjPtr obj,
>> +                               size_t curidx)
> 
> All 'foreach' functions in libvirt take a callback and iterate the
> objects calling the callback. This is just a generic accessor. Naming it
> foreach is very confusing.
> 

Sure eventually that's where things are going, but if I still have to
get from point A to point D or E or F...

I was trying to find a "cheap" way (for now) to not have the
volumes.count in the storage backend and only in the virstorageobj.

Eventually (point E, F, G) this becomes a "search" (e.g. virHashSearch)
looking for a specific truism.

I can make this better though to not offend the expectations of existing
ForEach functions.

John

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux