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:

  1. Using configuration sample files shipped with Virtuozzo Hybrid 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:

    • basic for creating standard containers.

    • confixx for creating containers that are to run the Confixx control panel.

    • vswap.plesk for creating containers with the Plesk control panel.

    • vswap.256MB for creating containers with 256 MB of main memory.

    • vswap.512Mb for creating containers with 512 MB of main memory.

    • vswap.1024Mb for creating containers with 1024 MB of main memory.

    • vswap.2048Mb for 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-sample file to the container MyCT. When you install Virtuozzo Hybrid Server on your hardware node, the default container samples are put to the /etc/vz/conf directory. They have the following format: ve-<name>.conf-sample (for example, ve-basic.conf-sample).

  2. Using specific 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 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

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:

# 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 Hybrid 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:

# 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 MyCT.

When applying new configuration samples to containers, keep in mind the following:

  • All container sample files are located in the /etc/vz/conf directory 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 --applyconfig option (vswap.plesk in the example above).

  • The --applyconfig option applies all the parameters from the specified sample file to the given container, except for the OSTEMPLATE, TEMPLATES, VE_ROOT, VE_PRIVATE, HOSTNAME, IP_ADDRESS, TEMPLATE, NETIF parameters (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.