# VMs with wrong state (RUNNING) after host reboot

**URL:** <https://forum.opennebula.io/t/vms-with-wrong-state-running-after-host-reboot/9032>\
**Category:** Installation & Configuration\
**Created:** [December 6, 2020, 6:35pm UTC](https://forum.opennebula.io/t/vms-with-wrong-state-running-after-host-reboot/9032 "2020-12-06T18:35:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skarux](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@skarux](https://forum.opennebula.io/u/skarux)\
**Post date:** [December 6, 2020, 6:35pm UTC](https://forum.opennebula.io/t/vms-with-wrong-state-running-after-host-reboot/9032/1 "2020-12-06T18:35:05Z")

</div>

Hello,  
I have noticed a problem when I perform host reboot:  
after rebooting the host, the VMs that previously were RUNNING are still detected as running and only after a while (some minutes) their state get automatically changed to POWEROFF.  
This gives me some troubles because I would like to have VMs getting suspended or properly shutdown during host shutdown (since I only have one host) and automatically restarted when the host is up again.  
I have checked [this](https://forum.opennebula.io/t/cant-execute-hook-with-the-new-hook-system-autorestart-vm/7995/7) post but it does not work since it never happens that the VM has STATE = ACTIVE and LCM\_STATE = UNKNOWN . Somebody else reported the [same issue](https://forum.opennebula.io/t/capture-vm-running-but-monitor-state-is-poweroff/3051) but without any solution.  
This is what I see on the VM log:

```
Sun Dec 6 18:54:08 2020 [Z0][VM][I]: New LCM state is RUNNING
Sun Dec 6 18:59:09 2020 [Z0][LCM][I]: VM running but monitor state is POWEROFF
Sun Dec 6 18:59:09 2020 [Z0][VM][I]: New LCM state is SHUTDOWN_POWEROFF
Sun Dec 6 18:59:09 2020 [Z0][VM][I]: New state is POWEROFF
Sun Dec 6 18:59:09 2020 [Z0][VM][I]: New LCM state is LCM_INIT

```

At 18:54:08 I have started the VM and I have then immediately rebooted the host. One minute later the host was up again but it took 4 minutes to detect the poweroff status. During another attempt it took more than 10 minutes to detect this.  
I am running OpenNebula 5.12.0.3-1.ce on Ubuntu 20.04.

Summarizing: I would like to properly shutdown and restart VMs during host reboot but I can’t because of this weird behaviour.

Thank you in advance for your help.

---

<div class="post-metadata">

**Author:** ![atodorov\_storpool](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/atodorov_storpool/32/5327_2.png) [@atodorov\_storpool](https://forum.opennebula.io/u/atodorov_storpool)\
**Post date:** [December 7, 2020, 6:47am UTC](https://forum.opennebula.io/t/vms-with-wrong-state-running-after-host-reboot/9032/2 "2020-12-07T06:47:11Z")

</div>

Hello @skarux,

I think that you should get familiar with the [monitoring](http://docs.opennebula.io/5.12/deployment/open_cloud_host_setup/monitoring.html) and see is there a room for additional tuning in your use case.

Also, IMHO, when a host reboots because of a hw failure or power outage there is no room to do proper VM shutdown. If you are talking about a planned maintenance procedure the administrator that execute the maintenance could take care of the VMs - migrate them or power-off them (properly)…

Best Regards,  
Anton Todorov

---

<div class="post-metadata">

**Author:** ![skarux](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@skarux](https://forum.opennebula.io/u/skarux)\
**Post date:** [December 9, 2020, 12:32pm UTC](https://forum.opennebula.io/t/vms-with-wrong-state-running-after-host-reboot/9032/3 "2020-12-09T12:32:29Z")

</div>

Thank you @atodorov_storpool,  
I will check the link to try at least gracefully suspending them during planned shutdown.  
What I don’t understand is why there is no way to set an automatic restart on failure or something like that, like for example can be done with dockers (ok, I know that containers are not VMs and probably OpenNebula is targeting environments where power failures never happen, but anyway it would be a nice feature to have).

---

<div class="post-metadata">

**Author:** ![feldsam](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/feldsam/32/4441_2.png) [@feldsam](https://forum.opennebula.io/u/feldsam)\
**Post date:** [December 15, 2020, 12:43pm UTC](https://forum.opennebula.io/t/vms-with-wrong-state-running-after-host-reboot/9032/4 "2020-12-15T12:43:27Z")

</div>

Hello @skarux, I think that OpenNebula is designed to be used with cluster of compute nodes and then you can implement host error hooks for properly starting VMs on another machine. Check this [http://docs.opennebula.io/5.12/advanced\_components/ha/ftguide.html](http://docs.opennebula.io/5.12/advanced_components/ha/ftguide.html)

Regarding planned shutdown, you should [live]migrate VMs to another compute node, or power off each. You can use “check all” function in Sunstone and power off all. After reboot you just check all and hit start button.
