Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37529175
en ru br
Репозитории ALT
S:7.0.254-alt2
D:3.0.22-alt2.1
5.1: 3.0.23-alt3
4.1: 3.0.22-alt3
4.0: 3.0.22-alt2
+updates:3.0.18-alt1
www.altlinux.org/Changes

Группа :: Система/Настройка/Прочее
Пакет: vzctl

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: vzctl-7.0.254.patch
Скачать


 .gear/rules                                        |   2 +
 .../tags/a40c870622df2b3a020df7f5c2c12ebe9702684b  |   6 +
 .gear/tags/list                                    |   1 +
 Makefile                                           |   8 +-
 etc/ifup-venet                                     |   2 +-
 etc/modules-load.d/vz.conf                         |   1 +
 etc/systemd.d/vz                                   |  48 +--
 etc/systemd.d/vz.service                           |   4 +-
 etc/systemd.d/vzevent.service                      |   2 +-
 etc/vps.reinstall.sample                           |   2 +-
 etc/vz.conf                                        |  12 +-
 include/config.h                                   |   2 +-
 include/vzctl.h                                    |  10 +-
 man/Makefile                                       |   2 +-
 man/pnetstat.8                                     |   2 +-
 man/vz-create_prvt.5                               |   2 +-
 man/vz-net_add.5                                   |   2 +-
 man/vz-net_del.5                                   |   2 +-
 man/vz-postinst.5                                  |   2 +-
 man/vz-start.5                                     |   2 +-
 man/vz-stop.5                                      |   2 +-
 man/vz.5                                           |   4 +-
 man/vzcheckovr.8                                   |   2 +-
 man/vzctl.8                                        |   2 +-
 man/vzpurge.8                                      |   2 +-
 man/vzsplit.8                                      |   2 +-
 man/vzubc.8                                        | 129 +++++++
 src/Makefile                                       |   2 +-
 src/config.c                                       |   1 +
 src/util.c                                         |   4 +-
 src/vz.c                                           |   6 +-
 src/vzeventd.c                                     |   6 +-
 src/vzlist.c                                       |   9 +-
 src/vzsplit.c                                      |   7 +-
 vzctl.spec                                         | 258 ++++++++++++++
 vzdiskcheck                                        |   2 +-
 vzgetpa                                            |   2 +-
 vzpurge                                            |   6 +-
 vzubc                                              | 384 +++++++++++++++++++++
 39 files changed, 866 insertions(+), 78 deletions(-)
diff --git a/.gear/rules b/.gear/rules
new file mode 100644
index 0000000..26340af
--- /dev/null
+++ b/.gear/rules
@@ -0,0 +1,2 @@
+tar: v@version@:.
+diff: v@version@:. . name=@name@-@version@.patch
diff --git a/.gear/tags/a40c870622df2b3a020df7f5c2c12ebe9702684b b/.gear/tags/a40c870622df2b3a020df7f5c2c12ebe9702684b
new file mode 100644
index 0000000..1913651
--- /dev/null
+++ b/.gear/tags/a40c870622df2b3a020df7f5c2c12ebe9702684b
@@ -0,0 +1,6 @@
+object 3f9cfda071cf6669461e8645c02edb91b90330cc
+type commit
+tag v7.0.254
+tagger Apache <apache@kojihub.eng.sw.ru> 1656327065 +0300
+
+AUTO v7.0.254 tag
diff --git a/.gear/tags/list b/.gear/tags/list
new file mode 100644
index 0000000..41855be
--- /dev/null
+++ b/.gear/tags/list
@@ -0,0 +1 @@
+a40c870622df2b3a020df7f5c2c12ebe9702684b v7.0.254
diff --git a/Makefile b/Makefile
index 04575c5..0c10941 100644
--- a/Makefile
+++ b/Makefile
@@ -15,11 +15,11 @@ SYSTEMDSCRIPTDIR = ${PREFIX}/libexec
  VZCTLSCRIPTDIR = ${SYSTEMDSCRIPTDIR}/vzctl
    MODPROBEDDIR = /etc/modprobe.d
      SYSCTLDDIR = /etc/sysctl.d
-MODULESLOADDDIR = /etc/modules-load.d
+MODULESLOADDDIR = /lib/modules-load.d
          MANDIR = ${PREFIX}/man
-      VZLOCKDIR = /vz/lock
+      VZLOCKDIR = /var/lib/vz/lock
    VZCTLLOCKDIR = /var/lock/vzctl
-     VZSPOOLDIR = /var/vz
+     VZSPOOLDIR = /var/lib/vz
         LOGRDIR = /etc/logrotate.d
    BASHCOMPLDIR = /etc/bash_completion.d
      VENAMESDIR = $(VZDIR)/names
@@ -52,7 +52,7 @@ VECONFIG_VSWAP = ve-vswap.256MB.conf-sample ve-vswap.512MB.conf-sample \
 	       vzsplit.8 vzcpucheck.8 vzpid.8 vzcfgscale.8 vzcfgvalidate.8 \
                vzdiskcheck.8 \
 	       vzauth.8 vztactl.8 vzlist.8 \
-	       vzeventd.8
+	       vzeventd.8 vzubc.8
         MAN5 = vz.5 ve.conf.5 vz-start.5 vz-stop.5 \
                vz-create_prvt.5 \
                vz-postinst.5 vz-net_add.5 vz-net_del.5 networks_classes.5
diff --git a/etc/ifup-venet b/etc/ifup-venet
index bd3e742..afe686b 100755
--- a/etc/ifup-venet
+++ b/etc/ifup-venet
@@ -17,7 +17,7 @@ if ! ip link show dev $vznet >/dev/null 2>&1; then exit 0; fi
 
 # VZNET device
 
-. /usr/libexec/libvzctl/scripts/vz-functions
+. /usr/share/libvzctl/scripts/vz-functions
 . /etc/vz/vz.conf
 
 veip="/proc/vz/veip"
diff --git a/etc/modules-load.d/vz.conf b/etc/modules-load.d/vz.conf
index 0bb23d9..8fd8076 100644
--- a/etc/modules-load.d/vz.conf
+++ b/etc/modules-load.d/vz.conf
@@ -18,3 +18,4 @@ overlay
 veth
 br_netfilter
 ip_vs
+binfmt_misc
diff --git a/etc/systemd.d/vz b/etc/systemd.d/vz
index 5c8d73a..e2cb6ff 100644
--- a/etc/systemd.d/vz
+++ b/etc/systemd.d/vz
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-VE_PARALLEL=0
+VE_PARALLEL=1
 
 VZCTL=/usr/sbin/vzctl
 VZLIST=/usr/sbin/vzlist
@@ -11,8 +11,9 @@ NETCLASSES=/etc/vz/conf/networks_classes
 SYSFS_PERM=/sys/fs/cgroup/ve/ve.default_sysfs_permissions
 SUSPEND_CONF_DIR=/etc/vz/vzreboot
 
-VZ_MODULES=/etc/modules-load.d/vz.conf
-PLOOP_MODULES=/etc/modules-load.d/ploop.conf
+VZDEV=venet0
+VZ_MODULES=/lib/modules-load.d/vz.conf
+PLOOP_MODULES=/lib/modules-load.d/ploop.conf
 
 get_parallel()
 {
@@ -126,11 +127,24 @@ get_physical_interfaces()
 
 setup_venet()
 {
-	[ ! -e /sys/class/net/venet0 ] && ip l a name venet0 type venet 
-	ip l s dev venet0 up
-	ip -6 a a fe80::1/128 dev venet0 2>/dev/null
-	sysctl -w net.ipv4.conf.venet0.send_redirects=0
-	sysctl -w net.ipv4.conf.venet0.rp_filter=0
+	[ ! -e /sys/class/net/${VZDEV} ] && ip l a name ${VZDEV} type venet
+	ip l s dev ${VZDEV} up
+
+	ip addr add 0.0.0.0/0 dev ${VZDEV} || return
+	if [ "$IPV6" = "yes" ]; then
+		if [ "$(sysctl -n -e net.ipv6.conf.$VZDEV.disable_ipv6)" = 0 ]; then
+			ip -6 addr add fe80::1/128 dev ${VZDEV} || return
+		fi
+		sysctl -w net.bridge.bridge-nf-call-ip6tables=1
+	fi
+	sysctl -w net.ipv4.conf.${VZDEV}.rp_filter=0
+
+	sysctl -w net.ipv4.conf.default.proxy_arp=0
+	sysctl -w net.ipv4.conf.default.send_redirects=1
+	sysctl -w net.ipv4.conf.all.send_redirects=0
+	sysctl -w net.bridge.bridge-nf-call-iptables=1
+	sysctl -w net.ipv4.ip_forward=1
+	sysctl -w net.ipv4.conf.${VZDEV}.send_redirects=0
 }
 
 setup_net()
@@ -177,7 +191,7 @@ setup_net()
 		[ ${hwcsum_set} -eq 0 ] && ethtool_args="${ethtool_args} rx ${rx} tx ${tx} sg ${sg}"
 		[ ${tso_set} -eq 0 ] && ethtool_args="${ethtool_args} tso ${tso}"
 	fi
-	[ -n "${ethtool_args}" ] && ethtool -K venet0 ${ethtool_args} &>/dev/null
+	[ -n "${ethtool_args}" ] && ethtool -K ${VZDEV} ${ethtool_args} &>/dev/null
 	return 0
 }
 
@@ -242,11 +256,6 @@ start_env()
 {
 	local pid pids iter
 
-	if ! which prlctl >/dev/null 2>&1; then
-		echo "prlctl is missing, skip autostart"
-		return
-	fi
-
 	target=`readlink /etc/systemd/system/default.target`
 	if [ -n "$target" ]; then
 		target=`basename $target`
@@ -256,17 +265,14 @@ start_env()
 	if /usr/bin/systemctl -q --no-legend list-jobs | grep -qw "$target"; then
 		# system boot
 		clean_lock
-		return
+		# return
 	fi
 
 	get_parallel
 
 	iter=0
-	for id in `prlctl list -Ha -o id --vmtype ct`; do
-		if ! prlctl list -i $id | grep "^Autostart: on"; then
-			continue
-		fi
-		prlctl start $id >/dev/null 2>&1 &
+	for id in `${VZLIST} -aH -octid,onboot | grep 'yes$' | awk '{print $1}'`; do
+		${VZCTL} start $id >/dev/null 2>&1 &
 		pid=$!
 		eval VE_${pid}=${id}
 		pids="$pids $pid"
@@ -372,7 +378,7 @@ stop()
 shaperrestart()
 {
 	setup_tc
-	/usr/libexec/libvzctl/scripts/vz-setrate shaperon
+	/usr/share/libvzctl/scripts/vz-setrate shaperon
 	exit $?
 }
 
diff --git a/etc/systemd.d/vz.service b/etc/systemd.d/vz.service
index 4b6536b..a2144cc 100644
--- a/etc/systemd.d/vz.service
+++ b/etc/systemd.d/vz.service
@@ -1,8 +1,8 @@
 [Unit]
 Description=@PRODUCT_NAME_SHORT@ Container service
-After=vcmmd.service vstorage-fs.service
+After=vzevent.service
 After=remote-fs.target
-Wants=vcmmd.service
+Wants=vzevent.service
 Wants=proc-sys-fs-binfmt_misc.mount
 
 [Service]
diff --git a/etc/systemd.d/vzevent.service b/etc/systemd.d/vzevent.service
index 356c84e..f038883 100644
--- a/etc/systemd.d/vzevent.service
+++ b/etc/systemd.d/vzevent.service
@@ -4,7 +4,7 @@ After=syslog.target network.target
 
 [Service]
 Type=forking
-PIDFile=/var/run/vzeventd.pid
+PIDFile=/run/vzeventd.pid
 ExecStartPre=-/sbin/modprobe -q vzevent
 ExecStart=/usr/sbin/vzeventd
 KillMode=process
diff --git a/etc/vps.reinstall.sample b/etc/vps.reinstall.sample
index 0948ae0..b6b56da 100755
--- a/etc/vps.reinstall.sample
+++ b/etc/vps.reinstall.sample
@@ -17,7 +17,7 @@
 # 128			- ignore this script, run original reinstall
 # other			- error
 
-VE_TAR=/vz/template/redhat-9-20040116.tar.gz
+VE_TAR=/var/lib/vz/template/redhat-9-20040116.tar.gz
 
 function create_prvt()
 {
diff --git a/etc/vz.conf b/etc/vz.conf
index 6bf7903..b016574 100644
--- a/etc/vz.conf
+++ b/etc/vz.conf
@@ -1,7 +1,7 @@
 ## Global parameters
 VIRTUOZZO=yes
-ACTIONLOGDIR=/vz/actionlog
-LOCKDIR=/vz/lock
+ACTIONLOGDIR=/var/log/vz/actionlog
+LOCKDIR=/var/lib/vz/lock
 
 # Golden Image functionality allowing the use of extended template caches that
 # contain an OS template and one or more application templates.
@@ -34,11 +34,11 @@ RATEMPU="*:1:1000"
 #VE_ROUTE_SRC_DEV="eth0"
 
 ## Template parameters
-TEMPLATE=/vz/template
+TEMPLATE=/var/lib/vz/template
 
 ## Defaults for VEs
-VE_ROOT=/vz/root/$VEID
-VE_PRIVATE=/vz/private/$VEID
+VE_ROOT=/var/lib/vz/root/$VEID
+VE_PRIVATE=/var/lib/vz/private/$VEID
 CONFIGFILE="basic"
 DEF_OSTEMPLATE=".almalinux-8"
 
@@ -70,7 +70,7 @@ USE_VENET_MASK=yes
 # In case empty value the number of parallel VEs calculated as 'num_cpu * 4'
 # VE_PARALLEL=1
 
-DUMPDIR=/vz/dump
+DUMPDIR=/var/lib/vz/dump
 
 # Specifies an action to be performed on Container file system error event.
 #   - stop: forcibly stop Container (default).
diff --git a/include/config.h b/include/config.h
index da47d9d..6e53129 100644
--- a/include/config.h
+++ b/include/config.h
@@ -56,7 +56,7 @@
 #define NETIF_CONFIGURE_MODE 74
 #define DISK_T		75
 
-struct CParam tmpparam;
+extern struct CParam tmpparam;
 
 struct Cconfig
 {
diff --git a/include/vzctl.h b/include/vzctl.h
index 027637f..f27eda6 100644
--- a/include/vzctl.h
+++ b/include/vzctl.h
@@ -43,7 +43,7 @@
 
 #define DEBUG_LEVEL		2
 #define MAXATTEMPT		10
-#define SCRIPT_DIR		"/usr/libexec/libvzctl/scripts/"
+#define SCRIPT_DIR		"/usr/share/libvzctl/scripts/"
 #define DIST_CONF_DIR		SCRIPT_DIR"dists/"
 #define DIST_SCRIPTS		DIST_CONF_DIR "scripts/"
 #define	DIST_CONF_DEF		"default"
@@ -80,11 +80,11 @@
 #define ACTIONLOCKFILE		".lck"
 #define SEQFILE			"vzctl.seq"
 
-#define VE_ROOT_DEFAULT		"/vz/root"
-#define VE_PRIVATE_DEFAULT	"/vz/private"
-#define TEMPLATE_DEFAULT	"/vz/template"
+#define VE_ROOT_DEFAULT		"/var/lib/vz/root"
+#define VE_PRIVATE_DEFAULT	"/var/lib/vz/private"
+#define TEMPLATE_DEFAULT	"/var/lib/vz/template"
 
-#define VE_STATE_DIR		"/var/vz/veip"
+#define VE_STATE_DIR		"/var/lib/vz/veip"
 #define VZFIFO_FILE		"/.vzfifo"
 
 #define START_PREFIX		"start"
diff --git a/man/Makefile b/man/Makefile
index 9e44cf2..6c95b78 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -8,7 +8,7 @@ MANS = vzctl.8 vz.5 ve.conf.5 networks_classes.5 \
  vzpurge.8 vzgetpa.8  ubclogd.8 vznetstat.8 vzsplit.8 vzcpucheck.8 \
  vzpid.8 vzcfgscale.8 vzcfgvalidate.8 \
  vzauth.8 vztactl.8 vzlist.8 \
- vzdiskcheck.8 vzeventd.8
+ vzdiskcheck.8 vzeventd.8 vzubc.8
 
 PSS = $(patsubst %, %.ps, $(MANS))
 PDFS = $(patsubst %, %.pdf, $(MANS))
diff --git a/man/pnetstat.8 b/man/pnetstat.8
index d1f6172..bb9ca90 100644
--- a/man/pnetstat.8
+++ b/man/pnetstat.8
@@ -7,7 +7,7 @@ pnetstat [\fB-v\fR <\fIid\fR>] [\fB-c\fR <\fIclass\fR>] [\fB-a\fR] [\fB-r\fR]
 .SH DESCRIPTION
 The utility displays incoming and outcoming traffic for servers for each defined
 network class. The output is grouped by server IDs. The network classes are
-described in the /etc/sysconfig/vz-scripts/networks_classes file. If no options
+described in the /etc/vz/conf/networks_classes file. If no options
 are specified the network statistics for all running servers is printed.
 .PP
 Note that for the ID of 0, the traffic of the HS (the host server
diff --git a/man/vz-create_prvt.5 b/man/vz-create_prvt.5
index e46bf32..02751c3 100644
--- a/man/vz-create_prvt.5
+++ b/man/vz-create_prvt.5
@@ -2,7 +2,7 @@
 .SH NAME
 vz-create_prvt \- Container's script for creating CT private area
 .SH SYNOPSIS
-/usr/libexec/libvzctl/scripts/vz-create_prvt
+/usr/share/libvzctl/scripts/vz-create_prvt
 .SH DESCRIPTION
 The \fBvz-create_prvt\fR script is called by \fBvzctl(8)\fR when it gets
 called with \fIcreate\fR command.
diff --git a/man/vz-net_add.5 b/man/vz-net_add.5
index fd36e42..8c7699c 100644
--- a/man/vz-net_add.5
+++ b/man/vz-net_add.5
@@ -2,7 +2,7 @@
 .SH NAME
 vz-net_add \- Container's script for adding an IP alias
 .SH SYNOPSIS
-/usr/libexec/libvzctl/scripts/vz-net_add
+/usr/share/libvzctl/scripts/vz-net_add
 .SH DESCRIPTION
 The \fBvz-net_add\fR script is called by \fBvzctl(8)\fR. The script can be any
 executable file and is usually a shell script.
diff --git a/man/vz-net_del.5 b/man/vz-net_del.5
index 9733738..4df498c 100644
--- a/man/vz-net_del.5
+++ b/man/vz-net_del.5
@@ -2,7 +2,7 @@
 .SH NAME
 vz-net_del \- Container's script for removing an IP alias
 .SH SYNOPSIS
-/usr/libexec/libvzctl/scripts/vz-net_del
+/usr/share/libvzctl/scripts/vz-net_del
 .SH DESCRIPTION
 The \fBvz-net_del\fR script is called by \fBvzctl(8)\fR. The script can be any
  executable file and is usually a shell script.
diff --git a/man/vz-postinst.5 b/man/vz-postinst.5
index 9047f6d..6deac0e 100644
--- a/man/vz-postinst.5
+++ b/man/vz-postinst.5
@@ -2,7 +2,7 @@
 .SH NAME
 vz-postinst \- Container's script to perform postinstall tasks
 .SH SYNOPSIS
-/usr/libexec/libvzctl/scripts/vz-postinst
+/usr/share/libvzctl/scripts/vz-postinst
 .SH DESCRIPTION
 The \fBvz-postinst\fR script is called by \fBvzctl(8)\fR after CT private
 area is created and mounted.
diff --git a/man/vz-start.5 b/man/vz-start.5
index adebe75..be6397a 100644
--- a/man/vz-start.5
+++ b/man/vz-start.5
@@ -2,7 +2,7 @@
 .SH NAME
 vz-start \- Container's startup configuration script
 .SH SYNOPSIS
-/usr/libexec/libvzctl/scripts/vz-start
+/usr/share/libvzctl/scripts/vz-start
 .SH DESCRIPTION
 The \fBvz-start\fR script is called by \fBvzctl(8)\fR just before CT
 is started. The script can be any executable file
diff --git a/man/vz-stop.5 b/man/vz-stop.5
index b0d192d..c49e409 100644
--- a/man/vz-stop.5
+++ b/man/vz-stop.5
@@ -2,7 +2,7 @@
 .SH NAME
 vz-stop \- Container's shutdown configuration script
 .SH SYNOPSIS
-/usr/libexec/libvzctl/scripts/vz-stop
+/usr/share/libvzctl/scripts/vz-stop
 .SH DESCRIPTION
 The \fBvz-stop\fR script is called by \fBvzctl(8)\fR just after
 the CT is shut down. The script can be any executable file
diff --git a/man/vz.5 b/man/vz.5
index 1baf18d..d5cf73f 100644
--- a/man/vz.5
+++ b/man/vz.5
@@ -2,7 +2,7 @@
 .SH NAME
 vz \- global @PRODUCT_NAME_SHORT@ configuration file
 .SH SYNOPSIS
-/etc/vz/vz
+/etc/vz/vz.conf
 .SH DESCRIPTION
 This is the global configuration file for @PRODUCT_NAME_SHORT@.
 It consists of lines in the form
@@ -80,7 +80,7 @@ written to a log file. Default value is \fB0\fR. Some useful values are:
 .br
  \(bu \fB0\fR - actions/errors of vzctl on start, stop, mount, umount, create, destroy,
 .br
- \(bu \fB1\fR - logging helper comands vzctl running in /usr/libexec/libvzctl/scripts,
+ \(bu \fB1\fR - logging helper comands vzctl running in /usr/share/libvzctl/scripts,
 .br
  \(bu \fB2\fR - logging create action events, pool, version used on create action,
 .br
diff --git a/man/vzcheckovr.8 b/man/vzcheckovr.8
index da332ad..4b0240d 100644
--- a/man/vzcheckovr.8
+++ b/man/vzcheckovr.8
@@ -23,7 +23,7 @@ There are five parameters this utility check:
 .br
 \(bu Max Alloc Limit
 .PP
-The warning levels for these parameters are in \f(CR/ets/sysconfig/vz\fR
+The warning levels for these parameters are in \f(CR/ets/vz/vz.conf\fR
 configuration file.
 .SH DIAGNOSTICS
 Normally, exit status is 0. On error, exit status is 1.
diff --git a/man/vzctl.8 b/man/vzctl.8
index 85d6a93..89e65a6 100644
--- a/man/vzctl.8
+++ b/man/vzctl.8
@@ -750,7 +750,7 @@ Custom action scripts can be of two types:
 .br
 .sp -1
 .HP 2
-\(bu per-container, executed for specific containers. Such scripts must not have the prefix 'vps' and need to be placed in '/vz/private/<CT_UUID>/scripts/'.
+\(bu per-container, executed for specific containers. Such scripts must not have the prefix 'vps' and need to be placed in '/var/lib/vz/private/<CT_UUID>/scripts/'.
 .IP "\fBvps.mount\fR, \fBmount\fR" 4
 Executed after a container is mounted. Can be global or container-specific.
 .IP "\fBstart\fR" 4
diff --git a/man/vzpurge.8 b/man/vzpurge.8
index 1c37e6a..44d94bc 100644
--- a/man/vzpurge.8
+++ b/man/vzpurge.8
@@ -9,7 +9,7 @@ This script finds and removes all CT private areas, which have no
 appropriate configuration file
 (\f(CW/etc/vz/conf/\fR\fIveid\fR\f(CW.conf\fR).
 To find private areas, value of \fBVE_PRIVATE\fR variable in
-\f(CW/etc/vz/vz\fR configuration file is used.
+\f(CW/etc/vz/vz.conf\fR configuration file is used.
 .P
 If CT is running, it is stopped. If CT is mounted, it is unmounted.
 .SH NOTES
diff --git a/man/vzsplit.8 b/man/vzsplit.8
index 8b3a266..9b397d1 100644
--- a/man/vzsplit.8
+++ b/man/vzsplit.8
@@ -27,7 +27,7 @@ Specify the configuration file name. The program output is placed to
 Specify the swap size in Kbytes. If not provided in the option, the swap size will be read from /proc/meminfo.
 .TP
 \fB-p\fR \fIpath\fR
-Specify path where CTs will reside. By default /vz used.
+Specify path where CTs will reside. By default /var/lib/vz used.
 .TP
 .SH DIAGNOSTICS
 \fBvzsplit\fR returns 0 upon a sucessful execution. If anything goes wrong, it
diff --git a/man/vzubc.8 b/man/vzubc.8
new file mode 100644
index 0000000..b9ab97f
--- /dev/null
+++ b/man/vzubc.8
@@ -0,0 +1,129 @@
+.TH vzubc 8 "2 May 2013" "OpenVZ" "Containers"
+.SH NAME
+vzubc \- show User Beancounters in a human-readable format
+.SH SYNOPSIS
+vzubc [\fIoption\fR ...] [\fICTID\fR ...]
+.SH DESCRIPTION
+This utility aims to show current values for User Beancounter in
+a human-readable format. Values that are in pages are converted into bytes,
+then long values are converted into kilo-, mega- gigabytes etc.
+For held and maxheld, it shows how close the values are to the barrier and
+to the limit. Zero and unlimited values are shown as \fB-\fR.
+
+One or several \fICTID\fRs can be specified to limit the output to the given
+containers. Each \fICTID\fR can be either a name or a numeric ID. Note that
+names can only be used if there is a container on the system with that name
+(\fBvzlist -o ctid\fI name\fR command is used for name to ID conversion).
+Unknown \fICTID\fRs are ignored.
+
+The utility can also be used from inside the container, in this case it only
+shows the values for that container (and it doesn't make sense to specify
+\fICTID\fR argument).
+.SH OPTIONS
+.TP
+.BR -w , \ --watch
+Watch mode: run itself under \fBwatch\fR(1), redisplaying the output
+every 2 seconds (by default) until interrupted by Ctrl-C.
+.TP
+.B -wd
+Make \fBwatch\fR(1) highlight the differences between current and previous
+output. Corresponds to \fBwatch -d\fR option.
+.TP
+.B -wt
+Instruct \fBwatch\fR(1) to not show its title (interval, command, and
+current time at the top of the display, as well as the following blank
+line). Corresponds to \fBwatch -t\fR option.
+.TP
+.BI -wn \ time
+Refresh interval for \fBwatch\fR(1), in seconds (corresponds to \fBwatch -n \fItime\fR).
+.TP
+.BR -q , \ --quiet
+Quiet mode. In this mode, \fBvzubc\fR only shows beancounters with fails and
+those with held/maxheld values close to limits.
+.BR -v , \ --verbose
+Verbose mode. In this mode, \fBvzubc\fR also shows beancounters with
+barrier set to \fBunlimited\fR (those are hidden by default).
+.TP
+.BI -qh \ ratio
+Quiet threshold for held to limit ratio. Default is \fB0.5\fR (50%).
+.TP
+.BI -qm \ ratio
+Quiet threshold for maxheld to limit ratio. Default is \fB0.8\fR (80%).
+.TP
+.BR -r , \ --relative
+Relative mode: for fail counters, instead of showing the absolute value,
+calculate the difference from the previous run. This mode is denoted by
+a \fB+\fR sign before the \fBFAIL\fR column header.
+.TP
+.BI -rd \ dir
+Set a directory for saving fail counters to \fIdir\fR (default is
+\fB/tmp/vzubc.store\fR).
+.TP
+.B -rc
+Clear all saved fail counter data.
+.TP
+.BR -i , \ --incremental
+Incremental mode. Shows an additional column with a difference in held
+value from the previous run. This option also affects quiet mode: all
+lines with changed held values are shown. Held data is saved to the same
+directory as fail counter data.
+.TP
+.BI -id \ dir
+A synonym for \fB-rd\fR.
+.TP
+.B -ic
+Clear all saved held data.
+.TP
+.BR -c , \ --color
+Enable color highlighting. Not compatible with \fB--watch\fR. Same thresholds
+as for quiet mode are used to highlight "more important" lines, plus the
+lines with non-zero fail counters are highlighted.
+.TP
+\fB-f\fR | \fB--file\fR \fIfilename\fR
+Read User Beancounters from \fIfilename\fR. By default this is
+\fB/proc/bc/resources\fR or, if that one is not available,
+\fB/proc/user_beancounters\fR. Use \fB-\fR to read from standard input.
+.SH EXAMPLES
+.TP
+.B vzubc 101 web dns
+Show all beancounters for CTID 101 and for CTs named \fBweb\fR and \fBdns\fR.
+.TP
+.B vzubc -w -wd -wn 10 101
+Display beancounters for CT 101 every 10 seconds, highlighting the changes.
+Interrupt with Control-C.
+.TP
+.B vzubc -q -c
+Show beancounters with held or maxheld close to limits, plus those with
+non-zero fail counters, with colors.
+.TP
+.B vzubc -q -qh 0.8 -qm 1
+Show beancounters with held value equal to or more than 80% of a limit,
+and/or with maxheld value equal or more than a limit, plus those with
+non-zero fail counters.
+.TP
+.B vzubc -w -q -r
+Display beancounters with held and maxheld close to limits, plus those with
+increasing fail counters.
+.TP
+.B vzubc -r -q -qh 2 -qm 2
+Only show beancounters with increased (since the last run) fail counters.
+.TP
+.B vzubc -rc -ic
+Show all beancounters, and clear all saved data for relative and incremental
+mode (i.e. saved values for fail counter and held).
+.SH FILES
+.EX
+/proc/bc/resources
+/proc/user_beancounters
+/tmp/vzubc.store/ubc.*
+.EE
+.SH EXIT STATUS
+Returns 0 upon successful execution, 1 otherwise.
+.SH SEE ALSO
+.BR watch (1),
+.BR vzlist (8),
+.BR vzmemcheck (8),
+.BR vzcfgvalidate (8),
+.BR http://wiki.openvz.org/UBC .
+.SH LICENSE
+Copyright (C) 2011, Parallels, Inc. Licensed under GNU GPL.
diff --git a/src/Makefile b/src/Makefile
index 7dc3d32..685b7ee 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -75,7 +75,7 @@ real-all: $(PROGS)
 	$(CC) -c $(CFLAGS) $(INC) $< -o $@
 
 vzeventd: $(OBJ_vzeventd)
-	$(CC) $(CFLAGS) $(INC) $(LDFLAGS) -lvzctl2 -ludev $^ -o $@
+	$(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -lvzctl2 -ludev -o $@
 
 ndsend: $(OBJ_nd)
 	$(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@
diff --git a/src/config.c b/src/config.c
index 432c030..41d5ed2 100644
--- a/src/config.c
+++ b/src/config.c
@@ -48,6 +48,7 @@
 #include "util.h"
 
 long _PAGE_SIZE = 4096;
+struct CParam tmpparam;
 struct Cconfig Config[] = {
 {"EXT_IP_ADDRESS", NULL, &tmpparam.ext_ipadd, NULL, PARAM_EXT_IP_ADD, IP_ADDR, 0, 0},
 {"", NULL, &tmpparam.ext_ipdel, NULL, PARAM_EXT_IP_DEL, IP_ADDR, 0, 0},
diff --git a/src/util.c b/src/util.c
index bd09616..80c1201 100644
--- a/src/util.c
+++ b/src/util.c
@@ -55,8 +55,8 @@
 #define NR_OPEN 1024
 #endif
 
-static char *envp_bash[] = {"HOME=/", "TERM=linux",
-	"PATH=/bin:/sbin:/usr/bin:/usr/sbin:.", NULL};
+static char *envp_bash[] = {"HOME=/root", "TERM=linux",
+	"PATH=/sbin:/usr/sbin:/bin:/usr/bin:.", NULL};
 
 /* check ipv4 x.x.x.x notation */
 int check_ipv4(char *ip)
diff --git a/src/vz.c b/src/vz.c
index 1b722e2..433f403 100644
--- a/src/vz.c
+++ b/src/vz.c
@@ -57,8 +57,8 @@
 #include "clist.h"
 
 static char * argv_bash[] = {"bash", NULL};
-static char * envp_bash[] = {"HOME=/", "TERM=linux",
-	"PATH=/bin:/sbin:/usr/bin:/usr/sbin",
+static char * envp_bash[] = {"HOME=/root", "TERM=linux",
+	"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
 	"SHELL=/bin/bash",
 	NULL};
 
@@ -336,7 +336,7 @@ int Set(ctid_t ctid, struct CParam *param)
 
 void Version(void)
 {
-	fprintf(stdout, "vzctl v." VERSION "\n");
+	fprintf(stdout, "vzctl version " VERSION "\n");
 }
 
 void Usage(void)
diff --git a/src/vzeventd.c b/src/vzeventd.c
index 4109625..9e06824 100644
--- a/src/vzeventd.c
+++ b/src/vzeventd.c
@@ -41,7 +41,7 @@
 #include <vzctl/libvzctl.h>
 
 #define VZEVENT_DIR	"/etc/vz/vzevent.d/"
-#define PID_FILE	"/var/run/vzeventd.pid"
+#define PID_FILE	"/run/vzeventd.pid"
 #define LOG_FILE	"/var/log/vzctl.log"
 
 #ifndef NETLINK_VZEVENT
@@ -129,8 +129,8 @@ static void run_event_script(const char *event, const char *id)
 	struct stat st;
 	char idstr[512];
 	char *arg[] = {fname, NULL};
-	char *env[] = {"HOME=/", "TERM=linux",
-		"PATH=/bin:/sbin:/usr/bin:/usr/sbin:", idstr, NULL};
+	char *env[] = {"HOME=/root", "TERM=linux",
+		"PATH=/sbin:/usr/sbin:/bin:/usr/bin:", idstr, NULL};
 
 	vzctl2_log(2, 0, "EVENT: %s %s", event, id);
 	snprintf(idstr, sizeof(idstr), "ID=%s", id);
diff --git a/src/vzlist.c b/src/vzlist.c
index 22cecd1..581e0dc 100644
--- a/src/vzlist.c
+++ b/src/vzlist.c
@@ -173,7 +173,7 @@ static void print_str(const char *str, const char *fmt)
 
 static void print_eid(struct Cveinfo *p, int index)
 {
-	print_str(p->ctid, "%36s");
+	print_str(p->ctid, "%30s");
 }
 
 static void print_uuid(struct Cveinfo *p, int index)
@@ -853,11 +853,12 @@ static int ioprio_sort_fn(const void *val1, const void *val2)
 static struct Cfield field_names[] =
 {
 /* veid should have index 0 */
-{"ctid" , "CTID", "%36s",  0, RES_NONE, print_eid, eid_sort_fn},
+{"ctid" , "CTID", "%30s",  0, RES_NONE, print_eid, eid_sort_fn},
 {"private", "PRIVATE", "%-32s", 0, RES_NONE, print_ve_private, none_sort_fn},
 {"root", "ROOT", "%-36s", 0, RES_NONE, print_ve_root, none_sort_fn},
 /* veid is for backward compatibility  */
-{"veid" , "CTID", "%36s",  0, RES_NONE, print_eid, eid_sort_fn},
+{"veid" , "CTID", "%30s",  0, RES_NONE, print_eid, eid_sort_fn},
+{"vpsid" , "CTID", "%30s",  0, RES_NONE, print_eid, eid_sort_fn},
 {"uuid" , "UUID", "%36s",  0, RES_NONE, print_uuid, eid_sort_fn},
 {"hostname", "HOSTNAME", "%-32s", 0, RES_HOSTNAME, print_hostname, hostnm_sort_fn},
 {"name", "NAME", "%-32s", 0, RES_NAME, print_name, name_sort_fn},
@@ -2120,7 +2121,7 @@ static char *get_real_ips(ctid_t ctid)
 {
 	struct vzctl_env_handle *h;
 	struct vzctl_net_info *info = NULL;
-	char *s;
+	char *s = NULL;
 	int err;
 
 	h = vzctl2_env_open(ctid, VZCTL_CONF_SKIP_PARSE, &err);
diff --git a/src/vzsplit.c b/src/vzsplit.c
index eec24f7..194037f 100644
--- a/src/vzsplit.c
+++ b/src/vzsplit.c
@@ -45,7 +45,6 @@
 
 #define PROCMEM		"/proc/meminfo"
 #define PROCTHREADS	"/proc/sys/kernel/threads-max"
-#define OUTPATH		"/etc/sysconfig/vz-scripts/"
 #define PROCCPU		"/proc/cpuinfo"
 
 #define MAX_SL		3
@@ -174,7 +173,7 @@ float	k_dcache[MAX_SL]	= {1.5 * 384, 1.2 * 384, 1 * 384};
 float	k_privvm[MAX_SL]	= {6, 3, 1.5};
 int	k_pglock[MAX_SL]	= {10, 3, 1};
 int	k_msl[MAX_SL]		= {10485760, 2097152, 0};
-char *partition = "/vz";
+char *partition = "/var/lib/vz";
 
 char *level_string[MAX_SL+1] = {
 "Free resource distribution. Any parameters may be increased",
@@ -595,7 +594,7 @@ int main(int argc, char **argv)
 
 		if (ds_total / 2 < HOST_DS) {
 			fprintf(stderr, "WARNING: Recommended minimal size"
-					"of /vz partition is 20Gb!\n");
+					"of /var/lib/vz partition is 20Gb!\n");
 			ds_total /= 2;
 		} else
 			ds_total -= HOST_DS;
@@ -619,7 +618,7 @@ int main(int argc, char **argv)
 				ve_allowed = ve_di;
 		}
 		if (retval == 1) {
-			fprintf(stderr, "WARNING: /vz partition do not have space "
+			fprintf(stderr, "WARNING: /var/lib/vz partition do not have space "
 					"required for %d Containers\n"
 					"The maximum allowed value is %d\n",
 					num_ve, ve_allowed);
diff --git a/vzctl.spec b/vzctl.spec
new file mode 100644
index 0000000..d8aa2c1
--- /dev/null
+++ b/vzctl.spec
@@ -0,0 +1,258 @@
+
+Name: vzctl
+Version: 7.0.254
+Release: alt2
+
+Summary: OpenVZ Virtual Environments control utility
+License: GPLv2
+Group: System/Configuration/Other
+Url: http://openvz.org/
+Vcs: https://src.openvz.org/scm/ovzl/vzctl.git
+
+Packager: Andrew A. Vasilyev <andy@altlinux.org>
+
+Source: %name-%version.tar
+Patch: %name-%version.patch
+
+ExclusiveArch: x86_64
+
+# these reqs are for vz helper scripts
+Requires: ploop >= 7.0.199
+Requires: network-config-subsystem
+Requires: libvzctl >= 7.0.714
+
+BuildRequires(pre): rpm-build-python3
+BuildRequires: glibc-devel libuuid-devel
+BuildRequires: libudev-devel
+# BuildRequires: systemd-devel libudev-devel
+BuildRequires: libvzctl-devel >= 7.0.639
+BuildRequires: libploop-devel >= 7.0.199
+BuildRequires: kernel-headers-ovz-el7 >= 3.10.0
+
+%define _libexecdir /usr/libexec
+%define vzdir /etc/vz
+%define confdir %vzdir/conf
+%define namesdir %vzdir/names
+%define lockdir /var/lib/vz/lock
+%define vzctl_lockdir /var/lock/vzctl
+%define spooldir /var/lib/vz
+%define netdir /etc/sysconfig/network-scripts
+%define bashcompldir /etc/bash_completion.d
+
+%description
+OpenVZ is an Operating System-level server virtualization solution, built
+on Linux.  OpenVZ creates isolated, secure virtual private servers on a
+single physical server enabling better server utilization and ensuring
+that applications do not conflict.  Each VE performs and executes exactly
+like a stand-alone server; VEs can be rebooted independently and have
+root access, users, IP addresses, memory, processes, files, applications,
+system libraries and configuration files.
+
+This package contain the control tool to manipulate
+OpenVZ Virtual Environments.
+
+%prep
+%setup
+%patch -p1
+
+%build
+%make CFLAGS="%optflags -D_GNU_SOURCE -DVERSION=\\\"%version\\\""
+
+%install
+make install \
+	DESTDIR=%buildroot \
+	SBINDIR=%_sbindir \
+	MANDIR=%_mandir \
+	SYSTEMDDIR=%_unitdir \
+	NETSCRIPTDIR=%netdir \
+	VZDIR=%vzdir \
+	CONFDIR=%confdir \
+	VZLOCKDIR=%lockdir \
+	VZCTLLOCKDIR=%vzctl_lockdir \
+	VZSPOOLDIR=%spooldir \
+	BASHCOMPLDIR=%bashcompldir \
+	LOGRDIR=%_logrotatedir \
+	MODULESLOADDDIR=/lib/modules-load.d
+
+ln -s -r %buildroot%_unitdir/vzevent.service %buildroot%_unitdir/vzeventd.service
+
+%post
+%post_service vzeventd
+
+# Load sysctls
+sysctl -p /etc/sysctl.d/99-vzctl.conf > /dev/null 2>&1
+
+# First installation, not upgrade.
+#if [ $1 -eq 1 ]; then
+#	# Insert iptables rules.
+#	%_libexecdir/vz-iptables-config.py add > /dev/null 2>&1
+#fi
+exit 0
+
+%preun
+%preun_service vz
+%preun_service vzeventd
+%preun_service vz-k8s-inside-ct
+# Last deinstallation, not upgrade.
+#if [ $1 -eq 0 ]; then
+#	# Remove iptables rules.
+#	%_libexecdir/vz-iptables-config.py remove > /dev/null 2>&1
+#fi
+
+%files
+%dir %vzdir
+%dir %confdir
+%dir %namesdir
+%dir %vzdir/dev
+%vzdir/vzevent.d
+%attr(700,root,root) %lockdir
+%spooldir
+%bashcompldir/*
+%_target_libdir_noarch/dracut/modules.d/*
+%_sbindir/*
+%_unitdir/*.service
+#%%_initdir/*
+%_libexecdir/vz
+%_libexecdir/vz-k8s-inside-ct
+%config(noreplace) %_logrotatedir/vzctl
+%confdir/*sample
+%_man8dir/*
+%_man5dir/*
+
+%config(noreplace) %confdir/networks_classes
+%config(noreplace) %vzdir/vz.conf
+%config(noreplace) %_sysconfdir/modprobe.d/*.conf
+%config %_sysconfdir/sysctl.d/*.conf
+%config /lib/modules-load.d/*.conf
+
+%changelog
+* Fri Jan 27 2023 Andrew A. Vasilyev <andy@altlinux.org> 7.0.254-alt2
+- change modules-load.d directory path to /lib
+
+* Tue Jun 28 2022 Andrew A. Vasilyev <andy@altlinux.org> 7.0.254-alt1
+- 7.0.254
+
+* Thu May 12 2022 Andrew A. Vasilyev <andy@altlinux.org> 7.0.252-alt1
+- 7.0.252
+
+* Tue Apr 12 2022 Andrew A. Vasilyev <andy@altlinux.org> 7.0.251-alt1
+- 7.0.251
+
+* Sat Nov 13 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.249-alt1
+- 7.0.249
+
+* Thu Jul 08 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.248-alt1
+- 7.0.248
+
+* Wed Jun 09 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.245-alt1
+- 7.0.245
+
+* Thu Apr 22 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.242-alt1
+- 7.0.241
+- vzlist: reduce the width of CTID field
+
+* Sun Jan 31 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.241-alt1
+- 7.0.241
+
+* Tue Jan 26 2021 Andrew A. Vasilyev <andy@altlinux.org> 7.0.240-alt1
+- 7.0.240
+
+* Tue Dec 08 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.236-alt2
+- add binfmt_misc kernel module for criu functioning
+- fix -fno-common default in GCC 10.0
+- fix warning: 's' may be used uninitialized in this function
+
+* Thu Nov 19 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.236-alt1
+- 7.0.236
+
+* Fri Oct 02 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.234-alt1
+- 7.0.234
+
+* Fri Sep 18 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.233-alt1
+- 7.0.233
+
+* Wed Sep 09 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.232-alt2
+- add vzubc utility from vzctl 4.11.1
+
+* Fri Sep 04 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.232-alt1
+- 7.0.232
+
+* Fri Aug 28 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.230-alt1
+- 7.0.230
+
+* Tue Jul 21 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.229-alt1
+- 7.0.229
+
+* Wed Jul 08 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.228-alt1
+- 7.0.228 with "k8s inside a CT" feature enabled
+
+* Wed May 27 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.227-alt1
+- 7.0.227
+
+* Sat Apr 25 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.226-alt1
+- 7.0.226
+- fix vz.service terminates during system boot with modern systemd
+
+* Mon Apr 20 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.222-alt1
+- 7.0.222
+
+* Tue Mar 24 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.220-alt1
+- 7.0.220
+
+* Thu Mar 19 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.219-alt1
+- 7.0.219
+
+* Wed Mar 11 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.218-alt1
+- 7.0.218
+
+* Wed Mar 04 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.217-alt1
+- 7.0.217
+
+* Wed Feb 19 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.216-alt1
+- 7.0.216
+
+* Wed Jan 22 2020 Andrew A. Vasilyev <andy@altlinux.org> 7.0.215-alt1
+- 7.0.215
+
+* Thu Dec 19 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.209-alt5
+- vzgetpa: /bin/bash as in all other OVZ scripts
+
+* Mon Dec 16 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.209-alt4
+- compatibility with libvirt
+
+* Thu Dec 05 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.209-alt3
+- fix License
+
+* Mon Nov 11 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.209-alt2
+- change /var/run to /run
+
+* Mon Oct 07 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.209-alt1
+- Update to 7.0.209
+
+* Wed Sep 25 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.208-alt1
+- Update to 7.0.208
+
+* Tue Aug 27 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.207-alt5
+- spec cleanup
+
+* Tue Aug 27 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.207-alt4
+- network and service changes for ALT
+
+* Mon Aug 26 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.207-alt3
+- change prlctl to vzlist/vzctl
+
+* Thu Aug 22 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.207-alt2
+- drop sysv rc scripts
+
+* Mon Aug 19 2019 Andrew A. Vasilyev <andy@altlinux.org> 7.0.207-alt1
+- Update to 7.0.207
+
+* Sun Nov 04 2018 Alexey Shabalin <shaba@altlinux.org> 7.0.191-alt1
+- Update to 7.0.191
+
+* Mon Feb 12 2018 Alexey Shabalin <shaba@altlinux.ru> 7.0.182-alt1
+- Initial build vzctl-7.0.182 for VZ-7
+
+* Tue Aug 25 2015 Terechkov Evgenii <evg@altlinux.org> 4.9.4-alt1
+- Updated to vzctl-4.9.4
+
diff --git a/vzdiskcheck b/vzdiskcheck
index d40a7d9..6d47eb0 100755
--- a/vzdiskcheck
+++ b/vzdiskcheck
@@ -24,7 +24,7 @@
 # Usage: vzdiskcheck [-v]
 # See also vzdiskcheck(8) man page
 
-VZROOT="/vz"
+VZROOT="/var/lib/vz"
 VERBOSE=0
 XML=0
 function usage()
diff --git a/vzgetpa b/vzgetpa
index 1a8449b..8c3faa8 100755
--- a/vzgetpa
+++ b/vzgetpa
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 #  Copyright (c) 1999-2017, Parallels International GmbH. All rights reserved.
 # Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved.
diff --git a/vzpurge b/vzpurge
index 57225f6..8be47e5 100755
--- a/vzpurge
+++ b/vzpurge
@@ -36,12 +36,12 @@ VZCTL='/usr/sbin/vzctl'
 
 # Read global configuration
 VEID="@veid@"
-. /etc/sysconfig/vz
-CONFIG_DIR=/etc/sysconfig/vz-scripts
+. /etc/vz/vz.conf
+CONFIG_DIR=/etc/vz/conf/
 
 # Check if we got correct VE_PRIVATE
 if echo $VE_PRIVATE | grep -v "@veid@" >/dev/null 2>&1; then
-	echo "ERROR: Can't find correct VE_PRIVATE in /etc/sysconfig/vz"
+	echo "ERROR: Can't find correct VE_PRIVATE in /etc/vz/vz.conf"
 	exit 1
 fi
 
diff --git a/vzubc b/vzubc
new file mode 100755
index 0000000..5b3e8d2
--- /dev/null
+++ b/vzubc
@@ -0,0 +1,384 @@
+#!/bin/sh
+# vzubc - a tool for displaying OpenVZ user beancounters.
+# Copyright (C) 2011-2013, Parallels, Inc. All rights reserved.
+# Licensed under GNU GPL v2 or later version.
+
+umask 0077
+
+# Ratio of held/limit to bypass quiet
+Q_HELD=0.5
+# Ratio of maxheld/limit to bypass quiet
+Q_MAXHELD=0.8
+# Directory to store previous failcnt values for relative mode
+STOREDIR=/tmp/vzubc.store
+# Colors
+C_BRIGHT="\\033[1;32m"
+C_ERROR="\\033[1;31m"
+C_WARNING="\\033[1;33m"
+C_NORMAL="\\033[0;39m"
+
+usage() {
+	cat << EOF
+Usage: vzubc [option ...] [<ctid> ...]
+
+ -w, --watch:
+     Run itself under watch(1) (a la top mode, Ctrl-C to exit).
+     -wd: show differences between runs
+     -wt: do not show watch title
+     -wn <time>: refresh every <time> seconds
+ -q, --quiet:
+     Quiet mode (only show beancounters with fails and close to limits).
+     -qh <ratio>: quiet threshold for held/limit ratio (default: $Q_HELD)
+     -qm <ratio>: quiet threshold for maxheld/limit ratio (default: $Q_MAXHELD)
+ -v, --verbose:
+     Verbose mode (show unlimited beancounters as well).
+ -r, --relative:
+     Relative mode, show fail counters delta compared to previous run.
+     -rc: clear all saved fail counter data for relative mode
+     -rd <dir>: directory for storing data (default: $STOREDIR)
+ -i, --incremental:
+     Incremental mode, add held value delta compared to previous run.
+     If used together with -q, beancounters with changed values are also shown.
+     -ic: clear all saved held data for incremental mode
+     -id <dir>: synonym for -rd
+ -c, --color:
+     Enable color highlighting (using same thresholds as for --quiet).
+     Color mode is not compatible with --watch.
+ -f, --file <file>:
+     File to read UBC values from. Defaults are /proc/bc/resources or
+     /proc/user_beancounters. Use - to read from stdin.
+
+ <ctid>: container name/ID to show info about (can be used multiple times)
+EOF
+	exit $1
+}
+
+CTIDS=""
+FILE=""
+ARGV=$*
+
+chk_zeroarg() {
+	if test -z "$2"; then
+		echo "Error: option $1 requires an argument" 1>&2
+		usage 1
+	fi
+}
+
+while test $# -gt 0; do
+	case $1 in
+	-W)	# Internal use only
+		watch=
+		;;
+	-w|--watch)
+		watch=yes
+		;;
+	-wd)
+		watch=yes
+		WATCH_ARGS="$WATCH_ARGS -d"
+		;;
+	-wt)
+		watch=yes
+		WATCH_ARGS="$WATCH_ARGS -t"
+		;;
+	-wn)
+		chk_zeroarg $1 $2
+		watch=yes
+		WATCH_ARGS="$WATCH_ARGS -n $2"
+		shift
+		;;
+	-q|--quiet)
+		quiet=1
+		;;
+	-qh)
+		chk_zeroarg $1 $2
+		thr=1
+		Q_HELD=$2
+		shift
+		;;
+	-qm)
+		chk_zeroarg $1 $2
+		thr=1
+		Q_MAXHELD=$2
+		shift
+		;;
+	-v|--verbose)
+		verbose=1
+		;;
+	-r|--relative)
+		relative=1
+		;;
+	-rc)
+		rm -f $STOREDIR/ubc.*.failcnt
+		;;
+	-rd|-id)
+		chk_zeroarg $1 $2
+		STOREDIR=$2
+		shift
+		;;
+	-i|--incremental)
+		incremental=1
+		;;
+	-ic)
+		rm -f $STOREDIR/ubc.*.held
+		;;
+	-c|--color)
+		color=1
+		AWK_COLORS="-v c_h=$C_BRIGHT -v c_n=$C_NORMAL -v c_w=$C_WARNING -v c_e=$C_ERROR"
+		;;
+	-h|--help)
+		usage 0
+		;;
+	-f|--file)
+		chk_zeroarg $1 $2
+		FILE=$2
+		shift
+		;;
+	-*)
+		echo "Unrecognized option: $1" 1>&2
+		usage 1
+		;;
+	*)
+		# Try to convert CT name to ID
+		ID=$(/usr/sbin/vzlist -H -o ctid "$1" 2>/dev/null)
+		if test $? -eq 0; then
+			CTIDS=$(echo $CTIDS $ID)
+		else
+			CTIDS=$(echo $CTIDS $1)
+		fi
+		;;
+	esac
+	shift
+done
+
+# Sanity checks
+if test -n "$watch" -a -n "$color"; then
+	echo "Error: can't use --watch and --color together" 1>&2
+	usage 1
+fi
+
+if test -n "$thr" -a -z "$color" -a -z "$quiet"; then
+	echo "Error: -qh and -qm only make sense with --quiet or --color" 1>&2
+	usage 1
+fi
+
+if test -n "$quiet" -a -n "$verbose"; then
+	echo "Error: options --quiet and --verbose can't be used together" 1>&2
+	usage 1
+fi
+
+if test -z "$FILE"; then
+	# No file name given, substitute sane default
+	FILE=/proc/bc/resources
+	test -f $FILE || FILE=/proc/user_beancounters
+fi
+
+# Test that input file is readable
+if test "$FILE" != "-"; then
+	cat < "$FILE" > /dev/null || exit 1
+fi
+
+# Relative/incremental mode preparations and sanity checks
+if test -n "$relative" -o -n "$incremental"; then
+	# Create dir if needed
+	if ! test -d $STOREDIR; then
+		mkdir $STOREDIR || exit 1
+	fi
+	# Check we can write to it
+	touch $STOREDIR/ubc.test || exit 1
+	rm -f $STOREDIR/ubc.test || exit 1
+fi
+
+# Re-exec ourselves under watch
+test -z "$watch" || exec watch $WATCH_ARGS -- $0 $ARGV -W
+
+cat $FILE | LANG=C awk -v CTIDS=" ${CTIDS} " \
+	-v quiet="$quiet" -v verbose="$verbose" \
+	-v qheld="$Q_HELD" -v qmaxheld="$Q_MAXHELD" \
+	-v rel="$relative" -v storedir="$STOREDIR" \
+	-v inc="$incremental" $AWK_COLORS \
+'
+function hr(res, v) {
+	if ((v == 9223372036854775807) || (v == 2147483647) || (v == 0))
+		return "- ";
+	i=1
+	if ((res ~ /pages$/) && (v != 0)) {
+		v = v*4; i++
+	}
+	while (v >= 1024) {
+		v=v/1024
+		i++
+	}
+	fmt="%d%c"
+	if (v < 100)
+		fmt="%.3g%c"
+	return sprintf(fmt, v, substr(" KMGTPEZY", i, 1))
+}
+
+function dp(p, d) {
+	if ((d == 0) || (d == 9223372036854775807) || (d == 2147483647))
+		return "- "
+	r = sprintf("%.1f", p / d * 100);
+	fmt="%d"
+	if (r < 10)
+		fmt="%.1g"
+	r = sprintf(fmt, r)
+	if (r == 0)
+		return "- "
+	return r "%"
+}
+
+function unlim(barrier, limit) {
+	if ((barrier == 9223372036854775807) || (barrier == 2147483647))
+		return 1;
+
+	return 0;
+}
+
+function important(id, held, maxheld, barrier, limit, failcnt) {
+	if (failcnt > 0)
+		return 2;
+	if (barrier == 0)
+		barrier = limit;
+	if (held > barrier)
+		return 2;
+	if (held > barrier * qheld)
+		return 1;
+	if (maxheld > barrier * qmaxheld)
+		return 1;
+	return 0;
+}
+
+function prepare_header() {
+	header=sprintf( c_h \
+"--------------------------------------------------------------------%s\n" \
+"CT %-10s| HELD%s  Bar%%  Lim%%| MAXH  Bar%%  Lim%%| BAR | LIM |%cFAIL\n" \
+"-------------+-%s----------------+-----------------+-----+-----+------" \
+c_n, inc ? "-------" : "",
+bcid, inc ? "  +/-  " : "", rel ? "+" : " ", inc ? "-------" : "")
+}
+
+BEGIN {
+	if (qheld > 1)
+		qheld /= 100
+	if (qmaxheld > 1)
+		qmaxheld /= 100
+	if (qheld > qmaxheld)
+		qheld=qmaxheld
+	prepare_header()
+	bcid=-1
+}
+/^Version: / {
+	if ($2 != "2.5") {
+		print "Error: unknown version:",
+			$2 > "/dev/stderr"
+		exit 1
+	}
+	next
+}
+/^[	 ]*uid / {
+	next
+}
+/^[	 ]*dummy/ {
+	id=""
+	next
+}
+/^[	 ]*[0-9]+:/ {
+	header=""
+	bcid=int($1)
+	if ((CTIDS !~ /^[ ]*$/) && (CTIDS !~ " " bcid " ")) {
+		skip=1
+		next
+	}
+	skip=0
+
+	prepare_header()
+
+	id=$2
+	held=$3
+	maxheld=$4
+	barrier=$5
+	limit=$6
+	failcnt=$7
+}
+/^[	 ]*[a-z]+/ {
+	id=$1
+	held=$2
+	maxheld=$3
+	barrier=$4
+	limit=$5
+	failcnt=$6
+}
+((id!="") && (!skip)) {
+	if ((bcid < 0) && (rel || inc)) {
+		print "Error: can not use relative/incremental" \
+			" modes: BCID is unknown" > "/dev/stderr"
+		exit 1
+	}
+	newfc=failcnt
+	store=storedir "/ubc." bcid "." id
+	if ( (rel) && (failcnt > 0) ) {
+		f_file=store ".failcnt"
+		getline oldfc < f_file
+		if (oldfc > 0)
+			failcnt=failcnt-oldfc
+		if (failcnt < 0)
+			failcnt=newfc
+	}
+	save_held=0
+	dh=0
+	if (inc) {
+		d_held="       "
+		h_file=store ".held"
+		save_held=1
+		getline o_held < h_file
+		if (o_held >= 0) {
+			dh=held - o_held
+			sig="+"
+			if (dh < 0) {
+				dh=-dh; sig="-"
+			}
+			if (dh != 0)
+				d_held = sprintf("%7s", sig hr(id, dh))
+			else
+				save_held=0
+		}
+	}
+	imp=important(id, held, maxheld, barrier, limit, failcnt)
+	unl=unlim(barrier, limit)
+	if ((((quiet) && (!imp)) || ((!verbose) && (unl))) && (dh==0)) {
+		id=""
+		next
+	}
+	if (header != "") {
+		if (printed)
+			print ""
+		print header
+		printed=1
+		header=""
+	}
+	if (imp == 2)
+		printf c_e;
+	else if (imp == 1)
+		printf c_w;
+	else
+		printf c_n;
+	printf "%13s|%5s%s %5s %5s|%5s %5s %5s|%5s|%5s| %5s\n" c_n,
+		id,
+		hr(id, held), d_held, dp(held, barrier), dp(held, limit),
+		hr(id, maxheld), dp(maxheld, barrier), dp(maxheld, limit),
+		hr(id, barrier), hr(id, limit), hr("", failcnt)
+	if ( (rel) && (newfc > 0) ) {
+		print newfc > f_file
+		close(f_file)
+	}
+	if (save_held) {
+		print held > h_file
+		close(h_file)
+	}
+	id=""
+}
+END {
+	if (printed)
+		printf "--------------------------------------------------------------------%s\n", inc ? "-------" : ""
+}
+'
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin