Where the hell is “HYPERVISOR_MEM” in OpenNebula 4.6?

Categories Virtualization

This was the question I asked myself when I saw no mention of HYPERVISOR_MEM in file /etc/one/sched.conf. It is the percentage of memory reserved for Hypervisor use.

# HYPERVISOR_MEM: Fraction of total MEMORY reserved for the hypervisor.
# E.g. 0.1 means that only 90% of the total MEMORY will be used

HYPERVISOR_MEM=0.4

.. will reserve 40% of the total memory for OpenNebula (only 60% RAM will be available for guest VMs). You can choose to over-commit resources by simply specifying a negative value:

HYPERVISOR_MEM=-0.4

This  is  was the preferred method to over-commit resources in OpenNebula.

Well, now things have got even more easier since OpenNebula v4.6. HYPERVISOR_MEM is deprecated now – instead set RESERVED_MEM and RESERVED_CPU attributes to the host via Sunstone -> Infrastructure -> Hosts -> [host]

  • RESERVED_CPU in percentage. It will be subtracted from the TOTAL CPU
  • RESERVED_MEM in KB. It will be subtracted from the TOTAL MEM

These values can be negative, in that case you’ll be actually increasing the overall capacity so over-commiting host capacity

 

Resize KVM images in OpenNebula

Categories Virtualization

Although I am doing this for OpenNebula, this can be followed for any KVM setup.

I am using a CentOS 6.2 image downloaded from OpenNebula Marketplace. This is of size 10GB, and my requirement is to extend root partition (/dev/sda1) to 20GB.

All commands on KVM host:

Make a backup of the existing disk image before proceeding..

I wish to add 10 more GB to the current partition (so, total size = 20GB). So, create a new raw disk image of size 20GB first, and then clone the contents from original image file to new image file.

The filesystem should be ready by now, but just in case you wish to run “resize2fs” manually:

Now include the new image in OpenNebula, use it in the VM template and start a new instance again.

NOTE: There are many more ways to resize, this is just one of those methods (like http://docs.openstack.org/image-guide/content/ch_modifying_images.html , or even live-resize using “qemu-img resize”).

For example: to extend the entire disk in order to create additional partitions (/dev/vda2, /dev/vda3 etc), “qemu-img resize” command should be enough.