5

Is there a way of limiting number of cpu cores seen from inside a VE? I have an eight core server, but I want my VE to see only one particular core.

Thanx!

10

If you vz is number 101, than use the following to set it two 2 CPUs (change the number accordingly):

vzctl set 101 --cpus 2 --save

No restart of the VE required. The --save makes it so when the VE is rebooted, the changes will still be there. vzctl --help for other resources that can be set.

6

OpenVZ isn't really virtualization. It's containerization. So each container sees the system that it's on as it's own. To control how much cpu time each VE can get you have to assign each VE cpucredits. This page goes into how set the limits on each VE.

Edit: Just found this in the vzctl man page.
--cpulimit num[%] Limit of CPU usage for the VE, in per cent. Note if the computer has 2 CPUs, it has total of 200% CPU time. Default CPU limit is 0 (no CPU limit). --cpus num sets number of CPUs available in the VE.

So Kyle's answer is correct. But I'll leave this answer here b/c there are more than one nob here to tweak.

  • Might be a better option for his/her unstated end goal as well. – Kyle Brandt Jan 8 '10 at 20:24
  • 1
    If I only had known this last week. I was dealing with CPUUNITS and didn't understood them correctly until too late. Thanks to vzsplit now I have a better performance on my system. – Leandro López Sep 5 '10 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.