You are here

Speed up a Ubuntu KVM host turn off process


Speed up a Ubuntu KVM host turn off process

I faced a problem - if there is a virtualization system KVM on ubuntu installed, then when host is turning off or rebooting, if it has working vms on it, the process of turning off is too slow. I've find out that this happens because of two things - the first is - when host is turning off virtual machines are comming to suspend state, and that process takes a long time. And second - there are too big timeouts for turning off - 5 minutes to each VM, and host can turn off only one vm at same time.

In this article I will show you how you can change suspend to power off, and how to decrease timeouts for turn off.

Attention - do not try to do that on working enviroments. If vm stops forcefully there is a chache to break VMs file sytem. My host is home computer, all virtual machines are for testing purpurces, and for me shutdown speed of host if much more  important than data on those vms.

Overall, you have to change a script - /usr/lib/libvirt/libvirt-guests.sh

On it you should change strings:

ON_SHUTDOWN=shutdown
SHUTDOWN_TIMEOUT=5
PARALLEL_SHUTDOWN=10

Let me explain. On first string we changing suspend to shutdown, for turning off save state on host shutdown.

On the second string we set the shutdown timeout. This is the time, after what VM will be turned off forcefully.

On the third string we are setting host to shutdown 10 vms at the same time.

After I edited that script the speed of turning off and reboots for my computer became much more faster.

I have a video on that theme (it is on Russian language):

0 0

Share the article with your friends in social networks, maybe it will be useful to them.


If the article helped you, you can >>thank the author<<