3.8. Managing Container Resource Configuration¶
Any container is configured by means of its own configuration file. You can manage container configurations in a number of ways:
Using configuration sample files shipped with Virtuozzo. These files are used when a new container is being created (for details, see Virtuozzo Containers). Currently, the following configuration sample files are provided:
basicfor creating standard containers.
confixxfor creating containers that are to run the Confixx control panel.
vswap.pleskfor creating containers with the Plesk control panel.
vswap.256MBfor creating containers with 256 MB of main memory.
vswap.512Mbfor creating containers with 512 MB of main memory.
vswap.1024Mbfor creating containers with 1024 MB of main memory.
vswap.2048Mbfor creating containers with 2048 MB of main memory.
Configuration sample files cannot contain spaces in their names.
Any sample configuration file can also be applied to an existing container. You would do this if, for example, you want to upgrade or downgrade the overall resources configuration of a particular container:
# prlctl set MyCT --applyconfig basic
This command applies all the parameters from the
ve-basic.conf-samplefile to the container
MyCT. When you install Virtuozzo on your hardware node, the default container samples are put to the
/etc/vz/confdirectory. They have the following format:
Using specific utilities for preparing configuration files in their entirety. The tasks these utilities perform are described in the following subsections of this section.
The direct creating and editing of the corresponding container configuration file (
/etc/vz/conf/<UUID>.conf). This can be performed with the help of any text editor. The instructions on how to edit container 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.
3.8.1. Splitting Server into Equal Pieces¶
vzsplit command, you can create configurations for containers that would take a specific fraction of the hardware node resources. For example, to create a configuration
myconf for up to 20 containers:
# vzsplit -n 20 -f myconf Config /etc/vz/conf/ve-myconf.conf-sample was created
The configuration is calculated based on the hardware node resources. You can now use the
--config myconf option of the
prlctl create command to create containers based on this configuration.
3.8.2. Applying New Configuration Samples to Containers¶
Virtuozzo allows you to change the configuration sample file a container is based on and, thus, to modify all the resources the container may consume and/or allocate at once. For example, if a container
MyCT is based on the
basic sample and you plan to run Plesk inside it, you may apply the
vswap.plesk sample to it instead. This will automatically adjust the container resource parameters for running Plesk. To do this, you can execute the following command on the hardware node:
# prlctl set MyCT --applyconfig vswap.plesk
This command reads the resource parameters from the
ve-vswap.plesk.conf-sample file located in the
/etc/vz/conf directory and applies them one by one to the container
When applying new configuration samples to containers, keep in mind the following:
- All container sample files are located in the
/etc/vz/confdirectory on the hardware node and are named according to the following pattern:
ve-<name>.conf-sample. You should specify only the
<name>part of the corresponding sample name after the
vswap.pleskin the example above).
--applyconfigoption applies all the parameters from the specified sample file to the given container, except for the
NETIFparameters (if they exist in the sample file).
You may need to restart your container if the changes cannot be set on the fly. In this case, you will see a corresponding alert.