3 # Provides: invirt-xen-config
4 # Required-Start: $local_fs $remote_fs
5 # Required-Stop: $local_fs $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: Startup script for the Invirt Xen host
12 PACKAGE=invirt-xen-config
14 DESC="Invirt Xen host"
16 GEN_FILES=(/etc/xen/xend-config.sxp.invirt)
17 SYSVMS=(s_master s_remote s_console)
19 for vm in "${SYSVMS[@]}"; do
24 dpkg -s "$PACKAGE" >/dev/null 2>/dev/null || exit 0
26 . /lib/init/gen-files.sh
27 . /lib/init/std-init.sh
30 # Attempt to start a sysvm, but only if it's not running already
31 # somewhere on the cluster
34 DISK="/dev/xenvg/${VM}_hda"
36 # Don't bother trying to start the VM if it's already running
37 if xm list "$1" >/dev/null 2>&1; then
41 if lvchange -a n "$DISK" >/dev/null 2>&1 && lvchange -a ey "$DISK" >/dev/null 2>&1; then
42 # If we can lock on the VM's disk, then the VM isn't running
43 [ "$VERBOSE" != no ] && log_daemon_msg "Starting sysvm $VM"
44 xm create "sysvms/$VM" >/dev/null
45 [ "$VERBOSE" != no ] && log_end_msg $?
51 # Regardless of whether we could get the lock or not, the
52 # lvchange -a n probably disabled the LV somewhere; be sure we
54 lvchange -a y "$DISK" >/dev/null 2>&1
62 for vm in "${SYSVMS[@]}"; do
66 echo 1 >/proc/sys/net/ipv4/ip_forward
67 for i in all default; do
68 echo 1 >/proc/sys/net/ipv4/conf/$i/rp_filter
69 echo 1 >/proc/sys/net/ipv4/conf/$i/proxy_arp
72 invoke-rc.d "$PARENTPACKAGE" "$1"
84 invoke-rc.d "$PARENTPACKAGE" stop