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

Lyre 4179e1 at gmail.com
Mon Feb 21 05:44:37 UTC 2011


On Mon, Feb 21, 2011 at 1:23 PM, Osier Yang <jyang at redhat.com> wrote:

> 于 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
>

What about the "actived" & "defined" in libvirt?

As far as I know, virConnectListDefinedDomains() will list domains which
isn't running and has persistent config file on disk

"defined" in libvirt-php should have same meaning with libvirt, since the
implementation of libvirt_list_defined_domains()
is just a wrapper of virConnectListDefinedDomains(),  and
libvirt_get_inactive_domain_count() is a wrapper of
virConnectNumOfDefinedDomains().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110221/2c6aca8e/attachment-0001.htm>


More information about the libvir-list mailing list