O'Reilly logo

KVM Virtualization Cookbook by Konstantin Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To inspect and update the memory and CPU resources assigned to a virtual machine follow the process outlined here:

  1. Get memory statistics for the running instance:
root@kvm:~# virsh dommemstat kvm1actual 1048576swap_in 0rss 333644root@kvm:~#
  1. Update the available memory for the VM to 2 GB:
root@kvm:~# virsh setmem kvm1 --size 1049000root@kvm:~#
  1. Stop the running instance:
root@kvm:~# virsh destroy kvm1Domain kvm1 destroyedroot@kvm:~#
  1. Set the maximum usable memory to 2 GB:
root@kvm:~# virsh setmaxmem kvm1 --size 2097152root@kvm:~#





 

 

  1. Start the instance:
root@kvm:~# virsh start kvm1Domain kvm1 startedroot@kvm:~#
  1. Check the current allocated memory:
root@kvm:~# virsh dommemstat kvm1actual 2097152swap_in 0 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required