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

Gian Uberto Lauri saint at eng.it
Fri Oct 7 01:58:13 PDT 2011


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             



More information about the Users mailing list