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

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



于 2011年02月21日 10:50, Lyre 写道:
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.


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?

Not sure if I get the meaning correctly, and also not sure what
the exact meaning of "active" and "inactive" are in libvirt-php,
but I guess:

1)
"active" and "inactive" are about the domain state.

2)
"defined" is about if it the domain has persistent config file on disk.

So, if guessing 1) is right:

A "defined" domain can be in either of "active" and "inactive" state;
And an "active" domain can be "defined" or "not defined", and it's
the same for "inactive" domain.

Any conflict?

Regards
Osier


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