[one-users] Mapping OpenNebula VM status to Libvirt like ones

Carlos Martín Sánchez cmartin at opennebula.org
Thu Oct 20 06:23:10 PDT 2011


Hi,

OpenNebula 1.4 had a libvirt interface, and the VM states haven't really
changed. This is the relevant code, taken from [1]:

  341         switch(one_state) {
 342         case 3:                                     /** running */
 343             if (vm->state!=VIR_DOMAIN_SHUTDOWN)
 344                 vm->state=VIR_DOMAIN_RUNNING;
 345             break;
 346         case 5:                                     /** pause */
 347             vm->state=VIR_DOMAIN_PAUSED;
 348             break;
 349         case 6:                                     /** done */
 350             vm->state=VIR_DOMAIN_SHUTOFF;
 351             vm->def->id=-1;
 352             break;
 353         case 7:                                     /** error */
 354             vm->state=VIR_DOMAIN_CRASHED;
 355             break;

Regards.

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

--
Carlos Martín, MSc
Project Engineer
OpenNebula - The Open Source Toolkit for Cloud Computing
www.OpenNebula.org <http://www.opennebula.org/> | cmartin at opennebula.org


On Fri, Oct 7, 2011 at 10:58 AM, Gian Uberto Lauri <saint at eng.it> wrote:

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


More information about the Users mailing list