[pve-devel] r6549 - in vzctl/trunk: . debian debian/patches
svn-commits at proxmox.com
svn-commits at proxmox.com
Tue Sep 20 07:40:55 CEST 2011
Author: dietmar
Date: 2011-09-20 07:40:55 +0200 (Tue, 20 Sep 2011)
New Revision: 6549
Added:
vzctl/trunk/debian/patches/0001-add-init-logger-support-to-vzctl.patch
vzctl/trunk/debian/patches/0002-add-the-init-logger-binary.patch
vzctl/trunk/debian/patches/0003-add-initlog-feature-to-manual-page.patch
vzctl/trunk/debian/patches/0004-add-INITLOG-option-to-vz.conf.patch
Modified:
vzctl/trunk/Makefile
vzctl/trunk/debian/changelog
vzctl/trunk/debian/patches/series
Log:
update to 3.0.29.1
Modified: vzctl/trunk/Makefile
===================================================================
--- vzctl/trunk/Makefile 2011-09-19 06:33:21 UTC (rev 6548)
+++ vzctl/trunk/Makefile 2011-09-20 05:40:55 UTC (rev 6549)
@@ -1,24 +1,14 @@
-RELEASE=1.8
+RELEASE=1.9
-SVER=3.0.28
-PACKAGERELEASE=1pve5
+SVER=3.0.29
+PACKAGERELEASE=1pve1
ARCH=amd64
PACKAGE=vzctl
DEB=${PACKAGE}_${SVER}-${PACKAGERELEASE}_${ARCH}.deb
-#VZCTL_BRANCH=vzctl-3.0.28.3
+VZCTL_BRANCH=vzctl-3.0.29.1
-# last good before openvz bug 1971
-#VZCTL_BRANCH=2f6732431912069d5abf6b30024eadda5af54e2c
-
-# last good before bash syntax problems
-#VZCTL_BRANCH=6fd51be9ddb44fd92ebe08c747b374151d69ca26
-
-# Mon, 5 Sep 2011 13:57:57
-VZCTL_BRANCH=6fd6b71bf1e0c76783696db5a3fbb88066274caf
-
-
all: ${DEB}
vzctl-${SVER}.org/COPYING:
Modified: vzctl/trunk/debian/changelog
===================================================================
--- vzctl/trunk/debian/changelog 2011-09-19 06:33:21 UTC (rev 6548)
+++ vzctl/trunk/debian/changelog 2011-09-20 05:40:55 UTC (rev 6549)
@@ -1,3 +1,9 @@
+vzctl (3.0.29-1pve1) unstable; urgency=low
+
+ * update to 3.0.29.1
+
+ -- Proxmox Support Team <support at proxmox.com> Tue, 20 Sep 2011 07:37:35 +0200
+
vzctl (3.0.28-1pve5) unstable; urgency=low
* update to latest upstream
Added: vzctl/trunk/debian/patches/0001-add-init-logger-support-to-vzctl.patch
===================================================================
--- vzctl/trunk/debian/patches/0001-add-init-logger-support-to-vzctl.patch (rev 0)
+++ vzctl/trunk/debian/patches/0001-add-init-logger-support-to-vzctl.patch 2011-09-20 05:40:55 UTC (rev 6549)
@@ -0,0 +1,203 @@
+From 7ff0640bb18951b3b484aa524837a859b91f2bb4 Mon Sep 17 00:00:00 2001
+From: Dietmar Maurer <dietmar at proxmox.com>
+Date: Tue, 20 Sep 2011 06:20:57 +0200
+Subject: [PATCH 1/4] add init logger support to vzctl
+
+
+Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
+---
+ include/res.h | 1 +
+ include/vzctl_param.h | 1 +
+ src/lib/config.c | 10 ++++++
+ src/lib/env.c | 80 +++++++++++++++++++++++++++++++++++++++++++++----
+ 4 files changed, 86 insertions(+), 6 deletions(-)
+
+diff --git a/include/res.h b/include/res.h
+index 2ad3d5b..e70be48 100644
+--- a/include/res.h
++++ b/include/res.h
+@@ -57,6 +57,7 @@ typedef struct {
+ int onboot;
+ unsigned long *bootorder;
+ int wait;
++ int initlog;
+ } misc_param;
+
+ struct mod_action;
+diff --git a/include/vzctl_param.h b/include/vzctl_param.h
+index ff520da..9245b6a 100644
+--- a/include/vzctl_param.h
++++ b/include/vzctl_param.h
+@@ -136,6 +136,7 @@
+ #define PARAM_BOOTORDER 364
+ #define PARAM_PCI_ADD 365
+ #define PARAM_PCI_DEL 366
++#define PARAM_INITLOG 367
+
+ #define PARAM_LINE "e:p:f:t:i:l:k:a:b:n:x:h"
+ #endif
+diff --git a/src/lib/config.c b/src/lib/config.c
+index baef108..bcbfbd5 100644
+--- a/src/lib/config.c
++++ b/src/lib/config.c
+@@ -62,6 +62,7 @@ static vps_config config[] = {
+ {"LOG_LEVEL", NULL, PARAM_LOGLEVEL},
+ {"LOGFILE", NULL, PARAM_LOGFILE},
+ {"VERBOSE", NULL, PARAM_VERBOSE},
++{"INITLOG", NULL, PARAM_INITLOG},
+
+ {"IPTABLES", NULL, PARAM_IPTABLES},
+ /* UB */
+@@ -121,6 +122,8 @@ static vps_config config[] = {
+ {"CPULIMIT", NULL, PARAM_CPULIMIT},
+ {"CPUS", NULL, PARAM_VCPUS},
+ {"CPUMASK", NULL, PARAM_CPUMASK},
++/* misc param */
++{"INITLOG", NULL, PARAM_INITLOG},
+ /* create param */
+ {"ONBOOT", NULL, PARAM_ONBOOT},
+ {"CONFIGFILE", NULL, PARAM_CONFIG},
+@@ -1273,6 +1276,9 @@ static int store_misc(vps_param *old_p, vps_param *vps_p, vps_config *conf,
+
+ ret = 0;
+ switch (conf->id) {
++ case PARAM_INITLOG:
++ ret = conf_store_yesno(conf_h, conf->name, misc->initlog);
++ break;
+ case PARAM_ONBOOT:
+ ret = conf_store_yesno(conf_h, conf->name, misc->onboot);
+ break;
+@@ -1887,6 +1893,9 @@ static int parse(envid_t veid, vps_param *vps_p, char *val, int id)
+ case PARAM_LOGGING:
+ ret = conf_parse_yesno(&vps_p->log.enable, val);
+ break;
++ case PARAM_INITLOG:
++ ret = conf_parse_yesno(&vps_p->res.misc.initlog, val);
++ break;
+ case PARAM_LOGLEVEL:
+ if (parse_int(val, &int_id))
+ return ERR_INVAL;
+@@ -2710,6 +2719,7 @@ static void merge_misc(misc_param *dst, misc_param *src)
+ MERGE_INT(onboot)
+ MERGE_P(bootorder)
+ MERGE_INT(wait)
++ MERGE_INT(initlog)
+ }
+
+ static void merge_dq(dq_param *dst, dq_param *src)
+diff --git a/src/lib/env.c b/src/lib/env.c
+index 5e53657..135286f 100644
+--- a/src/lib/env.c
++++ b/src/lib/env.c
+@@ -23,6 +23,7 @@
+ #include <signal.h>
+ #include <fcntl.h>
+ #include <sys/types.h>
++#include <sys/stat.h>
+ #include <sys/wait.h>
+ #include <sys/stat.h>
+ #include <string.h>
+@@ -318,7 +319,7 @@ static int _env_create(vps_handler *h, envid_t veid, int wait_p, int err_p,
+ int fd, ret;
+ vps_res *res;
+ char *argv[] = {"init", "-z", " ", NULL};
+- char *envp[] = {"HOME=/", "TERM=linux", NULL};
++ char *envp[] = {"HOME=/", "TERM=linux", NULL, NULL};
+
+ res = (vps_res *) data;
+ memset(&create_param, 0, sizeof(create_param));
+@@ -425,12 +426,65 @@ try:
+ */
+ if (read(wait_p, &ret, sizeof(ret)) == 0)
+ return 0;
+- if ((fd = open("/dev/null", O_RDWR)) != -1) {
+- dup2(fd, 0);
+- dup2(fd, 1);
+- dup2(fd, 2);
+- }
++
+ logger(10, 0, "Starting init");
++
++ if (((fd = open("/dev/null", O_RDWR)) != -1) && (fd == STDIN_FILENO)) {
++
++ dup2(fd, 1); // STDOUT = /dev/null
++ dup2(fd, 2); // STDERR = /dev/null
++
++ if (res->misc.initlog == 1) {
++ int pid;
++
++ if (!((mkfifo ("/var/log/init.fifo", 0600) == 0) || (errno == EEXIST))) {
++ logger(-1, errno, "unable to create init fifo");
++ return 0;
++ }
++
++ // create new /dev/console ==> /var/log/init.fifo
++ unlink ("/dev/console");
++ symlink ("/var/log/init.fifo", "/dev/console");
++
++ pid = fork();
++
++ if (pid == -1) {
++ logger(-1, errno, "unable to fork init-logger");
++ return 0;
++ }
++
++ if (!pid) {
++
++ close(wait_p); close(err_p);
++
++ /* Note: open fifo RDWR to avoid EOF */
++ close(STDIN_FILENO);
++ open("/var/log/init.fifo", O_RDWR);
++
++ close(STDOUT_FILENO);
++ open("/var/log/init.log", O_CREAT|O_WRONLY|O_TRUNC);
++
++ close(STDERR_FILENO);
++ dup2(STDOUT_FILENO, STDERR_FILENO);
++
++ execl("/sbin/init-logger", NULL);
++ exit (-1);
++ }
++
++ close(STDOUT_FILENO);
++ if (open("/var/log/init.fifo", O_WRONLY) == -1) {
++ logger(-1, errno, "open init.fifo failed");
++ return 0;
++ }
++
++ close(STDERR_FILENO);
++ dup2(STDOUT_FILENO, STDERR_FILENO);
++
++ // tell init to use /var/log/init.fifo
++ envp[2] = "CONSOLE=/var/log/init.fifo";
++ }
++ }
++
+ execve("/sbin/init", argv, envp);
+ execve("/etc/init", argv, envp);
+ execve("/bin/init", argv, envp);
+@@ -446,6 +500,20 @@ static int vz_real_env_create(vps_handler *h, envid_t veid, vps_res *res,
+ {
+ int ret, pid;
+
++ char ildest[4096];
++
++ *ildest = 0;
++ strcat (ildest, res->fs.root);
++ strcat (ildest, "/sbin/init");
++
++ *ildest = 0;
++ strcat (ildest, res->fs.root);
++ strcat (ildest, "/sbin/init-logger");
++ if (cp_file (ildest, "/usr/lib/vzctl/scripts/init-logger") != 0) {
++ logger(-1, 0, "Unable to copy init-logger");
++ return VZ_RESOURCE_ERROR;
++ }
++
+ if ((ret = vz_chroot(res->fs.root)))
+ return ret;
+ if ((ret = vz_setluid(veid)))
+--
+1.5.6.5
+
Added: vzctl/trunk/debian/patches/0002-add-the-init-logger-binary.patch
===================================================================
--- vzctl/trunk/debian/patches/0002-add-the-init-logger-binary.patch (rev 0)
+++ vzctl/trunk/debian/patches/0002-add-the-init-logger-binary.patch 2011-09-20 05:40:55 UTC (rev 6549)
@@ -0,0 +1,202 @@
+From c713acbd14c32071057a65d4a02a18500fed43f3 Mon Sep 17 00:00:00 2001
+From: Dietmar Maurer <dietmar at proxmox.com>
+Date: Tue, 20 Sep 2011 06:26:18 +0200
+Subject: [PATCH 2/4] add the init-logger binary
+
+We use diet to create small binaries.
+
+Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
+---
+ scripts/Makefile.am | 4 +
+ scripts/init-logger.c | 163 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 167 insertions(+), 0 deletions(-)
+ create mode 100644 scripts/init-logger.c
+
+diff --git a/scripts/Makefile.am b/scripts/Makefile.am
+index 5b28c6e..3d25b6a 100644
+--- a/scripts/Makefile.am
++++ b/scripts/Makefile.am
+@@ -17,7 +17,11 @@
+
+ include $(top_srcdir)/pathsubst.am
+
++init-logger: init-logger.c
++ diet -Os gcc -static -s -o init-logger init-logger.c
++
+ vzlib_SCRIPTS = \
++ init-logger \
+ vps-create \
+ vps-functions \
+ vps-net_add \
+diff --git a/scripts/init-logger.c b/scripts/init-logger.c
+new file mode 100644
+index 0000000..1153b1b
+--- /dev/null
++++ b/scripts/init-logger.c
+@@ -0,0 +1,163 @@
++/*
++
++ Copyright (C) 2008 Proxmox Server Solutions GmbH
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; version 2 dated June, 1991.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software Foundation,
++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++ You should have received a copy of the GNU General Public License
++
++ Author: Dietmar Maurer <dietmar at proxmox.com>
++
++ Compile statically using dietlibc:
++ diet -Os gcc -static -s -o init-logger.ARCH init-logger.c
++*/
++
++#include <sys/types.h>
++#include <sys/wait.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <errno.h>
++#include <stdio.h>
++#include <signal.h>
++#include <sys/select.h>
++
++/* Set a signal handler */
++static void
++setsig(struct sigaction *sa, int sig,
++ void (*fun)(int), int flags)
++{
++ sa->sa_handler = fun;
++ sa->sa_flags = flags;
++ sigemptyset(&sa->sa_mask);
++ sigaction(sig, sa, NULL);
++}
++
++static int terminate = 0;
++
++void
++term_handler()
++{
++ terminate = 1;
++}
++
++ssize_t
++safe_read (int fd, char *buf, size_t count)
++{
++ ssize_t n;
++
++ do {
++ n = read (fd, buf, count);
++ } while (n < 0 && errno == EINTR);
++
++ return n;
++}
++
++ssize_t
++safe_write (int fd, char *buf, size_t count)
++{
++ ssize_t n;
++
++ do {
++ n = write (fd, buf, count);
++ } while (n < 0 && errno == EINTR);
++
++ return n;
++}
++
++int
++full_write(int fd, char *buf, size_t len)
++{
++ size_t n;
++ size_t total;
++
++ total = 0;
++
++ while (len > 0) {
++ n = safe_write(fd, buf, len);
++
++ if (n < 0)
++ break;
++
++ buf += n;
++ total += n;
++ len -= n;
++ }
++
++ return total;
++}
++
++static void
++simple_cat (void)
++{
++ int bufsize = 256;
++ char buf[bufsize];
++ size_t n_read;
++ int noop_count = 0;
++
++ fd_set rfds;
++ struct timeval tv;
++ int retval;
++
++ FD_ZERO(&rfds);
++ FD_SET(STDIN_FILENO, &rfds);
++
++ tv.tv_sec = 1;
++ tv.tv_usec = 0;
++
++ while ((retval = select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv)) >= 0 ||
++ (errno == EINTR)) {
++
++ tv.tv_sec = 1;
++ tv.tv_usec = 0;
++
++ FD_ZERO(&rfds);
++ FD_SET(STDIN_FILENO, &rfds);
++
++ if (retval == -1 && errno == EINTR)
++ continue;
++
++ if (retval) {
++ n_read = safe_read (STDIN_FILENO, buf, bufsize);
++ if (n_read == ((size_t) -1))
++ return;
++
++ noop_count = 0;
++
++ if (full_write (STDOUT_FILENO, buf, n_read) != n_read)
++ return;
++ } else {
++ if (terminate)
++ noop_count++;
++ }
++
++ if (noop_count >= 2)
++ return;
++ }
++}
++
++int
++main(int argc, char * argv[])
++{
++ struct sigaction sa;
++
++ setsig(&sa, SIGTERM, term_handler, SA_RESTART);
++ setsig(&sa, SIGINT, term_handler, SA_RESTART);
++
++ printf ("starting init logger\n");
++
++ simple_cat();
++
++ printf ("\ninit logger finished\n");
++
++ exit (0);
++}
+--
+1.5.6.5
+
Added: vzctl/trunk/debian/patches/0003-add-initlog-feature-to-manual-page.patch
===================================================================
--- vzctl/trunk/debian/patches/0003-add-initlog-feature-to-manual-page.patch (rev 0)
+++ vzctl/trunk/debian/patches/0003-add-initlog-feature-to-manual-page.patch 2011-09-20 05:40:55 UTC (rev 6549)
@@ -0,0 +1,30 @@
+From 2d81e37f1414a2b18ad668f7dd8a00c391c5d908 Mon Sep 17 00:00:00 2001
+From: Dietmar Maurer <dietmar at proxmox.com>
+Date: Tue, 20 Sep 2011 06:32:17 +0200
+Subject: [PATCH 3/4] add initlog feature to manual page
+
+
+Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
+---
+ man/ctid.conf.5 | 5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/man/ctid.conf.5 b/man/ctid.conf.5
+index d3ec3d0..ecda4ae 100644
+--- a/man/ctid.conf.5
++++ b/man/ctid.conf.5
+@@ -30,6 +30,11 @@ Specifies whether this container will be started during system boot.
+ Default is \fBno\fR, meaning the container will not be started
+ if \fBONBOOT\fR parameter is omitted.
+ Corresponds to the \fB--onboot\fR option.
++.IP \fBINITLOG\fR="\fByes\fR|\fBno\fR"
++If enabled init output is logged to /var/log/init.log. An additional process started
++inside the container (init-logger) reads the output from init and writes it
++to /var/log/init.log.
++Corresponds to the \fB--initlog\fR option.
+ .IP \fBBOOTORDER\fR="\fInumber\fR"
+ Specifies the CT boot order priority. Corresponds to the
+ \fB--bootorder\fR option.
+--
+1.5.6.5
+
Added: vzctl/trunk/debian/patches/0004-add-INITLOG-option-to-vz.conf.patch
===================================================================
--- vzctl/trunk/debian/patches/0004-add-INITLOG-option-to-vz.conf.patch (rev 0)
+++ vzctl/trunk/debian/patches/0004-add-INITLOG-option-to-vz.conf.patch 2011-09-20 05:40:55 UTC (rev 6549)
@@ -0,0 +1,28 @@
+From d84b559cdc367d976ce94bcbd6d30f4f918f6cda Mon Sep 17 00:00:00 2001
+From: Dietmar Maurer <dietmar at proxmox.com>
+Date: Tue, 20 Sep 2011 06:33:58 +0200
+Subject: [PATCH 4/4] add INITLOG option to vz.conf
+
+
+Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
+---
+ etc/vz.conf | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/etc/vz.conf b/etc/vz.conf
+index 63e509a..d2072e7 100644
+--- a/etc/vz.conf
++++ b/etc/vz.conf
+@@ -10,6 +10,9 @@ LOGFILE=/var/log/vzctl.log
+ LOG_LEVEL=0
+ VERBOSE=0
+
++## log output of init process to $VE_ROOT/var/log/init.log
++INITLOG=yes
++
+ ## Disk quota parameters
+ DISK_QUOTA=yes
+ VZFASTBOOT=no
+--
+1.5.6.5
+
Modified: vzctl/trunk/debian/patches/series
===================================================================
--- vzctl/trunk/debian/patches/series 2011-09-19 06:33:21 UTC (rev 6548)
+++ vzctl/trunk/debian/patches/series 2011-09-20 05:40:55 UTC (rev 6549)
@@ -1,4 +1,7 @@
-initlog.patch
+0001-add-init-logger-support-to-vzctl.patch
+0002-add-the-init-logger-binary.patch
+0003-add-initlog-feature-to-manual-page.patch
+0004-add-INITLOG-option-to-vz.conf.patch
fix-init-script.patch
fix-vzevent-init.patch
fix-default-template.diff
More information about the pve-devel
mailing list