├── .stamp-all ├── Makefile.version ├── targets.list ├── Makefile.incl ├── .cvsignore ├── etc ├── modprobe.d │ └── vz.conf ├── logrotate.d │ └── vzctl ├── modules-load.d │ └── vz.conf ├── ifdown-venet ├── script.d │ └── README ├── systemd.d │ ├── vzevent.service │ ├── vz-k8s-inside-ct.service │ ├── vz.service │ ├── vz-cgroup-dummy.service │ └── vz-k8s-inside-ct ├── dracut │ └── 99vzctl │ │ └── module-setup.sh ├── vzevent.d │ ├── ve-stop │ ├── ve-fserror │ └── ve-reboot ├── vps.vzpkgtools.conf-sample ├── 0.conf ├── vps.configure.sample ├── 0.conf.ia64 ├── 0.conf.x86_64 ├── networks_classes ├── ve-basic.conf-sample.ia64 ├── ve-basic.conf-sample.x86_64 ├── ve-basic.conf-sample ├── ve-vswap.256MB.conf-sample ├── ve-vswap.512MB.conf-sample ├── ve-vswap.1024MB.conf-sample ├── ve-vswap.2048MB.conf-sample ├── ve-vswap.plesk.conf-sample ├── ifup-venet ├── sysctl.d │ └── 99-vzctl.conf ├── ve-vps.256MB.conf-sample ├── ve-vps.256MB.conf-sample.x86_64 ├── ve-vps.512MB.conf-sample ├── vps.vzpkgtools.conf-sample.ia64 ├── vps.vzpkgtools.conf-sample.x86_64 ├── ve-vps.512MB.conf-sample.x86_64 ├── ve-vps.1024MB.conf-sample ├── ve-vps.1024MB.conf-sample.x86_64 ├── ve-vps.2048MB.conf-sample ├── ve-vps.2048MB.conf-sample.x86_64 ├── ve-cpanel.conf-sample ├── ve-cpanel.conf-sample.x86_64 ├── ve-slm.plesk.conf-sample ├── ve-slm.256MB.conf-sample ├── ve-slm.512MB.conf-sample ├── ve-slm.1024MB.conf-sample ├── ve-slm.2048MB.conf-sample ├── ve-light.conf-sample ├── ve-light.conf-sample.x86_64 ├── ve-confixx.conf-sample.x86_64 ├── ve-oracle.conf-sample ├── ve-oracle.conf-sample.ia64 ├── ve-oracle.conf-sample.x86_64 ├── ve-vps.plesk.conf-sample ├── ve-confixx.conf-sample ├── ve-vps.plesk.conf-sample.x86_64 ├── ve-unlimited.db2.conf-sample.ia64 ├── ve-unlimited.db2.conf-sample ├── ve-light.conf-sample.ia64 ├── vps.reinstall.sample ├── ve-vps.plesk7.rh9.conf-sample ├── ve-vps.plesk7.rh9.conf-sample.x86_64 ├── ve-slm.plesk.conf-sample.x86_64 ├── ve-slm.1024MB.conf-sample.ia64 ├── ve-slm.2048MB.conf-sample.ia64 ├── ve-slm.256MB.conf-sample.ia64 ├── ve-slm.256MB.conf-sample.x86_64 ├── ve-slm.1024MB.conf-sample.x86_64 ├── ve-slm.2048MB.conf-sample.x86_64 ├── ve-slm.512MB.conf-sample.ia64 ├── ve-slm.512MB.conf-sample.x86_64 ├── vz-pci_configure └── vz.conf ├── man ├── .cvsignore ├── vzdiskcheck.8 ├── vzcpucheck.8 ├── vzpid.8 ├── vzeventd.8 ├── vzreboot.8 ├── vzgetpa.8 ├── toc.man.in ├── vzpurge.8 ├── vztactl.8 ├── vz-stop.5 ├── vzcfgvalidate.8 ├── vzcheckovr.8 ├── vz-start.5 ├── vzauth.8 ├── toc.sh ├── vz-postinst.5 ├── vz-create_prvt.5 ├── vz-net_del.5 ├── vz-net_add.5 ├── networks_classes.5 ├── vznetstat.8 ├── pnetstat.8 ├── vzsplit.8 ├── vzcfgscale.8 ├── Makefile ├── vzcfgconvert.8 ├── ubclogd.8 ├── vzlist.8 └── ve.conf.5 ├── .gitignore ├── README.md ├── COPYING ├── include ├── tmplmn.h ├── script.h ├── ha.h ├── vzcfgscale.h ├── timeutils.h ├── clist.h ├── ubclogd.h ├── validate.h ├── vzerror.h ├── veth.h ├── util.h ├── config.h ├── tc.h ├── list.h └── vzlist.h ├── vzgetpa ├── src ├── timeutils.c ├── technologies.c ├── script.c ├── vzmonitor.c ├── tmplmn.c ├── ndsend.c ├── Makefile ├── vzcfgconvert.c ├── vzauth.c └── ha.c ├── vzpid ├── vzdiskcheck ├── vzcpucheck └── vzpurge /.stamp-all: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Makefile.version: -------------------------------------------------------------------------------- 1 | 9.0.1 2 | -------------------------------------------------------------------------------- /targets.list: -------------------------------------------------------------------------------- 1 | vzctl.vzspecs dist-vz9-u00 2 | -------------------------------------------------------------------------------- /Makefile.incl: -------------------------------------------------------------------------------- 1 | PRODUCT_NAME_SHORT?=OpenVZ 2 | -------------------------------------------------------------------------------- /.cvsignore: -------------------------------------------------------------------------------- 1 | .depend 2 | *.diff 3 | vzctl 4 | .stamp-all 5 | -------------------------------------------------------------------------------- /etc/modprobe.d/vz.conf: -------------------------------------------------------------------------------- 1 | options vzevent reboot_event=1 2 | -------------------------------------------------------------------------------- /man/.cvsignore: -------------------------------------------------------------------------------- 1 | *.ps 2 | *.pdf 3 | *.diff 4 | *.html 5 | *.txt 6 | *.pcl 7 | toc.man 8 | -------------------------------------------------------------------------------- /etc/logrotate.d/vzctl: -------------------------------------------------------------------------------- 1 | /var/log/vzctl.log { 2 | monthly 3 | rotate 6 4 | copytruncate 5 | notifempty 6 | missingok 7 | } 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | src/ndsend 2 | src/ubclogd 3 | src/vzauth 4 | src/vzctl 5 | src/vzeventd 6 | src/vzlist 7 | src/vznetstat 8 | src/vzsplit 9 | src/vztactl 10 | tags 11 | *.o 12 | .stamp-all 13 | .depend 14 | -------------------------------------------------------------------------------- /etc/modules-load.d/vz.conf: -------------------------------------------------------------------------------- 1 | # Loads appropriate modules needed for dispatcher functionality 2 | 3 | bridge 4 | fuse 5 | vzmon 6 | vzdev 7 | vzstat 8 | vzevent 9 | overlay 10 | veth 11 | br_netfilter 12 | ip_vs 13 | 14 | -------------------------------------------------------------------------------- /etc/ifdown-venet: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONFIG=${1} 4 | if [ -f "$CONFIG" ]; then 5 | . "$CONFIG" 6 | vznet=$DEVICE 7 | else 8 | vznet=$1 9 | fi 10 | 11 | # VZNET device 12 | echo "Shutting down interface $vznet: " 13 | ip link set $vznet down 14 | 15 | 16 | -------------------------------------------------------------------------------- /etc/script.d/README: -------------------------------------------------------------------------------- 1 | This folder is used for custom vzctl configuration scripts. 2 | Scripts found in this folder will be used instead of the original. 3 | 4 | The supported scripts are: 5 | vz-create_prvt 6 | vz-net_add 7 | vz-net_del 8 | vz-pci_configure 9 | vz-setrate 10 | vz-start 11 | vz-stop 12 | 13 | -------------------------------------------------------------------------------- /etc/systemd.d/vzevent.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=vzevent service. 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | Type=forking 7 | PIDFile=/run/vzeventd.pid 8 | ExecStart=/usr/sbin/vzeventd 9 | KillMode=process 10 | Restart=on-failure 11 | RestartSec=5s 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | -------------------------------------------------------------------------------- /etc/dracut/99vzctl/module-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # module-setup for vz modules workaround 3 | 4 | # called by dracut 5 | check() { 6 | return 0 7 | } 8 | 9 | # called by dracut 10 | depends() { 11 | echo bash 12 | return 0 13 | } 14 | 15 | # called by dracut 16 | install() { 17 | rm -f "$initdir/etc/modules-load.d/vz.conf" || : 18 | } 19 | 20 | -------------------------------------------------------------------------------- /etc/systemd.d/vz-k8s-inside-ct.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=@PRODUCT_NAME_SHORT@ K8S inside Container service 3 | Before=vz.service 4 | After=systemd-sysctl.service 5 | After=network.service 6 | 7 | [Service] 8 | ExecStart=/usr/libexec/vz-k8s-inside-ct start 9 | Type=oneshot 10 | RemainAfterExit=yes 11 | TimeoutSec=1h 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | -------------------------------------------------------------------------------- /etc/vzevent.d/ve-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | # This script clean CT resources on stop event 6 | # 7 | 8 | prvt=`/usr/sbin/vzlist -Ho private $ID 2>/dev/null` 9 | [ -f "$prvt/.running" ] && /usr/sbin/vzctl stop $ID --force >/dev/null 2>&1 10 | -------------------------------------------------------------------------------- /etc/systemd.d/vz.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=@PRODUCT_NAME_SHORT@ Container service 3 | After=vcmmd.service vstorage-fs.service vz-cgroup-dummy.service 4 | After=remote-fs.target 5 | Wants=vcmmd.service vz-cgroup-dummy.service 6 | Wants=proc-sys-fs-binfmt_misc.mount 7 | 8 | [Service] 9 | ExecStart=/usr/libexec/vz start 10 | ExecStop=/usr/libexec/vz stop 11 | Type=oneshot 12 | RemainAfterExit=yes 13 | TimeoutSec=1h 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /etc/vps.vzpkgtools.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for vzpkgtools needs. 2 | # 3 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 4 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 5 | 6 | ONBOOT="no" 7 | 8 | PHYSPAGES="262144:262144" 9 | SWAPPAGES="0" 10 | 11 | CPUUNITS="1000" 12 | 13 | DISKSPACE="10485760:10485760" 14 | DISKINODES="200000:220000" 15 | 16 | PLATFORM="linux" 17 | 18 | VE_TYPE="temporary" 19 | NUMMEMORYSUBGROUPS="512" 20 | -------------------------------------------------------------------------------- /etc/0.conf: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 2 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 3 | # 4 | 5 | # This is configuration file for VE0. 6 | # Only UB parameters are processed 7 | # 8 | # Copyright (c) 1999-2015 Parallels IP Holdings GmbH. All rights reserved. 9 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 10 | 11 | ONBOOT="no" 12 | 13 | # UBC parameters (in form of barrier:limit) 14 | OOMGUARPAGES="2147483647:2147483647" 15 | -------------------------------------------------------------------------------- /etc/vps.configure.sample: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | # Sample of custom configuration script. 6 | # This script running on reinstall action inside running VE. 7 | # The original VE is mounted under /old directory. 8 | # 9 | # Parameters passed thru enviroment: 10 | # VEID - id of running VE. 11 | # 12 | # Exitcodes: 13 | # 0 - ok 14 | # other - error 15 | 16 | cp /old/etc/hosts /etc/hosts 17 | exit 0 18 | -------------------------------------------------------------------------------- /etc/0.conf.ia64: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 2 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 3 | # 4 | 5 | # This is configuration file for VE0. 6 | # Only UB parameters are processed 7 | # 8 | # Copyright (c) 1999-2015 Parallels IP Holdings GmbH. All rights reserved. 9 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 10 | 11 | ONBOOT="no" 12 | 13 | # UBC parameters (in form of barrier:limit) 14 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 15 | -------------------------------------------------------------------------------- /etc/0.conf.x86_64: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 2 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 3 | # 4 | 5 | # This is configuration file for VE0. 6 | # Only UB parameters are processed 7 | # 8 | # Copyright (c) 1999-2015 Parallels IP Holdings GmbH. All rights reserved. 9 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 10 | 11 | ONBOOT="no" 12 | 13 | # UBC parameters (in form of barrier:limit) 14 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 15 | -------------------------------------------------------------------------------- /etc/networks_classes: -------------------------------------------------------------------------------- 1 | # Example of networks_classes file 2 | # To get full power of traffic management system 3 | # please define HW node IP networks and your traffic 4 | # classification as described below. 5 | 6 | # HW node VPS's networks 7 | #0 10.10.10.0/24 8 | #0 10.10.15.0/24 9 | 10 | # all IP("local" traffic) 11 | 1 0.0.0.0/0 12 | 13 | # class 2 - "foreign" traffic 14 | #2 10.0.0.0/8 15 | #2 11.0.0.0/8 16 | 17 | # inside "foreign" network there 18 | # is a hole with "local" traffic 19 | #1 10.10.16.0/24 20 | 21 | # all IPv6("local" traffic) 22 | 1 ::0/0 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | vzctl 2 | ===== 3 | 4 | vzctl is a Containers control utility. It is a component of 5 | [OpenVZ](https://openvz.org/). 6 | 7 | OpenVZ is a powerful, easy to use, cost effective server virtualization solution 8 | that empowers PC users with the ability to create completely networked, fully 9 | portable, entirely independent virtual machines and Containers on a single 10 | physical machine. 11 | 12 | ### How to contribute 13 | 14 | * [How to submit a patch](https://openvz.org/How_to_submit_patches) 15 | * [How to contribute to OpenVZ](https://openvz.org/Contribute) 16 | -------------------------------------------------------------------------------- /etc/ve-basic.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "basic" Container. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | PHYSPAGES="65536:65536" 12 | SWAPPAGES="65536" 13 | 14 | CPUUNITS="1000" 15 | 16 | DISKSPACE="2097152:2306048" 17 | DISKINODES="200000:220000" 18 | QUOTATIME="0" 19 | IP_ADDRESS="0.0.0.0" 20 | 21 | PLATFORM="linux" 22 | -------------------------------------------------------------------------------- /etc/ve-basic.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "basic" Container. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 4 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 5 | 6 | VERSION="2" 7 | 8 | ONBOOT="yes" 9 | 10 | PHYSPAGES="65536:65536" 11 | SWAPPAGES="65536" 12 | 13 | CPUUNITS="1000" 14 | 15 | DISKSPACE="10485760:10485760" 16 | DISKINODES="655360:655360" 17 | 18 | QUOTATIME="0" 19 | IP_ADDRESS="0.0.0.0" 20 | 21 | PLATFORM="linux" 22 | -------------------------------------------------------------------------------- /etc/ve-basic.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "basic" Container. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | PHYSPAGES="131072:131072" 12 | SWAPPAGES="0" 13 | 14 | CPUUNITS="1000" 15 | 16 | NETFILTER="full" 17 | 18 | DISKSPACE="10485760:10485760" 19 | DISKINODES="655360:655360" 20 | 21 | QUOTATIME="0" 22 | IP_ADDRESS="0.0.0.0" 23 | 24 | PLATFORM="linux" 25 | NUMMEMORYSUBGROUPS="512" 26 | -------------------------------------------------------------------------------- /etc/ve-vswap.256MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vswap.256MB" Container. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | PHYSPAGES="65536:65536" 12 | SWAPPAGES="0" 13 | 14 | CPUUNITS="1000" 15 | 16 | NETFILTER="full" 17 | 18 | DISKSPACE="10485760:10485760" 19 | DISKINODES="655360:655360" 20 | QUOTATIME="0" 21 | IP_ADDRESS="0.0.0.0" 22 | 23 | PLATFORM="linux" 24 | NUMMEMORYSUBGROUPS="512" 25 | -------------------------------------------------------------------------------- /etc/ve-vswap.512MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vswap.512MB" Container. 2 | #: Configuration file for allocating 512 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | PHYSPAGES="131072:131072" 12 | SWAPPAGES="0" 13 | 14 | CPUUNITS="1000" 15 | 16 | NETFILTER="full" 17 | 18 | DISKSPACE="10485760:10485760" 19 | DISKINODES="655360:655360" 20 | QUOTATIME="0" 21 | IP_ADDRESS="0.0.0.0" 22 | 23 | PLATFORM="linux" 24 | NUMMEMORYSUBGROUPS="512" 25 | -------------------------------------------------------------------------------- /etc/ve-vswap.1024MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vswap.1024MB" Container. 2 | #: Configuration file for allocating 1024 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | PHYSPAGES="262144:262144" 12 | SWAPPAGES="0" 13 | 14 | NETFILTER="full" 15 | 16 | CPUUNITS="1000" 17 | 18 | DISKSPACE="10485760:10485760" 19 | DISKINODES="655360:655360" 20 | QUOTATIME="0" 21 | IP_ADDRESS="0.0.0.0" 22 | 23 | PLATFORM="linux" 24 | NUMMEMORYSUBGROUPS="512" 25 | -------------------------------------------------------------------------------- /etc/ve-vswap.2048MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vswap.2048MB" Container. 2 | #: Configuration file for allocating 2048 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | PHYSPAGES="524288:524288" 12 | SWAPPAGES="0" 13 | 14 | CPUUNITS="1000" 15 | 16 | NETFILTER="full" 17 | 18 | DISKSPACE="10485760:10485760" 19 | DISKINODES="655360:655360" 20 | QUOTATIME="0" 21 | IP_ADDRESS="0.0.0.0" 22 | 23 | PLATFORM="linux" 24 | NUMMEMORYSUBGROUPS="512" 25 | -------------------------------------------------------------------------------- /etc/ve-vswap.plesk.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for Container with 1024MB 2 | # Configuration file for Container with installed Plesk application 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | PHYSPAGES="262144:262144" 12 | SWAPPAGES="0" 13 | 14 | CPUUNITS="1000" 15 | 16 | NETFILTER="full" 17 | 18 | DISKSPACE="10485760:10485760" 19 | DISKINODES="655360:655360" 20 | 21 | QUOTATIME="0" 22 | IP_ADDRESS="0.0.0.0" 23 | 24 | PLATFORM="linux" 25 | NUMMEMORYSUBGROUPS="512" 26 | -------------------------------------------------------------------------------- /man/vzdiskcheck.8: -------------------------------------------------------------------------------- 1 | .TH vzdiskcheck 8 "April 2012" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | vzdiskcheck \- show information about disk space usage of /vz by Containers. 4 | .SH SYNOPSIS 5 | vzdiskcheck [\fB-v\fR] [\fB-x\fR] 6 | .SH DESCRIPTION 7 | This script outputs information on the disk usage in /vz. 8 | .SH OPTIONS 9 | .IP \fB-v\fR 10 | Display information for each CT. 11 | .IP \fB-x\fR 12 | Output in XML format. 13 | .SH RETURN CODE 14 | Returns 0 upon success. 15 | .SH SEE ALSO 16 | .BR vzctl (8). 17 | .SH COPYRIGHT 18 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 19 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 20 | -------------------------------------------------------------------------------- /man/vzcpucheck.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzcpucheck 8 "April 2012" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzcpucheck \- show information about the CPU power and utilization. 5 | .SH SYNOPSIS 6 | vzcpucheck [\fB-v\fR] [\fB-x\fR] 7 | .SH DESCRIPTION 8 | This script outputs information on the CPU power and utilization. 9 | .SH OPTIONS 10 | .IP \fB-v\fR 11 | Display information for each CT. 12 | .IP \fB-x\fR 13 | Output in XML format. 14 | .SH RETURN CODE 15 | Returns 0 upon success. 16 | .SH SEE ALSO 17 | .BR vzctl (8). 18 | .SH COPYRIGHT 19 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 20 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 21 | -------------------------------------------------------------------------------- /man/vzpid.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzpid 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzpid \- display the CT id given the process id (pid). 5 | .SH SYNOPSIS 6 | vzpid [\fB-h\fR] [\fIpid\fR [...]] 7 | .SH DESCRIPTION 8 | This script displays the CT id the process with the given \fIid\fR belongs to. 9 | .SH OPTIONS 10 | .IP \fIpid\fR 11 | Enter the \fIpid\fR of the process to display the CT id where the process takes place. 12 | .SH RETURN CODE 13 | Returns 0 upon a successful execution. 14 | .SH SEE ALSO 15 | .BR vzctl (8). 16 | .SH COPYRIGHT 17 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 18 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 19 | 20 | -------------------------------------------------------------------------------- /etc/systemd.d/vz-cgroup-dummy.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=@PRODUCT_NAME_SHORT@ dummy service to protect from cgroup removal 3 | # Systemd can sometimes remove cgroups of Containers, this service makes each 4 | # cgroup hierarchy present in "used" mask in systemd, and systemd does not 5 | # remove inside "used" hierarchies, so this protects us from cgroups 6 | # disappearing from under criu or any other cgroup user. 7 | 8 | [Service] 9 | Type=oneshot 10 | RemainAfterExit=yes 11 | ExecStart=/usr/bin/true 12 | AllowedCPUs=0-100 13 | CPUWeight=100 14 | IOWeight=100 15 | MemoryAccounting=yes 16 | TasksAccounting=yes 17 | DevicePolicy=closed 18 | Slice=machine.slice 19 | 20 | [Install] 21 | WantedBy=multi-user.target 22 | -------------------------------------------------------------------------------- /man/vzeventd.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzevent 8 "21 Oct 2014" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzeventd \- @PRODUCT_NAME_SHORT@ Container events daemon 5 | .SH SYNOPSIS 6 | vzeventd 7 | .SH DESCRIPTION 8 | vzeventd listens to the @PRODUCT_NAME_SHORT@ kernel for Container events and executes appropriate event scripts. 9 | Each script must be named after the corresponding event and placed in the folder \fB/etc/vz/vzevent.d\fR. 10 | .P 11 | The supported event scripts are: 12 | .br 13 | .B ve-start 14 | .br 15 | .B ve-stop 16 | .br 17 | .B ve-reboot 18 | .SH COPYRIGHT 19 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 20 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 21 | -------------------------------------------------------------------------------- /man/vzreboot.8: -------------------------------------------------------------------------------- 1 | .TH vzreboot 8 "April 2012" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | \fBvzreboot\fR \- @PRODUCT_NAME_SHORT@ fast reboot utility. 4 | .SH SYNOPSIS 5 | \fBvzreboot\fR [\fIkernel_version\fR] 6 | .SH DESCRIPTION 7 | vzreboot is a wrapper for the kexec utility. This utility uses the default kernel from 8 | /etc/grub.conf to directly load it into memory (skipping the hardware initialization phase) 9 | and then boots the new kernel. 10 | With \fIkernel_version\fR, the utility boots the specified kernel. 11 | .TP 12 | .SH SEE ALSO 13 | .BR kexec (8). 14 | .SH COPYRIGHT 15 | Copyright (c) 2012-2017, Parallels International GmbH. All rights reserved. 16 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 17 | -------------------------------------------------------------------------------- /etc/systemd.d/vz-k8s-inside-ct: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | start() 4 | { 5 | modules='xt_set openvswitch vport_vxlan ip_vs_rr ip_vs_wrr ip_vs_sh nf_conntrack_ipv4 nf_conntrack' 6 | for m in $modules; do 7 | modprobe $m 8 | done 9 | 10 | sysctl -w kernel.panic=10 11 | sysctl -w net.bridge.bridge-nf-call-iptables=1 12 | sysctl -w net.bridge.bridge-nf-call-ip6tables=1 13 | t=$(sysctl -n net.nf_conntrack_max) 14 | if [ -z "$t" ]; then 15 | h=150000 16 | else 17 | let h=$t/8*3 18 | fi 19 | echo "Set nf_conntrack hashsize $h" 20 | echo "$h" > /sys/module/nf_conntrack/parameters/hashsize 21 | } 22 | 23 | case "$1" in 24 | start) 25 | start 26 | ;; 27 | *) 28 | echo "Usage: $0 start|stop" 29 | exit 1 30 | esac 31 | -------------------------------------------------------------------------------- /man/vzgetpa.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzgetpa 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzgetpa \- utility that prints location of CT private area. 5 | .SH SYNOPSIS 6 | vzgetpa \fIveid\fR 7 | .SH DESCRIPTION 8 | This script prints the location of CT private area for CT with id \fIveid\fR, 9 | using global configuration file, and per-CT configuration file (if it exist). 10 | .SH DIAGNOSTICS 11 | Returns 0 upon success. If CT id given as an argument is empty or invalid 12 | (not a number), script returns 1. 13 | .SH SEE ALSO 14 | .BR vz (5), 15 | .BR ve.conf (5). 16 | .SH COPYRIGHT 17 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 18 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 19 | -------------------------------------------------------------------------------- /man/toc.man.in: -------------------------------------------------------------------------------- 1 | .nh \" no hyphenation 2 | .ls 3 \" line spacing 3 | .ad c \" centered 4 | .br 5 | .sp 2v 6 | .\" .PSPIC -I -11 i_virtuozzo.eps 7 | .PSPIC -I -13 vz_logo_big.eps 8 | .sp 2v 9 | .ps +16 \" point size 10 | .fam H "\ helvetica 11 | \fBvzctl manual pages\fR 12 | .br 13 | .ps -15 14 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 15 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 16 | .br 17 | .fam T 18 | .sp 3v 19 | .ad l 20 | .ps +7 21 | Table of Contents 22 | .br 23 | .ta 6iR 24 | .ls 3 25 | .tc 26 | .ps -2 27 | Name Page 28 | .br 29 | .ps -3 30 | .vs 8 31 | .ls 2 32 | .tc . 33 | .br 34 | @TOC@ 35 | .\" fix the defaults to not screw up next pages 36 | .ls 1 37 | .ad n 38 | .hy 39 | .tc 40 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | This software is licenced under the GNU GENERAL PUBLIC LICENCE Version 2 | 2. Except that any software in the lib/ directory is for the creation of a 3 | linkable library to the tools and is licensed under the GNU LESSER GENERAL 4 | PUBLIC LICENCE Version 2.1. Contributing Authors agree that their code is 5 | submitted under the licence appropriate for its location within the source 6 | tree (GPL except for LGPL in lib/) and agree that any future patches, provided 7 | they are accepted into the project, may change the licence of their code from 8 | GPL to LGPL by moving pieces of it into lib/ or LGPL to GPL by moving pieces 9 | of it out of lib/ 10 | 11 | Note that the only valid version of the GPL is THIS particular version 12 | of the license (ie v2, not v2.2 or v3.x or whatever), unless explicitly 13 | otherwise stated. 14 | -------------------------------------------------------------------------------- /etc/vzevent.d/ve-fserror: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2021 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | ctid= 6 | SYSFSDEV=/sys/fs/cgroup/devices/machine.slice 7 | 8 | eval $(. /etc/vz/vz.conf && echo ON_VE_FSERROR="${ON_VE_FSERROR}") 9 | 10 | [ "$ON_VE_FSERROR" = "stop" ] || exit 11 | 12 | read -r DEV < /sys/class/block/$ID/dev 13 | [ -z "$DEV" ] && exit 0 14 | 15 | for d in `ls -1 $SYSFSDEV`; do 16 | [ -d "$SYSFSDEV/$d" ] || continue 17 | if grep "b $DEV r" $SYSFSDEV/$d/devices.list; then 18 | ctid=$d 19 | break; 20 | fi 21 | done 22 | 23 | echo "`date --iso-8601=seconds` fserror : Container $ctid : fserror on $ID/$DEV" >> /var/log/vzctl.log 24 | [ -z "$ctid" ] && exit 0 25 | 26 | /usr/sbin/vzctl stop $ctid --fast >/dev/null 2>&1 27 | -------------------------------------------------------------------------------- /etc/vzevent.d/ve-reboot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2015-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | 5 | . /etc/vz/vz.conf 6 | 7 | reboot_disabled() 8 | { 9 | grep -q -e '^[[:space:]]*ALLOWREBOOT=no' -e '^[[:space:]]*ALLOWREBOOT="no"' $1 2>/dev/null 10 | return $? 11 | } 12 | 13 | [ "$ALLOWREBOOT" = "no" ] && exit 0 14 | 15 | if reboot_disabled /etc/vz/conf/$ID.conf; then 16 | exit 0 17 | fi 18 | 19 | opt="--quiet" 20 | for ((i=0; i<20; i++)); do 21 | if ! vzctl --quiet status $ID | grep -wq running; then 22 | vzctl $opt start $ID 23 | [ $? -ne 9 ] && break 24 | 25 | # Process CT locked error 26 | if grep -q 'Backing' "$LOCKDIR/$ID.lck"; then 27 | opt="$opt --skiplock" 28 | continue 29 | fi 30 | fi 31 | sleep 5; 32 | done 33 | 34 | exit 0 35 | -------------------------------------------------------------------------------- /man/vzpurge.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzpurge 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzpurge \- utility to remove unused CT private areas. 5 | .SH SYNOPSIS 6 | vzpurge 7 | .SH DESCRIPTION 8 | This script finds and removes all CT private areas, which have no 9 | appropriate configuration file 10 | (\f(CW/etc/vz/conf/\fR\fIveid\fR\f(CW.conf\fR). 11 | To find private areas, value of \fBVE_PRIVATE\fR variable in 12 | \f(CW/etc/vz/vz\fR configuration file is used. 13 | .P 14 | If CT is running, it is stopped. If CT is mounted, it is unmounted. 15 | .SH NOTES 16 | This script makes assumption that CT private area is unused if CT has 17 | no configuration file, so using it can be \fBdangerous\fR as you can 18 | \fBlost your data\fR. Use it if you are absolutely sure what you are doing. 19 | .SH SEE ALSO 20 | .BR vzctl (8), 21 | .BR vz (5). 22 | .SH COPYRIGHT 23 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 24 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 25 | 26 | -------------------------------------------------------------------------------- /etc/ifup-venet: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONFIG=${1} 4 | if [ -f "$CONFIG" ]; then 5 | . "$CONFIG" 6 | vznet=$DEVICE 7 | else 8 | vznet=$1 9 | fi 10 | 11 | if [ "x$vznet" = "x" ]; then 12 | echo "Error: the network interface is not specified" 13 | exit 1 14 | fi 15 | 16 | if ! ip link show dev $vznet >/dev/null 2>&1; then exit 0; fi 17 | 18 | # VZNET device 19 | 20 | . /usr/libexec/libvzctl/scripts/vz-functions 21 | . /etc/vz/vz.conf 22 | 23 | veip="/proc/vz/veip" 24 | 25 | # configure interface 26 | ip link set $vznet up 2>/dev/null 27 | echo "Bringing up interface $vznet: " 28 | ip addr add 0.0.0.0/0 dev $vznet 2>/dev/null 29 | ip -6 addr add fe80::1/128 dev $vznet 2>/dev/null 30 | 31 | echo "Configuring interface $vznet: " 32 | sysctl -w net.ipv4.conf.$vznet.send_redirects=0 2>/dev/null 33 | sysctl -w net.ipv4.conf.$vznet.rp_filter=0 2>/dev/null 34 | 35 | 36 | if [ -r $veip ]; then 37 | vzgetnetdev 38 | 39 | for veip in `awk '!/^Version:/ { print $1; }' < $veip`; do 40 | vzarp add $veip 41 | vzaddrouting $veip 42 | done 43 | fi 44 | -------------------------------------------------------------------------------- /man/vztactl.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vztactl 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vztactl \- traffic accounting utility. 5 | .SH SYNOPSIS 6 | vztactl \fI[class_load ]\fR \fI[class_unload]\fR \fI[class_list]\fR \fI[reset_ve_stat ]\fR \fI[reset_all_stat]\fR 7 | .SH DESCRIPTION 8 | This utility used to manage traffic accounting. 9 | .SH OPTIONS 10 | .IP "\fBclass_load\fR \fInet_classes_file\fR" 11 | Load traffic classes from file \fInet_classes_file\fR. 12 | .IP "\fBclass_unload\fR \fIclass\fR" 13 | Unload traffic classes. 14 | .IP "\fBclass_list\fR" 15 | Get list loadded traffic classes. 16 | .IP "\fBreset_ve_stat\fR \fIctid\fR" 17 | Reset traffic statistic for CT \fIctid\fR. 18 | .IP "\fBreset_all_stat\fR" 19 | Reset statistics for all CTs. 20 | .SH RETURN CODE 21 | Returns 0 upon success. 22 | .SH SEE ALSO 23 | .BR networks_classes (5). 24 | .SH COPYRIGHT 25 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 26 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 27 | -------------------------------------------------------------------------------- /man/vz-stop.5: -------------------------------------------------------------------------------- 1 | .TH vz-stop 5 "October 2009" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | vz-stop \- Container's shutdown configuration script 4 | .SH SYNOPSIS 5 | /usr/libexec/libvzctl/scripts/vz-stop 6 | .SH DESCRIPTION 7 | The \fBvz-stop\fR script is called by \fBvzctl(8)\fR just after 8 | the CT is shut down. The script can be any executable file 9 | and is usually a shell script. It can be used to perform any 10 | additional cleanup of the CT such as 11 | network cleanup. 12 | .P 13 | Parameters are passed to the script in the form of environment 14 | variables. 15 | .IP VEID 12 16 | Numeric id of CT. 17 | .IP IP_ADDR 12 18 | IP address(es) assigned to the CT. Several addresses should 19 | be divided by spaces. 20 | .SH DIAGNOSTICS 21 | The script is expected to return 0 on success, any other return code 22 | will be printed by \fBvzctl(8)\fR. 23 | .SH SEE ALSO 24 | .BR vzctl (8). 25 | .SH COPYRIGHT 26 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 27 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 28 | -------------------------------------------------------------------------------- /man/vzcfgvalidate.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzcfgvalidate 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzcfgvalidate \- validate the CT configuration file 5 | .SH SYNOPSIS 6 | vzcfgvalidate [\fB-r\fR | \fB-i\fR] \fIconfigfile\fR 7 | .SH DESCRIPTION 8 | This utility checks validity of resource control parameters in the CT configuration \fIconfigfile\fR file. Configurations where resources allowed for a Container exceed the system capacity are not valid and are dangerous from the stability point of view. 9 | There are three severity levels in the output: Error, Warning, Recommendation. 10 | .SH OPTIONS 11 | .TP 12 | \fB-r\fR 13 | Enter the correction mode to fix the wrong resources configuration. 14 | .TP 15 | \fB-i\fR 16 | Enter the interactive correction mode. 17 | .SH DIAGNOSTICS 18 | Normally, the exit status is 0. On a program execution error, the exit status is 1. 19 | If the validation fails, the exit status is 2. 20 | .SH SEE ALSO 21 | .BR ve.conf (5). 22 | .SH COPYRIGHT 23 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 24 | -------------------------------------------------------------------------------- /etc/sysctl.d/99-vzctl.conf: -------------------------------------------------------------------------------- 1 | # WARNING: Do not modify! 2 | # File is replaced upon package update, all changes will be lost. 3 | 4 | # Needed for Containers functionality 5 | 6 | net.ipv4.ip_forward=1 7 | net.ipv6.conf.all.forwarding=1 8 | net.ipv6.conf.all.proxy_ndp=1 9 | 10 | net.ipv4.neigh.default.gc_thresh2=2048 11 | net.ipv4.neigh.default.gc_thresh3=4096 12 | net.ipv6.neigh.default.gc_thresh2=2048 13 | net.ipv6.neigh.default.gc_thresh3=4096 14 | 15 | net.ipv4.conf.default.send_redirects=0 16 | net.ipv4.conf.all.send_redirects=0 17 | net.core.rmem_max = 12582912 18 | net.core.wmem_max = 5242880 19 | 20 | # Do not show kernel addresses inside Container 21 | kernel.kptr_restrict=1 22 | 23 | kernel.pid_max = 1048576 24 | 25 | # Increase namespaces amount limit 26 | user.max_ipc_namespaces = 2147483647 27 | user.max_mnt_namespaces = 2147483647 28 | user.max_net_namespaces = 2147483647 29 | user.max_pid_namespaces = 2147483647 30 | user.max_user_namespaces = 2147483647 31 | user.max_uts_namespaces = 2147483647 32 | 33 | net.core.netdev_max_backlog = 4096 34 | 35 | fs.file-max = 2147483647 36 | -------------------------------------------------------------------------------- /man/vzcheckovr.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzcheckovr 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzcheckovr \- utility to check host server overcommitment. 5 | .SH SYNOPSIS 6 | vzcheckovr [\fB-v\fR] 7 | .SH OPTIONS 8 | .IP \fB-v\fR 4 9 | Verbose output 10 | .SH DESCRIPTION 11 | This utility used to check that the configuration of the whole system is valid. 12 | Configurations where recources allowed to Container exceed system 13 | capacity are not valid an dangerous from the stability point of view. 14 | There are five parameters this utility check: 15 | .PP 16 | \(bu Low Memory 17 | .br 18 | \(bu Memory + Swap 19 | .br 20 | \(bu Alocated Memory 21 | .br 22 | \(bu Total Alloc Limit 23 | .br 24 | \(bu Max Alloc Limit 25 | .PP 26 | The warning levels for these parameters are in \f(CR/ets/sysconfig/vz\fR 27 | configuration file. 28 | .SH DIAGNOSTICS 29 | Normally, exit status is 0. On error, exit status is 1. 30 | .SH SEE ALSO 31 | .BR ve.conf (5), vz (5), 32 | .BR vzmemcheck (8). 33 | .SH COPYRIGHT 34 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 35 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 36 | 37 | -------------------------------------------------------------------------------- /etc/ve-vps.256MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vps.256MB" VPS. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="11055923:11377049" 10 | LOCKEDPAGES="256:256" 11 | PRIVVMPAGES="65536:69632" 12 | SHMPAGES="21504:21504" 13 | NUMPROC="240:240" 14 | PHYSPAGES="0:2147483647" 15 | VMGUARPAGES="33792:2147483647" 16 | OOMGUARPAGES="26112:2147483647" 17 | NUMTCPSOCK="360:360" 18 | NUMFLOCK="188:206" 19 | NUMPTY="16:16" 20 | NUMSIGINFO="256:256" 21 | TCPSNDBUF="1720320:2703360" 22 | TCPRCVBUF="1720320:2703360" 23 | OTHERSOCKBUF="1126080:2097152" 24 | DGRAMRCVBUF="262144:262144" 25 | NUMOTHERSOCK="360:360" 26 | DCACHESIZE="3409920:3624960" 27 | NUMFILE="9312:9312" 28 | AVNUMPROC="180:180" 29 | NUMIPTENT="128:128" 30 | 31 | MEMINFO="privvmpages:1" 32 | 33 | CPUUNITS="1000" 34 | 35 | DISKSPACE="1048576:1153024" 36 | DISKINODES="200000:220000" 37 | QUOTATIME="0" 38 | PLATFORM="linux" 39 | IP_ADDRESS="0.0.0.0" 40 | NUMMEMORYSUBGROUPS="512" 41 | -------------------------------------------------------------------------------- /etc/ve-vps.256MB.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vps.256MB" VPS. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="14372700:14790164" 10 | LOCKEDPAGES="256:256" 11 | PRIVVMPAGES="65536:69632" 12 | SHMPAGES="21504:21504" 13 | NUMPROC="240:240" 14 | PHYSPAGES="0:9223372036854775807" 15 | VMGUARPAGES="33792:9223372036854775807" 16 | OOMGUARPAGES="26112:9223372036854775807" 17 | NUMTCPSOCK="360:360" 18 | NUMFLOCK="188:206" 19 | NUMPTY="16:16" 20 | NUMSIGINFO="256:256" 21 | TCPSNDBUF="1720320:2703360" 22 | TCPRCVBUF="1720320:2703360" 23 | OTHERSOCKBUF="1126080:2097152" 24 | DGRAMRCVBUF="262144:262144" 25 | NUMOTHERSOCK="360:360" 26 | DCACHESIZE="3409920:3624960" 27 | NUMFILE="9312:9312" 28 | AVNUMPROC="180:180" 29 | NUMIPTENT="128:128" 30 | 31 | MEMINFO="privvmpages:1" 32 | 33 | CPUUNITS="1000" 34 | 35 | DISKSPACE="1048576:1153024" 36 | DISKINODES="200000:220000" 37 | QUOTATIME="0" 38 | PLATFORM="linux" 39 | IP_ADDRESS="0.0.0.0" 40 | -------------------------------------------------------------------------------- /etc/ve-vps.512MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vps.512MB" CT. 2 | #: Configuration file for allocating 512 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="22111846:22754099" 10 | LOCKEDPAGES="512:512" 11 | PRIVVMPAGES="131072:139264" 12 | SHMPAGES="43008:43008" 13 | NUMPROC="480:480" 14 | PHYSPAGES="0:2147483647" 15 | VMGUARPAGES="67584:2147483647" 16 | OOMGUARPAGES="52224:2147483647" 17 | NUMTCPSOCK="720:720" 18 | NUMFLOCK="376:412" 19 | NUMPTY="32:32" 20 | NUMSIGINFO="512:512" 21 | TCPSNDBUF="3440640:5406720" 22 | TCPRCVBUF="3440640:5406720" 23 | OTHERSOCKBUF="2252160:4194304" 24 | DGRAMRCVBUF="524288:524288" 25 | NUMOTHERSOCK="720:720" 26 | NUMFILE="18624:18624" 27 | DCACHESIZE="6819840:7249920" 28 | NUMIPTENT="256:256" 29 | AVNUMPROC="360:360" 30 | 31 | MEMINFO="privvmpages:1" 32 | 33 | CPUUNITS="1000" 34 | 35 | DISKSPACE="1048576:1153024" 36 | DISKINODES="200000:220000" 37 | QUOTATIME="0" 38 | PLATFORM="linux" 39 | IP_ADDRESS="0.0.0.0" 40 | NUMMEMORYSUBGROUPS="512" 41 | -------------------------------------------------------------------------------- /etc/vps.vzpkgtools.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for vzpkgtools needs. 2 | # 3 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 4 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 5 | 6 | VERSION="2" 7 | 8 | ONBOOT="no" 9 | 10 | KMEMSIZE="54525952:58124288" 11 | LOCKEDPAGES="256:256" 12 | PRIVVMPAGES="200704:204800" 13 | SHMPAGES="21504:21504" 14 | NUMPROC="240:240" 15 | PHYSPAGES="0:9223372036854775807" 16 | VMGUARPAGES="33792:9223372036854775807" 17 | OOMGUARPAGES="26112:9223372036854775807" 18 | NUMTCPSOCK="360:360" 19 | NUMFLOCK="188:206" 20 | NUMPTY="16:16" 21 | NUMSIGINFO="256:256" 22 | TCPSNDBUF="1720320:2703360" 23 | TCPRCVBUF="1720320:2703360" 24 | OTHERSOCKBUF="1126080:2097152" 25 | DGRAMRCVBUF="262144:262144" 26 | NUMOTHERSOCK="512:512" 27 | DCACHESIZE="6819840:7249920" 28 | NUMFILE="9312:9312" 29 | AVNUMPROC="180:180" 30 | NUMIPTENT="128:128" 31 | 32 | MEMINFO="privvmpages:1" 33 | 34 | CPUUNITS="1000" 35 | 36 | DISKSPACE="10485760:11534336" 37 | DISKINODES="200000:220000" 38 | QUOTATIME="0" 39 | PLATFORM="linux" 40 | 41 | SLMMEMORYLIMIT="268435456:268435456" 42 | VE_TYPE="temporary" 43 | -------------------------------------------------------------------------------- /etc/vps.vzpkgtools.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for vzpkgtools needs. 2 | # 3 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 4 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 5 | 6 | VERSION="2" 7 | 8 | ONBOOT="no" 9 | 10 | KMEMSIZE="54525952:58124288" 11 | LOCKEDPAGES="256:256" 12 | PRIVVMPAGES="200704:204800" 13 | SHMPAGES="131072:131072" 14 | NUMPROC="240:240" 15 | PHYSPAGES="0:9223372036854775807" 16 | VMGUARPAGES="33792:9223372036854775807" 17 | OOMGUARPAGES="26112:9223372036854775807" 18 | NUMTCPSOCK="360:360" 19 | NUMFLOCK="188:206" 20 | NUMPTY="16:16" 21 | NUMSIGINFO="256:256" 22 | TCPSNDBUF="1720320:2703360" 23 | TCPRCVBUF="1720320:2703360" 24 | OTHERSOCKBUF="1126080:2097152" 25 | DGRAMRCVBUF="262144:262144" 26 | NUMOTHERSOCK="512:512" 27 | DCACHESIZE="6819840:7249920" 28 | NUMFILE="9312:9312" 29 | AVNUMPROC="180:180" 30 | NUMIPTENT="128:128" 31 | 32 | MEMINFO="privvmpages:1" 33 | 34 | CPUUNITS="1000" 35 | 36 | DISKSPACE="10485760:10485760" 37 | DISKINODES="200000:220000" 38 | QUOTATIME="0" 39 | PLATFORM="linux" 40 | 41 | SLMMEMORYLIMIT="268435456:268435456" 42 | VE_TYPE="temporary" 43 | -------------------------------------------------------------------------------- /etc/ve-vps.512MB.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vps.512MB" CT. 2 | #: Configuration file for allocating 512 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="28745400:29580328" 10 | LOCKEDPAGES="512:512" 11 | PRIVVMPAGES="131072:139264" 12 | SHMPAGES="43008:43008" 13 | NUMPROC="480:480" 14 | PHYSPAGES="0:9223372036854775807" 15 | VMGUARPAGES="67584:9223372036854775807" 16 | OOMGUARPAGES="52224:9223372036854775807" 17 | NUMTCPSOCK="720:720" 18 | NUMFLOCK="376:412" 19 | NUMPTY="32:32" 20 | NUMSIGINFO="512:512" 21 | TCPSNDBUF="3440640:5406720" 22 | TCPRCVBUF="3440640:5406720" 23 | OTHERSOCKBUF="2252160:4194304" 24 | DGRAMRCVBUF="524288:524288" 25 | NUMOTHERSOCK="720:720" 26 | NUMFILE="18624:18624" 27 | DCACHESIZE="6819840:7249920" 28 | NUMIPTENT="256:256" 29 | AVNUMPROC="360:360" 30 | 31 | MEMINFO="privvmpages:1" 32 | 33 | CPUUNITS="1000" 34 | 35 | DISKSPACE="1048576:1153024" 36 | DISKINODES="200000:220000" 37 | QUOTATIME="0" 38 | PLATFORM="linux" 39 | IP_ADDRESS="0.0.0.0" 40 | -------------------------------------------------------------------------------- /etc/ve-vps.1024MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vps.1024MB" CT. 2 | #: Configuration file for allocating 1024 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="44223692:45508198" 10 | LOCKEDPAGES="1024:1024" 11 | PRIVVMPAGES="262144:278528" 12 | SHMPAGES="86016:86016" 13 | NUMPROC="960:960" 14 | PHYSPAGES="0:2147483647" 15 | VMGUARPAGES="135168:2147483647" 16 | OOMGUARPAGES="104448:2147483647" 17 | NUMTCPSOCK="1440:1440" 18 | NUMFLOCK="752:824" 19 | NUMPTY="64:64" 20 | NUMSIGINFO="1024:1024" 21 | TCPSNDBUF="6881280:10813440" 22 | TCPRCVBUF="6881280:10813440" 23 | OTHERSOCKBUF="4504320:8388608" 24 | DGRAMRCVBUF="1048576:1048576" 25 | NUMOTHERSOCK="1440:1440" 26 | NUMFILE="37248:37248" 27 | DCACHESIZE="13639680:14499840" 28 | NUMIPTENT="512:512" 29 | AVNUMPROC="720:720" 30 | 31 | MEMINFO="privvmpages:1" 32 | 33 | CPUUNITS="1000" 34 | 35 | DISKSPACE="1048576:1153024" 36 | DISKINODES="200000:220000" 37 | QUOTATIME="0" 38 | PLATFORM="linux" 39 | IP_ADDRESS="0.0.0.0" 40 | NUMMEMORYSUBGROUPS="512" 41 | -------------------------------------------------------------------------------- /etc/ve-vps.1024MB.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vps.1024MB" CT. 2 | #: Configuration file for allocating 1024 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="57490800:59160657" 10 | LOCKEDPAGES="1024:1024" 11 | PRIVVMPAGES="262144:278528" 12 | SHMPAGES="86016:86016" 13 | NUMPROC="960:960" 14 | PHYSPAGES="0:9223372036854775807" 15 | VMGUARPAGES="135168:9223372036854775807" 16 | OOMGUARPAGES="104448:9223372036854775807" 17 | NUMTCPSOCK="1440:1440" 18 | NUMFLOCK="752:824" 19 | NUMPTY="64:64" 20 | NUMSIGINFO="1024:1024" 21 | TCPSNDBUF="6881280:10813440" 22 | TCPRCVBUF="6881280:10813440" 23 | OTHERSOCKBUF="4504320:8388608" 24 | DGRAMRCVBUF="1048576:1048576" 25 | NUMOTHERSOCK="1440:1440" 26 | NUMFILE="37248:37248" 27 | DCACHESIZE="13639680:14499840" 28 | NUMIPTENT="512:512" 29 | AVNUMPROC="720:720" 30 | 31 | MEMINFO="privvmpages:1" 32 | 33 | CPUUNITS="1000" 34 | 35 | DISKSPACE="1048576:1153024" 36 | DISKINODES="200000:220000" 37 | QUOTATIME="0" 38 | PLATFORM="linux" 39 | IP_ADDRESS="0.0.0.0" 40 | -------------------------------------------------------------------------------- /etc/ve-vps.2048MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vps.2048MB" CT. 2 | #: Configuration file for allocating 2048 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="88447385:91016396" 10 | LOCKEDPAGES="2048:2048" 11 | PRIVVMPAGES="524288:557056" 12 | SHMPAGES="172032:172032" 13 | NUMPROC="1920:1920" 14 | PHYSPAGES="0:2147483647" 15 | VMGUARPAGES="270336:2147483647" 16 | OOMGUARPAGES="208896:2147483647" 17 | NUMTCPSOCK="2880:2880" 18 | NUMFLOCK="1504:1648" 19 | NUMPTY="128:128" 20 | NUMSIGINFO="1024:1024" 21 | TCPSNDBUF="13762560:21626880" 22 | TCPRCVBUF="13762560:21626880" 23 | OTHERSOCKBUF="9008640:16777216" 24 | DGRAMRCVBUF="2097152:2097152" 25 | NUMOTHERSOCK="2880:2880" 26 | NUMFILE="74496:74496" 27 | DCACHESIZE="27279360:28999680" 28 | NUMIPTENT="1024:1024" 29 | AVNUMPROC="1440:1440" 30 | 31 | MEMINFO="privvmpages:1" 32 | 33 | CPUUNITS="1000" 34 | 35 | DISKSPACE="1048576:1153024" 36 | DISKINODES="200000:220000" 37 | QUOTATIME="0" 38 | PLATFORM="linux" 39 | IP_ADDRESS="0.0.0.0" 40 | NUMMEMORYSUBGROUPS="512" 41 | -------------------------------------------------------------------------------- /etc/ve-vps.2048MB.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "vps.2048MB" CT. 2 | #: Configuration file for allocating 2048 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="114981601:118321315" 10 | LOCKEDPAGES="2048:2048" 11 | PRIVVMPAGES="524288:557056" 12 | SHMPAGES="172032:172032" 13 | NUMPROC="1920:1920" 14 | PHYSPAGES="0:9223372036854775807" 15 | VMGUARPAGES="270336:9223372036854775807" 16 | OOMGUARPAGES="208896:9223372036854775807" 17 | NUMTCPSOCK="2880:2880" 18 | NUMFLOCK="1504:1648" 19 | NUMPTY="128:128" 20 | NUMSIGINFO="1024:1024" 21 | TCPSNDBUF="13762560:21626880" 22 | TCPRCVBUF="13762560:21626880" 23 | OTHERSOCKBUF="9008640:16777216" 24 | DGRAMRCVBUF="2097152:2097152" 25 | NUMOTHERSOCK="2880:2880" 26 | NUMFILE="74496:74496" 27 | DCACHESIZE="27279360:28999680" 28 | NUMIPTENT="1024:1024" 29 | AVNUMPROC="1440:1440" 30 | 31 | MEMINFO="privvmpages:1" 32 | 33 | CPUUNITS="1000" 34 | 35 | DISKSPACE="1048576:1153024" 36 | DISKINODES="200000:220000" 37 | QUOTATIME="0" 38 | PLATFORM="linux" 39 | IP_ADDRESS="0.0.0.0" 40 | -------------------------------------------------------------------------------- /man/vz-start.5: -------------------------------------------------------------------------------- 1 | .TH vz-start 5 "October 2009" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | vz-start \- Container's startup configuration script 4 | .SH SYNOPSIS 5 | /usr/libexec/libvzctl/scripts/vz-start 6 | .SH DESCRIPTION 7 | The \fBvz-start\fR script is called by \fBvzctl(8)\fR just before CT 8 | is started. The script can be any executable file 9 | and is usually a shell script. It can be used to perform any 10 | additional setup of the CT such as network setup. 11 | .P 12 | Parameters are passed to the script in the form of environment 13 | variables. Currently only two variables IP_ADDR and VE_ID 14 | are defined. 15 | .IP IP_ADDR 12 16 | IP address(es) assigned to the CT. 17 | .IP VE_ROOT 12 18 | Root directory of given CT. 19 | .IP DIST 12 20 | Name of the distribution this CT runs (like \fBredhat-7.1\fR). Used for script 21 | to do distribution-dependent setup. 22 | .SH DIAGNOSTICS 23 | The script is expected to return 0 on success, any other return code 24 | will be printed by \fBvzctl\fR, but the CT booting will not be 25 | terminated. 26 | .SH SEE ALSO 27 | .BR vzctl (8). 28 | .SH COPYRIGHT 29 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 30 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 31 | -------------------------------------------------------------------------------- /man/vzauth.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzauth 8 "March 2012" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzauth \- authenticate a user in a CT 5 | .SH SYNOPSIS 6 | vzauth [\fB-t\fR \fBsystem\fR|\fBpleskadmin\fR] [\fB-g\fR \fIgid\fR] \fIctid\fR \fIuser\fR 7 | .SH DESCRIPTION 8 | This utility is used to authenticate the \fIuser\fR in a CT \fIctid\fR. User password is passed 9 | to \fBstdin\fR. This utility mounts the CT if it is unmounted, reads \fB$VE_ROOT/etc/shadow\fR and then uses \fBcrypt\fR(3) to authenticate the user. 10 | If \fB-g\fR specified, user is checked to be a member of group \fIgid\fR. 11 | .SH DIAGNOSTICS 12 | .IP \fB0\fR 13 | access granted 14 | .IP \fB1\fR 15 | invalid parameters 16 | .IP \fB2\fR 17 | unable to read VE_ROOT from the CT configuration file. 18 | .IP \fB3\fR 19 | access denided 20 | .IP \fB4\fR 21 | unable to mount the CT 22 | .IP \fB5\fR 23 | unable to read the password 24 | .IP \fB6\fR 25 | unable to open /etc/shadow 26 | .IP \fB7\fR 27 | unable to open /etc/psa/.psa.shadow 28 | .SH EXAMPLES 29 | echo 'passwd' | vzauth 1 root 30 | .SH SEE ALSO 31 | .BR crypt (3) 32 | .SH COPYRIGHT 33 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 34 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 35 | -------------------------------------------------------------------------------- /include/tmplmn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | /* $Id$ */ 25 | #ifndef _TMPLMN_H_ 26 | #define _TMPLMN_H_ 27 | char *get_dist_type(struct CParam *param); 28 | char *get_ostmpl(struct CParam *param); 29 | #endif 30 | -------------------------------------------------------------------------------- /include/script.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef _SCRIPT_H_ 25 | #define _SCRIPT_H_ 26 | char *readscript(char *name, int use_f); 27 | char *makecmdline(char **argv); 28 | void freearg(char **arg); 29 | #endif /* _SCRIPT_H_ */ 30 | 31 | -------------------------------------------------------------------------------- /man/toc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if test $# -ne 1; then 4 | echo "Usage:" `basename $0` "manfile.ps" 1>&2 5 | exit 0; 6 | fi 7 | 8 | if ! test -f $1; then 9 | echo "File not found: $1" 1>&2 10 | exit 1; 11 | fi 12 | 13 | grep -A5 "^%%Page:" $1 | tr '\\' '*' | sed "s/*214/fi/" | awk ' 14 | BEGIN { 15 | p=0 16 | prevname="no"; 17 | } 18 | /^%%Page: / { 19 | p=$2; 20 | } 21 | /\/F0 10.95\/Times-Roman\@0 SF/ { 22 | i=0; l=0; sn=3; 23 | do { 24 | if (l>0) 25 | { 26 | getline; 27 | sn=0; 28 | } 29 | for (n=sn; n <= NF; n++) 30 | { 31 | prev=""; 32 | for(x=1; x<=length($n); x++) 33 | { 34 | c=substr($n, x, 1); 35 | if (i==0) 36 | { 37 | if (c == "(") 38 | { 39 | i=1; 40 | continue; 41 | } 42 | 43 | } 44 | else if (i==1) 45 | { 46 | if (c == ")") 47 | { 48 | if (prev == "*") 49 | { 50 | name=name ")" 51 | i=2; 52 | } 53 | else 54 | i=0; 55 | } 56 | } 57 | if ((i==1) && (c != "*")) 58 | name=name c; 59 | prev=c; 60 | } 61 | } 62 | l++; 63 | } while ( substr(name, length(name), 1) != ")" ); 64 | 65 | if (name != prevname) 66 | { 67 | print name " " p+1; 68 | print ".br" 69 | } 70 | prevname=name; 71 | name=""; 72 | }' 73 | -------------------------------------------------------------------------------- /man/vz-postinst.5: -------------------------------------------------------------------------------- 1 | .TH vz-postinst 5 "October 2009" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | vz-postinst \- Container's script to perform postinstall tasks 4 | .SH SYNOPSIS 5 | /usr/libexec/libvzctl/scripts/vz-postinst 6 | .SH DESCRIPTION 7 | The \fBvz-postinst\fR script is called by \fBvzctl(8)\fR after CT private 8 | area is created and mounted. 9 | .P 10 | This script performs various postinstall tasks. 11 | .P 12 | It randomizes times in \fIVE_ROOT\fR/etc/crontab file to prevent starting cron 13 | jobs in all VEs in the same time. 14 | .P 15 | It also disables root password if the password field is empty in 16 | \fIVE_ROOT\fR/etc/passwd file. 17 | .SH OPTIONS 18 | Parameters are passed to the script in the form of environment 19 | variables. The following variables can be defined: 20 | .IP VE_ROOT 12 21 | Root directory of CT. 22 | .IP DIST 12 23 | Name of the distribution this CT runs (like \fBredhat-7.1\fR). Used for script 24 | to do distribution-dependent setup. 25 | .SH DIAGNOSTICS 26 | The script is expected to return 0 on success, any other return code 27 | will be printed by \fBvzctl\fR. 28 | .SH SEE ALSO 29 | .BR vzctl (8). 30 | .SH COPYRIGHT 31 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 32 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 33 | -------------------------------------------------------------------------------- /man/vz-create_prvt.5: -------------------------------------------------------------------------------- 1 | .TH vz-create_prvt 5 "October 2009" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | vz-create_prvt \- Container's script for creating CT private area 4 | .SH SYNOPSIS 5 | /usr/libexec/libvzctl/scripts/vz-create_prvt 6 | .SH DESCRIPTION 7 | The \fBvz-create_prvt\fR script is called by \fBvzctl(8)\fR when it gets 8 | called with \fIcreate\fR command. 9 | The script can be any executable file and is usually a shell script. 10 | .P 11 | This script is expected to create CT private area from 12 | private area template, and randomize its crontab. 13 | .P 14 | Parameters are passed to the script in the form of environment 15 | variables. The following variables can be defined: 16 | .IP VEID 12 17 | Numeric id of CT. 18 | .IP PRIVATE_TEMPLATE 19 | Path to private area template, used as a source. 20 | .IP VE_PRIVATE 12 21 | Path to root of CT private areas. 22 | .IP DIR 12 23 | Suffix to CT private area path, used as a destination. 24 | Full path is VE_PRIVATE/tmp/DIR. 25 | .SH DIAGNOSTICS 26 | The script is expected to return 0 on success, any other return code 27 | will be printed by \fBvzctl\fR. 28 | .SH SEE ALSO 29 | .BR vzctl (8). 30 | .SH COPYRIGHT 31 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 32 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 33 | -------------------------------------------------------------------------------- /etc/ve-cpanel.conf-sample: -------------------------------------------------------------------------------- 1 | #: Configuration file for the VPS running cPanel Control Panel 2 | # 3 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 4 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 5 | 6 | VERSION="2" 7 | 8 | ONBOOT="no" 9 | 10 | # UBC parameters (in form of barrier:limit) 11 | # Primary parameters 12 | AVNUMPROC="40:40" 13 | NUMPROC="100:100" 14 | NUMTCPSOCK="80:80" 15 | NUMOTHERSOCK="80:80" 16 | VMGUARPAGES="6144:2147483647" 17 | # Secondary parameters 18 | KMEMSIZE="4194304:4471128" 19 | TCPSNDBUF="319488:524288" 20 | TCPRCVBUF="319488:524288" 21 | OTHERSOCKBUF="132096:336896" 22 | DGRAMRCVBUF="132096:132096" 23 | OOMGUARPAGES="6144:2147483647" 24 | # Auxiliary parameters 25 | LOCKEDPAGES="32:32" 26 | SHMPAGES="8192:8192" 27 | PRIVVMPAGES="50000:60000" 28 | NUMFILE="1280:1280" 29 | NUMFLOCK="100:110" 30 | NUMPTY="16:16" 31 | NUMSIGINFO="256:256" 32 | DCACHESIZE="524288:548864" 33 | 34 | PHYSPAGES="0:2147483647" 35 | NUMIPTENT="150:150" 36 | 37 | # Disk quota parameters (in form of softlimit:hardlimit) 38 | DISKSPACE="1048576:1153024" 39 | DISKINODES="200000:220000" 40 | QUOTATIME="0" 41 | 42 | # CPU fair sheduler parameter 43 | CPUUNITS="1000" 44 | 45 | QUOTAUGIDLIMIT="150" 46 | PLATFORM="linux" 47 | IP_ADDRESS="0.0.0.0" 48 | NUMMEMORYSUBGROUPS="512" 49 | -------------------------------------------------------------------------------- /etc/ve-cpanel.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | #: Configuration file for the VPS running cPanel Control Panel 2 | # 3 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 4 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 5 | 6 | VERSION="2" 7 | 8 | ONBOOT="no" 9 | 10 | # UBC parameters (in form of barrier:limit) 11 | # Primary parameters 12 | AVNUMPROC="40:40" 13 | NUMPROC="100:100" 14 | NUMTCPSOCK="80:80" 15 | NUMOTHERSOCK="80:80" 16 | VMGUARPAGES="6144:9223372036854775807" 17 | # Secondary parameters 18 | KMEMSIZE="5452595:5812466" 19 | TCPSNDBUF="319488:524288" 20 | TCPRCVBUF="319488:524288" 21 | OTHERSOCKBUF="132096:336896" 22 | DGRAMRCVBUF="132096:132096" 23 | OOMGUARPAGES="6144:9223372036854775807" 24 | # Auxiliary parameters 25 | LOCKEDPAGES="32:32" 26 | SHMPAGES="8192:8192" 27 | PRIVVMPAGES="50000:60000" 28 | NUMFILE="1280:1280" 29 | NUMFLOCK="100:110" 30 | NUMPTY="16:16" 31 | NUMSIGINFO="256:256" 32 | DCACHESIZE="524288:548864" 33 | 34 | PHYSPAGES="0:9223372036854775807" 35 | NUMIPTENT="150:150" 36 | 37 | # Disk quota parameters (in form of softlimit:hardlimit) 38 | DISKSPACE="1048576:1153024" 39 | DISKINODES="200000:220000" 40 | QUOTATIME="0" 41 | 42 | # CPU fair sheduler parameter 43 | CPUUNITS="1000" 44 | 45 | QUOTAUGIDLIMIT="150" 46 | PLATFORM="linux" 47 | IP_ADDRESS="0.0.0.0" 48 | -------------------------------------------------------------------------------- /etc/ve-slm.plesk.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for CT with 1024MB 2 | #: Configuration file for CT with installed Plesk application 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="2147483647:2147483647" 10 | LOCKEDPAGES="2147483647:2147483647" 11 | PRIVVMPAGES="2147483647:2147483647" 12 | SHMPAGES="2147483647:2147483647" 13 | NUMPROC="32567:32567" 14 | PHYSPAGES="2147483647:2147483647" 15 | VMGUARPAGES="2147483647:2147483647" 16 | OOMGUARPAGES="2147483647:2147483647" 17 | NUMTCPSOCK="2147483647:2147483647" 18 | NUMFLOCK="2147483647:2147483647" 19 | NUMPTY="255:255" 20 | NUMSIGINFO="1024:1024" 21 | TCPSNDBUF="2147483647:2147483647" 22 | TCPRCVBUF="2147483647:2147483647" 23 | OTHERSOCKBUF="2147483647:2147483647" 24 | DGRAMRCVBUF="2147483647:2147483647" 25 | NUMOTHERSOCK="2147483647:2147483647" 26 | NUMFILE="2147483647:2147483647" 27 | DCACHESIZE="2147483647:2147483647" 28 | NUMIPTENT="2147483647:2147483647" 29 | 30 | CPUUNITS="1000" 31 | 32 | DISKSPACE="5242880:5767170" 33 | DISKINODES="350000:370000" 34 | QUOTATIME="0" 35 | PLATFORM="linux" 36 | 37 | SLMMODE="all" 38 | SLMMEMORYLIMIT="1073741824:1073741824" 39 | IP_ADDRESS="0.0.0.0" 40 | NUMMEMORYSUBGROUPS="512" 41 | -------------------------------------------------------------------------------- /etc/ve-slm.256MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.256MB" VPS. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="2147483647:2147483647" 12 | LOCKEDPAGES="2147483647:2147483647" 13 | PRIVVMPAGES="2147483647:2147483647" 14 | SHMPAGES="2147483647:2147483647" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="2147483647:2147483647" 17 | VMGUARPAGES="2147483647:2147483647" 18 | OOMGUARPAGES="2147483647:2147483647" 19 | NUMTCPSOCK="2147483647:2147483647" 20 | NUMFLOCK="2147483647:2147483647" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="2147483647:2147483647" 24 | TCPRCVBUF="2147483647:2147483647" 25 | OTHERSOCKBUF="2147483647:2147483647" 26 | DGRAMRCVBUF="2147483647:2147483647" 27 | NUMOTHERSOCK="2147483647:2147483647" 28 | DCACHESIZE="2147483647:2147483647" 29 | NUMFILE="2147483647:2147483647" 30 | NUMIPTENT="2147483647:2147483647" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="268435456:268435456" 41 | IP_ADDRESS="0.0.0.0" 42 | NUMMEMORYSUBGROUPS="512" 43 | -------------------------------------------------------------------------------- /etc/ve-slm.512MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.512MB" CT. 2 | #: Configuration file for allocating 512 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="2147483647:2147483647" 12 | LOCKEDPAGES="2147483647:2147483647" 13 | PRIVVMPAGES="2147483647:2147483647" 14 | SHMPAGES="2147483647:2147483647" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="2147483647:2147483647" 17 | VMGUARPAGES="2147483647:2147483647" 18 | OOMGUARPAGES="2147483647:2147483647" 19 | NUMTCPSOCK="2147483647:2147483647" 20 | NUMFLOCK="2147483647:2147483647" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="2147483647:2147483647" 24 | TCPRCVBUF="2147483647:2147483647" 25 | OTHERSOCKBUF="2147483647:2147483647" 26 | DGRAMRCVBUF="2147483647:2147483647" 27 | NUMOTHERSOCK="2147483647:2147483647" 28 | NUMFILE="2147483647:2147483647" 29 | DCACHESIZE="2147483647:2147483647" 30 | NUMIPTENT="2147483647:2147483647" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="536870912:536870912" 41 | IP_ADDRESS="0.0.0.0" 42 | NUMMEMORYSUBGROUPS="512" 43 | -------------------------------------------------------------------------------- /etc/ve-slm.1024MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.1024MB" CT. 2 | #: Configuration file for allocating 1024 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="2147483647:2147483647" 12 | LOCKEDPAGES="2147483647:2147483647" 13 | PRIVVMPAGES="2147483647:2147483647" 14 | SHMPAGES="2147483647:2147483647" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="2147483647:2147483647" 17 | VMGUARPAGES="2147483647:2147483647" 18 | OOMGUARPAGES="2147483647:2147483647" 19 | NUMTCPSOCK="2147483647:2147483647" 20 | NUMFLOCK="2147483647:2147483647" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="2147483647:2147483647" 24 | TCPRCVBUF="2147483647:2147483647" 25 | OTHERSOCKBUF="2147483647:2147483647" 26 | DGRAMRCVBUF="2147483647:2147483647" 27 | NUMOTHERSOCK="2147483647:2147483647" 28 | NUMFILE="2147483647:2147483647" 29 | DCACHESIZE="2147483647:2147483647" 30 | NUMIPTENT="2147483647:2147483647" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="1073741824:1073741824" 41 | IP_ADDRESS="0.0.0.0" 42 | NUMMEMORYSUBGROUPS="512" 43 | -------------------------------------------------------------------------------- /etc/ve-slm.2048MB.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.2048MB" CT. 2 | #: Configuration file for allocating 2048 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="2147483647:2147483647" 12 | LOCKEDPAGES="2147483647:2147483647" 13 | PRIVVMPAGES="2147483647:2147483647" 14 | SHMPAGES="2147483647:2147483647" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="2147483647:2147483647" 17 | VMGUARPAGES="2147483647:2147483647" 18 | OOMGUARPAGES="2147483647:2147483647" 19 | NUMTCPSOCK="2147483647:2147483647" 20 | NUMFLOCK="2147483647:2147483647" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="2147483647:2147483647" 24 | TCPRCVBUF="2147483647:2147483647" 25 | OTHERSOCKBUF="2147483647:2147483647" 26 | DGRAMRCVBUF="2147483647:2147483647" 27 | NUMOTHERSOCK="2147483647:2147483647" 28 | NUMFILE="2147483647:2147483647" 29 | DCACHESIZE="2147483647:2147483647" 30 | NUMIPTENT="2147483647:2147483647" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="2147483648:2147483648" 41 | IP_ADDRESS="0.0.0.0" 42 | NUMMEMORYSUBGROUPS="512" 43 | -------------------------------------------------------------------------------- /etc/ve-light.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "light" CT. 2 | # Parameters are taken from "AdminGuide2-exm.tex,v 1.4", example A. 3 | #: Light config file 4 | # 5 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 6 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 7 | 8 | VERSION="2" 9 | 10 | ONBOOT="no" 11 | 12 | # UBC parameters (in form of barrier:limit) 13 | # Primary parameters 14 | AVNUMPROC="15:15" 15 | NUMPROC="40:40" 16 | NUMTCPSOCK="40:40" 17 | NUMOTHERSOCK="40:40" 18 | VMGUARPAGES="1725:2147483647" 19 | # Secondary parameters 20 | KMEMSIZE="870400:923648" 21 | TCPSNDBUF="159744:262144" 22 | TCPRCVBUF="159744:262144" 23 | OTHERSOCKBUF="135168:196608" 24 | DGRAMRCVBUF="135168:196608" 25 | OOMGUARPAGES="1725:2147483647" 26 | # Auxiliary parameters 27 | LOCKEDPAGES="4:4" 28 | SHMPAGES="1152:1152" 29 | PRIVVMPAGES="7680:8448" 30 | NUMFILE="512:512" 31 | NUMFLOCK="50:60" 32 | NUMPTY="4:4" 33 | NUMSIGINFO="256:256" 34 | DCACHESIZE="196608:202752" 35 | 36 | PHYSPAGES="0:2147483647" 37 | NUMIPTENT="16:16" 38 | 39 | # Disk quota parameters (in form of softlimit:hardlimit) 40 | DISKSPACE="204800:204800" 41 | DISKINODES="80000:88000" 42 | QUOTATIME="0" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="250" 46 | PLATFORM="linux" 47 | IP_ADDRESS="0.0.0.0" 48 | NUMMEMORYSUBGROUPS="512" 49 | -------------------------------------------------------------------------------- /etc/ve-light.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "light" CT. 2 | # Parameters are taken from "AdminGuide2-exm.tex,v 1.4", example A. 3 | #: Light config file 4 | # 5 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 6 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 7 | 8 | VERSION="2" 9 | 10 | ONBOOT="no" 11 | 12 | # UBC parameters (in form of barrier:limit) 13 | # Primary parameters 14 | AVNUMPROC="15:15" 15 | NUMPROC="40:40" 16 | NUMTCPSOCK="40:40" 17 | NUMOTHERSOCK="40:40" 18 | VMGUARPAGES="1725:9223372036854775807" 19 | # Secondary parameters 20 | KMEMSIZE="1131520:12007424" 21 | TCPSNDBUF="159744:262144" 22 | TCPRCVBUF="159744:262144" 23 | OTHERSOCKBUF="61440:163840" 24 | DGRAMRCVBUF="32768:32768" 25 | OOMGUARPAGES="1725:9223372036854775807" 26 | # Auxiliary parameters 27 | LOCKEDPAGES="4:4" 28 | SHMPAGES="1152:1152" 29 | PRIVVMPAGES="7680:8448" 30 | NUMFILE="512:512" 31 | NUMFLOCK="50:60" 32 | NUMPTY="4:4" 33 | NUMSIGINFO="256:256" 34 | DCACHESIZE="196608:202752" 35 | 36 | PHYSPAGES="0:9223372036854775807" 37 | NUMIPTENT="16:16" 38 | 39 | # Disk quota parameters (in form of softlimit:hardlimit) 40 | DISKSPACE="204800:204800" 41 | DISKINODES="80000:88000" 42 | QUOTATIME="0" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="250" 46 | PLATFORM="linux" 47 | IP_ADDRESS="0.0.0.0" 48 | -------------------------------------------------------------------------------- /etc/ve-confixx.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for CT with confixx. 2 | #: Configuration file for running Confixx Control Panels 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | # UBC parameters (in form of barrier:limit) 12 | # Primary parameters 13 | AVNUMPROC="40:40" 14 | NUMPROC="100:100" 15 | NUMTCPSOCK="80:80" 16 | NUMOTHERSOCK="80:80" 17 | VMGUARPAGES="6144:9223372036854775807" 18 | # Secondary parameters 19 | KMEMSIZE="54525952:58124288" 20 | TCPSNDBUF="319488:524288" 21 | TCPRCVBUF="319488:524288" 22 | OTHERSOCKBUF="132096:336896" 23 | DGRAMRCVBUF="132096:132096" 24 | OOMGUARPAGES="6144:9223372036854775807" 25 | # Auxiliary parameters 26 | LOCKEDPAGES="32:32" 27 | SHMPAGES="24000:24000" 28 | PRIVVMPAGES="27033:29491" 29 | NUMFILE="1280:1280" 30 | NUMFLOCK="100:110" 31 | NUMPTY="16:16" 32 | NUMSIGINFO="256:256" 33 | DCACHESIZE="524288:548864" 34 | 35 | PHYSPAGES="0:9223372036854775807" 36 | NUMIPTENT="128:128" 37 | 38 | # Disk quota parameters (in form of softlimit:hardlimit) 39 | DISKSPACE="1048576:1153024" 40 | DISKINODES="200000:220000" 41 | QUOTATIME="0" 42 | QUOTAUGIDLIMIT="150" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | -------------------------------------------------------------------------------- /include/ha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef _HA_H_ 25 | #define _HA_H_ 26 | 27 | struct ha_params { 28 | int ha_enable; 29 | unsigned long *ha_prio; 30 | }; 31 | 32 | int handle_set_cmd_on_ha_cluster(int veid, const char *ve_private, 33 | struct ha_params *cmdline, 34 | struct ha_params *config, 35 | int save); 36 | 37 | #endif /* _HA_H_ */ 38 | -------------------------------------------------------------------------------- /etc/ve-oracle.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for 2 | # CT capable of running Oracle9i. 3 | #: Configuration file for running Oracle9i server 4 | # 5 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 6 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 7 | 8 | VERSION="2" 9 | 10 | ONBOOT="no" 11 | 12 | # UBC parameters (in form of barrier:limit) 13 | # Primary parameters 14 | AVNUMPROC="200:200" 15 | NUMPROC="400:400" 16 | NUMTCPSOCK="500:500" 17 | NUMOTHERSOCK="500:500" 18 | VMGUARPAGES="107520:2147483647" 19 | # Secondary parameters 20 | KMEMSIZE="16384000:18022400" 21 | TCPSNDBUF="5365760:10485760" 22 | TCPRCVBUF="5365760:10485760" 23 | OTHERSOCKBUF="1503232:4063232" 24 | DGRAMRCVBUF="262144:262144" 25 | OOMGUARPAGES="107520:2147483647" 26 | # Auxiliary parameters 27 | LOCKEDPAGES="4096:4096" 28 | SHMPAGES="131072:131072" 29 | PRIVVMPAGES="262144:292912" 30 | NUMFILE="8192:8192" 31 | NUMFLOCK="200:220" 32 | NUMPTY="64:64" 33 | NUMSIGINFO="512:512" 34 | DCACHESIZE="4194304:4317184" 35 | 36 | PHYSPAGES="0:2147483647" 37 | NUMIPTENT="128:128" 38 | 39 | # Disk quota parameters (in form of softlimit:hardlimit) 40 | DISKSPACE="3145728:3145728" 41 | DISKINODES="200000:220000" 42 | QUOTATIME="0" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | NUMMEMORYSUBGROUPS="512" 50 | -------------------------------------------------------------------------------- /etc/ve-oracle.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for ia64 2 | # CT capable of running Oracle9i. 3 | #: Configuration file for running Oracle9i server 4 | # 5 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 6 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 7 | 8 | VERSION="2" 9 | 10 | ONBOOT="no" 11 | 12 | # UBC parameters (in form of barrier:limit) 13 | # Primary parameters 14 | AVNUMPROC="200:200" 15 | NUMPROC="400:400" 16 | NUMTCPSOCK="500:500" 17 | NUMOTHERSOCK="500:500" 18 | VMGUARPAGES="53760:9223372036854775807" 19 | # Secondary parameters 20 | KMEMSIZE="81920000:90112000" 21 | TCPSNDBUF="5365760:10485760" 22 | TCPRCVBUF="5365760:10485760" 23 | OTHERSOCKBUF="1503232:4063232" 24 | DGRAMRCVBUF="262144:262144" 25 | OOMGUARPAGES="53760:9223372036854775807" 26 | # Auxiliary parameters 27 | LOCKEDPAGES="4096:4096" 28 | SHMPAGES="131072:131072" 29 | PRIVVMPAGES="32768:36614" 30 | NUMFILE="8192:8192" 31 | NUMFLOCK="200:220" 32 | NUMPTY="64:64" 33 | NUMSIGINFO="512:512" 34 | DCACHESIZE="8388608:8634368" 35 | 36 | PHYSPAGES="0:9223372036854775807" 37 | NUMIPTENT="12:12" 38 | 39 | # Disk quota parameters (in form of softlimit:hardlimit) 40 | DISKSPACE="3145728:3145728" 41 | DISKINODES="200000:220000" 42 | QUOTATIME="0" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | -------------------------------------------------------------------------------- /etc/ve-oracle.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for 2 | # CT capable of running Oracle9i. 3 | #: Configuration file for running Oracle9i server 4 | # 5 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 6 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 7 | 8 | VERSION="2" 9 | 10 | ONBOOT="no" 11 | 12 | # UBC parameters (in form of barrier:limit) 13 | # Primary parameters 14 | AVNUMPROC="200:200" 15 | NUMPROC="400:400" 16 | NUMTCPSOCK="500:500" 17 | NUMOTHERSOCK="500:500" 18 | VMGUARPAGES="107520:9223372036854775807" 19 | # Secondary parameters 20 | KMEMSIZE="21299200:23429120" 21 | TCPSNDBUF="5365760:10485760" 22 | TCPRCVBUF="5365760:10485760" 23 | OTHERSOCKBUF="1503232:4063232" 24 | DGRAMRCVBUF="262144:262144" 25 | OOMGUARPAGES="107520:9223372036854775807" 26 | # Auxiliary parameters 27 | LOCKEDPAGES="4096:4096" 28 | SHMPAGES="131072:131072" 29 | PRIVVMPAGES="262144:292912" 30 | NUMFILE="8192:8192" 31 | NUMFLOCK="200:220" 32 | NUMPTY="64:64" 33 | NUMSIGINFO="512:512" 34 | DCACHESIZE="4194304:4317184" 35 | 36 | PHYSPAGES="0:9223372036854775807" 37 | NUMIPTENT="128:128" 38 | 39 | # Disk quota parameters (in form of softlimit:hardlimit) 40 | DISKSPACE="3145728:3145728" 41 | DISKINODES="200000:220000" 42 | QUOTATIME="0" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | -------------------------------------------------------------------------------- /etc/ve-vps.plesk.conf-sample: -------------------------------------------------------------------------------- 1 | # Sample configuration file for VPS based on OS template 2 | #: redhat-9 with Plesk Server Administrator 7 application template 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | # UBC parameters (in form of barrier:limit) 12 | # Primary parameters 13 | AVNUMPROC="200:200" 14 | NUMPROC="400:400" 15 | NUMTCPSOCK="500:500" 16 | NUMOTHERSOCK="500:500" 17 | VMGUARPAGES="0:2147483647" 18 | # Secondary parameters 19 | KMEMSIZE="18743296:20619264" 20 | TCPSNDBUF="5365760:10485760" 21 | TCPRCVBUF="5365760:10485760" 22 | OTHERSOCKBUF="1503232:4063232" 23 | DGRAMRCVBUF="262144:262144" 24 | OOMGUARPAGES="0:2147483647" 25 | # Auxiliary parameters 26 | LOCKEDPAGES="4096:4096" 27 | SHMPAGES="131072:131072" 28 | PRIVVMPAGES="393216:439368" 29 | NUMFILE="12288:12288" 30 | NUMFLOCK="200:220" 31 | NUMPTY="64:64" 32 | NUMSIGINFO="512:512" 33 | DCACHESIZE="4192304:4317184" 34 | 35 | PHYSPAGES="0:2147483647" 36 | NUMIPTENT="128:128" 37 | 38 | # Disk quota parameters (in form of softlimit:hardlimit) 39 | DISKSPACE="5242880:5767170" 40 | DISKINODES="3500000:370000" 41 | QUOTATIME="0" 42 | QUOTAUGIDLIMIT="150" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | NUMMEMORYSUBGROUPS="512" 50 | -------------------------------------------------------------------------------- /etc/ve-confixx.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for CT with confixx. 2 | #: Configuration file for running Confixx Control Panels 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | # UBC parameters (in form of barrier:limit) 12 | # Primary parameters 13 | AVNUMPROC="40:40" 14 | NUMPROC="100:100" 15 | NUMTCPSOCK="80:80" 16 | NUMOTHERSOCK="80:80" 17 | VMGUARPAGES="6144:2147483647" 18 | # Secondary parameters 19 | KMEMSIZE="4194304:4470784" 20 | TCPSNDBUF="319488:524288" 21 | TCPRCVBUF="319488:524288" 22 | OTHERSOCKBUF="132096:336896" 23 | DGRAMRCVBUF="132096:132096" 24 | OOMGUARPAGES="6144:2147483647" 25 | # Auxiliary parameters 26 | LOCKEDPAGES="32:32" 27 | SHMPAGES="24000:24000" 28 | PRIVVMPAGES="27033:29491" 29 | NUMFILE="1280:1280" 30 | NUMFLOCK="100:110" 31 | NUMPTY="16:16" 32 | NUMSIGINFO="256:256" 33 | DCACHESIZE="524288:548864" 34 | 35 | PHYSPAGES="0:2147483647" 36 | NUMIPTENT="128:128" 37 | 38 | # Disk quota parameters (in form of softlimit:hardlimit) 39 | DISKSPACE="1048576:1153024" 40 | DISKINODES="200000:220000" 41 | QUOTATIME="0" 42 | QUOTAUGIDLIMIT="150" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | NETFILTER="full" 48 | 49 | 50 | PLATFORM="linux" 51 | IP_ADDRESS="0.0.0.0" 52 | NUMMEMORYSUBGROUPS="512" 53 | -------------------------------------------------------------------------------- /etc/ve-vps.plesk.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # Sample configuration file for VPS based on OS template 2 | #: redhat-9 with Plesk Server Administrator 7 application template 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | # UBC parameters (in form of barrier:limit) 12 | # Primary parameters 13 | AVNUMPROC="200:200" 14 | NUMPROC="400:400" 15 | NUMTCPSOCK="500:500" 16 | NUMOTHERSOCK="500:500" 17 | VMGUARPAGES="0:9223372036854775807" 18 | # Secondary parameters 19 | KMEMSIZE="24313856:26746880" 20 | TCPSNDBUF="5365760:10485760" 21 | TCPRCVBUF="5365760:10485760" 22 | OTHERSOCKBUF="1503232:4063232" 23 | DGRAMRCVBUF="262144:262144" 24 | OOMGUARPAGES="0:9223372036854775807" 25 | # Auxiliary parameters 26 | LOCKEDPAGES="4096:4096" 27 | SHMPAGES="131072:131072" 28 | PRIVVMPAGES="393216:439368" 29 | NUMFILE="12288:12288" 30 | NUMFLOCK="200:220" 31 | NUMPTY="64:64" 32 | NUMSIGINFO="512:512" 33 | DCACHESIZE="4192304:4317184" 34 | 35 | PHYSPAGES="0:9223372036854775807" 36 | NUMIPTENT="128:128" 37 | 38 | # Disk quota parameters (in form of softlimit:hardlimit) 39 | DISKSPACE="5242880:5767170" 40 | DISKINODES="350000:370000" 41 | QUOTATIME="0" 42 | QUOTAUGIDLIMIT="150" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | -------------------------------------------------------------------------------- /etc/ve-unlimited.db2.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for 2 | # unlimited CT capable of running IBM DB2 EE for Linux. 3 | #: Configuration file for running DB2 EE server 4 | # 5 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 6 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 7 | 8 | VERSION="2" 9 | 10 | ONBOOT="no" 11 | 12 | # UBC parameters (in form of barrier:limit) 13 | # Primary parameters 14 | AVNUMPROC="200:200" 15 | NUMPROC="400:400" 16 | NUMTCPSOCK="500:500" 17 | NUMOTHERSOCK="500:500" 18 | VMGUARPAGES="53760:9223372036854775807" 19 | # Secondary parameters 20 | KMEMSIZE="81920000:90112000" 21 | TCPSNDBUF="5365760:10485760" 22 | TCPRCVBUF="5365760:10485760" 23 | OTHERSOCKBUF="1503232:4063232" 24 | DGRAMRCVBUF="262144:262144" 25 | OOMGUARPAGES="53760:9223372036854775807" 26 | # Auxiliary parameters 27 | LOCKEDPAGES="4096:4096" 28 | SHMPAGES="32768:32768" 29 | PRIVVMPAGES="131072:146456" 30 | NUMFILE="8192:8192" 31 | NUMFLOCK="200:220" 32 | NUMPTY="64:64" 33 | NUMSIGINFO="512:512" 34 | DCACHESIZE="8384608:8634368" 35 | 36 | PHYSPAGES="0:9223372036854775807" 37 | NUMIPTENT="12:12" 38 | 39 | # Disk quota parameters (in form of softlimit:hardlimit) 40 | DISKSPACE="1048576:1153024" 41 | DISKINODES="200000:220000" 42 | QUOTATIME="0" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | -------------------------------------------------------------------------------- /include/vzcfgscale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef _VZCFGSCALE_H_ 25 | #define _VZCFGSCALE_H_ 26 | 27 | #define PARAM_OUTPUT_FILE 'o' 28 | #define PARAM_ALL 'a' 29 | #define PARAM_CPU 'c' 30 | #define PARAM_DISK 'd' 31 | #define PARAM_UBC 'u' 32 | #define PARAM_NET 'n' 33 | #define PARAM_REMOVE 'r' 34 | #define PARAM_HELP 'h' 35 | #define PARAM_VALIDATE 'v' 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /etc/ve-unlimited.db2.conf-sample: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for 2 | # unlimited CT capable of running IBM DB2 EE for Linux. 3 | #: Configuration file for running DB2 EE server 4 | # 5 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 6 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 7 | 8 | VERSION="2" 9 | 10 | ONBOOT="no" 11 | 12 | # UBC parameters (in form of barrier:limit) 13 | # Primary parameters 14 | AVNUMPROC="200:200" 15 | NUMPROC="400:400" 16 | NUMTCPSOCK="500:500" 17 | NUMOTHERSOCK="500:500" 18 | VMGUARPAGES="107520:2147483647" 19 | # Secondary parameters 20 | KMEMSIZE="16384000:18022400" 21 | TCPSNDBUF="5365760:10485760" 22 | TCPRCVBUF="5365760:10485760" 23 | OTHERSOCKBUF="1503232:4063232" 24 | DGRAMRCVBUF="262144:262144" 25 | OOMGUARPAGES="107520:2147483647" 26 | # Auxiliary parameters 27 | LOCKEDPAGES="4096:4096" 28 | SHMPAGES="131072:131072" 29 | PRIVVMPAGES="262144:292912" 30 | NUMFILE="8192:8192" 31 | NUMFLOCK="200:220" 32 | NUMPTY="64:64" 33 | NUMSIGINFO="512:512" 34 | DCACHESIZE="4192304:4317184" 35 | 36 | PHYSPAGES="0:2147483647" 37 | NUMIPTENT="128:128" 38 | 39 | # Disk quota parameters (in form of softlimit:hardlimit) 40 | DISKSPACE="1048576:1153024" 41 | DISKINODES="200000:220000" 42 | QUOTATIME="0" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | NUMMEMORYSUBGROUPS="512" 50 | -------------------------------------------------------------------------------- /etc/ve-light.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for ia64 so-called "light" CT. 2 | # This is config file valid only for CT based on RedHat <= 7.3 3 | # Parameters are taken from "AdminGuide2-exm.tex,v 1.4", example A. 4 | #: Light config file 5 | # 6 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 7 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 8 | 9 | VERSION="2" 10 | 11 | ONBOOT="no" 12 | 13 | # UBC parameters (in form of barrier:limit) 14 | # Primary parameters 15 | AVNUMPROC="15:15" 16 | NUMPROC="40:40" 17 | NUMTCPSOCK="40:40" 18 | NUMOTHERSOCK="40:40" 19 | VMGUARPAGES="862:9223372036854775807" 20 | # Secondary parameters 21 | KMEMSIZE="4352000:4618240" 22 | TCPSNDBUF="159744:262144" 23 | TCPRCVBUF="159744:262144" 24 | OTHERSOCKBUF="61440:163840" 25 | DGRAMRCVBUF="32768:32768" 26 | OOMGUARPAGES="862:9223372036854775807" 27 | # Auxiliary parameters 28 | LOCKEDPAGES="4:4" 29 | SHMPAGES="128:128" 30 | PRIVVMPAGES="1920:2112" 31 | NUMFILE="512:512" 32 | NUMFLOCK="50:60" 33 | NUMPTY="4:4" 34 | NUMSIGINFO="256:256" 35 | DCACHESIZE="393216:405504" 36 | 37 | PHYSPAGES="0:9223372036854775807" 38 | NUMIPTENT="16:16" 39 | 40 | # Disk quota parameters (in form of softlimit:hardlimit) 41 | DISKSPACE="204800:204800" 42 | DISKINODES="80000:88000" 43 | QUOTATIME="0" 44 | 45 | # CPU fair sheduler parameter 46 | CPUUNITS="250" 47 | PLATFORM="linux" 48 | IP_ADDRESS="0.0.0.0" 49 | -------------------------------------------------------------------------------- /etc/vps.reinstall.sample: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | # Sample of custom reinstall script. 6 | # This script running on reinstall action. 7 | # It should create temporary private area in directory passed as 8 | # '--ve_private_tmp' option 9 | # 10 | # Parameters: 11 | # --veid - VE id 12 | # --ve_private_tmp - path to VE temporary private area 13 | # --ve_private - path to VE original private area 14 | # 15 | # Exitcodes: 16 | # 0 - ok 17 | # 128 - ignore this script, run original reinstall 18 | # other - error 19 | 20 | VE_TAR=/vz/template/redhat-9-20040116.tar.gz 21 | 22 | function create_prvt() 23 | { 24 | [ -z "${VE_PRIVATE_TMP}" ] && exit 1 25 | mkdir -p "${VE_PRIVATE_TMP}" 26 | /usr/bin/tar -C "${VE_PRIVATE_TMP}" -xzf ${VE_TAR} 27 | if [ $? -ne 0 ]; then 28 | exit 1 29 | fi 30 | } 31 | 32 | while [ "${#}" -gt 0 ]; do 33 | case "${1}" in 34 | "--veid") 35 | if [ -z "${2}" ]; then exit 1; fi 36 | VEID="${2}" 37 | shift 38 | ;; 39 | "--ve_private") 40 | if [ -z "${2}" ]; then exit 1; fi 41 | VE_PRIVATE="$2" 42 | shift 43 | ;; 44 | "--ve_private_tmp") 45 | if [ -z "${2}" ]; then exit 1; fi 46 | VE_PRIVATE_TMP="$2" 47 | shift 48 | ;; 49 | *) 50 | echo "Invalid option ${1}" 51 | exit 1 52 | ;; 53 | esac 54 | shift 55 | done 56 | create_prvt 57 | exit 0 58 | 59 | -------------------------------------------------------------------------------- /etc/ve-vps.plesk7.rh9.conf-sample: -------------------------------------------------------------------------------- 1 | # Sample configuration file for VPS based on OS template 2 | #: redhat-9 with Plesk Server Administrator 7 application template 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | # UBC parameters (in form of barrier:limit) 12 | # Primary parameters 13 | AVNUMPROC="200:200" 14 | NUMPROC="400:400" 15 | NUMTCPSOCK="500:500" 16 | NUMOTHERSOCK="500:500" 17 | VMGUARPAGES="0:2147483647" 18 | # Secondary parameters 19 | KMEMSIZE="16384000:18022400" 20 | TCPSNDBUF="5365760:10485760" 21 | TCPRCVBUF="5365760:10485760" 22 | OTHERSOCKBUF="1503232:4063232" 23 | DGRAMRCVBUF="262144:262144" 24 | OOMGUARPAGES="0:2147483647" 25 | # Auxiliary parameters 26 | LOCKEDPAGES="4096:4096" 27 | SHMPAGES="131072:131072" 28 | PRIVVMPAGES="262144:292912" 29 | NUMFILE="8192:8192" 30 | NUMFLOCK="200:220" 31 | NUMPTY="64:64" 32 | NUMSIGINFO="512:512" 33 | DCACHESIZE="4192304:4317184" 34 | 35 | PHYSPAGES="0:2147483647" 36 | NUMIPTENT="128:128" 37 | 38 | # Disk quota parameters (in form of softlimit:hardlimit) 39 | DISKSPACE="1048576:1153024" 40 | DISKINODES="200000:220000" 41 | QUOTATIME="0" 42 | QUOTAUGIDLIMIT="150" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | OSTEMPLATE="redhat-9" 48 | TEMPLATES="mod_perl-rh9 mod_ssl-rh9 mysql-rh9 php-rh9 mod_frontpage-rh9 psa-rh9" 49 | PLATFORM="linux" 50 | IP_ADDRESS="0.0.0.0" 51 | NUMMEMORYSUBGROUPS="512" 52 | -------------------------------------------------------------------------------- /etc/ve-vps.plesk7.rh9.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # Sample configuration file for VPS based on OS template 2 | #: redhat-9 with Plesk Server Administrator 7 application template 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | # UBC parameters (in form of barrier:limit) 12 | # Primary parameters 13 | AVNUMPROC="200:200" 14 | NUMPROC="400:400" 15 | NUMTCPSOCK="500:500" 16 | NUMOTHERSOCK="500:500" 17 | VMGUARPAGES="0:9223372036854775807" 18 | # Secondary parameters 19 | KMEMSIZE="21299200:23429120" 20 | TCPSNDBUF="5365760:10485760" 21 | TCPRCVBUF="5365760:10485760" 22 | OTHERSOCKBUF="1503232:4063232" 23 | DGRAMRCVBUF="262144:262144" 24 | OOMGUARPAGES="0:9223372036854775807" 25 | # Auxiliary parameters 26 | LOCKEDPAGES="4096:4096" 27 | SHMPAGES="131072:131072" 28 | PRIVVMPAGES="262144:292912" 29 | NUMFILE="8192:8192" 30 | NUMFLOCK="200:220" 31 | NUMPTY="64:64" 32 | NUMSIGINFO="512:512" 33 | DCACHESIZE="4192304:4317184" 34 | 35 | PHYSPAGES="0:9223372036854775807" 36 | NUMIPTENT="128:128" 37 | 38 | # Disk quota parameters (in form of softlimit:hardlimit) 39 | DISKSPACE="1048576:1153024" 40 | DISKINODES="200000:220000" 41 | QUOTATIME="0" 42 | QUOTAUGIDLIMIT="150" 43 | 44 | # CPU fair sheduler parameter 45 | CPUUNITS="1000" 46 | 47 | OSTEMPLATE="redhat-9" 48 | TEMPLATES="mod_perl-rh9 mod_ssl-rh9 mysql-rh9 php-rh9 mod_frontpage-rh9 psa-rh9" 49 | PLATFORM="linux" 50 | IP_ADDRESS="0.0.0.0" 51 | -------------------------------------------------------------------------------- /vzgetpa: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 4 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 5 | # 6 | # This file is part of OpenVZ. OpenVZ is free software; you can redistribute 7 | # it and/or modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the License, 9 | # or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 | # 02110-1301, USA. 20 | # 21 | # Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 22 | # Schaffhausen, Switzerland. 23 | # 24 | # Simple script that prints location of VE private area 25 | # Usage: vzgetpa VEID 26 | # See also vzgetpa(8) man page 27 | 28 | VEID=$1 29 | PROGNAME=`basename $0` 30 | 31 | function usage() 32 | { 33 | echo "Usage: $PROGNAME VEID" 1>&2 34 | exit 0 35 | } 36 | 37 | test $# -eq 1 || usage 38 | 39 | . /etc/vz/vz.conf 40 | 41 | if test -f /etc/vz/conf/$VEID.conf; then 42 | . /etc/vz/conf/$VEID.conf 43 | fi 44 | 45 | 46 | echo $VE_PRIVATE 47 | -------------------------------------------------------------------------------- /etc/ve-slm.plesk.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for CT with 1024MB. 2 | #: Configuration file for CT with installed Plesk application 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | KMEMSIZE="9223372036854775807:9223372036854775807" 10 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 11 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 12 | SHMPAGES="9223372036854775807:9223372036854775807" 13 | NUMPROC="32567:32567" 14 | PHYSPAGES="9223372036854775807:9223372036854775807" 15 | VMGUARPAGES="9223372036854775807:9223372036854775807" 16 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 17 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 18 | NUMFLOCK="9223372036854775807:9223372036854775807" 19 | NUMPTY="255:255" 20 | NUMSIGINFO="1024:1024" 21 | TCPSNDBUF="9223372036854775807:9223372036854775807" 22 | TCPRCVBUF="9223372036854775807:9223372036854775807" 23 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 24 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 25 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 26 | NUMFILE="9223372036854775807:9223372036854775807" 27 | DCACHESIZE="9223372036854775807:9223372036854775807" 28 | NUMIPTENT="9223372036854775807:9223372036854775807" 29 | 30 | CPUUNITS="1000" 31 | 32 | DISKSPACE="5242880:5767170" 33 | DISKINODES="350000:370000" 34 | QUOTATIME="0" 35 | PLATFORM="linux" 36 | 37 | SLMMODE="all" 38 | SLMMEMORYLIMIT="1073741824:1073741824" 39 | IP_ADDRESS="0.0.0.0" 40 | -------------------------------------------------------------------------------- /etc/ve-slm.1024MB.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.1024MB" CT. 2 | #: Configuration file for allocating 1024 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="9223372036854775807:9223372036854775807" 12 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 13 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 14 | SHMPAGES="9223372036854775807:9223372036854775807" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="9223372036854775807:9223372036854775807" 17 | VMGUARPAGES="9223372036854775807:9223372036854775807" 18 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 19 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 20 | NUMFLOCK="9223372036854775807:9223372036854775807" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="9223372036854775807:9223372036854775807" 24 | TCPRCVBUF="9223372036854775807:9223372036854775807" 25 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 26 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 27 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 28 | NUMFILE="9223372036854775807:9223372036854775807" 29 | DCACHESIZE="9223372036854775807:9223372036854775807" 30 | NUMIPTENT="9223372036854775807:9223372036854775807" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="1073741824:1073741824" 41 | IP_ADDRESS="0.0.0.0" 42 | -------------------------------------------------------------------------------- /etc/ve-slm.2048MB.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.2048MB" CT. 2 | #: Configuration file for allocating 2048 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="9223372036854775807:9223372036854775807" 12 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 13 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 14 | SHMPAGES="9223372036854775807:9223372036854775807" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="9223372036854775807:9223372036854775807" 17 | VMGUARPAGES="9223372036854775807:9223372036854775807" 18 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 19 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 20 | NUMFLOCK="9223372036854775807:9223372036854775807" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="9223372036854775807:9223372036854775807" 24 | TCPRCVBUF="9223372036854775807:9223372036854775807" 25 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 26 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 27 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 28 | NUMFILE="9223372036854775807:9223372036854775807" 29 | DCACHESIZE="9223372036854775807:9223372036854775807" 30 | NUMIPTENT="9223372036854775807:9223372036854775807" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="2147483648:2147483648" 41 | IP_ADDRESS="0.0.0.0" 42 | -------------------------------------------------------------------------------- /etc/ve-slm.256MB.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.256MB" VPS. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="9223372036854775807:9223372036854775807" 12 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 13 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 14 | SHMPAGES="9223372036854775807:9223372036854775807" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="9223372036854775807:9223372036854775807" 17 | VMGUARPAGES="9223372036854775807:9223372036854775807" 18 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 19 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 20 | NUMFLOCK="9223372036854775807:9223372036854775807" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="9223372036854775807:9223372036854775807" 24 | TCPRCVBUF="9223372036854775807:9223372036854775807" 25 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 26 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 27 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 28 | DCACHESIZE="9223372036854775807:9223372036854775807" 29 | NUMFILE="9223372036854775807:9223372036854775807" 30 | NUMIPTENT="9223372036854775807:9223372036854775807" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="268435456:268435456" 41 | IP_ADDRESS="0.0.0.0" 42 | -------------------------------------------------------------------------------- /etc/ve-slm.256MB.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.256MB" VPS. 2 | #: Configuration file for allocating 256 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="9223372036854775807:9223372036854775807" 12 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 13 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 14 | SHMPAGES="9223372036854775807:9223372036854775807" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="9223372036854775807:9223372036854775807" 17 | VMGUARPAGES="9223372036854775807:9223372036854775807" 18 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 19 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 20 | NUMFLOCK="9223372036854775807:9223372036854775807" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="9223372036854775807:9223372036854775807" 24 | TCPRCVBUF="9223372036854775807:9223372036854775807" 25 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 26 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 27 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 28 | DCACHESIZE="9223372036854775807:9223372036854775807" 29 | NUMFILE="9223372036854775807:9223372036854775807" 30 | NUMIPTENT="9223372036854775807:9223372036854775807" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="268435456:268435456" 41 | IP_ADDRESS="0.0.0.0" 42 | -------------------------------------------------------------------------------- /etc/ve-slm.1024MB.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.1024MB" CT. 2 | #: Configuration file for allocating 1024 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="9223372036854775807:9223372036854775807" 12 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 13 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 14 | SHMPAGES="9223372036854775807:9223372036854775807" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="9223372036854775807:9223372036854775807" 17 | VMGUARPAGES="9223372036854775807:9223372036854775807" 18 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 19 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 20 | NUMFLOCK="9223372036854775807:9223372036854775807" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="9223372036854775807:9223372036854775807" 24 | TCPRCVBUF="9223372036854775807:9223372036854775807" 25 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 26 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 27 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 28 | NUMFILE="9223372036854775807:9223372036854775807" 29 | DCACHESIZE="9223372036854775807:9223372036854775807" 30 | NUMIPTENT="9223372036854775807:9223372036854775807" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="1073741824:1073741824" 41 | IP_ADDRESS="0.0.0.0" 42 | -------------------------------------------------------------------------------- /etc/ve-slm.2048MB.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.2048MB" CT. 2 | #: Configuration file for allocating 2048 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="9223372036854775807:9223372036854775807" 12 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 13 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 14 | SHMPAGES="9223372036854775807:9223372036854775807" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="9223372036854775807:9223372036854775807" 17 | VMGUARPAGES="9223372036854775807:9223372036854775807" 18 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 19 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 20 | NUMFLOCK="9223372036854775807:9223372036854775807" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="9223372036854775807:9223372036854775807" 24 | TCPRCVBUF="9223372036854775807:9223372036854775807" 25 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 26 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 27 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 28 | NUMFILE="9223372036854775807:9223372036854775807" 29 | DCACHESIZE="9223372036854775807:9223372036854775807" 30 | NUMIPTENT="9223372036854775807:9223372036854775807" 31 | 32 | CPUUNITS="1000" 33 | 34 | DISKSPACE="1048576:1153024" 35 | DISKINODES="200000:220000" 36 | QUOTATIME="0" 37 | PLATFORM="linux" 38 | 39 | SLMMODE="all" 40 | SLMMEMORYLIMIT="2147483648:2147483648" 41 | IP_ADDRESS="0.0.0.0" 42 | -------------------------------------------------------------------------------- /etc/ve-slm.512MB.conf-sample.ia64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.512MB" CT. 2 | #: Configuration file for allocating 512 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="9223372036854775807:9223372036854775807" 12 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 13 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 14 | SHMPAGES="9223372036854775807:9223372036854775807" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="9223372036854775807:9223372036854775807" 17 | VMGUARPAGES="9223372036854775807:9223372036854775807" 18 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 19 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 20 | NUMFLOCK="9223372036854775807:9223372036854775807" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="9223372036854775807:9223372036854775807" 24 | TCPRCVBUF="9223372036854775807:9223372036854775807" 25 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 26 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 27 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 28 | NUMFILE="9223372036854775807:9223372036854775807" 29 | DCACHESIZE="9223372036854775807:9223372036854775807" 30 | NUMIPTENT="9223372036854775807:9223372036854775807" 31 | 32 | MEMINFO="privvmpages:1" 33 | 34 | CPUUNITS="1000" 35 | 36 | DISKSPACE="1048576:1153024" 37 | DISKINODES="200000:220000" 38 | QUOTATIME="0" 39 | PLATFORM="linux" 40 | 41 | SLMMODE="all" 42 | SLMMEMORYLIMIT="536870912:536870912" 43 | IP_ADDRESS="0.0.0.0" 44 | -------------------------------------------------------------------------------- /etc/ve-slm.512MB.conf-sample.x86_64: -------------------------------------------------------------------------------- 1 | # This is an example configuration file for so-called "slm.512MB" CT. 2 | #: Configuration file for allocating 512 Mb of memory. 3 | # 4 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 5 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 6 | 7 | VERSION="2" 8 | 9 | ONBOOT="yes" 10 | 11 | KMEMSIZE="9223372036854775807:9223372036854775807" 12 | LOCKEDPAGES="9223372036854775807:9223372036854775807" 13 | PRIVVMPAGES="9223372036854775807:9223372036854775807" 14 | SHMPAGES="9223372036854775807:9223372036854775807" 15 | NUMPROC="32567:32567" 16 | PHYSPAGES="9223372036854775807:9223372036854775807" 17 | VMGUARPAGES="9223372036854775807:9223372036854775807" 18 | OOMGUARPAGES="9223372036854775807:9223372036854775807" 19 | NUMTCPSOCK="9223372036854775807:9223372036854775807" 20 | NUMFLOCK="9223372036854775807:9223372036854775807" 21 | NUMPTY="255:255" 22 | NUMSIGINFO="1024:1024" 23 | TCPSNDBUF="9223372036854775807:9223372036854775807" 24 | TCPRCVBUF="9223372036854775807:9223372036854775807" 25 | OTHERSOCKBUF="9223372036854775807:9223372036854775807" 26 | DGRAMRCVBUF="9223372036854775807:9223372036854775807" 27 | NUMOTHERSOCK="9223372036854775807:9223372036854775807" 28 | NUMFILE="9223372036854775807:9223372036854775807" 29 | DCACHESIZE="9223372036854775807:9223372036854775807" 30 | NUMIPTENT="9223372036854775807:9223372036854775807" 31 | 32 | MEMINFO="privvmpages:1" 33 | 34 | CPUUNITS="1000" 35 | 36 | DISKSPACE="1048576:1153024" 37 | DISKINODES="200000:220000" 38 | QUOTATIME="0" 39 | PLATFORM="linux" 40 | 41 | SLMMODE="all" 42 | SLMMEMORYLIMIT="536870912:536870912" 43 | IP_ADDRESS="0.0.0.0" 44 | -------------------------------------------------------------------------------- /man/vz-net_del.5: -------------------------------------------------------------------------------- 1 | .TH vz-net_del 5 "October 2009" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | vz-net_del \- Container's script for removing an IP alias 4 | .SH SYNOPSIS 5 | /usr/libexec/libvzctl/scripts/vz-net_del 6 | .SH DESCRIPTION 7 | The \fBvz-net_del\fR script is called by \fBvzctl(8)\fR. The script can be any 8 | executable file and is usually a shell script. 9 | .P 10 | First, it removes source routing for this IP, by executing command 11 | "\fB/sbin/ip\fR route del \fIaddr\fR dev venet0", where \fIaddr\fR is 12 | given IP address. 13 | .P 14 | Then, it removes ARP records for given IP from all 15 | interfaces, excluding those with LOOBBACK or NOARP flags set, by executing 16 | command "\fB/sbin/ip\fR neigh del proxy \fIaddr\fR dev \fIdevice\fR", 17 | where \fRaddr\fR is IP address and \fIdevice\fR is network interface 18 | device name (like \fIeth0\fR). 19 | .SH OPTIONS 20 | Parameters are passed to the script in the form of environment 21 | variables. The following variables can be defined: 22 | .IP VEID 12 23 | Numeric id of CT. 24 | .IP IP_ADDR 12 25 | IP address(es) to remove from CT. Several addresses are divided by space. 26 | .IP DIST 12 27 | Name of the distribution this CT runs (like \fBredhat-7.1\fR). Used for script 28 | to do distribution-dependent setup. 29 | .IP VZ_LOG 12 30 | Location of log file to write log to (optional). 31 | .SH DIAGNOSTICS 32 | The script is expected to return 0 on success, any other return code 33 | will be printed by \fBvzctl\fR. 34 | .SH SEE ALSO 35 | .BR vzctl (8). 36 | .SH COPYRIGHT 37 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 38 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 39 | -------------------------------------------------------------------------------- /man/vz-net_add.5: -------------------------------------------------------------------------------- 1 | .TH vz-net_add 5 "October 2009" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | vz-net_add \- Container's script for adding an IP alias 4 | .SH SYNOPSIS 5 | /usr/libexec/libvzctl/scripts/vz-net_add 6 | .SH DESCRIPTION 7 | The \fBvz-net_add\fR script is called by \fBvzctl(8)\fR. The script can be any 8 | executable file and is usually a shell script. 9 | .P 10 | This script adds source routing for given IP, by executing command 11 | "\fB/sbin/ip\fR route add \fIaddr\fR dev venet0 src \fIsrcaddr\fR", 12 | where \fIaddr\fR is IP address given, and \fIsrcaddr\fR is first local 13 | non-loopback address. 14 | .P 15 | Also, it adds public ARP records for given IP on all interfaces excluding 16 | those with LOOPBACK or NOARP flags set. It does so with the command 17 | "\fB/sbin/ip\fR neigh add proxy \fIaddr\fR dev \fIdevice\fR", where 18 | \fRaddr\fR is IP address and \fIdevice\fR is network interface device name 19 | (like \fIeth0\fR). 20 | .SH OPTIONS 21 | Parameters are passed to the script in the form of environment 22 | variables. The following variables can be defined: 23 | .IP VEID 12 24 | Numeric id of CT. 25 | .IP IP_ADDR 12 26 | IP address(es) to add as an alias to CT. Several addresses are divided 27 | by space. 28 | .IP VE_STATE 12 29 | This (optional) variable is telling the state of CT and can be one of the 30 | following: \fIrunning\fR, \fIstarting\fR, \fIstopping\fR, \fIstopped\fR. 31 | .P 32 | .SH DIAGNOSTICS 33 | The script is expected to return 0 on success, any other return code 34 | will be printed by \fBvzctl\fR. 35 | .SH SEE ALSO 36 | .BR vzctl (8). 37 | .SH COPYRIGHT 38 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 39 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 40 | -------------------------------------------------------------------------------- /include/timeutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | * 23 | * Header for timeutils.c, used by ubclogd. 24 | */ 25 | 26 | #ifndef _TIMEUTILS_H_ 27 | #define _TIMEUTILS_H_ 28 | 29 | #include 30 | #include 31 | 32 | /* Counts the difference between two timevals. 33 | * NOTE: it is assumed that t2 > t1. 34 | * Result is returned in struct pointed by tdiff. 35 | */ 36 | void timediff(const struct timeval *t1, const struct timeval *t2, 37 | struct timeval *tdiff); 38 | 39 | 40 | /* Decreases *st by value of *t. Normal return code is 0. 41 | * If resulting value is negative, *st is set to 0, and -1 is returned. 42 | */ 43 | int decrease_sleeptime(struct timespec *st, const struct timeval *t); 44 | 45 | #endif /* _TIMEUTILS_H_ */ 46 | -------------------------------------------------------------------------------- /man/networks_classes.5: -------------------------------------------------------------------------------- 1 | .TH networks_classes 5 "October 2009" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | networks_classes \- @PRODUCT_NAME_SHORT@ network classes configuration 4 | .SH SYNOPSIS 5 | /etc/vz/conf/networks_classes 6 | .SH DESCRIPTION 7 | This file describes pools of IP addresses used for @PRODUCT_NAME_SHORT@ traffic 8 | shaping and accounting. File consist of records; each record resides 9 | on a separate line and contains a pair of values \fBClass\fR \fBNetwork\fR, 10 | separated by space. Here \fBClass\fR is number in the range 0 - 11 | \fIMAX_CLASSES\fR (which is defined in 12 | \fB/etc/vz/conf/vz-functions\fR), and \fBNetwork\fR is 13 | network block in CIDR notation (e.g. \fIA.B.C.D/M\fR, where \fIM\fR 14 | is the number of binary 1-s in network mask). 15 | If nested networks exists with different class numbers, "wider" networks 16 | must be mentioned first. 17 | .PP 18 | Class number \fI0\fR is reserved for network addresses used by CT themselves. 19 | @PRODUCT_NAME_SHORT@ traffic accounting won't work unless you specify at least this 20 | class. 21 | .SH EXAMPLES 22 | \f(CW 23 | # Example of networks_classes file. 24 | .br 25 | .br 26 | # host server CT's networks 27 | .br 28 | 0 10.10.10.0/24 29 | .br 30 | 0 10.10.15.0/24 31 | .br 32 | .br 33 | # all IP ("local" traffic) 34 | .br 35 | 1 0.0.0.0/0 36 | .br 37 | .br 38 | # class 2 - "foreign" traffic 39 | .br 40 | 2 10.0.0.0/8 41 | .br 42 | 2 11.0.0.0/8 43 | .br 44 | .br 45 | # inside "foreign" network there 46 | .br 47 | # is a hole with "local" traffic 48 | .br 49 | 1 10.10.16.0/24 50 | \fR 51 | .SH SEE ALSO 52 | .BR vzctl (8), 53 | .BR vz-net_add (5). 54 | .SH COPYRIGHT 55 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 56 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 57 | -------------------------------------------------------------------------------- /man/vznetstat.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vznetstat 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vznetstat \- display network traffic statistics per CT. 5 | .SH SYNOPSIS 6 | vznetstat \fI[-4|-6]\fR \fI[-v ctid]\fR \fI[-c class]\fR \fI[-a]\fR \fI[-r]\fR \fI[-h]\fR 7 | .SH DESCRIPTION 8 | The utility displays incoming and outcoming traffic for Containers for each defined network class. The output is grouped by CT ID. The network classes are described in the /etc/vz/conf/networks_classes file. If no options are specified the network statistics for all running Containers is printed. 9 | .PP 10 | Note that for the CT ID of 0, the traffic of the HS (the host server 11 | itself) is shown. The figures for HS does not include CT traffic. 12 | .SH OPTIONS 13 | .IP "\fB-v\fR \fIctid\fR" 14 | Display statistics only for the CTs with the given \fIctid\fR. 15 | .IP "\fB-c\fR \fIclass\fR" 16 | Display statistics only for the given network \fIclass\fR. 17 | .IP "\fB-a\fR 18 | Display all classes (16). 19 | .IP "\fB-r\fR 20 | Round off the statistics figures from bytes to K(b), M(b) or G(b). 21 | .IP \fB-h\fR 22 | Print short usage information. 23 | .IP \fB-4\fR 24 | Display ipv4 statistics. 25 | .IP \fB-6\fR 26 | Display ipv6 statistics. 27 | .SH RETURN CODE 28 | Returns 0 upon success. 29 | .SH EXAMPLES 30 | To display statistics for all CTs: 31 | \f(CW 32 | .nh 33 | .nf 34 | vznetstat 35 | \fR 36 | .hy 37 | .fi 38 | .PP 39 | To display statistics for CTs 101 and 102 for network classes 1 and 2: 40 | \f(CW 41 | .nh 42 | .nf 43 | vznetstat -v 101 -v 102 -c 1 -c 2 44 | \fR 45 | .hy 46 | .fi 47 | .SH SEE ALSO 48 | .BR networks_classes (5). 49 | .SH COPYRIGHT 50 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 51 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 52 | -------------------------------------------------------------------------------- /man/pnetstat.8: -------------------------------------------------------------------------------- 1 | .TH pnetstat 8 "28 Dec 2006" "@PRODUCT_NAME_SHORT@" 2 | .SH NAME 3 | pnetstat \- display network traffic statistics for servers. 4 | .SH SYNOPSIS 5 | pnetstat [\fB-v\fR <\fIid\fR>] [\fB-c\fR <\fIclass\fR>] [\fB-a\fR] [\fB-r\fR] 6 | [\fB-h\fR] [\fB-t\fR <\fIct\fR|\fIvm\fR|\fIall\fR>] 7 | .SH DESCRIPTION 8 | The utility displays incoming and outcoming traffic for servers for each defined 9 | network class. The output is grouped by server IDs. The network classes are 10 | described in the /etc/sysconfig/vz-scripts/networks_classes file. If no options 11 | are specified the network statistics for all running servers is printed. 12 | .PP 13 | Note that for the ID of 0, the traffic of the HS (the host server 14 | itself) is shown. The figures for HS does not include servers traffic. 15 | .SH OPTIONS 16 | .IP "\fB-v\fR <\fIid\fR>" 17 | Display statistics only for the servers with the given \fIid\fR. 18 | .IP "\fB-c\fR <\fIclass\fR>" 19 | Display statistics only for the given network \fIclass\fR. 20 | .IP "\fB-a\fR 21 | Display all classes (16). 22 | .IP "\fB-r\fR 23 | Round off the statistics figures from bytes to K(b), M(b) or G(b). 24 | .IP "\fB-t\fR <\fIct\fR|\fIvm\fR|\fIall\fR> 25 | Display statistics only for Containers, virtual machines or both. 26 | .IP \fB-h\fR 27 | Print short usage information. 28 | .SH RETURN CODE 29 | Returns 0 upon success. 30 | .SH EXAMPLES 31 | To display statistics for all servers: 32 | \f(CW 33 | .nh 34 | .nf 35 | pnetstat 36 | \fR 37 | .hy 38 | .fi 39 | .PP 40 | To display statistics for Containers 101 and 102 for network classes 1 and 2: 41 | \f(CW 42 | .nh 43 | .nf 44 | pnetstat -v 101 -v 102 -c 1 -c 2 45 | \fR 46 | .hy 47 | .fi 48 | .SH SEE ALSO 49 | .BR networks_classes (5). 50 | .SH COPYRIGHT 51 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 52 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 53 | -------------------------------------------------------------------------------- /man/vzsplit.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzsplit 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzsplit \- generate a sample CT configuration file with a certain set of system resource control parameters. 5 | .SH SYNOPSIS 6 | vzsplit [\fB-n\fR \fInumve\fR] [\fB-f\fR \fIconf_name\fR] [\fB-s\fR \fIswapsize\fR] [\fB-p\fR \fIpath\fR] 7 | .SH DESCRIPTION 8 | The \fBvzsplit\fR utility is used to split the host server into equal parts. 9 | It generates a full set of system resource control parameters for the given 10 | number of Containers. The values are calculated from the total physical memory of 11 | the host server the utility runs on and the number of Containers the host server\ 12 | shall be able to run even if the given number of Containers consume all resources 13 | available. 14 | Without any option \fBvzsplit\fR prompts for the desired number of Containers and outputs the resulting resource control parameters to the screen. 15 | If there is not enough system resources to run the specified number of 16 | CTs, an appropriate message is shown and the sample configuration file is not generated. 17 | .SH OPTIONS 18 | .TP 19 | \fB-n\fR \fInumve\fR 20 | Specify the number of CTs. 21 | .TP 22 | \fB-f\fR \fIconf_name\fR 23 | Specify the configuration file name. The program output is placed to 24 | /etc/vz/conf/ve-\fIconf_name\fR.conf-sample. 25 | .TP 26 | \fB-s\fR \fIswapsize\fR 27 | Specify the swap size in Kbytes. If not provided in the option, the swap size will be read from /proc/meminfo. 28 | .TP 29 | \fB-p\fR \fIpath\fR 30 | Specify path where CTs will reside. By default /vz used. 31 | .TP 32 | .SH DIAGNOSTICS 33 | \fBvzsplit\fR returns 0 upon a sucessful execution. If anything goes wrong, it 34 | returns 1. 35 | .SH SEE ALSO 36 | .BR ve.conf (5). 37 | .SH COPYRIGHT 38 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 39 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 40 | 41 | -------------------------------------------------------------------------------- /src/timeutils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | * 23 | * Various time-related functions for ubclogd. See description in header. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | void timediff(const struct timeval *t1, const struct timeval *t2, 31 | struct timeval *tdiff) 32 | { 33 | tdiff->tv_sec = t2->tv_sec - t1->tv_sec; 34 | tdiff->tv_usec = t2->tv_usec - t1->tv_usec; 35 | if (tdiff->tv_usec < 0) 36 | { 37 | tdiff->tv_sec--; 38 | tdiff->tv_usec = 1000000 + tdiff->tv_usec; 39 | } 40 | } 41 | 42 | int decrease_sleeptime(struct timespec *st, const struct timeval *t) 43 | { 44 | st->tv_sec -= t->tv_sec; 45 | if (t->tv_usec != 0) 46 | { 47 | st->tv_nsec -= t->tv_usec * 1000; /* nsec = 1000 * usec */ 48 | } 49 | if (st->tv_nsec < 0) 50 | { 51 | st->tv_sec--; 52 | st->tv_nsec = 1000000000L + st->tv_nsec; 53 | } 54 | if (st->tv_sec < 0) 55 | { 56 | st->tv_sec = 0; st->tv_nsec = 0; 57 | return -1; 58 | } 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /man/vzcfgscale.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzcfgscale 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzcfgscale \- scale a CT configuration file. 5 | .SH SYNOPSIS 6 | vzcfgscale [\fIoptions\fR] \fIconfigfile\fR 7 | .SH DESCRIPTION 8 | This utility is used to scale a Container 9 | configuration. It multiplies Container resource control parameters 10 | by the number passed as an argument. 11 | .SH OPTIONS 12 | .IP "\fB-o\fR, \fB--output-file\fR \fIoutfile\fR" 4 13 | Output the scaled configuration into the \fIoutfile\fR. By default, the utility prints its output to the screen. Note that the file specified cannot be the same as input file \fIconfigfile\fR, otherwise you will lose the configuration file content. 14 | .IP "\fB-a\fR, \fB--all\fR \fIcoeff\fR" 4 15 | Multiply all Container parameters by the coefficient specified. 16 | .IP "\fB-c\fR, \fB--cpu-only\fR \fIcoeff\fR" 4 17 | Multiply the CPU parameters by the coefficient specified. 18 | .IP "\fB-d\fR, \fB--disk-only\fR \fIcoeff\fR" 4 19 | Multiply the disk quota parameters by the coefficient specified. 20 | .IP "\fB-u\fR, \fB--ubc-only\fR \fIcoeff\fR" 4 21 | Multiply the UBC parameters by the coefficient specified. 22 | .IP "\fB-n\fR, \fB--network-only\fR \fIcoeff\fR" 4 23 | Multiply the network bandwidth parameters by the coefficient specified. 24 | .IP "\fB-r\fR, \fB--remove\fR" 4 25 | Skip the CT-specific parameters like \fBVE_ROOT\fR, \fBVE_PRIVATE\fR, etc. This option is used for producing configuration samples to be employed as an argument for the \fB--config\fR option of the \fBvzctl create\fR command. 26 | .PP 27 | After the CT configuration file has been scaled it is recommended to check the CT configuration validity with the \fBvzcfgvalidate\fR(8) utility. 28 | .SH DIAGNOSTICS 29 | Normally, the exit status is 0. On error, the exit status is 1. 30 | .SH SEE ALSO 31 | .BR ve.conf (5), 32 | .BR vzcfgvalidate (8). 33 | .SH COPYRIGHT 34 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 35 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 36 | -------------------------------------------------------------------------------- /include/clist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef _CLIST_H_ 25 | #define _CLIST_H_ 26 | 27 | #include "list.h" 28 | 29 | struct CList 30 | { 31 | char *str; 32 | unsigned long *val1; 33 | unsigned long *val2; 34 | int flag; 35 | struct CList *next; 36 | struct CList *end; 37 | }; 38 | 39 | struct CList *ListAddElem(struct CList *list, char *val, unsigned long *val1, 40 | unsigned long *val2); 41 | struct CList *ListAddIpElem(struct CList *list, char *ip, unsigned long *mask); 42 | void ListFree(struct CList *list); 43 | int ListSize(struct CList *list); 44 | struct CList *ListLast(struct CList *list); 45 | struct CList *ListFind(struct CList *list, const char *elem); 46 | struct CList *ListFindVar(struct CList *list, char *elem, char delim); 47 | struct CList *ListFindVal(struct CList *list, unsigned long *val1, 48 | unsigned long *val2); 49 | char * List_genstr(struct CList *list, char *buf, int size); 50 | int ListCmp(struct CList *l1, struct CList *l2); 51 | #endif /* _CLIST_H_ */ 52 | -------------------------------------------------------------------------------- /etc/vz-pci_configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2000-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | # 19 | # 20 | # This script executed after moving PCI devices in/from CT 21 | # 22 | # Parameters are passed in environment variables. 23 | # Required parameters: 24 | # VEID - container ID 25 | # PCI - list of pci devices 26 | # ADD - boolean flag (1 - add, 0 -del) 27 | 28 | NVIDIA_PROC=/proc/driver/nvidia/ 29 | VZCTL=vzctl 30 | 31 | # Prepare nVidia vidoa cards for using in CT 32 | handle_nvidia_device() 33 | { 34 | local pci major minor dev card dev_num PCI 35 | PCI=$1 36 | 37 | lspci -s $PCI | grep -qi 'VGA.*nvidia' || return; 38 | 39 | modprobe nvidia &> /dev/null 40 | if [ $? -ne 0 ]; then 41 | echo "Can't load module nvidia" 42 | exit 1 43 | fi 44 | } 45 | 46 | for dev in $PCI; do 47 | handle_nvidia_device $dev 48 | cmd='-' 49 | if [ "$ADD" = 1 ]; then 50 | cmd='+' 51 | sort="" 52 | SYSFS_PATH="/sys" 53 | else 54 | sort=-r 55 | SYSFS_PATH="/$VE_ROOT/sys/" 56 | fi 57 | for i in `find $SYSFS_PATH/bus/pci/devices/$dev/ -name ve_device_add -printf '%d %p\n'| sort -n $sort | while read n f; do echo $f; done`; do 58 | echo $cmd$VEID > $i || exit 1 59 | done 60 | done 61 | 62 | exit 0 63 | 64 | -------------------------------------------------------------------------------- /vzpid: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | # This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | # it and/or modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2 of the License, 8 | # or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | # 02110-1301, USA. 19 | # 20 | # Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | # Schaffhausen, Switzerland. 22 | # 23 | # See also vzpid(8) man page 24 | 25 | 26 | veidmark='envID:' 27 | namemark='Name:' 28 | 29 | function usage() 30 | { 31 | echo "Usage: vzpid [pid ...] [-h]" 32 | } 33 | 34 | function header() 35 | { 36 | echo "Pid VEID Name" 37 | } 38 | 39 | function getveid() 40 | { 41 | local pid=$1 42 | 43 | [ -f /proc/${pid}/status ] || return 44 | cat /proc/${pid}/status | \ 45 | awk -v pid=${pid} 'BEGIN{veid=0} /^'${namemark}'|^'${veidmark}'/{ 46 | if ($1 == "'${namemark}'") { 47 | name = $2; 48 | } else if ($1 == "'${veidmark}'") { 49 | veid = $2; 50 | } 51 | } 52 | END{ 53 | printf("%d\t%s\t%s\n", pid, veid, name); 54 | }' 55 | } 56 | 57 | pidlist= 58 | if [ $# -eq 0 ]; then 59 | usage 60 | exit 1 61 | elif [ $# -eq 1 -a "x$1" = "x-" ]; then 62 | while read pid; do 63 | pidlist="${pidlist} ${pid}" 64 | done 65 | elif [ $# -eq 1 -a "x$1" = "x-h" ]; then 66 | usage 67 | exit 0 68 | else 69 | pidlist=$* 70 | fi 71 | header 72 | for i in ${pidlist}; do 73 | getveid ${i} 74 | done 75 | 76 | -------------------------------------------------------------------------------- /include/ubclogd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | * 23 | * A header file for ubclogd. 24 | */ 25 | 26 | #ifndef _UBCLOGD_H_ 27 | #define _UBCLOGD_H_ 28 | 29 | #define PROGRAM_NAME "ubclogd" 30 | #define ULD_VERSION "2.1.0" 31 | #define ULD_RELEASE "2" 32 | #define FULL_NAME PROGRAM_NAME " v." ULD_VERSION "-" ULD_RELEASE 33 | #define STARTUP_MSG FULL_NAME " started.\n" 34 | #define UBC_HEADER " uid resource held maxheld" \ 35 | " barrier limit failcnt\n" 36 | 37 | #define UPDATE_INTERVAL 60 38 | #define RESERVED_SPACE 512 39 | #define BLOCKSIZE 1024 40 | /* How many blocks can be used before expanding */ 41 | #define BLOCK_THRESHOLD 4 42 | /* How many extra blocks to add, not counting used blocks */ 43 | #define BLOCK_EXTRA 4 44 | #define LOG_FILE "/var/log/ubc" 45 | #define UBC_FILE "/proc/user_beancounters" 46 | #define FILL_CHAR '\0' 47 | 48 | 49 | /* List of UBC parameters we log */ 50 | char * ubc_to_log[] = 51 | { 52 | "kmemsize", 53 | "numproc", 54 | "privvmpages", 55 | "physpages", 56 | "oomguarpages", 57 | NULL 58 | }; 59 | 60 | #endif /* _UBCLOGD_H_ */ 61 | -------------------------------------------------------------------------------- /include/validate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * 4 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 5 | * it and/or modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of the License, 7 | * or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | * 19 | * Our contact details: Parallels International GmbH, Vordergasse 59, 8200 20 | * Schaffhausen, Switzerland. 21 | */ 22 | 23 | #ifndef _VALIDATE_H_ 24 | #define _VALIDATE_H_ 25 | 26 | #define STR_ACT_NONE "none" 27 | #define STR_ACT_WARN "warning" 28 | #define STR_ACT_ERROR "error" 29 | #define STR_ACT_FIX "fix" 30 | 31 | 32 | #define ACT_NONE 0 33 | #define ACT_WARN 1 34 | #define ACT_ERROR 2 35 | #define ACT_FIX 3 36 | 37 | #define UTILIZATION 0 38 | #define COMMITMENT 1 39 | 40 | struct CRusage { 41 | double low_mem; 42 | double total_ram; 43 | double mem_swap; 44 | double alloc_mem; 45 | double alloc_mem_lim; 46 | double alloc_mem_max_lim; 47 | double cpu; 48 | }; 49 | 50 | int validate(int veid, struct CParam *param, int recover, int ask); 51 | int validate_ve(int veid, struct CParam *param); 52 | struct CRusage *calc_hn_rusage(int mode); 53 | struct CRusage * calc_ve_commitment(int veid, struct CParam *param, 54 | int numerator); 55 | struct CRusage * calc_ve_utilization(struct CParam *param, int numerator); 56 | int inc_rusage(struct CRusage *rusagetotal, struct CRusage *rusageve); 57 | int check_hn_overcommitment(int veid, struct CParam *param); 58 | int check_param(struct CParam *param, int log); 59 | int mul_rusage(struct CRusage *rusage, int k); 60 | #endif 61 | -------------------------------------------------------------------------------- /include/vzerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef _ERROR_H_ 25 | #define _ERROR_H_ 26 | 27 | #include 28 | 29 | #define VZ_SYSTEM_ERROR VZCTL_E_SYSTEM 30 | #define VZ_NOMEM_ERROR VZCTL_E_NOMEM 31 | #define VZ_RESOURCE_ERROR VZCTL_E_RESOURCE 32 | #define VZ_COMMAND_EXECUTION_ERROR VZCTL_E_EXEC 33 | #define VZ_LOCKED VZCTL_E_LOCKED 34 | #define VZ_NOSCRIPT VZCTL_E_NOSCRIPT 35 | #define VZCTL_E_SCRIPT_EXECUTION 19 36 | #define VZ_NOVE_CONFIG VZCTL_E_NOVE_CONFIG 37 | #define VZ_INVALID_PARAMETER_SYNTAX VZCTL_E_INVAL_PARAMETER_SYNTAX 38 | #define VZ_INVALID_PARAMETER_VALUE VZCTL_E_INVAL 39 | #define VZ_VE_ROOT_NOTSET VZCTL_E_VE_ROOT_NOTSET 40 | #define VZ_VE_PRIVATE_NOTSET VZCTL_E_VE_PRIVATE_NOTSET 41 | #define VZCTL_E_ENV_NOT_RUNG VZCTL_E_ENV_NOT_RUN 42 | #define VZ_FS_CANTMOUNT VZCTL_E_MOUNT 43 | #define VZ_FS_NOT_MOUNTED VZCTL_E_FS_NOT_MOUNTED 44 | #define VZ_VE_NOT_RUNNING VZCTL_E_ENV_NOT_RUN 45 | #define VZ_SET_NAME_ERROR VZCTL_E_SET_NAME 46 | #define VZ_VE_MANAGE_DISABLED VZCTL_E_ENV_MANAGE_DISABLED 47 | #define VZCTL_E_LIST_SNAPSHOT 167 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /** Return test message of the last error 54 | */ 55 | const char *vzctl_get_last_error(void); 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #endif /* _VZ_ERROR_H_ */ 60 | -------------------------------------------------------------------------------- /man/Makefile: -------------------------------------------------------------------------------- 1 | # This Makefile is not needed to build the package, it just provides 2 | # convenient way for developer to make ps/pdf/pcl from manpages --kir. 3 | 4 | MANS = vzctl.8 vz.5 ve.conf.5 networks_classes.5 \ 5 | vz-start.5 vz-stop.5 \ 6 | vz-net_add.5 vz-net_del.5 \ 7 | vz-create_prvt.5 vz-postinst.5 \ 8 | vzpurge.8 vzgetpa.8 vznetstat.8 vzsplit.8 vzcpucheck.8 \ 9 | vzpid.8 vzcfgscale.8 vzcfgvalidate.8 \ 10 | vzauth.8 vztactl.8 vzlist.8 \ 11 | vzdiskcheck.8 vzeventd.8 12 | 13 | PSS = $(patsubst %, %.ps, $(MANS)) 14 | PDFS = $(patsubst %, %.pdf, $(MANS)) 15 | PCLS = $(patsubst %, %.pcl, $(MANS)) 16 | TXTS = $(patsubst %, %.txt, $(MANS)) 17 | GROFF = groff 18 | #GROFF_OPTIONS = -Tps -t -msafer -man 19 | # below is for A4 page size, requires a4.tmac 20 | GROFF_OPTIONS = -Tps -t -ma4 -msafer -man -rC1 -rD1 -rS11 21 | GROFF_TEXT_OPTIONS = -Tlatin1 -t -ma4 -msafer -man -rC1 -rD1 -rS11 22 | GROFF_PCL_OPTIONS = -Tlj4 -t -ma4 -msafer -man -rC1 -rD1 -rS11 -P-pa4 -P-d1 23 | PS2PDF = ps2pdf 24 | 25 | all: 26 | 27 | ps: $(PSS) 28 | 29 | all.ps: $(MANS) 30 | $(GROFF) $(GROFF_OPTIONS) $(MANS) > all.ps 31 | 32 | all.pcl: $(MANS) 33 | $(GROFF) $(GROFF_PCL_OPTIONS) $(MANS) > all.pcl 34 | 35 | pdf: $(PDFS) 36 | 37 | txt: $(TXTS) 38 | 39 | print: manual.pcl 40 | lpr manual.pcl 41 | 42 | clean: clean-ps clean-pdf clean-pcl clean-txt 43 | rm -f toc.man toc.ps all.ps manual.ps manual.pdf manual.pcl 44 | 45 | clean-pdf: 46 | rm -f $(PDFS) 47 | 48 | clean-ps: 49 | rm -f $(PSS) 50 | 51 | clean-pcl: 52 | rm -f $(PCLS) 53 | 54 | clean-txt: 55 | rm -f $(TXTS) 56 | 57 | 58 | %.5.ps: %.5 59 | $(GROFF) $(GROFF_OPTIONS) $< > $@ 60 | 61 | %.8.ps: %.8 62 | $(GROFF) $(GROFF_OPTIONS) $< > $@ 63 | 64 | %.pdf: %.ps 65 | $(PS2PDF) $< 66 | 67 | # pcl - for HP LaserJet and compatible printers 68 | %.5.pcl: %.5 69 | $(GROFF) $(GROFF_PCL_OPTIONS) $< > $@ 70 | 71 | %.8.pcl: %.8 72 | $(GROFF) $(GROFF_PCL_OPTIONS) $< > $@ 73 | 74 | # text with overstriking 75 | %.5.txt.os: %.5 76 | $(GROFF) $(GROFF_TEXT_OPTIONS) $< > $@ 77 | %.8.txt.os: %.8 78 | $(GROFF) $(GROFF_TEXT_OPTIONS) $< > $@ 79 | 80 | # to remove overstrike 81 | %.txt: %.txt.os 82 | sed 's/.//g' < $< > $@ && rm -f $< 83 | 84 | toc.man: toc.man.in all.ps Makefile 85 | sed -ne '1,/@TOC@/p' < toc.man.in | sed '/@TOC@/d' > $@ 86 | ./toc.sh all.ps >> $@ 87 | sed -ne '/@TOC@/,$$p' < toc.man.in | sed '/@TOC@/d' >> $@ 88 | 89 | toc.ps: toc.man 90 | $(GROFF) -Tps -t -ma4 -msafer $< > $@ 91 | 92 | manual.pcl: toc.man $(MANS) 93 | $(GROFF) $(GROFF_PCL_OPTIONS) $^ > $@ 94 | 95 | manual.ps: toc.man $(MANS) 96 | $(GROFF) $(GROFF_OPTIONS) $^ > $@ 97 | 98 | .PHONY: clean clean-ps clean-pdf 99 | -------------------------------------------------------------------------------- /etc/vz.conf: -------------------------------------------------------------------------------- 1 | ## Global parameters 2 | VIRTUOZZO=yes 3 | ACTIONLOGDIR=/vz/actionlog 4 | LOCKDIR=/vz/lock 5 | 6 | # Golden Image functionality allowing the use of extended template caches that 7 | # contain an OS template and one or more application templates. 8 | GOLDEN_IMAGE="yes" 9 | 10 | ## Logging parameters 11 | LOGGING=yes 12 | LOGFILE=/var/log/vzctl.log 13 | LOG_LEVEL=0 14 | 15 | ## Disk quota parameters 16 | DISK_QUOTA=yes 17 | 18 | ## IPV6 support 19 | IPV6=yes 20 | 21 | ## Network traffic parameters 22 | TRAFFIC_SHAPING=no 23 | BANDWIDTH="" 24 | TOTALRATE="*:1:4000" 25 | RATE="*:1:8" 26 | # If packet size is lower then MPU bytes, it will consume MPU HTB tokens. 27 | # This is to limit packet rate (packet rate = TOTALRATE / RATEMPU). 28 | # If MPU value (bytes) is omitted then VZ_TC_DEFAULT_MPU (1000) is used. 29 | # If dev:class is not in RATEMPU, then packet rate is not limited for them. 30 | RATEMPU="*:1:1000" 31 | 32 | # The name of the device whose ip address will be used as source ip for VE. 33 | # By default automatically assigned. 34 | #VE_ROUTE_SRC_DEV="eth0" 35 | 36 | ## Template parameters 37 | TEMPLATE=/vz/template 38 | 39 | ## Defaults for VEs 40 | VE_ROOT=/vz/root/$VEID 41 | VE_PRIVATE=/vz/private/$VEID 42 | CONFIGFILE="basic" 43 | DEF_OSTEMPLATE=".almalinux-9" 44 | 45 | ## Load vzwdog module 46 | VZWDOG=no 47 | 48 | # Enable use of hardware checksumming on venet interfaces. Absent: autoconfigure. 49 | # USE_NET_HWCSUM=yes 50 | # Enable use of hardware tcp segmentation offload on venet interfaces. Absent: autoconfigure. 51 | # USE_NET_TSO=yes 52 | 53 | # Enable Receive packet steering for virtual interfaces 54 | USE_NET_RPS=yes 55 | 56 | # Defines FS version for template caching. 57 | VEFSTYPE="xfs" 58 | # Defines Image Format for template caching. 59 | VEIMAGEFORMAT="ploop" 60 | 61 | USE_VENET_MASK=yes 62 | 63 | # VZ Tools limits 64 | # To enable - uncomment next line, check the value - there should not be CT with the same ID 65 | # VZ_TOOLS_BCID=2 66 | # Uncomment next line to specify required disk IO bandwidth in Bps (10485760 - 10MBps) 67 | # VZ_TOOLS_IOLIMIT=10485760 68 | # Uncomment next line to specify memory limit in bytes (536870912 - 512Mb) 69 | # VZ_TOOLS_MEMLIMIT=536870912 70 | 71 | # Number of the parallel VEs on start/stop. 72 | # In case empty value the number of parallel VEs calculated as 'num_cpu * 4' 73 | # VE_PARALLEL=1 74 | 75 | DUMPDIR=/vz/dump 76 | 77 | # Specifies an action to be performed on Container file system error event. 78 | # - stop: forcibly stop Container (default). 79 | # ON_VE_FSERROR=stop 80 | 81 | # Specifies an action to be performed on Containers on node shutdown or reboot 82 | # 'suspend' or 'stop' 83 | VE_STOP_MODE=stop 84 | -------------------------------------------------------------------------------- /src/technologies.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "vzctl.h" 31 | 32 | struct env_feature { 33 | char *name; 34 | unsigned long long mask; 35 | }; 36 | static struct env_feature env_features[] = { 37 | { "nfs", VZ_FEATURE_NFS}, 38 | { "sit", VZ_FEATURE_SIT}, 39 | { "ipip", VZ_FEATURE_IPIP}, 40 | { "ppp", VZ_FEATURE_PPP}, 41 | { "ipgre", VZ_FEATURE_IPGRE}, 42 | { "bridge", VZ_FEATURE_BRIDGE}, 43 | { "nfsd", VZ_FEATURE_NFSD}, 44 | { "time", VZ_FEATURE_TIME}, 45 | 46 | { NULL} 47 | }; 48 | 49 | void features_mask2str(unsigned long long mask, unsigned long long known, char *delim, 50 | char *buf, int len) 51 | { 52 | struct env_feature *feat; 53 | int ret, i, j = 0; 54 | 55 | for (i = 0, feat = env_features; feat->name != NULL; feat++) { 56 | if (!(known & feat->mask)) 57 | continue; 58 | ret = snprintf(buf, len, "%s%s:%s", 59 | j++ == 0 ? "" : delim, 60 | feat->name, 61 | mask & feat->mask ? "on" : "off"); 62 | buf += ret; 63 | len -= ret; 64 | if (len <= 0) 65 | break; 66 | i++; 67 | } 68 | } 69 | 70 | void print_json_features(unsigned long long mask, unsigned long long known) 71 | { 72 | struct env_feature *feat; 73 | int i, j = 0; 74 | 75 | for (i = 0, feat = env_features; feat->name != NULL; feat++) { 76 | if (!(known & feat->mask)) 77 | continue; 78 | printf("%s \"%s\": %s", 79 | j++ == 0 ? "{\n" : ",\n", 80 | feat->name, 81 | mask & feat->mask ? "true" : "false"); 82 | i++; 83 | } 84 | if (j) 85 | printf("\n }"); 86 | else 87 | printf("null"); 88 | } 89 | -------------------------------------------------------------------------------- /src/script.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "config.h" 34 | 35 | char *makecmdline(char **argv) 36 | { 37 | char **p; 38 | char *str, *sp; 39 | int len = 0; 40 | 41 | if (!argv) 42 | return NULL; 43 | p = argv; 44 | while (*p) 45 | len += strlen(*p++) + 1; 46 | if ((str = (char *)xmalloc(len + 1)) == NULL) 47 | return NULL; 48 | p = argv; 49 | sp = str; 50 | while (*p) 51 | sp += sprintf(sp, "%s ", *p++); 52 | return str; 53 | } 54 | 55 | void freearg(char **arg) 56 | { 57 | char **p = arg; 58 | if (arg == NULL) 59 | return; 60 | while (*p) 61 | free(*p++); 62 | free(arg); 63 | return; 64 | } 65 | 66 | char *readscript(char *name, int use_f) 67 | { 68 | struct stat st; 69 | char *buf = NULL, *p = NULL; 70 | int fd, len; 71 | 72 | if (!name) 73 | return NULL; 74 | /* Read include file first */ 75 | if (use_f) 76 | buf = readscript(VE_FUNC, 0); 77 | 78 | if (stat(name, &st)) 79 | return NULL; 80 | 81 | if (!(fd = open(name, O_RDONLY))) 82 | { 83 | logger(-1, errno, "Error opening %s", name); 84 | return NULL; 85 | } 86 | if (buf) 87 | { 88 | len = st.st_size + strlen(buf); 89 | buf = (char *)realloc(buf, len + 2); 90 | p = buf + strlen(buf); 91 | } 92 | else 93 | { 94 | len = st.st_size; 95 | buf = (char *)realloc(buf, len + 2); 96 | p = buf; 97 | } 98 | 99 | buf[len] = '\n'; 100 | buf[len + 1] = 0; 101 | if (read(fd, p, st.st_size) < 0) 102 | { 103 | logger(-1, errno, "Error reading %s", name); 104 | free(buf); 105 | return NULL; 106 | } 107 | close(fd); 108 | return buf; 109 | } 110 | 111 | -------------------------------------------------------------------------------- /src/vzmonitor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include "vzctl.h" 34 | 35 | #ifndef NETLINK_VZEVENT 36 | #define NETLINK_VZEVENT 31 37 | #endif 38 | 39 | void msg_print(char *buf, ctid_t ctid) 40 | { 41 | char *p; 42 | 43 | p = strchr(buf, '@'); 44 | if (p == NULL || ++p == 0) { 45 | logger(0, 0, "Invalid message format: [%s]", buf); 46 | return; 47 | } 48 | 49 | if (CMP_CTID(p, ctid) == 0) { 50 | fprintf(stdout, "%s\n", buf); 51 | fflush(stdout); 52 | } 53 | } 54 | 55 | int monitoring(ctid_t ctid) 56 | { 57 | int s, ret; 58 | struct sockaddr_nl nladdr; 59 | struct iovec iov; 60 | char buf[512]; 61 | struct msghdr msg; 62 | 63 | ret = -1; 64 | memset(&msg, 0, sizeof(msg)); 65 | msg.msg_name = (void*)&nladdr; 66 | msg.msg_namelen = sizeof(nladdr); 67 | msg.msg_iov = &iov; 68 | msg.msg_iovlen = 1; 69 | 70 | s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_VZEVENT); 71 | if (s < 0) 72 | goto out; 73 | 74 | memset(&nladdr, 0, sizeof(nladdr)); 75 | nladdr.nl_family = AF_NETLINK; 76 | nladdr.nl_groups = 0x01; /* multicast */ 77 | 78 | if (bind(s, (struct sockaddr *)&nladdr, sizeof(nladdr)) == -1) { 79 | logger(-1, errno, "Could not bind the socket"); 80 | goto out; 81 | } 82 | 83 | nladdr.nl_pid = 0; 84 | nladdr.nl_groups = 0; 85 | 86 | while (1) { 87 | memset(buf, 0, sizeof(buf)); 88 | iov.iov_base = buf; 89 | iov.iov_len = sizeof(buf); 90 | 91 | ret = recvmsg(s, &msg, 0); 92 | if (ret < 0) { 93 | logger(-1, errno, "Failed to receive the event message"); 94 | goto out; 95 | } else if (!ret) 96 | break; 97 | 98 | msg_print(buf, ctid); 99 | } 100 | ret = 0; 101 | out: 102 | return ret; 103 | } 104 | -------------------------------------------------------------------------------- /include/veth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef __VETH_H__ 25 | #define __VETH_H__ 26 | 27 | #include "list.h" 28 | 29 | #define IFNAMSIZE 16 30 | #define ETH_ALEN 6 31 | #define MAC_SIZE 3*ETH_ALEN - 1 32 | #define VZNETCFG "/usr/sbin/vznetcfg" 33 | 34 | #define PROC_VETH "/proc/vz/veth" 35 | 36 | #define SW_OUI 0x001851 37 | #define DEF_VETHNAME "veth$VEID" 38 | 39 | #define VZCTL_VETH_CONFIGURE_ALL 0x01 40 | #define VZCTL_VETH_CONFIGURE_NONE 0x02 41 | 42 | struct vzctl_ip_param { 43 | list_elem_t list; 44 | char *ip; 45 | unsigned int mask; 46 | int op; 47 | }; 48 | typedef struct vzctl_ip_param vzctl_ip_param_t; 49 | typedef struct vzctl_ip_param veth_ip; 50 | 51 | /** Data structure for devices. */ 52 | typedef struct veth_dev { 53 | list_elem_t list; /**< next element. */ 54 | list_head_t ip; 55 | char mac[ETH_ALEN]; /**< device MAC address. */ 56 | int addrlen; /**< device MAC address length. */ 57 | char dev_name[IFNAMSIZE+1]; /**< device name. */ 58 | char mac_ve[ETH_ALEN]; /**< device MAC address in VPS. */ 59 | int addrlen_ve; /**< VPS device MAC address length. */ 60 | char dev_name_ve[IFNAMSIZE+1]; /**< device name in VPS. */ 61 | int flags; 62 | char *gw; /**< gateway ip */ 63 | char *gw6; /**< gateway ip6 */ 64 | char *network; /**< connect virtual interface to 65 | virtual network. 66 | */ 67 | int dhcp; /**< DHCP on/off. */ 68 | int dhcp6; /**< DHC6P on/off. */ 69 | int active; 70 | int configure; /**< configure flag */ 71 | int custom_dev_name; 72 | int mac_filter; 73 | int configure_mode; /** configure network related 74 | parameters mask 75 | */ 76 | } veth_dev; 77 | 78 | /** Devices list. 79 | * */ 80 | typedef struct veth_param { 81 | list_head_t dev; 82 | int delall; 83 | } veth_param; 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/tmplmn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | /* $Id$ */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include "vzctl.h" 43 | #include "vzerror.h" 44 | #include "tmplmn.h" 45 | #include "util.h" 46 | 47 | char *read_dist(struct CParam *param) 48 | { 49 | FILE *fd; 50 | char buf[STR_SIZE]; 51 | int len; 52 | char *p; 53 | int status; 54 | char *argv[6]; 55 | int i = 0; 56 | 57 | argv[i++] = VZPKG; 58 | argv[i++] = "info"; 59 | argv[i++] = "-q"; 60 | if (param->ostmpl != NULL) { 61 | argv[i++] = param->ostmpl; 62 | argv[i++] = "distribution"; 63 | } else 64 | return NULL; 65 | argv[i++] = NULL; 66 | 67 | if ((fd = vzctl_popen(argv, NULL, 0)) == NULL) { 68 | char *str = arg2str(argv); 69 | logger(-1, errno, "failed: %s ", str); 70 | free(str); 71 | return NULL; 72 | } 73 | *buf = 0; 74 | len = fread(buf, 1, sizeof(buf), fd); 75 | status = vzctl_pclose(fd); 76 | if (WEXITSTATUS(status) || len <= 0) 77 | return NULL; 78 | buf[len] = 0; 79 | if ((p = strrchr(buf, '\n')) != NULL) 80 | *p = 0; 81 | return strdup(buf); 82 | 83 | } 84 | 85 | char *get_dist_type(struct CParam *param) 86 | { 87 | char *dist, *tmp; 88 | 89 | if (param->dist != NULL) 90 | return strdup(param->dist); 91 | if ((tmp = get_ostmpl(param)) == NULL) 92 | return NULL; 93 | if ((dist = read_dist(param)) == NULL) 94 | dist = strdup(tmp); 95 | /* store calculated dist */ 96 | param->dist = strdup(dist); 97 | 98 | return dist; 99 | } 100 | 101 | char *get_ostmpl(struct CParam *param) 102 | { 103 | if (param == NULL) 104 | return NULL; 105 | if (param->ostmpl != NULL) 106 | return param->ostmpl; 107 | return NULL; 108 | } 109 | -------------------------------------------------------------------------------- /man/vzcfgconvert.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzcfgconvert 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzcfgconvert \- convert the CT configuration file from Virtuozzo 5 | \fI2.0.2\fR to \fI3.0.0\fR or from \fI2.6.2\fR to \fI3.0.0\fR. 6 | .SH SYNOPSIS 7 | vzcfgconvert [\fIveid\fR] 8 | .SH DESCRIPTION 9 | This utility converts the CT configuration file from the old \fI2.0.2\fR or \fI2.6.2\fR 10 | Virtuozzo to the latest Virtuozzo update of \fI3.0.0\fR format and saves the updated 11 | configuration file. After upgrading a Hardware Node or migrating a Container 12 | from Virtuozzo 2.0.2 Hardware Node to a Virtuozzo 3.0.0 Hardware 13 | Node, the Container configuration file remains in the old format. 14 | @PRODUCT_NAME_SHORT@ can use the old format files to start and run the Container. However, for validation and scaling utilities the file has to be in the 15 | Virtuozzo \fI3.0.0\fR format. 16 | .SS \fBConversion\ formulas from 2.0.2 to 2.6.2\fR 17 | kmemsize.bar = old.kmemsize.bar * 1.44 18 | .br 19 | kmemsize.lim = old.kmemsize.lim * 1.44 20 | .br 21 | kmem = kmemsize.bar / PAGE_SIZE 22 | .br 23 | vmguarpages.bar = 0.002754 * kmem * kmem + 8.22 * kmem - 503.53 24 | .br 25 | vmguarpages.lim = 2147483647 26 | .br 27 | k = (classid != 1) ? max(3.67, old.totvmpages.bar / 71429) : max(2.33, 28 | old.totvmpages.bar / 58777) 29 | .br 30 | privvmpages.bar = vmguarpages.bar * k 31 | .br 32 | privvmpages.lim = vmguarpages.bar * k * 1.11 33 | .br 34 | k = (classid != 1) ? k = 10.67 : k = 1.5 35 | .br 36 | shmpages.bar = shmpages.lim = old.ipcshmpages.bar + old.anonshpages.bar) * k 37 | .br 38 | physpages.bar = 0 39 | .br 40 | physpages.lim = 2147483647 41 | .br 42 | oomguarpages.bar = old.oomguar.bar 43 | .br 44 | oomguarpages.lim = 2147483647 45 | .br 46 | numtcpsock.bar = old.numsock.bar 47 | .br 48 | numtcpsock.lim = old.numsock.lim 49 | .br 50 | tcpsndbuf.bar = old.tcpsendbuf.bar 51 | .br 52 | tcpsndbuf.lim = old.tcpsendbuf.lim * 2 53 | .br 54 | tcprcvbuf.bar = old.tcprcvbuf.bar 55 | .br 56 | tcprcvbuf.lim = old.tcprcvbuf.lim * 2 57 | .br 58 | othersockbuf.bar = old.unixsockbuf.bar 59 | .br 60 | othersockbuf.lim = old.unixsockbuf.lim * 2.67 61 | .br 62 | dgramrcvbuf.bar = old.sockrcvbuf.bar 63 | .br 64 | dgramrcvbuf.lim = old.sockrcvbuf.lim 65 | .br 66 | numothersock.bar = old.numunixsock.bar * 2.67 67 | .br 68 | numothersock.lim = old.numunixsock.lim * 2.67 69 | .br 70 | numfile.bar = numfile.lim = old.numproc.bar * 20.48 71 | .br 72 | avnumproc.bar = avnumproc.lim = kmemsize.bar / 67584 73 | .br 74 | dcachesize.bar = dcachesize.lim = numfile.bar * 512 75 | .SS \fBConversion\ formulas from 2.6.2 to 3.0.0\fR 76 | kmemside.bar *= 1.2 77 | .br 78 | kmemside.lim *= 1.2 79 | .br 80 | numfile.bar *= 1.6 81 | .br 82 | numfile.lim *= 1.6 83 | .br 84 | dcachesize.lim *= 2 85 | .SH BUGS 86 | Conversation should be done once, otherwise result can be inconsistent. 87 | .SH DIAGNOSTICS 88 | Normally, the exit status is 0. On error, the exit status is 1. 89 | .SH SEE ALSO 90 | .BR ve.conf (5), 91 | .BR vzcfgvalidate (8). 92 | .SH COPYRIGHT 93 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 94 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 95 | -------------------------------------------------------------------------------- /man/ubclogd.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH ubclogd 8 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | ubclogd \- utility for periodical logging of selected user beancounters. 5 | .SH SYNOPSIS 6 | ubclogd [\fB-i\fR \fIseconds\fR] [\fB-r\fR \fIkilobytes\fR] 7 | [\fB-o\fR \fIlogfile\fR] [\fB-n\fR] 8 | .PP 9 | ubclogd \fB-h\fR 10 | .SH DESCRIPTION 11 | The purpose of this utility is to log snapshots of some selected user 12 | beancounter parameters. 13 | .PP 14 | Upon startup, \fBubclogd\fR checks that it is run under root account, and that 15 | \fB\f(CW/proc/user_beancounters\fR is accessible. It when opens and acquires 16 | an exclusive lock on its log file. Then, it tries to grab some disk space 17 | by adding blocks of zeroes to the end of file. This space is used to write 18 | the log file, so in case of filesystem space shortage log will still 19 | be available. 20 | .PP 21 | Then it forks a daemon, which task is to periodically wake up and 22 | log current values of some user beancounters, reading it from 23 | \fB\f(CW/proc/user_beancounters\fR file. It also maintains free space 24 | at the end of file by periodically writing blocks of zeroes to it. 25 | .PP 26 | Logged beancounters are: \fBkmemsize\fR, \fBnumproc\fR, \fBprivvmpages\fR, 27 | \fBphyspages\fR, and \fBoomguarpages\fR. This list is compiled in and can 28 | not be changed from command line. 29 | .PP 30 | Log file format is similar to this of \fB\f(CW/proc/user_beancounters\fR, 31 | separated by lines with time stamps. 32 | .SH OPTIONS 33 | .IP "\fB-i\fR \fIseconds\fR" 34 | Parameters gather interval, in seconds. Default is \fI60\fR seconds. 35 | .IP "\fB-r\fR \fIkilobytes\fR" 36 | Amount of space to reserve for log file, in kilobytes. Default is \fI512\fR KB. 37 | .IP "\fB-o\fR \fIlogfile\fR" 38 | Name of log file to write log to. Default is 39 | \f(CW/var/log/ubc\fR. 40 | .IP \fB-n\fR 41 | Do not fork into background. 42 | .IP \fB-h\fR 43 | Outputs a short help message, including compiled in defaults 44 | for above command line parameters. 45 | .SH SIGNALS 46 | Below is the list of signals for which \fBubclogd\fR has a special handlers. 47 | .IP \fBSIGUSR1\fR 48 | Upon receiving the signal, extra space in log file is truncated, and 49 | \fBubclogd\fR enters \fI"do not maintain extra space"\fR mode. This 50 | can be used either before rotating \fBubclogd\fR's log file, or before 51 | stopping it, if you do not want to have many zero-filled blocks 52 | at end of file. 53 | .IP \fBSIGHUP\fR 54 | Makes \fBubclogd\fR to reopen its log file, and restore 55 | \fI"maintain extra space"\fR mode. This is used after log rotation. 56 | .SH RETURN VALUE 57 | Returns 0 upon success. If some operation before forking into background 58 | failed, returns 1. 59 | .SH FILES 60 | .BR \f(CW/proc/user_beancounters\fR , 61 | .BR \f(CW/var/log/ubc . 62 | .SH CAVEATS 63 | It is not convenient to read the log file, because it contains a lot 64 | of null characters at the end. This is the price you have to pay for 65 | \fBubclogd\fR ability to reserve free space. 66 | .PP 67 | Log rotating is a bit complex: you have to send \fBSIGUSR1\fR to 68 | process, when rename its log file, and at last send \fBSIGHUP\fR. 69 | .SH SEE ALSO 70 | .BR kill (1). 71 | .SH COPYRIGHT 72 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 73 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 74 | -------------------------------------------------------------------------------- /include/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef _UTIL_H_ 25 | #define _UTIL_H_ 26 | #include 27 | #include "list.h" 28 | 29 | #define BACKUP 0 30 | #define DESTR 1 31 | 32 | #define PROCMEM "/proc/meminfo" 33 | #define PROCTHR "/proc/sys/kernel/threads-max" 34 | #define SAMPLE_CONF_PATTERN "ve-%s.conf-sample" 35 | 36 | #define FREE_P(x) free(x); x = NULL; 37 | #define STR2MAC(dev) \ 38 | ((unsigned char *)dev)[0], \ 39 | ((unsigned char *)dev)[1], \ 40 | ((unsigned char *)dev)[2], \ 41 | ((unsigned char *)dev)[3], \ 42 | ((unsigned char *)dev)[4], \ 43 | ((unsigned char *)dev)[5] 44 | 45 | 46 | #define VZCTL_CLOSE_STD 0x1 47 | #define VZCTL_CLOSE_NOCHECK 0x2 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | int utf8tostr(const char *src, char *dst, int dst_size, const char *enc); 53 | int xstrdup(char **dst, const char *src); 54 | char *parse_line(char *str, char *ltoken, int lsz); 55 | int stat_file(const char *file); 56 | int check_var(const void *val, const char *message); 57 | int make_dir(const char *path, int full, int mode); 58 | int reset_std(void); 59 | int yesno2id(const char *str); 60 | const char *id2yesno(int id); 61 | int get_net_family(const char *ipstr); 62 | int get_netaddr(const char *ip_str, unsigned int *ip); 63 | int parse_int(const char *str, int *val); 64 | double max(double val1, double val2); 65 | unsigned long max_ul(unsigned long val1, unsigned long val2); 66 | unsigned long min_ul(unsigned long val1, unsigned long val2); 67 | void free_str(list_head_t *head); 68 | struct vzctl_str_param *add_str_param(list_head_t *head, const char *str); 69 | int env_is_mounted(ctid_t ctid); 70 | void free_ar_str(char **ar); 71 | int copy_file(const char *src, const char *dst); 72 | char *list2str(const char *prefix, list_head_t *head); 73 | int is_vswap_mode(void); 74 | void features_mask2str(unsigned long long mask, unsigned long long known, char *delim, 75 | char *buf, int len); 76 | void print_json_features(unsigned long long mask, unsigned long long known); 77 | FILE *vzctl_popen(char *argv[], char *env[], int quiet); 78 | int vzctl_pclose(FILE *fp); 79 | char *arg2str(char **arg); 80 | int vzctl_get_normalized_guid(const char *str, char *out, int len); 81 | int get_mul(char c, unsigned long long *n); 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | #endif /* _UTIL_H_ */ 86 | -------------------------------------------------------------------------------- /man/vzlist.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH vzlist 8 "January 2012" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | vzlist \- CT listing utility. 5 | .SH SYNOPSIS 6 | vzlist [\fB-a\fR|\fB-S\fR] [-H] [\fB-o\fR \fIfield\fR[,\fIfield\fR...]] \ 7 | [\fB-s\fR [\fB-\fR]\fIfield\fR] [\fB-h\fR \fIhost_pattern\fR] \ 8 | [\fB-N\fR \fIname_pattern\fR] [\fB-d\fR \fIdescr_pattern\fR] \ 9 | [\fB-i\fR \fIifname\fR] [\fIctid\fR [\fIctid\fR...] | \fB-1\fR] 10 | .PP 11 | vzlist \fB-L\fR 12 | .SH DESCRIPTION 13 | The \fBvzlist\fR utility lists CTs. By default only running CTs are listed. 14 | With \fIctid\fR specified, only specified CTs are listed, 15 | \fIctid\fR of \fB-1\fR is used to output CT IDs only, one per line. 16 | .PP 17 | For the fields that can have many values (e.g. \fBip\fR or \fBnetif\fR), 18 | all the values are displayed only for the last (i.e. leftmost) column; 19 | otherwise, only the first value is shown. 20 | .SH OPTIONS 21 | .IP "\fB-H\fR, \fB--no-header\fR" 22 | Suppress displaying the header. 23 | .IP "\fB-j\fR, \fB--json\fR" 24 | Output in JSON format. 25 | .IP "\fB-a\fR, \fB--all\fR" 26 | List all CTs. 27 | .IP "\fB-S\fR, \fB--stopped\fR" 28 | List only stopped CTs. 29 | .IP "\fB-n\fR, \fB--name\fR" 30 | Display CT names (instead of hostnames). 31 | .IP "\fB-o\fR, \fB--output\fR \fIfield[,\fIfield\fR...]" 32 | Display only the specified \fIfield\fR(s). 33 | .IP "\fB-s\fR, \fB--sort\fR \fIfield\fR" 34 | Sort by the value of \fIfield\fR (possible arguments are the same 35 | as for \fB-o\fR). The \fB-\fR before the field name means sorting 36 | in the reverse order. 37 | .SS Output filters 38 | List of CTs can be further filtered using the following options. 39 | For patterns (except for \fB--netif\fR) one can use the same wildcards 40 | as in shell (i.e. \fB*\fR, \fB?\fR, and \fB[]\fR). 41 | Note: to avoid expansion of wildcards by the shell, one have to escape 42 | the pattern by either putting it into single quotes (like \fB'a*a'\fR) 43 | or by adding a backslash before the wildcard character (like \fBa\\*a\fR). 44 | .IP "\fB-h\fR, \fB--hostname\fR \fIpattern\fR" 45 | List only those CTs whose hostname matches the \fIpattern\fR. 46 | .IP "\fB-N\fR, \fB--name_filter\fR \fIpattern\fR" 47 | List only CTs whose names match the \fIpattern\fR. 48 | .IP "\fB-d\fR, \fB--description\fR \fIdesc_pattern\fR" 49 | List only those CTs whose descriptions match the \fIdesc_pattern\fR. 50 | .IP "\fB-i\fR, \fB--netif\fR \fIhost_ifname\fR" 51 | List only CTs whose host interface names match the \fIhost_ifname\fR pattern. 52 | Note that you can not use wildcards with this option. 53 | .SS Possible fields 54 | .IP "\fB-L\fR, \fB--list\fR" 55 | List all the fields that can be used for both output 56 | (\fB-o\fR, \fB--output\fR) and the sorting order 57 | (\fB-s\fR, \fB--sort\fR). 58 | 59 | For the user beancounter fields, if suffix is not specified, current usage 60 | (a.k.a. "held") value is show. One can also use the following suffixes: 61 | .RS 62 | .TP 63 | .B .m 64 | maxheld 65 | .TP 66 | .B .b 67 | barrier 68 | .TP 69 | .B .l 70 | limit 71 | .TP 72 | .B .f 73 | fail counter 74 | .PP 75 | For the disk quota fields, if suffix is not specified, current usage 76 | is shown. One can also use the following suffixes: 77 | .TP 78 | .B .s 79 | soft limit 80 | .TP 81 | .B .h 82 | hard limit 83 | .RE 84 | .SH RETURN CODE 85 | Returns 0 upon success. 86 | .SH COPYRIGHT 87 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 88 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 89 | -------------------------------------------------------------------------------- /vzdiskcheck: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2012-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | # This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | # it and/or modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2 of the License, 8 | # or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | # 02110-1301, USA. 19 | # 20 | # Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | # Schaffhausen, Switzerland. 22 | # 23 | # Script that prints disk usage information 24 | # Usage: vzdiskcheck [-v] 25 | # See also vzdiskcheck(8) man page 26 | 27 | VZROOT="/vz" 28 | VERBOSE=0 29 | XML=0 30 | function usage() 31 | { 32 | echo "Usage: vzdiskcheck [-v]" 33 | exit 2 34 | } 35 | 36 | if [ $# -eq 1 ]; then 37 | case $1 in 38 | "-v") 39 | VERBOSE=1 40 | ;; 41 | "-x") 42 | XML=1 43 | ;; 44 | *) 45 | usage 46 | ;; 47 | esac 48 | elif [ $# -gt 1 ]; then 49 | usage 50 | fi 51 | 52 | # force POSIX locale 53 | unset LANG 54 | 55 | # fetch disk information. 56 | BLOCKSIZE="$(stat -f ${VZROOT} | grep 'Block size' | awk '{ print $3 }')" 57 | BLOCKSTOTAL="$(stat -f ${VZROOT} | grep 'Blocks' | awk '{ print $3 }')" 58 | TOTAL_DISKSPACE="$(echo $BLOCKSIZE*$BLOCKSTOTAL/1024 | bc)" 59 | 60 | TOTAL_DISKSPACE_ASSIGNED=0 61 | TOTAL_DISKSPACE_USED=0 62 | VZROOTUID=$(stat -ft $VZROOT | cut -d' ' -f2) 63 | [ $VERBOSE -eq 1 ] && echo -e "CTID\tAssigned\tUsed" 64 | vzlist -aH -o ctid,layout,diskspace,diskspace.h,private | ( while read ctid layout diskused diskassigned private; do 65 | [ "$(stat -ft $private | cut -d' ' -f2)" != "$VZROOTUID" ] && continue 66 | case $layout in 67 | 5) 68 | diskused=$(du -sx $private | cut -f1) 69 | ;; 70 | esac 71 | TOTAL_DISKSPACE_ASSIGNED=$((TOTAL_DISKSPACE_ASSIGNED + $diskassigned)) 72 | TOTAL_DISKSPACE_USED=$((TOTAL_DISKSPACE_USED + $diskused)) 73 | [ $VERBOSE -eq 1 ] && echo -e "$ctid\t$diskassigned\t\t$diskused" 74 | done 75 | [ $VERBOSE -eq 1 ] && echo 76 | 77 | if [ $XML -eq 1 ]; then 78 | echo "" 79 | echo "$(printf "%2.2f" "$(echo "${TOTAL_DISKSPACE_ASSIGNED}/${TOTAL_DISKSPACE}" | bc -l)")" 80 | echo "$(printf "%2.2f" "$(echo "${TOTAL_DISKSPACE_USED}/${TOTAL_DISKSPACE}" | bc -l)")" 81 | echo "" 82 | exit 0 83 | fi 84 | 85 | # show disk information. 86 | echo "DISK" 87 | echo "* Total diskspace of ${VZROOT}: ${TOTAL_DISKSPACE}" 88 | echo "* Total assigned diskspace to container: ${TOTAL_DISKSPACE_ASSIGNED}" 89 | echo "* Total used diskspace by containers: ${TOTAL_DISKSPACE_USED}" 90 | echo "* Overcommitment assigned: ${TOTAL_DISKSPACE_ASSIGNED} : ${TOTAL_DISKSPACE} = $(printf "%2.2f" "$(echo "${TOTAL_DISKSPACE_ASSIGNED}/${TOTAL_DISKSPACE}" | bc -l)") : 1" 91 | echo "* Overcommitment used: ${TOTAL_DISKSPACE_USED} : ${TOTAL_DISKSPACE} = $(printf "%2.2f" "$(echo "${TOTAL_DISKSPACE_USED}/${TOTAL_DISKSPACE}" | bc -l)") : 1") 92 | 93 | -------------------------------------------------------------------------------- /include/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | /* $Id$ */ 25 | #ifndef _CONFIG_H_ 26 | #define _CONFIG_H_ 27 | #include "vzctl.h" 28 | #include "veth.h" 29 | #include "list.h" 30 | 31 | #define STRNCOMP(x, y) strncmp(x, y, strlen(y)) 32 | #define NONE -1 33 | #define TWOULONG 1 34 | #define ULONG 2 35 | #define INT 3 36 | #define LIST 4 37 | #define STR 5 38 | #define YESNO 7 39 | #define IP_ADDR 9 40 | #define FLAG 10 41 | #define VETYPE 11 42 | #define FLOAT 15 43 | #define LIST_PW 23 44 | #define SETMODE 27 45 | #define TWOULONG_P 31 46 | #define TWOULONG_B2P 32 47 | #define TWOULONG_N 33 48 | #define TWOULONG_K 34 49 | #define STR_UTF8 53 50 | #define APPCONF_MAP 54 51 | #define ONOFF 60 52 | #define NETIF_DHCP6 64 53 | #define NETIF_GW6 65 54 | #define PLOOP_TYPE_T 71 55 | #define STR_GUID 73 56 | #define NETIF_CONFIGURE_MODE 74 57 | #define DISK_T 75 58 | 59 | struct Cconfig 60 | { 61 | char *name; /* Name in config file */ 62 | char *alias; 63 | void *pvar; /* parameter pointer */ 64 | void *pvar1; /* parameter pointer2 */ 65 | int option_id; /* Command line option id*/ 66 | int type; /* Type */ 67 | int version; /* UBC parameters version 68 | * 0 - none 69 | * 1 - old 70 | * 2 - new 71 | */ 72 | int opt_srch; /* 0 - full compare 73 | * 1 - partial compare 74 | */ 75 | }; 76 | 77 | extern struct Cconfig Config[]; 78 | 79 | struct CSkipVeParam { 80 | char *name; 81 | }; 82 | 83 | struct CSetMode { 84 | char *name; 85 | int mode; 86 | }; 87 | 88 | struct CParam; 89 | struct CList; 90 | 91 | int ParseTwoLongs(const char *str, unsigned long *val, int type); 92 | int FindOption(int id); 93 | int SetParam(int i, char *sp, int checkdup, int version, int unset); 94 | int FindName(char *name); 95 | void FreeParam(struct CParam *param); 96 | int get_mem(unsigned long long *mem); 97 | int get_lowmem(unsigned long long *mem); 98 | int get_ubc(int veid, struct CParam *param); 99 | int get_pagesize(void); 100 | int yesno_to_num(char *str); 101 | char *get_ipname(unsigned int ip); 102 | int get_ipaddr(const char *name, unsigned int *ip); 103 | int add_veth_param(veth_param *list, veth_dev *dev); 104 | int add_veth_ip(list_head_t *list, veth_ip *ip, int op); 105 | void *xmalloc(size_t size); 106 | void *xcalloc(size_t nmemb, size_t size); 107 | int *find_veid(int veid, int *base, int nmemb); 108 | int get_ip_str(struct CList *ip, char *buf, int len); 109 | #endif /* _CONFIG_H_ */ 110 | -------------------------------------------------------------------------------- /vzcpucheck: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | # This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | # it and/or modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2 of the License, 8 | # or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | # 02110-1301, USA. 19 | # 20 | # Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | # Schaffhausen, Switzerland. 22 | # 23 | # Script that prints cpu utilization information 24 | # Usage: vzcpucheck [-v] 25 | # See also vzcpucheck(8) man page 26 | 27 | VERBOSE=0 28 | XML=0 29 | CPUINFO=/proc/cpuinfo 30 | VEINFO=/proc/vz/veinfo 31 | FRSHD=/proc/fairsched 32 | 33 | function usage() 34 | { 35 | echo "Usage: vzcpucheck [-v]" 36 | exit 2 37 | } 38 | 39 | if [ $# -eq 1 ]; then 40 | case $1 in 41 | "-v") 42 | VERBOSE=1 43 | ;; 44 | "-x") 45 | XML=1 46 | ;; 47 | *) 48 | usage 49 | ;; 50 | esac 51 | elif [ $# -gt 1 ]; then 52 | usage 53 | fi 54 | 55 | if [ ! -r $FRSHD ]; then 56 | echo "Can't read $FRSHD: Permission denied" 1>&2 57 | exit 1; 58 | fi 59 | if [ ! -r $CPUINFO ]; then 60 | echo "Can't read $CPUINFO: Permission denied" 1>&2 61 | exit 1; 62 | fi 63 | 64 | CPUUTL=`cat ${CPUINFO} | awk ' 65 | { 66 | if ($1 == "bogomips" || $1 == "BogoMIPS") { 67 | sum += $3; 68 | } 69 | } 70 | END { 71 | print(sum * 25); 72 | }'` 73 | 74 | cat ${FRSHD} | awk -v totunits="$CPUUTL" -v verbose="$VERBOSE" -v xml="$XML" ' 75 | BEGIN { 76 | sum = 0; 77 | fail = 0; 78 | weight=-1 79 | id=-1 80 | getline 81 | if ($1 == "Version:"){ 82 | getline; 83 | } 84 | for (i = 0; i < NF; i++) { 85 | if ($i == "weight") { 86 | weight = i; 87 | } 88 | if ($i == "id") { 89 | id = i; 90 | } 91 | } 92 | if (weight == -1) { 93 | print("ERROR: Unknown format of '$FRSHD' column: weight not found"); 94 | fail = 1 95 | exit 96 | } 97 | if (id == -1) { 98 | print("ERROR: Unknown format of '$FRSHD' column: id not found"); 99 | fail = 1; 100 | exit 101 | } 102 | if (verbose) { 103 | print("veid\t\tunits"); 104 | print("-----------------------"); 105 | } 106 | } 107 | { 108 | if ($1 == 0 && $id != 0) { 109 | if ($weight){ 110 | units = int(500000/$weight); 111 | } else { 112 | units = 500000; 113 | } 114 | if (verbose) { 115 | if ($id == 2147483647) { 116 | print("0\t\t" units); 117 | } else { 118 | print($id "\t\t" units); 119 | } 120 | } 121 | sum += units; 122 | } 123 | } 124 | END { 125 | if (fail) 126 | exit 1 127 | if (xml) { 128 | print("" sum / totunits ""); 129 | exit 0; 130 | } 131 | print("Current CPU utilization: " sum); 132 | print("Power of the node: " int(totunits)); 133 | if (sum > totunits) { 134 | print("Warning: hardware node is overcommited"); 135 | } 136 | }' 137 | 138 | 139 | -------------------------------------------------------------------------------- /include/tc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef _TC_H_ 25 | #define _TC_H_ 26 | 27 | #define VZCTLDEV "/dev/vzctl" 28 | 29 | #define ERR_BAD_IP -1 30 | #define ERR_TC_READ_CLASSES -2 31 | #define ERR_TC_NO_CLASSES -3 32 | #define ERR_IOCTL -4 33 | #define ERR_NOMEM -5 34 | #define ERR_INVAL_OPT -6 35 | #define ERR_TC_VZCTL -7 36 | #define ERR_OUT -8 37 | #define ERR_TC_INVAL_CLASS -9 38 | #define ERR_TC_INVAL_CMD -10 39 | #define ERR_READ_UUIDMAP -11 40 | 41 | /* 42 | * Traffic accouting management structures 43 | */ 44 | 45 | #ifndef __ENVID_T_DEFINED__ 46 | # define __ENVID_T_DEFINED__ 47 | typedef unsigned int envid_t; 48 | #endif 49 | 50 | struct vz_tc_class_info { 51 | __u32 cid; /* class number */ 52 | __u32 addr; /* Network byte order */ 53 | __u32 mask; /* subnet mask */ 54 | /* 55 | * On any changes to this struct keep in mind fixing 56 | * all copy_to_user instances, initializing new fields/paddings 57 | * to prevent possible leaks from kernel-space. 58 | */ 59 | }; 60 | 61 | 62 | struct vzctl_tc_classes { 63 | struct vz_tc_class_info *info; 64 | int length; 65 | }; 66 | 67 | /* For IPv6 */ 68 | struct vz_tc_class_info_v6 { 69 | __u32 cid; /* class number */ 70 | __u32 addr[4];/* Network byte order */ 71 | __u32 mask[4];/* subnet mask */ 72 | /* 73 | * On any changes to this struct keep in mind fixing 74 | * all copy_to_user instances, initializing new fields/paddings 75 | * to prevent possible leaks from kernel-space. 76 | */ 77 | }; 78 | 79 | struct vzctl_tc_classes_v6 { 80 | struct vz_tc_class_info_v6 *info; 81 | int length; 82 | }; 83 | 84 | struct vzctl_tc_get_stat { 85 | envid_t veid; 86 | __u64 *incoming; 87 | __u64 *outgoing; 88 | __u32 *incoming_pkt; 89 | __u32 *outgoing_pkt; 90 | int length; 91 | }; 92 | 93 | struct vzctl_tc_get_stat_list { 94 | envid_t *list; 95 | int length; 96 | }; 97 | 98 | char *get_ipname(unsigned int ip); 99 | int tc_max_class(void); 100 | int tc_set_classes(struct vz_tc_class_info *c_info, int length); 101 | int tc_set_v6_classes(struct vz_tc_class_info_v6 *c_info, int length); 102 | int tc_get_class_num(void); 103 | int tc_get_v6_class_num(void); 104 | int tc_get_classes(struct vz_tc_class_info *c_info, int length); 105 | int tc_get_v6_classes(struct vz_tc_class_info_v6 *info, int length); 106 | int tc_get_stat(ctid_t ctid, struct vzctl_tc_get_stat *stat, int v6); 107 | int tc_get_base(int veid); 108 | int tc_destroy_ve_stats(ctid_t ctid); 109 | int tc_destroy_all_stats(void); 110 | int get_ve_list(struct vzctl_tc_get_stat_list *velist); 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/ndsend.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This code is public domain. 6 | * 7 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9 | * 10 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 11 | * Schaffhausen, Switzerland. 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #define EXC_OK 0 36 | #define EXC_USAGE 1 37 | #define EXC_SYS 2 38 | #define EXC_RECV 3 39 | #define EXC_NORECV 4 40 | 41 | char* iface = NULL; 42 | 43 | struct in6_addr src_ipaddr; 44 | int ifindex; 45 | __u8 real_hwaddr[6]; 46 | 47 | struct nd_packet { 48 | __u8 icmp6_type; 49 | __u8 icmp6_code; 50 | __u16 icmp6_cksum; 51 | 52 | __u32 reserved:5, 53 | override:1, 54 | solicited:1, 55 | router:1, 56 | reserved2:24; 57 | struct in6_addr target; 58 | __u8 otype; 59 | __u8 ospace; 60 | __u8 obits[6]; 61 | }; 62 | 63 | int init_device_addresses(int sock, const char* device) 64 | { 65 | struct ifreq ifr; 66 | 67 | memset(&ifr, 0, sizeof(ifr)); 68 | strncpy(ifr.ifr_name, device, IFNAMSIZ-1); 69 | 70 | if (ioctl(sock, SIOCGIFINDEX, &ifr) != 0) { 71 | fprintf(stderr, "Unknown network interface %s: %m\n", device); 72 | return -1; 73 | } 74 | ifindex = ifr.ifr_ifindex; 75 | 76 | /* get interface HW address */ 77 | if (ioctl(sock, SIOCGIFHWADDR, &ifr) != 0) { 78 | fprintf(stderr, "Cannot get the MAC address of " 79 | "network interface %s: %m\n", device); 80 | return -1; 81 | } 82 | memcpy(real_hwaddr, ifr.ifr_hwaddr.sa_data, 6); 83 | 84 | return 0; 85 | } 86 | 87 | int sock; 88 | struct nd_packet pkt; 89 | 90 | void create_nd_packet(struct nd_packet* pkt) 91 | { 92 | pkt->icmp6_type = ND_NEIGHBOR_ADVERT; 93 | pkt->icmp6_code = 0; 94 | pkt->icmp6_cksum = 0; 95 | pkt->reserved = 0; 96 | pkt->override = 1; 97 | pkt->solicited = 0; 98 | pkt->router = 0; 99 | pkt->reserved2 = 0; 100 | memcpy(&pkt->target, &src_ipaddr, 16); 101 | pkt->otype = ND_OPT_TARGET_LINKADDR; 102 | pkt->ospace = 1; 103 | memcpy(&pkt->obits, real_hwaddr, 6); 104 | } 105 | 106 | void sender(void) 107 | { 108 | struct sockaddr_in6 to; 109 | 110 | to.sin6_family = AF_INET6; 111 | to.sin6_port = 0; 112 | ((__u32*)&to.sin6_addr)[0] = htonl(0xFF020000); 113 | ((__u32*)&to.sin6_addr)[1] = 0; 114 | ((__u32*)&to.sin6_addr)[2] = 0; 115 | ((__u32*)&to.sin6_addr)[3] = htonl(0x1); 116 | to.sin6_scope_id = ifindex; 117 | 118 | if (sendto(sock, &pkt, sizeof(pkt), 0, 119 | (struct sockaddr*) &to, sizeof(to)) < 0) { 120 | fprintf(stderr, "sendto function returned error: %m\n"); 121 | exit(EXC_SYS); 122 | } 123 | } 124 | 125 | int main(int argc,char** argv) 126 | { 127 | int value; 128 | 129 | if (inet_pton(AF_INET6, argv[1], &src_ipaddr) <= 0) 130 | return -1; 131 | iface = argv[2]; 132 | 133 | sock = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6); 134 | if (sock < 0) { 135 | fprintf(stderr, "socket function returned error: %m\n"); 136 | exit(EXC_SYS); 137 | } 138 | 139 | if (init_device_addresses(sock, iface) < 0) 140 | exit(EXC_SYS); 141 | 142 | value = 255; 143 | setsockopt (sock, SOL_IPV6, IPV6_MULTICAST_HOPS, 144 | &value, sizeof (value)); 145 | 146 | create_nd_packet(&pkt); 147 | sender(); 148 | exit(EXC_OK); 149 | } 150 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for vzctl - Virtual Environments control utility 2 | # Copyright (c) 1999-2017, Parallels International GmbH 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | 5 | INSTALL = install 6 | PREFIX = /usr 7 | SBINDIR = ${PREFIX}/sbin 8 | LIBVER = 1 9 | ### Compiler flags 10 | CC = gcc 11 | 12 | VERSION ?= $(shell cat ../Makefile.version) 13 | CFLAGS += -pipe -Werror -Wall -Winline -Wcast-align -Wno-unused-parameter -Wstrict-prototypes -Wunused-variable -g2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\" 14 | INC = -I../include -Ilib 15 | LDFLAGS += -L lib 16 | 17 | # CFLAGS += -DDEBUG 18 | 19 | # We need -m64 for ppc64 in order to get proper ioctls 20 | # Do NOT use ARCH since it is always set to ppc from the spec file 21 | ifeq ($(shell uname -m),ppc64) 22 | override CFLAGS += -m64 23 | endif 24 | 25 | ### Object files 26 | OBJS = script.o vz.o \ 27 | config.o tmplmn.o \ 28 | list.o \ 29 | vzmonitor.o \ 30 | snapshot-list.o technologies.o wrap.o util.o 31 | 32 | OBJS_vzctl = vzctl.o enter.o $(OBJS) 33 | OBJ_vzeventd = vzeventd.o 34 | OBJ_nd = ndsend.o 35 | OBJS_ubclogd = timeutils.o 36 | OBJS_split = vzsplit.o 37 | OBJS_convert = vzcfgconvert.o config.o list.o 38 | OBJS_cfgscale = vzcfgscale.o mm.o $(OBJS) 39 | OBJS_vzauth = vzauth.o 40 | OBJS_proxyctl = vzproxyctl.o 41 | OBJS_vztactl = vztactl.o tc.o list.o util.o wrap.o 42 | OBJS_vznetstat= vznetstat.o tc.o util.o 43 | OBJS_vzlist = vzlist.o $(OBJS) 44 | ### Target names 45 | PROGS = vzctl vzsplit vzauth vzlist ndsend vzeventd vznetstat vztactl 46 | LIB = $(LGCOV) -lpthread -lutil -luuid -lploop -lnftables -ldl -lvzctl2 47 | LIBDIR = /usr/lib64 48 | 49 | ################################################## 50 | default: all 51 | 52 | .force:; 53 | 54 | .stamp-debug: 55 | $(MAKE) clean depend 56 | touch $@ 57 | 58 | .stamp-all: 59 | $(MAKE) clean depend 60 | touch $@ 61 | 62 | debug:.stamp-debug .force 63 | $(MAKE) $(MAKEOPTS) real-all DEBUG='-DDEBUG -g' 64 | 65 | all: .stamp-all .force 66 | $(MAKE) $(MAKEOPTS) real-all 67 | 68 | real-all: $(PROGS) 69 | 70 | %.o: %.c 71 | $(CC) -c $(CFLAGS) $(INC) $< -o $@ 72 | 73 | vzeventd: $(OBJ_vzeventd) 74 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LIB) -ludev -o $@ 75 | 76 | ndsend: $(OBJ_nd) 77 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ 78 | 79 | vzctl: $(OBJS_vzctl) $(OBJS) 80 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -lutil $(LIB) -o $@ 81 | 82 | ubclogd: $(OBJS_ubclogd) 83 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ 84 | 85 | vzsplit: $(OBJS_split) 86 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LIB) -o $@ 87 | 88 | vzcfgconvert: $(OBJS_convert) 89 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LIB) -o $@ 90 | 91 | vzcfgscale: $(OBJS_cfgscale) 92 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LIB) -o $@ 93 | 94 | vzauth: $(OBJS_vzauth) 95 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LIB) -o $@ 96 | 97 | vzproxyctl: $(OBJS_proxyctl) 98 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ 99 | vztactl: $(OBJS_vztactl) 100 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LIB) -o $@ 101 | vznetstat: $(OBJS_vznetstat) 102 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LIB) -luuid -o $@ 103 | vzlist: $(OBJS_vzlist) 104 | $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LIB) -lm -o $@ 105 | 106 | clean: 107 | $(RM) $(PROGS) $(OBJS) $(OBJS_memcheck) ${OBJS_vzctl} ${OBJ_vzeventd} \ 108 | $(OBJS_ubclogd) $(OBJS_split) $(OBJS_calc) $(OBJS_convert) \ 109 | $(OBJS_cfgscale) $(OBJS_vzauth) \ 110 | $(OBJS_proxyctl) $(OBJS_vznetstat) \ 111 | $(OBJS_vzlist) $(OBJ_nd) .depend *[~\#] 112 | 113 | installsbin: $(PROGS) 114 | for file in $(PROGS); do \ 115 | $(INSTALL) $$file $(DESTDIR)$(SBINDIR)/$$file; \ 116 | done 117 | 118 | install: installsbin 119 | 120 | depend: 121 | $(CC) $(CFLAGS) $(INC) -M $(OBJS:.o=.c) >.depend 122 | 123 | -include .depend 124 | 125 | .PHONY: clean depend install all real-all debug default installsbin \ 126 | -------------------------------------------------------------------------------- /src/vzcfgconvert.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define VZ_2_0_2_CONFIG 30 | #include "vzctl.h" 31 | #include "config.h" 32 | #include "util.h" 33 | 34 | struct CParam *gparam, *lparam; 35 | 36 | void usage() 37 | { 38 | fprintf(stdout, "Usage: vzcfgconvert \n"); 39 | } 40 | 41 | struct CParam *convert1to2(struct CParam *param) 42 | { 43 | struct CParam *new = ConvertUBC(param); 44 | 45 | RemoveOldParam(param); 46 | #define CHANGE_PARAM(name) \ 47 | if (new->name != NULL) { \ 48 | if (param->name == NULL) \ 49 | param->name = malloc(sizeof(unsigned long) * 2); \ 50 | param->name[0] = new->name[0]; \ 51 | param->name[1] = new->name[1]; \ 52 | } 53 | CHANGE_PARAM(kmemsize) 54 | CHANGE_PARAM(tcpsendbuf) 55 | CHANGE_PARAM(tcprcvbuf) 56 | 57 | FillParam(0, new, param); 58 | 59 | return new; 60 | } 61 | 62 | void convert2to3(struct CParam *param) 63 | { 64 | #define INC_PARAM(name, mul) \ 65 | if (param->name != NULL) { \ 66 | param->name[0] *= mul; \ 67 | param->name[1] *= mul; \ 68 | } \ 69 | 70 | INC_PARAM(kmemsize, 1.2) 71 | INC_PARAM(numfile, 1.6) 72 | INC_PARAM(dcachesize, 2) 73 | } 74 | 75 | int main(int argc, char**argv) 76 | { 77 | char buf[STR_SIZE]; 78 | char tmp[STR_SIZE]; 79 | struct CParam param, *newparam = NULL; 80 | int veid; 81 | int ver = 0; 82 | struct stat st; 83 | 84 | if (argc != 2) { 85 | usage(); 86 | exit(1); 87 | } 88 | if (parse_int(argv[1], &veid)) 89 | { 90 | fprintf(stderr, "Error: Invalid veid: %s\n", argv[1]); 91 | return 1; 92 | } 93 | snprintf(buf, sizeof(buf), "%s/%d.conf", CFG_DIR, veid); 94 | if (stat(buf, &st)) 95 | { 96 | fprintf(stderr, "Error: Container config file %s not found\n", buf); 97 | return 1; 98 | } 99 | gparam = ¶m; 100 | memset(¶m, 0, sizeof(struct CParam)); 101 | gparam->log_enable = YES; 102 | gparam->quiet = 1; 103 | if (ParseConfig(veid, buf, ¶m, 1)) 104 | return 1; 105 | if (param.version == 3) 106 | { 107 | fprintf(stderr, "Nothing to convert Container %d config file is new\n" 108 | , veid); 109 | return 0; 110 | } 111 | else if (param.version != 2) 112 | { 113 | ver = GetConfVer(veid, param.version, ¶m); 114 | if (ver == -1) 115 | { 116 | fprintf(stderr, "Error: Unable to determine Container config" 117 | " version. Invalid config\n"); 118 | return 1; 119 | } else if (ver == 1) { 120 | newparam = convert1to2(¶m); 121 | } else { 122 | newparam = ¶m; 123 | } 124 | } else { 125 | newparam = ¶m; 126 | } 127 | newparam->version = 2; 128 | convert2to3(newparam); 129 | sprintf(tmp, "%s.tmp", buf); 130 | if (ver != 1) 131 | copy_file(buf, tmp); 132 | if (SaveConfig(veid, tmp, newparam, NULL) < 0) 133 | { 134 | fprintf(stderr, "Error: Unable to save temporary Container config" 135 | " file %s\n", tmp); 136 | return 1; 137 | } 138 | rename(tmp, buf); 139 | fprintf(stderr, "Container %d config file converted: success\n", veid); 140 | 141 | return 0; 142 | } 143 | -------------------------------------------------------------------------------- /src/vzauth.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "vzctl/libvzctl.h" 30 | #include "vzctl/vzerror.h" 31 | 32 | #define ERR_PARAM 1 33 | #define ERR_AUTH 3 34 | #define ERR_READ_PASSWD 5 35 | #define ERR_PSASHADOW 7 36 | #define ERR_GID_CHECK 9 37 | 38 | 39 | void usage(void) 40 | { 41 | fprintf(stderr, "Usage: vzauth [-t ] [-g ] ctid user\n"); 42 | fprintf(stderr, "\t -t \tsystem|pleskadmin\n"); 43 | fprintf(stderr, "\t -g \tcheck group id\n"); 44 | return; 45 | } 46 | 47 | char *read_passwd(void) 48 | { 49 | FILE *fp; 50 | char str[512]; 51 | char *ch; 52 | 53 | if ((fp = fopen("/dev/stdin", "r")) == NULL) 54 | { 55 | fprintf(stderr, "Unable to open /dev/stdin: %s\n", 56 | strerror(errno)); 57 | return NULL; 58 | } 59 | *str = 0; 60 | if (fgets(str, sizeof(str), fp) == NULL && !feof(fp)) 61 | { 62 | fprintf(stderr, "Error in read pasword from stdin: %s\n", 63 | strerror(errno)); 64 | return NULL; 65 | } 66 | if ((ch = strrchr(str, '\n')) != NULL) 67 | *ch = 0; 68 | fclose(fp); 69 | return strdup(str); 70 | } 71 | 72 | static int parse_int(const char *str, int *val) 73 | { 74 | char *tail; 75 | 76 | errno = 0; 77 | *val = (int)strtol(str, &tail, 10); 78 | if (*tail != '\0' || errno == ERANGE) 79 | return 1; 80 | return 0; 81 | } 82 | 83 | int main(int argc, char **argv) 84 | { 85 | char *user, *passwd; 86 | int ret; 87 | int type = 0, i = 1; 88 | int gid = -1; 89 | struct vzctl_env_handle *h; 90 | ctid_t ctid; 91 | 92 | while (i < argc - 1) { 93 | if (!strcmp(argv[i], "-t")) { 94 | i++; 95 | if (!strcmp(argv[i], "system")) 96 | type = 0; 97 | else if (!strcmp(argv[i], "pleskadmin")) 98 | type = 1; 99 | else { 100 | fprintf(stderr, "unknown type: %s\n", argv[i]); 101 | exit(ERR_PARAM); 102 | } 103 | } else if (!strcmp(argv[i], "-g")) { 104 | i++; 105 | 106 | if (parse_int(argv[i], &gid)) { 107 | fprintf(stderr, "An invalid gid"); 108 | exit(ERR_PARAM); 109 | } 110 | } else 111 | break; 112 | i++; 113 | } 114 | if (i + 2 != argc) { 115 | usage(); 116 | exit(ERR_PARAM); 117 | } 118 | 119 | if (vzctl2_parse_ctid(argv[i], ctid)) { 120 | fprintf(stderr, "Invalid VEID %s\n", argv[i]); 121 | return ERR_PARAM; 122 | } 123 | user = argv[++i]; 124 | 125 | if ((passwd = read_passwd()) == NULL) 126 | return ERR_READ_PASSWD; 127 | 128 | vzctl2_init_log("vzauth"); 129 | vzctl2_set_flags(VZCTL_FLAG_DONT_USE_WRAP); 130 | 131 | if (vzctl2_lib_init()) 132 | return ERR_PARAM; 133 | 134 | h = vzctl2_env_open(ctid, 0, &ret); 135 | if (ret) 136 | return ERR_PARAM; 137 | 138 | ret = vzctl2_env_auth(h, user, passwd, gid, type); 139 | if (ret) { 140 | switch (ret) { 141 | case VZCTL_E_AUTH_GUID: 142 | ret = ERR_GID_CHECK; 143 | break; 144 | case VZCTL_E_AUTH_PSASHADOW: 145 | ret = ERR_PSASHADOW; 146 | break; 147 | default: 148 | ret = ERR_AUTH; 149 | break; 150 | } 151 | } 152 | 153 | vzctl2_env_close(h); 154 | 155 | fprintf(stderr, "%s\n", !ret ? "Access granted." : "Access denied."); 156 | 157 | return ret; 158 | } 159 | -------------------------------------------------------------------------------- /man/ve.conf.5: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH ve.conf 5 "October 2009" "@PRODUCT_NAME_SHORT@" 3 | .SH NAME 4 | ve.conf \- configuration file for a Container. 5 | .SH SYNOPSIS 6 | /etc/vz/conf/XXX.conf 7 | .SH DESCRIPTION 8 | This is a configuration file for a CT. It is stored as 9 | \fB/etc/vz/conf/\fR\fIXXX\fB.conf\fR, where \fIXXX\fR 10 | is the ID of the given CT. 11 | .PP 12 | Configuration file consists of lines arrayed in a column. 13 | .PP 14 | \fBPARAMETER\fR="\fIvalue\fR" 15 | .PP 16 | All parameter names and values are case-sensitive. Quotes surrounding a \fIvalue\fR are required if the value contains spaces, and are optional otherwise. 17 | Extra spaces are not allowed. All unrecognized lines will be ignored. 18 | .PP 19 | Please note that the file is created/modified by the \fBvzctl(8)\fR command with the \fIset --save\fR arguments, therefore changes to this file made otherwise than by \fBvzctl(8)\fR can be lost during the next \fBvzctl\fR run. 20 | .PP 21 | The meaning of each parameter is described in \fBvzctl(8)\fR, so here only 22 | the appropriate \fBvzctl set\fR option is given. 23 | .SS Miscellaneous parameters 24 | .IP \fBONBOOT\fR="\fByes|no\fR" 25 | Specifies whether this CT will be started during the system boot. The default value is \fBno\fR, meaning the CT will not be started if the \fBONBOOT\fR parameter is omitted. 26 | Corresponds to the \fB--onboot\fR option. 27 | .IP \fBBOOTORDER\fR="\fInumber\fR" 28 | Specifies the CT boot order priority. Corresponds to the 29 | \fB--bootorder\fR option. 30 | .IP \fBOSTEMPLATE\fR="\fItmpl_name\fR" 31 | Corresponds to the \fB--ostemplate\fR option. 32 | .IP \fBTEMPLATES\fR="\fIapp_name\ ...\fR" 33 | This is a list of the templates installed inside a CT by the 34 | \fBvzpkg\fR command. 35 | .IP \fBVE_ROOT\fR="\fIdirectory\fR" 36 | Corresponds to the \fB--root\fR option. 37 | .IP \fBVE_PRIVATE\fR="\fIdirectory\fR" 38 | Corresponds to the \fB--private\fR option. 39 | .IP \fBDISABLED\fR="\fByes\fR|\fBno\fR" 40 | Corresponds to the \fB--disabled\fR option. 41 | .IP \fBORIGIN_SAMPLE\fR="\fIname\fR" 42 | Name of the CT sample the CT is based on. 43 | .IP \fBCONFIG_CUSTOMIZED\fR="\fByes\fR|\fBno\fR" 44 | Set to \fByes\fR if the CT configuration file has been modified. 45 | .SS Resource management parameters 46 | .IP \fBNUMPROC\fR 47 | Corresponds to the \fB--numproc\fR options. 48 | .IP \fBNUMFILE\fR 49 | Corresponds to the \fB--numfile\fR options. 50 | .IP \fBNUMFLOCK\fR 51 | Corresponds to the \fB--numflock\fR options. 52 | .IP \fBNUMPTY\fR 53 | Corresponds to the \fB--numpty\fR options. 54 | .IP \fBNUMSIGINFO\fR 55 | Corresponds to the \fB--numsiginfo\fR options. 56 | .IP \fBPRIVVMPAGES\fR 57 | Corresponds to the \fB--privvmpages\fR options. 58 | .IP \fBVMMGUARPAGES\fR 59 | Corresponds to the \fB--vmguarpages\fR options. 60 | .IP \fBLOCKEDPAGES\fR 61 | Corresponds to the \fB--lockedpages\fR options. 62 | .IP \fBSHMPAGES\fR 63 | Corresponds to the \fB--shmpages\fR options. 64 | .IP \fBNUMIPTENT\fR 65 | Corresponds to the \fB--numiptent\fR options. 66 | .IP \fBCPUUNITS\fR 67 | Corresponds to the \fB--cpuunits\fR option. 68 | .IP \fBDISKSPACE\fR="\fIsoftlimit\fR[:\fIhardlimit\fR]" 69 | Corresponds to the \fB--diskspace\fR parameter. 70 | .IP \fBQUOTAUGIDLIMIT\fR="\fInum\fR" 71 | Corresponds to the \fB--quotaugidlimit\fR parameter. 72 | .IP \fBNOATIME\fR="\fByes\fR|\fBno\fR" 73 | Corresponds to the \fB--noatime\fR option. 74 | .IP \fBRATE\fR="\fIinterface:class:rate\fR\ [\fIinterface:class:rate\fR\ ...]" 75 | Corresponds to the \fB--rate\fR option. 76 | .IP \fBRATEBOUND\fR="\fIyse|no\fR" 77 | Corresponds to the \fB--ratebound\fR option. 78 | .SS Network related parameters 79 | .IP \fBIP_ADDRESS\fR="\fIaddress\ [address]\fR" 80 | Specifies the \fIaddress\fR the CT will be assigned. Several addresses 81 | are divided by spaces. 82 | Corresponds to the \fB--ipadd\fR option. 83 | .IP \fBHOSTNAME\fR="\fIname\fR" 84 | Corresponds to the \fB--hostname\fR option. 85 | .IP \fBNAMESERVER\fR="\fIip\fR\ [\fIip\fR]" 86 | Corresponds to the \fB--nameserver\fR option. Several name server addresses 87 | are set off by spaces. 88 | .IP \fBSEARCHDOMAIN\fR="\fIdomain\fR\ [\fIdomain\fR]" 89 | Corresponds to the \fB--searchdomain\fR option. Several search domains 90 | are separated by spaces. 91 | .PP 92 | .SH SEE ALSO 93 | .BR vzctl (8), 94 | .BR vz (5). 95 | .SH COPYRIGHT 96 | Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 97 | Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 98 | -------------------------------------------------------------------------------- /include/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef __LIST_H__ 25 | #define __LIST_H__ 26 | 27 | 28 | struct list_elem; 29 | typedef struct { 30 | struct list_elem *prev, *next; 31 | } list_head_t; 32 | 33 | typedef struct list_elem { 34 | struct list_elem *prev, *next; 35 | } list_elem_t; 36 | 37 | struct vzctl_str_param { 38 | list_elem_t list; 39 | char *str; 40 | }; 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | static inline void list_head_init(list_head_t *head) 46 | { 47 | head->next = (list_elem_t *)head; 48 | head->prev = (list_elem_t *)head; 49 | } 50 | 51 | static inline void list_elem_init(list_elem_t *entry) 52 | { 53 | entry->next = entry; 54 | entry->prev = entry; 55 | } 56 | 57 | static inline void list_add(list_elem_t *new_el, list_head_t *list) 58 | { 59 | new_el->next = list->next; 60 | new_el->prev = (list_elem_t *)list; 61 | list->next->prev = new_el; 62 | list->next = new_el; 63 | } 64 | 65 | static inline void list_add_tail(list_elem_t *new_el, list_head_t *list) 66 | { 67 | new_el->next = (list_elem_t *)list; 68 | new_el->prev = list->prev; 69 | list->prev->next = new_el; 70 | list->prev = new_el; 71 | } 72 | 73 | static inline void list_del(list_elem_t *el) 74 | { 75 | el->prev->next = el->next; 76 | el->next->prev = el->prev; 77 | el->prev = NULL; 78 | el->next = NULL; 79 | } 80 | 81 | static inline void list_del_init(list_elem_t *el) 82 | { 83 | el->prev->next = el->next; 84 | el->next->prev = el->prev; 85 | list_elem_init(el); 86 | } 87 | 88 | static inline int list_is_init(list_head_t *h) 89 | { 90 | return h->next == NULL; 91 | } 92 | 93 | static inline int list_empty(list_head_t *h) 94 | { 95 | if (list_is_init(h)) 96 | return 1; 97 | return h->next == (list_elem_t *)h; 98 | } 99 | 100 | static inline int list_elem_inserted(list_elem_t *el) 101 | { 102 | return el->next != el; 103 | } 104 | 105 | static inline void list_moveall(list_head_t *src, list_head_t *dst) 106 | { 107 | list_add((list_elem_t *)dst, src); 108 | list_del((list_elem_t *)src); 109 | list_head_init(src); 110 | } 111 | #ifdef __cplusplus 112 | } 113 | #endif 114 | 115 | #define LIST_HEAD(name) \ 116 | list_head_t name = { (void *) &name, (void *) &name } 117 | 118 | #define list_entry(ptr, type, field) \ 119 | ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->field))) 120 | 121 | #define list_first_entry(head, type, field) \ 122 | list_entry((head)->next, type, field) 123 | 124 | #define list_for_each(entry, head, field) \ 125 | for (entry = list_entry((head)->next, typeof(*entry), field);\ 126 | &entry->field != (list_elem_t*)(head); \ 127 | entry = list_entry(entry->field.next, typeof(*entry), field)) 128 | 129 | #define list_for_each_prev(entry, head, field) \ 130 | for (entry = list_entry((head)->prev, typeof(*entry), field);\ 131 | &entry->field != (list_elem_t*)(head); \ 132 | entry = list_entry(entry->field.prev, typeof(*entry), field)) 133 | 134 | #define list_for_each_safe(entry, tmp, head, field) \ 135 | for (entry = list_entry((head)->next, typeof(*entry), field),\ 136 | tmp = list_entry(entry->field.next, typeof(*entry), field); \ 137 | &entry->field != (list_elem_t*)(head); \ 138 | entry = tmp, \ 139 | tmp = list_entry(tmp->field.next, typeof(*tmp), field)) 140 | 141 | #endif /* __LIST_H__ */ 142 | -------------------------------------------------------------------------------- /vzpurge: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved. 3 | # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | # 5 | # This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | # it and/or modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2 of the License, 8 | # or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | # 02110-1301, USA. 19 | # 20 | # Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | # Schaffhausen, Switzerland. 22 | # 23 | # This script finds all VE areas which have no appropriate 24 | # configuration files, and removes it. It also removes configuration 25 | # files that have ".destroyed" suffix. 26 | # See also vzpurge(8) man page. 27 | 28 | # Check if the caller is root 29 | ID=`id -u` 30 | if [ ! $ID -eq 0 ]; then 31 | echo "You need to be root to run this command." 32 | exit 1 33 | fi 34 | 35 | VZCTL='/usr/sbin/vzctl' 36 | 37 | # Read global configuration 38 | VEID="@veid@" 39 | . /etc/sysconfig/vz 40 | CONFIG_DIR=/etc/sysconfig/vz-scripts 41 | 42 | # Check if we got correct VE_PRIVATE 43 | if echo $VE_PRIVATE | grep -v "@veid@" >/dev/null 2>&1; then 44 | echo "ERROR: Can't find correct VE_PRIVATE in /etc/sysconfig/vz" 45 | exit 1 46 | fi 47 | 48 | # Split the value of VE_PRIVATE to parts before and after @veid@ 49 | VE_PRIV_PREFIX=`echo $VE_PRIVATE | sed -e 's/@veid@.*//'` 50 | VE_PRIV_SUFFIX=`echo $VE_PRIVATE | \ 51 | sed -e 's/.*@veid@//' -e 's%/$%%' -e 's%^/%*%'` 52 | # This is regex for grep; trailing slash is also removed 53 | VE_PRIV_FILT=`echo $VE_PRIVATE | sed -e 's/@veid@/[1-9][0-9]*/' -e 's%/$%%'` 54 | VE_PRIV_FILTER="^$VE_PRIV_FILT$" 55 | # Count the number of slashes in VE_PRIV_SUFFIX 56 | MAXDEPTH=`echo $VE_PRIV_SUFFIX | awk -F "/" '{print NF+1}'` 57 | #echo "** VE_PRIVATE = $VE_PRIVATE" 58 | #echo "** VE_PRIV_PREFIX = $VE_PRIV_PREFIX" 59 | #echo "** VE_PRIV_SUFFIX = $VE_PRIV_SUFFIX" 60 | #echo "** VE_PRIV_FILT = $VE_PRIV_FILT" 61 | #echo "** VE_PRIV_FILTER = $VE_PRIV_FILTER" 62 | #echo "** MAXDEPTH = $MAXDEPTH" 63 | 64 | 65 | # Get the list of private areas 66 | 67 | if test "x$VE_PRIV_SUFFIX" = "x"; then 68 | FIND_PATH="*" 69 | else 70 | FIND_PATH=$VE_PRIV_SUFFIX 71 | fi 72 | 73 | PRIV_DIR_LIST=\ 74 | `find $VE_PRIV_PREFIX -maxdepth $MAXDEPTH -path "$FIND_PATH" \ 75 | -type d 2>/dev/null | grep -e "$VE_PRIV_FILTER"` 76 | 77 | #echo "PRIV_DIR_LIST = $PRIV_DIR_LIST" 78 | 79 | VALID_VES=`ls -1 ${CONFIG_DIR}/*.conf 2>/dev/null | \ 80 | sed -e "s|${CONFIG_DIR}/||g" -e 's/.conf//g' | grep "[1-9][0-9]*"` 81 | 82 | #echo "VALID_VES=$VALID_VES" 83 | 84 | SED_PROG="-e s#$VE_PRIV_PREFIX##" 85 | if test "x$VE_PRIV_SUFFIX" != "x"; then 86 | VE_PRIV_SUFFIX=`echo $VE_PRIV_SUFFIX | sed "s#\*#/#"` 87 | SED_PROG="$SED_PROG -e s#$VE_PRIV_SUFFIX##" 88 | fi 89 | 90 | RETCODE=0 91 | for VE_DIR in $PRIV_DIR_LIST; do 92 | VE=`echo $VE_DIR | sed $SED_PROG` 93 | # echo "** VE .$VE." 94 | if echo "$VALID_VES" | grep "^${VE}$" >/dev/null 2>&1; then 95 | continue 96 | else 97 | # Stop/unmount VE if it is running/mounted 98 | VE_STATUS=`$VZCTL status $VE` 99 | if echo $VE_STATUS | grep ' running' >/dev/null 2>&1; then 100 | $VZCTL stop $VE 101 | elif echo $VE_STATUS | grep ' mounted' >/dev/null 2>&1; then 102 | $VZCTL umount $VE 103 | fi 104 | echo -n "Deleting VE $VE private area ($VE_DIR) ..." 105 | RM_MSG=`rm -rf $VE_DIR 2>&1` 106 | if test $? -eq 0; then 107 | echo " Ok" 108 | else 109 | echo " Failed" 110 | echo $RM_MSG 111 | RETCODE=1 112 | fi 113 | fi 114 | done 115 | 116 | # Remove configuration files *.conf.destroyed 117 | # let's be paranoid about file names here ;) 118 | CONF_FILES=`ls -1 $CONFIG_DIR/*.destroyed 2>/dev/null | grep "[1-9][0-9]*.conf.destroyed"` 119 | for FILE in $CONF_FILES; do 120 | # we don't care if rm fails 121 | rm -f $FILE >/dev/null 2>&1 122 | done 123 | 124 | exit $RETCODE 125 | # end of script 126 | -------------------------------------------------------------------------------- /include/vzlist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #ifndef _VZLIST_H 25 | #define _VZLIST_H 26 | 27 | #include 28 | 29 | #define PROCVEINFO "/proc/vz/veinfo" 30 | #define PROCUBC "/proc/user_beancounters" 31 | #define PROC_BC_RES "/proc/bc/resources" 32 | #define PROCVEINFO "/proc/vz/veinfo" 33 | 34 | #define MAXCPUUNITS 500000 35 | #define MAX_STR 16384 36 | 37 | struct Cubc { // held maxheld barrier limit failcnt 38 | unsigned long kmemsize[5]; 39 | unsigned long lockedpages[5]; 40 | unsigned long privvmpages[5]; 41 | unsigned long shmpages[5]; 42 | unsigned long numproc[5]; 43 | unsigned long physpages[5]; 44 | unsigned long vmguarpages[5]; 45 | unsigned long oomguarpages[5]; 46 | unsigned long numtcpsock[5]; 47 | unsigned long numflock[5]; 48 | unsigned long numpty[5]; 49 | unsigned long numsiginfo[5]; 50 | unsigned long tcpsndbuf[5]; 51 | unsigned long tcprcvbuf[5]; 52 | unsigned long othersockbuf[5]; 53 | unsigned long dgramrcvbuf[5]; 54 | unsigned long numothersock[5]; 55 | unsigned long dcachesize[5]; 56 | unsigned long numfile[5]; 57 | unsigned long numiptent[5]; 58 | unsigned long swappages[5]; 59 | }; 60 | 61 | struct Cslm { 62 | int mode; 63 | unsigned long memorylimit[3]; // inst avg quality 64 | }; 65 | 66 | struct Cquota { 67 | unsigned long quota_block[3]; // 0-usage 1-softlimit 2-hardlimit 68 | unsigned long quota_inode[3]; // 0-usage 1-softlimit 2-hardlimit 69 | }; 70 | 71 | struct Ccpu { 72 | unsigned long limit[3]; // 0-limit %, 1-limit Mhz 2-units 73 | }; 74 | 75 | struct vzctl_io_param { 76 | int *prio; 77 | unsigned int *limit; 78 | unsigned int *iopslimit; 79 | }; 80 | 81 | struct Cveinfo { 82 | ctid_t ctid; 83 | int tm; 84 | char *hostname; 85 | char *name; 86 | char *description; 87 | char *ip; 88 | char *ext_ip; 89 | char *configured_ip; 90 | char *ve_private; 91 | char *ve_root; 92 | char *ostmpl; 93 | char *distribution; 94 | struct Cubc *ubc; 95 | struct Cquota *quota; 96 | struct Ccpu *cpu; 97 | veth_param *veth; 98 | int status; 99 | int hide; 100 | int onboot; 101 | char *clust_srv_name; 102 | unsigned long *bootorder; 103 | struct vzctl_cpustat *cpustat; 104 | struct vzctl_io_param io; 105 | char *cpumask; 106 | char *nodemask; 107 | struct vzctl_env_features *features; 108 | int mm; 109 | int ha_enable; 110 | unsigned long *ha_prio; 111 | char *uuid; 112 | char *devnodes; 113 | int autostop; 114 | int disabled; 115 | unsigned long cpus; 116 | char *nameserver; 117 | char *searchdomain; 118 | char *config; 119 | vzctl_env_type type; 120 | }; 121 | 122 | #define RES_NONE 0 123 | #define RES_HOSTNAME 1 124 | #define RES_UBC 2 125 | #define RES_QUOTA 3 126 | #define RES_IP 4 127 | #define RES_LA 5 128 | #define RES_CPU 6 129 | #define RES_TM 7 130 | #define RES_OSTEMPLATE 8 131 | #define RES_DESCRIPTION 9 132 | #define RES_NAME 10 133 | #define RES_NETIF 13 134 | #define RES_IFNAME 14 135 | #define RES_ONBOOT 15 136 | #define RES_BOOTORDER 18 137 | #define RES_UPTIME 19 138 | #define RES_IO 20 139 | #define RES_CONFIGURED_IP 21 140 | #define RES_HA_ENABLE 22 141 | #define RES_HA_PRIO 23 142 | #define RES_STATUS 24 143 | #define RES_DISTRIBUTION 25 144 | 145 | struct Cfield { 146 | char *name; 147 | char *hdr; 148 | char *hdr_fmt; 149 | int index; 150 | int res_type; 151 | void (* const print_fn)(struct Cveinfo *p, int index); 152 | int (* const sort_fn)(const void* val1, const void* val2); 153 | }; 154 | 155 | struct Cfield_order { 156 | int order; 157 | struct Cfield_order *next; 158 | }; 159 | 160 | #endif /* _VZLIST_H */ 161 | -------------------------------------------------------------------------------- /src/ha.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2017, Parallels International GmbH 3 | * Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved. 4 | * 5 | * This file is part of OpenVZ. OpenVZ is free software; you can redistribute 6 | * it and/or modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | * 02110-1301, USA. 19 | * 20 | * Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200 21 | * Schaffhausen, Switzerland. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include "vzctl.h" 36 | #include "util.h" 37 | #include "vzerror.h" 38 | #include "config.h" 39 | #include "ha.h" 40 | 41 | #define SHAMAN_BIN "/usr/sbin/shaman" 42 | 43 | #ifndef GFS2_MAGIC 44 | #define GFS2_MAGIC 0x01161970 45 | #endif 46 | 47 | #ifndef NFS_SUPER_MAGIC 48 | #define NFS_SUPER_MAGIC 0x6969 49 | #endif 50 | 51 | /* Kernel sources, fs/fuse/inode.c */ 52 | #ifndef FUSE_SUPER_MAGIC 53 | #define FUSE_SUPER_MAGIC 0x65735546 54 | #endif 55 | 56 | #ifndef EXT4_SUPER_MAGIC 57 | #define EXT4_SUPER_MAGIC 0xEF53 58 | #endif 59 | 60 | static int is_shared_fs(const char *path) 61 | { 62 | struct statfs st; 63 | 64 | if (statfs(path, &st)) { 65 | logger(-1, errno, "statfs '%s'", path); 66 | return -1; 67 | } 68 | 69 | return (st.f_type == GFS2_MAGIC || 70 | st.f_type == NFS_SUPER_MAGIC || 71 | st.f_type == FUSE_SUPER_MAGIC); 72 | } 73 | 74 | /** 75 | * Check whether shaman binary is present in the standard path 76 | * 77 | * @retval 0 on success 78 | * @retval -1 if shaman binary is not present 79 | * @retval >0 if error is occured in the process of checking 80 | */ 81 | static int is_shaman_present(void) 82 | { 83 | return stat_file(SHAMAN_BIN); 84 | } 85 | 86 | static void shaman_get_resname(int veid, char *buf, int size) 87 | { 88 | snprintf(buf, size, "ct-%d", veid); 89 | } 90 | 91 | int handle_set_cmd_on_ha_cluster(int veid, const char *ve_private, 92 | struct ha_params *cmdline, 93 | struct ha_params *config, 94 | int save) 95 | { 96 | int i = 5; 97 | struct stat st; 98 | char command[NAME_MAX]; 99 | char resname[NAME_MAX]; 100 | char *argv[] = {SHAMAN_BIN, "-i", "-q", command, resname, NULL, NULL, NULL}; 101 | char prio[NAME_MAX]; 102 | 103 | if (cmdline->ha_enable) { 104 | /* 105 | * If there is a '--ha-enable yes' in the command line, then use 'add' 106 | * command to create resource file and set up needed parameters. 107 | */ 108 | snprintf(command, sizeof(command), "%s", 109 | (cmdline->ha_enable == YES) ? "add" : "del"); 110 | } else if (cmdline->ha_prio) { 111 | snprintf(command, sizeof(command), "set"); 112 | } else { 113 | /* HA options are not present in the command line */ 114 | return 0; 115 | } 116 | 117 | /* 118 | * Check that '--ha-*' options are always used along with '--save', otherwise 119 | * CT config and HA cluster contents could become unsynchronized. 120 | */ 121 | if (!save) { 122 | logger(-1, 0, "High Availability Cluster options could be set only" 123 | " when --save option is provided"); 124 | return VZ_NOT_ENOUGH_PARAMS; 125 | } 126 | 127 | /* 128 | * If HA_ENABLE is explicitely set to "no" in the CT config and the command 129 | * line doesn't provide the '--ha_enable' option -- just save parameters 130 | * in the CT config and don't run shaman. 131 | */ 132 | if ((config->ha_enable == NO) && !cmdline->ha_enable) 133 | return 0; 134 | 135 | if (stat(ve_private, &st) || !is_shared_fs(ve_private)) 136 | return 0; 137 | 138 | if (!is_shaman_present()) 139 | return 0; 140 | 141 | shaman_get_resname(veid, resname, sizeof(resname)); 142 | 143 | if (cmdline->ha_prio || config->ha_prio) { 144 | snprintf(prio, sizeof(prio), "%lu", 145 | cmdline->ha_prio ? *cmdline->ha_prio : *config->ha_prio); 146 | argv[i++] = "--prio"; 147 | argv[i++] = prio; 148 | } 149 | 150 | return run_script(argv, NULL, 0); 151 | } 152 | --------------------------------------------------------------------------------