Kir Kolyshkin (k001) wrote in openvz,
Kir Kolyshkin

Recent improvements in vzctl

Update: note you need VSwap enabled (ie currently RHEL6-based) kernel for the below stuff to work, see

VSwap is an excellent feature, simplifying container resource management a lot. Now it's time to also simplify the command line interface, i.e. vzctl. Here is what we did recently (take a look at vzctl git repo if you want to review the actual changes):

1. We no longer require to set kmemsize, dcachesize and lockedpages parameters to non-unlimited values (this is one of the enhancements in the recent kernels we have talked about recently). Therefore, setting these parameters to fractions of CT RAM (physpages) are now removed from configuration files and vzsplit output.

2. There is no longer a need to specify all the UBC parameters in per-container configuration file. If you leave some parameters unset, the kernel will use default values (usually unlimited). So, VSwap example configs are now much smaller, with as much as 19 parameters removed from those.

3. vzctl set now supports two new options: --ram and --swap. These are just convenient short aliases for --physpages and --swappages, the differences being that you only need to specify one value (the limit) and the argument is in bytes rather than pages.

So, to configure a container named MyCT to have 1.5GB of RAM and 3GB of swap space available, all you need to do is just run this command:
vzctl set MyCT --ram 1.5G --swap 3G --save

4. This is not VSwap-related, but nevertheless worth sharing. Let's illustrate it by a copy-paste from a terminal:
# vzctl create 123 --ostemplate centos-4-x86_64
Creating container private area (centos-4-x86_64)
Found centos-4-x86_64.tar.gz at
-- 2011-11-29 18:54:08 --
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 171979832 (164M) [application/x-gzip]
Saving to: `/vz/template/cache/centos-4-x86_64.tar.gz'

100%[======================================>] 171,979,832 588K/s in 4m 27s

2011-11-29 18:58:35 (630 KB/s) - `/vz/template/cache/centos-4-x86_64.tar.gz' saved [171979832/171979832]

Performing postcreate actions
Saved parameters for CT 123
Container private area was created

All this will be available in vzctl-3.0.30, which is to be released soon (next week? who knows). If you can't wait and want to test this stuff, here's a nightly build of vzctl available (version from Please give it a try and tell me what you think.

Update: comments disabled due to spam
Tags: git, openvz, vzctl
Comments for this post were disabled by the author