<br><br><div class="gmail_quote">On Mon, Feb 21, 2011 at 1:23 PM, Osier Yang <span dir="ltr"><<a href="mailto:jyang@redhat.com">jyang@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
于 2011年02月21日 10:50, Lyre 写道:<div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi all:<br>
<br>
I noticed that there's some inconsistent behaviors in libvirt-php, and<br>
wondering what's the best way to handle them.<br>
<br>
In libvirt-php:<br>
<br>
libvirt_list_domains() returns an array of all domain resource;<br>
libvirt_list_active_domains() returns an array of running domain ids;<br>
libvirt_list_defined_domains() returns an array of defined domain names.<br>
<br>
and<br>
<br>
libvirt_list_storagepools() returns an array of actived storagepool names.<br>
<br>
In my opinion, returning an array of names would be better when listing<br>
all kinds of objects.<br>
<br>
<br>
And the naming convenances, let's take domains as an example.<br>
<br>
libvirt-php provied<br>
libvirt_list_domains() for all domains, which has no corresponding<br>
function in libvirt.<br>
libvirt_list_active_domains() for running domains, corresponding to<br>
virConnectListDomains()  in libvirt.<br>
libvirt_list_defined_domains() for defined domains, corresponding to<br>
virConnectListDefinedDomains()  in libvirt.<br>
<br>
<br>
I believe it is fine. However, for defined objects, sometimes it used<br>
term "defined" (libvirt_list_defined_domains),<br>
and sometimes use term "inactive" (libvirt_get_inactive_domain_count)<br>
in contrast to "active". Which would be better?<br>
</blockquote>
<br></div></div>
Not sure if I get the meaning correctly, and also not sure what<br>
the exact meaning of "active" and "inactive" are in libvirt-php,<br>
but I guess:<br>
<br>
1)<br>
"active" and "inactive" are about the domain state.<br>
<br>
2)<br>
"defined" is about if it the domain has persistent config file on disk.<br>
<br>
So, if guessing 1) is right:<br>
<br>
A "defined" domain can be in either of "active" and "inactive" state;<br>
And an "active" domain can be "defined" or "not defined", and it's<br>
the same for "inactive" domain.<br>
<br>
Any conflict?<br>
<br>
Regards<br><font color="#888888">
Osier<br>
</font></blockquote></div><br>What about the "actived" & "defined" in libvirt?<br><br>As far as I know, virConnectListDefinedDomains() will list domains which isn't running and has persistent config file on disk<br>
<br>"defined" in libvirt-php should have same meaning with libvirt, since the implementation of libvirt_list_defined_domains() <br> is just a wrapper of virConnectListDefinedDomains(),  and libvirt_get_inactive_domain_count() is a wrapper of virConnectNumOfDefinedDomains().