
Managing Resources
61
2
Using OpenVZ specialized utilities for preparing configuration files in their entirety. The
tasks these utilities perform are described in the following subsections of this section.
3
The direct creating and editing of the corresponding configuration file
(
/etc/sysconfig/vz-scripts/
VPS_ID
.conf
). This can be performed either with
the help of any text editor. The instructions on how to edit VPS configuration files directly
are provided in the four preceding sections. In this case you have to edit all the
configuration parameters separately, one by one.
Splitting Hardware Node Into Equal Pieces
It is possible to create a Virtual Private Server configuration roughly representing a given
fraction of the Hardware Node. If you want to create such a configuration that up to 20 fully
loaded Virtual Private Servers would be able to be simultaneously running on the given
Hardware Node, you can do it as is illustrated below:
# cd /etc/sysconfig/vz-scripts/
# vzsplit -n 20 -f vps.mytest
Config /etc/sysconfig/vz-scripts/ve-vps.mytest.conf-sample was created
# vzcfgvalidate ve-vps.mytest.conf-sample
Recommendation: kmemsize.lim-kmemsize.bar should be > 253952 \
(currently, 126391)
Recommendation: dgramrcvbuf.bar should be > 132096 (currently, 93622)
Note that the configuration produced depends on the given Hardware Node resources.
Therefore, it is important to validate the resulted configuration file before trying to use it, which
is done with the help of the
vzcfgvalidate
utility.
The number of Virtual Private Servers you can run on the Hardware Node is actually several
times greater than the value specified in the command line because Virtual Private Servers
normally do not consume all the resources that are guaranteed to them. To illustrate this idea, let
us look at the Virtual Private Server created from the configuration produced above:
# vzctl create 101 --ostemplate fedora-core-4 --config vps.mytest
Creating VPS private area: /vz/private/101
VPS private area was created
# vzctl set 101 --ipadd 192.168.1.101 --save
Saved parameters for VPS 101
# vzctl start 101
Starting VPS ...
VPS is mounted
Adding IP address(es): 192.168.1.101
VPS start in progress...
# vzcalc 101
Resource Current(%) Promised(%) Max(%)
Memory 0.53 1.90 6.44
As is seen, if Virtual Private Servers use all the resources guaranteed to them, then around 20
VPSs can be simultaneously running. However, taking into account the
Promised
column
output, it is safe to run 40-50 such Virtual Private Servers on this Hardware Node.