
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@redhat.com> --- 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