Providing virtual machine priority in kvm based virtual machines

Hi All,

Is there any way I can prioritize my VMs when there is resource crunch in host machine so that some VMs will be allocated more vcpu, more memory than other VMs in kvm/qemu hypervisor based virtual machines?

Lets say in my cloud environment my Ubuntu 16 compute hosts are running some development and production VMs. When there is resource crunch, I want my production VMs to utilize more vcpu and memory than development VMs. Here the host machine should decide which VMs to give priority in terms of resource allocation so as to increase or decrease vcpu, memory of the hosted VMs.

Tried with virsh command line to set vcpucount. However it needs to reboot the VM to effect the config change which I do not want for my VMs.

I can think of changing nice value of the qemu process (using nice/renice/chrp command options) for my VM instances, but not sure whether it will work properly or not when the actual resource crunch happens as nice is just a scheduler hint to the linux kernel.

Similar question is posted in stackoverflow under "understanding-kvm-cpu-scheduler-algorithm" subject line.

Please let me know is there any linux command line utility or tool available to increase or decrease resource of the VMs based on the resource utilization in host.

thank you for your replies and pointers.

regards,
Sanjay

1 Like