[libvirt] [libvirt-php] About the inconsistency in libvirt-php

Michal Novotny minovotn at redhat.com
Mon Feb 21 13:32:33 UTC 2011


On 02/21/2011 03:50 AM, Lyre wrote:
> Hi all:
>
> I noticed that there's some inconsistent behaviors in libvirt-php, and 
> wondering what's the best way to handle them.
>
> In libvirt-php:
>
> libvirt_list_domains() returns an array of all domain resource;
> libvirt_list_active_domains() returns an array of running domain ids;
> libvirt_list_defined_domains() returns an array of defined domain names.
>
> and
>
> libvirt_list_storagepools() returns an array of actived storagepool names.
>
> In my opinion, returning an array of names would be better when 
> listing all kinds of objects.
>


Well, good point Lyre. I guess we should be change it to something like:

libvirt_list_domains() - return domain pointers for all domains
libvirt_list_active_domains() - return pointers for active domains
libvirt_list_defined_domains() - return pointers for inactive domains, 
also we should consider renaming it to list_inactive_domains()

Also, I guess we should add a new function:

libvirt_list_domain_names() - return names of all domains (both active 
and inactive)

This should be applied to everything - networks, storage pools etc...


>
> And the naming convenances, let's take domains as an example.
>
> libvirt-php provied
> libvirt_list_domains() for all domains, which has no corresponding 
> function in libvirt.
> libvirt_list_active_domains() for running domains, corresponding to 
> virConnectListDomains()  in libvirt.
> libvirt_list_defined_domains() for defined domains, corresponding to 
> virConnectListDefinedDomains()  in libvirt.
>
>
> I believe it is fine. However, for defined objects, sometimes it used 
> term "defined" (libvirt_list_defined_domains),
> and sometimes use term "inactive" (libvirt_get_inactive_domain_count)  
> in contrast to "active". Which would be better?


For this one I guess we should use naming like "all", "active" and 
"inactive".

Michal

-- 
Michal Novotny<minovotn at redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat




More information about the libvir-list mailing list