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 Server. 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:
1# prlctl set MyCT --applyconfig basicThis command applies all the parameters from the
ve-basic.conf-samplefile to the containerMyCT. When you install Virtuozzo Server on your hardware node, the default container samples are put to the/etc/vz/confdirectory. They have the following format:ve-<name>.conf-sample(for example,ve-basic.conf-sample).
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.
Splitting Server into Equal Pieces
Using the 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:
| |
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.
Applying New Configuration Samples to Containers
Virtuozzo Server 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:
| |
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 MyCT.
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--applyconfigoption (vswap.pleskin the example above). - The
--applyconfigoption applies all the parameters from the specified sample file to the given container, except for theOSTEMPLATE,TEMPLATES,VE_ROOT,VE_PRIVATE,HOSTNAME,IP_ADDRESS,TEMPLATE,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.