Hi,<br><br>OpenNebula 1.4 had a libvirt interface, and the VM states haven't really changed. This is the relevant code, taken from [1]:<br><br>  <span style="font-family: courier new,monospace;">341         switch(one_state) {</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"> 342         case 3:                                     /** running */</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 343             if (vm->state!=VIR_DOMAIN_SHUTDOWN)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"> 344                 vm->state=VIR_DOMAIN_RUNNING;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 345             break;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"> 346         case 5:                                     /** pause */</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 347             vm->state=VIR_DOMAIN_PAUSED;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"> 348             break;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 349         case 6:                                     /** done */</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"> 350             vm->state=VIR_DOMAIN_SHUTOFF;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 351             vm->def->id=-1;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"> 352             break;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 353         case 7:                                     /** error */</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"> 354             vm->state=VIR_DOMAIN_CRASHED;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> 355             break;</span><br>

<br>Regards.<br><br>[1] <a href="http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/opennebula/one_driver.c;h=3146589db3feb76c8c51154dc86f0a3f88601260;hb=cb4aba9b6aa3c5af1f035700095ed87dcce004be#l307">http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/opennebula/one_driver.c;h=3146589db3feb76c8c51154dc86f0a3f88601260;hb=cb4aba9b6aa3c5af1f035700095ed87dcce004be#l307</a><br>

<br clear="all"><span style="border-collapse:collapse;color:rgb(136, 136, 136);font-family:arial,sans-serif;font-size:13px">--<br>Carlos Martín, MSc</span><font color="#888888"><br>Project Engineer</font><br><span style="border-collapse:collapse;color:rgb(136, 136, 136);font-family:arial, sans-serif;font-size:13px"><span style="background-color:rgb(255, 255, 204);color:rgb(34, 34, 34);background-repeat:initial initial">OpenNebula</span> - The Open Source Toolkit for Cloud Computing<br>

<a href="http://www.opennebula.org/" style="color:rgb(42, 93, 176)" target="_blank">www.<span style="background-color:rgb(255, 255, 204);color:rgb(34, 34, 34);background-repeat:initial initial">OpenNebula</span>.org</a> | <a href="mailto:cmartin@opennebula.org" style="color:rgb(42, 93, 176)" target="_blank">cmartin@<span style="background-color:rgb(255, 255, 204);color:rgb(34, 34, 34);background-repeat:initial initial">opennebula</span>.org</a></span><br>


<br><br><div class="gmail_quote">On Fri, Oct 7, 2011 at 10:58 AM, Gian Uberto Lauri <span dir="ltr"><<a href="mailto:saint@eng.it">saint@eng.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hello gentlemen!<br>
<br>
The project  I am working in  choosed the libvirt set  of status codes<br>
with one added (machine ready and accepting SSH connections).<br>
<br>
Do you think that the mapping you read from this code has any problem ?<br>
<br>
        // No matter what, if LCM status in UNKNOWn<br>
                // we return NOSTATE<br>
                if(lcmStatus == LcmStatusCodes.UNKNOWN)<br>
                        return State.NOSTATE;<br>
<br>
                // Else, we return the libvirt state that maches<br>
                // OpenNebula VM state according to this assignment<br>
                switch(vmStatus) {<br>
                case  VmStatusCodes.INIT:<br>
<br>
                        break;<br>
<br>
                case  VmStatusCodes.PENDING:<br>
                        rv = State.NOSTATE;<br>
                        break;<br>
<br>
                case  VmStatusCodes.HOLD:<br>
                        rv = State.BLOCKED;<br>
                        break;<br>
<br>
                case  VmStatusCodes.ACTIVE:<br>
                        rv = (gotPort22Connection) ? State.RUNNING_READY<br>
                                : State.RUNNING;<br>
                        break;<br>
<br>
                case  VmStatusCodes.STOPPED:<br>
                        rv = State.SHUTOFF;<br>
                        break;<br>
<br>
                case  VmStatusCodes.SUSPENDED:<br>
                        rv = State.PAUSED;<br>
                        break;<br>
<br>
                case  VmStatusCodes.DONE:<br>
                        rv = State.SHUTOFF;<br>
                        break;<br>
<br>
                case  VmStatusCodes.FAILED:<br>
                        rv = State.CRASHED;<br>
                        break;<br>
<br>
                default:<br>
                        rv = State.NOSTATE;<br>
<br>
<br>
                }<br>
Thank you ion advance!<br>
<br>
--<br>
ing. Gian Uberto Lauri<br>
Ricercatore / Reasearcher<br>
Laboratorio Ricerca e Sviluppo / Research & Development Lab.<br>
Area Calcolo Distribuito / Distributed Computation Area<br>
<br>
<a href="mailto:GianUberto.Lauri@eng.it">GianUberto.Lauri@eng.it</a><br>
<br>
Engineering Ingegneria Informatica spa<br>
Corso Stati Uniti 23/C, 35127 Padova (PD)<br>
<br>
Tel. <a href="tel:%2B39-049.8283.571" value="+390498283571">+39-049.8283.571</a>         | main(){printf(&unix["\021%six\012\0"],<br>
Fax  <a href="tel:%2B39-049.8283.569" value="+390498283569">+39-049.8283.569</a>             |    (unix)["have"]+"fun"-0x60);}<br>
Skype: gian.uberto.lauri          |          David Korn, AT&T Bell Labs<br>
<a href="http://www.eng.it" target="_blank">http://www.eng.it</a>                         |          ioccc best One Liner, 1987<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
</blockquote></div><br>