On 02/19/13 15:58, Dave Allan wrote:
On Tue, Feb 19, 2013 at 11:26:34AM +0100, Michal Privoznik wrote:
> On 19.02.2013 03:14, John Ferlan wrote:
>> Add a list of active domains, list of active/inactive networks, and
>> list of active/inactive storage pools
>> ---
>> examples/hellolibvirt/hellolibvirt.c | 201 ++++++++++++++++++++++++++++++-----
>> 1 file changed, 173 insertions(+), 28 deletions(-)
>>
>
> I wonder if we should advise users to use the other list APIs that are
> around for a while (virConnectListAll. I guess it all boils down to
> question if the hellolibvirt binary is supposed to work with ancient
> libvirts or is just an example shipped within a release.
> In case it is supposed to work with prehistoric versions, we must add a
> fallback code. If we are satisfied with the example working with current
> libvirt, there's no need for fallbacking code then.
I originally wrote hellolibvirt because at the time (prehistoric
versions!) there was no good example of a trivial use of the library.
I think it's not a bad idea to keep it updated with modern code since
I'm guessing anybody looking at it probably intends to develop against
the version from which they got it. I think it should illustrate the
most basic use of the API, so it should demonstrate best practices for
the functionality it implements, in this case, use the new API that
lists all domains rather than the two older calls and don't bother
with the fallback case.
I agree.
Additionally for the fallback case there's "example" code in the virsh
source tree.
Dave