[one-users] OCCI vm status indication

Miloš Kozák milos.kozak at lejmr.com
Sun Jun 2 01:10:22 PDT 2013


Hi,
thank you for the answer. I tried to verify that. It is quite easy to 
sent LCM_STATES to XML, thought. But at this point I would rather tried 
to resolve it with VM_STATE. I am afraid that there might be a bug. 
Source from compute.js:

function VMStateBulletStr(vm){
     var vm_state = vm.COMPUTE.STATE;
     var state_html = "";
     switch (vm_state) {
     case "INIT":
     case "PENDING":
     case "HOLD":
     case "STOPPED":
     case "SUSPENDED":
     case "POWEROFF":
         state_html = '<img 
style="display:inline-block;margin-right:5px;;" 
src="images/yellow_bullet.png" alt="'+vm_state+'" title="'+vm_state+'" />';
         break;
     case "ACTIVE":
     case "DONE":
         state_html = '<img 
style="display:inline-block;margin-right:5px;" 
src="images/green_bullet.png" alt="'+vm_state+'" title="'+vm_state+'"/>';
         break;
     case "FAILED":
         state_html = '<img 
style="display:inline-block;margin-right:5px;" 
src="images/red_bullet.png" alt="'+vm_state+'" title="'+vm_state+'"/>';
         break;
     };
     return state_html;
}

As I read it, the XML should contain states as poweroff and so on, but 
it gives only done, pending, done and active. I ran small script on a VM:

until [ `sleep 0.7` ]; do  occi-compute show 109 | grep STATE; done;

And triggered all thinkable commands on the VM. When I tryed poweroff 
and shutdown it prevailed in ACTIVE. That is why I think there might by 
a problem..

I tried to resolve it on my own, but I dont know ruby....


Thanks for answer,
Milos

Dne 26.4.2013 11:23, Daniel Molina napsal(a):
> Hi ,
>
>
> On 25 April 2013 09:28, Miloš Kozák <milos.kozak at lejmr.com 
> <mailto:milos.kozak at lejmr.com>> wrote:
>
>     Hi,
>     I am running opennebula 3.8.3 and OCCI self-service portal. My
>     problem is that the VM indication is misleading. There 3 statuses
>     - green, yellow, red. When I stop VM it turns to yellow, if
>     anything is wrong red.. that is perfectly correct but the VM is
>     indicated by green for shutdown, poweroff and all other statuses..
>     I was trying to fix compute.js, but it didnt worked out.. So I
>     assume there is a deeper problem? Can you confirm that?
>
>
> When using OCCI the VM xml that is sent in a OCCI /compute/:id GET 
> request include the VM_STATE [1].
>
> VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
>             POWEROFF}
>
> The problem is that the states you are looking for are LCM_STATES.
>
> LCM_STATE=%w{LCM_INIT PROLOG BOOT RUNNING MIGRATE SAVE_STOP SAVE_SUSPEND
> SAVE_MIGRATE PROLOG_MIGRATE PROLOG_RESUME EPILOG_STOP EPILOG
> SHUTDOWN CANCEL FAILURE CLEANUP UNKNOWN HOTPLUG SHUTDOWN_POWEROFF
> BOOT_UNKNOWN BOOT_POWEROFF BOOT_SUSPENDED BOOT_STOPPED}
>
> If you want to include this information you have to modify the 
> VirtualMachineOCCI class to include these states [2]
>
> Hope this helps
>
> [1] 
> https://github.com/OpenNebula/one/blob/release-3.8.3/src/oca/ruby/OpenNebula/VirtualMachine.rb
> [2] 
> https://github.com/OpenNebula/one/blob/release-3.8.3/src/cloud/occi/lib/VirtualMachineOCCI.rb
>
>
>     Thank you, Milos
>     _______________________________________________
>     Users mailing list
>     Users at lists.opennebula.org <mailto:Users at lists.opennebula.org>
>     http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
>
>
> -- 
> Daniel Molina

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20130602/9b8cf298/attachment.htm>


More information about the Users mailing list