[Libvirt-cim] [PATCH V4] DevicePool, reimplement get_diskpool_config with libvirt

John Ferlan jferlan at redhat.com
Mon Mar 11 20:24:01 UTC 2013


Since I don't have an email to reply-to, here is the link:

https://www.redhat.com/archives/libvirt-cim/2012-December/msg00039.html



In get_diskpool_config():

* Rather than use the "racy" NumOfStoragePools and ListStoragePools, why
not use virConnectListAllStoragePools() passing the "Active" flag for
all active pools only?

* You may even want to consider keeping the returned virStoragePoolPtr
structures around..



I also imagine the other objects (networks and domains) could use the
similar calls. I guess the answer somewhat depends on what is the
minimum version of libvirt that needs to be supported.

But if you "have" to stay with the current model...

* The return 'names[i]' is something you'd have to free() anyway, so
rather than strdup(names[i]), just take it when setting pools[i].tag and
set names[i] = NULL;  That avoids an error path.



John






More information about the Libvirt-cim mailing list