KVM and virtual CPUs

Here's the situation : We have a Cloudmin system with several KVM VMs, Each one have différent disk and RAM ressources. One of them is more demanding on CPU power.

Is it possible to attribute a différent number of "virtual cpu cores" to different VM's via Cloudmin ?

Status: 
Active

Comments

As far as I know, no .. KVM has no built-in way of limiting the CPU use of a VM, or limiting it to some cores.

Xen can do this though.

Ok. Thank's for the answer.

After some research, I found that with libvirt, it was possible to create SMP KVM VMs, with 2 or more virtual cores.

From qemu-kvm doc :

-smp n Simulate an SMP system with n CPUs

So my question is : is possible to start a VM with -smp 2 (or more) within Cloudmin, instead of just 1 virtual core ?

That could certainly be added ... however, it seems like it would do the opposite of what you want, which is to limit CPU use. Giving a KVM instance multiple cores would allow it to consume even more CPU on the host ..

Yes that's true.

In fact, one of our VM's is heavily loaded, while one another is lightly loaded.

Since the Host has CPU ressources free (load is ca. 1.20 on a quad-core), we could give some air to the first VM with 1 more virtual core.

So, you think I could just add "-smp 2" to this VM's Coudmin config file ?

You can configure Cloudmin to add this flag, as follows :

  1. SSH into the Cloudmin master system as root
  2. Get the system's unique ID with the command cloudmin list-systems --host yourkvminstance --id-only
  3. Edit the file /etc/webmin/servers/XXXX.serv , where XXXX is the unique ID.
  4. Add the line kvm_args=-smp 2 at the end.
  5. Shut down and then re-start up the KVM instance.

Ok, thanks a lot for the confirmation.

Regards.