Configuration files templates

From ISPWiki
Jump to: navigation, search

Typically, configuration files are located in the directory /etc/vz/conf and are named as: ve-config_name.conf-sample. The ve-basic.conf-sample default template is created by OpenVZ and is not used by VMmanager OVZ. Normally, OpenVZ uses a template, which is specified in /etc/vz/vz.conf

However, VMmanager OVZ uses the following scheme when creating a container: Container template + template /etc/vz/conf/ve-ispbasic.conf-sample, which is used by default. The name is specified in the panel code and cannot be modified. The file will be regenerated upon deletion.

Container creation procedure:

  • A container is created based on the /etc/vz/conf/ve-basic.conf-sample template
/bin/sh -c /usr/sbin/vzctl\ create\ CTID\ --ostemplate\ ostemplate\ --layout\ ploop\ --config\ ispbasic'   
layout - the way how container's files are located  - ploop / simfs, ostemplate - OS selected when creating a container 
  • Tempplate parameters (vemgr database/ preset table) + information from the container creation form are specified for the newly created container.
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --quotaugidlimit\ 2048\ --save' pid  
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --ipadd\ \ --save'
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --hostname\ ct2.org\ --save'
Run '/bin/sh -c /usr/sbin/vzlist\ -H\ -o\ layout\ 102' Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --diskspace\ 3000M\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --diskinodes\ 384000\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --swap\ 1024M\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --ram\ 512M\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --lockedpages\ 131072:unlimited\ --oomguarpages\ 131072:unlimited\ --vmguarpages\ 393216\ --privvmpages\ unlimited:unlimited\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --cpus\ 1\ --save' Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --cpuunits\ 100\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --cpulimit\ 100\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --numproc\ unlimited\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --numfile\ unlimited\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --numtcpsock\ unlimited\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --numothersock\ unlimited\ --save' 
Run '/bin/sh -c /usr/sbin/vzctl\ set\ 102\ --tcprcvbuf\ unlimited\ --save' 

ve-basic.conf-sample

# UBC parameters (in form of barrier:limit)
KMEMSIZE="14372700:14790164"
LOCKEDPAGES="2048:2048"
PRIVVMPAGES="65536:69632"
SHMPAGES="21504:21504"
NUMPROC="240:240"
PHYSPAGES="0:unlimited"
VMGUARPAGES="33792:unlimited"
OOMGUARPAGES="26112:unlimited"
NUMTCPSOCK="360:360"
NUMFLOCK="188:206"
NUMPTY="16:16"
NUMSIGINFO="256:256"
TCPSNDBUF="1720320:2703360"
TCPRCVBUF="1720320:2703360"
OTHERSOCKBUF="1126080:2097152"
DGRAMRCVBUF="262144:262144"
NUMOTHERSOCK="360:360"
DCACHESIZE="3409920:3624960"
NUMFILE="9312:9312"
AVNUMPROC="180:180"
NUMIPTENT="128:128"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="2G:2.2G"
DISKINODES="200000:220000"
QUOTATIME="0"

# CPU fair scheduler parameter
CPUUNITS="1000"

ve-light.conf-sample

Contents:

# UBC parameters (in form of barrier:limit)
# Primary parameters
AVNUMPROC="15:15"
NUMPROC="40:40"
NUMTCPSOCK="40:40"
NUMOTHERSOCK="40:40"
VMGUARPAGES="1725:unlimited"
# Secondary parameters
KMEMSIZE="1740800:1847296"
TCPSNDBUF="159744:262144"
TCPRCVBUF="159744:262144"
OTHERSOCKBUF="135168:237568"
DGRAMRCVBUF="135168:196608"
OOMGUARPAGES="1725:unlimited"
# Auxiliary parameters
LOCKEDPAGES="4:4"
SHMPAGES="1152:1152"
PRIVVMPAGES="7680:8448"
NUMFILE="512:512"
NUMFLOCK="50:60"
NUMPTY="4:4"
NUMSIGINFO="256:256"
DCACHESIZE="196608:202752"

PHYSPAGES="0:unlimited"
NUMIPTENT="16:16"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="1G:1.1G"
DISKINODES="80000:88000"
QUOTATIME="0"

# CPU fair scheduler parameter
CPUUNITS="250"


ve-unlimited.conf-sample

Template with unlimited resources.

Contents:

# UBC parameters (in form of barrier:limit)
# Primary parameters
AVNUMPROC="unlimited"
NUMPROC="unlimited"
NUMTCPSOCK="1801439850948198"
NUMOTHERSOCK="1801439850948198"
VMGUARPAGES="unlimited"
# Secondary parameters
KMEMSIZE="unlimited"
#TCPSNDBUF="2147483647:2147483647"
TCPSNDBUF="4611686018427387903:9223372036854775807"
TCPRCVBUF="4611686018427387903:9223372036854775807"
OTHERSOCKBUF="4611686018427387903:9223372036854775807"
DGRAMRCVBUF="unlimited"
OOMGUARPAGES="unlimited"
# Auxiliary parameters
LOCKEDPAGES="unlimited"
SHMPAGES="unlimited"
PRIVVMPAGES="unlimited"
NUMFILE="unlimited"
NUMFLOCK="unlimited"
NUMPTY="unlimited"
NUMSIGINFO="unlimited"
DCACHESIZE="unlimited" 

PHYSPAGES="0:unlimited"
NUMIPTENT="unlimited"

# Disk quota parameters (in form of softlimit:hardlimit)
DISK_QUOTA="no"

ve-vswap-<mem_size>.conf-sample

Starting from vzctl-3 and kernel ovz-el, VSwap and new templates in the format ve-vswap-<mem_size>.conf-sample are supported.

Contents:

# RAM
PHYSPAGES="0:*"

# Swap
SWAPPAGES="0:*"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="2G:2.2G"
DISKINODES="200000:220000"
QUOTATIME="0"

# CPU fair scheduler parameter
CPUUNITS="1000"

Using a custom configuration file template

Files of configuration templates are only used for creating a skeleton of a container to which parameters from the "Container template" or creation form will be applied. Editing parameter, e.g.

# RAM
PHYSPAGES="0:1G"или 
# Swap SWAPPAGES="0:2G"

directly in ve-ispbasic.conf-sample doesn't mean that the changes will be applied to a ready container template. If you want to use different configurations, create multiple "Templates".