Package: vzctl
Version: 3.0.22-5
Severity: wishlist
Tags: patch

Attached patch makes ve start script to mount ve and run
/etc/conf/<veid>-prestart.sh
if it exists. 

Example file /etc/conf/102-prestart.sh:

#!/bin/sh
if [ ! -d  /var/lib/vz/root/102/var/log ]; then
        echo "$0 error: VE base dir not yet mounted!"
        exit
fi
mount /dev/mapper/web-ve102log /var/lib/vz/root/102/var/log -onosuid,nodev
## EOF


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.18-028stab053-bl-ovz (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages vzctl depends on:
ii  iproute                     20080108-1   Professional tools to control the 
ii  libc6                       2.7-6        GNU C Library: Shared libraries
ii  vzquota                     3.0.11-1dso1 OpenVZ - server virtualization sol

Versions of packages vzctl recommends:
ii  rsync                         3.0.0-2    fast remote file copy program (lik

-- no debconf information
--- vz.orig     2008-03-02 17:07:51.000000000 +0100
+++ vz.grin     2008-04-11 15:48:56.804114963 +0200
@@ -358,6 +358,20 @@
        print_result "$msg"
 }
 
+prestart_ve()
+{
+       local veid
+       veid="$1"
+       # run prestart.sh for veid (like bind mounting into its root/
+       if [ -x "${CONFIG_DIR}/${veid}-prestart.sh" ]; then
+               __echo "Mounting VE${veid} and running prestart: "
+               msg=`$VZCTL mount ${veid} 2>&1`
+               print_result "$msg"
+               . ${CONFIG_DIR}/${veid}-prestart.sh
+       fi
+}
+
+
 start_ves()
 {
        local veid
@@ -384,6 +398,8 @@
                                fi
                        fi
                fi
+               # run prestart.sh for veid (like bind mounting into its root/)
+               prestart_ve ${veid}
                msg=`$VZCTL start ${veid} 2>&1`
                print_result "$msg"
        done
@@ -392,6 +408,7 @@
                $VZCTL stop ${veid} 2>&1 >/dev/null 2>&1
                print_result "$msg"
                __echo "Starting VE ${veid}: "
+               prestart_ve ${veid}
                msg=`$VZCTL start ${veid} 2>&1`
                print_result "$msg"
        done

Reply via email to