You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2017/11/23 13:16:56 UTC
[cloudstack] 01/04: misc fixes changes
This is an automated email from the ASF dual-hosted git repository.
bhaisaab pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 383857faccd3c73aa5b5b5b81a9a1d6f790f4a5a
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Thu Nov 23 15:45:55 2017 +0530
misc fixes changes
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
.../debian/config/etc/init.d/cloud-early-config | 175 ++++++++++-----------
systemvm/patches/debian/config/etc/rc.local | 3 +-
systemvm/patches/debian/config/etc/sysctl.conf | 1 -
.../definitions/systemvmtemplate/cleanup.sh | 8 +
.../configure_systemvm_services.sh | 2 +
.../systemvmtemplate/install_systemvm_packages.sh | 2 +-
6 files changed, 97 insertions(+), 94 deletions(-)
diff --git a/systemvm/patches/debian/config/etc/init.d/cloud-early-config b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
index 8b0c814..e973e9e 100755
--- a/systemvm/patches/debian/config/etc/init.d/cloud-early-config
+++ b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
@@ -5,7 +5,7 @@
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
-# Short-Description: configure according to cmdline
+# Short-Description: configures systemvm using cmdline
### END INIT INFO
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -125,30 +125,30 @@ get_boot_params() {
log_it "${VPORT} not loaded, perhaps guest kernel is too old." && exit 2
fi
- local factor=2
- local progress=1
- for i in {1..5}
- do
- while read line; do
- if [[ $line == cmdline:* ]]; then
- cmd=${line//cmdline:/}
+ local factor=2
+ local progress=1
+ for i in {1..5}
+ do
+ while read line; do
+ if [[ $line == cmdline:* ]]; then
+ cmd=${line//cmdline:/}
echo $cmd > /var/cache/cloud/cmdline
- elif [[ $line == pubkey:* ]]; then
- pubkey=${line//pubkey:/}
- echo $pubkey > /var/cache/cloud/authorized_keys
- echo $pubkey > /root/.ssh/authorized_keys
+ elif [[ $line == pubkey:* ]]; then
+ pubkey=${line//pubkey:/}
+ echo $pubkey > /var/cache/cloud/authorized_keys
+ echo $pubkey > /root/.ssh/authorized_keys
fi
- done < $VPORT
- # In case of reboot we do not send the boot args again.
- # So, no need to wait for them, as the boot args are already set at startup
- if [ -s /var/cache/cloud/cmdline ]
- then
+ done < $VPORT
+ # In case of reboot we do not send the boot args again.
+ # So, no need to wait for them, as the boot args are already set at startup
+ if [ -s /var/cache/cloud/cmdline ]
+ then
log_it "Found a non empty cmdline file. Will now exit the loop and proceed with configuration."
break;
fi
sleep ${progress}s
progress=$[ progress * factor ]
- done
+ done
chmod go-rwx /root/.ssh/authorized_keys
;;
vmware)
@@ -577,12 +577,12 @@ setup_common() {
fi
if [ -n "$ETH0_IP6" ]
then
- setup_interface_ipv6 "0" $ETH0_IP6 $ETH0_IP6_PRELEN
+ setup_interface_ipv6 "0" $ETH0_IP6 $ETH0_IP6_PRELEN
fi
setup_interface "1" $ETH1_IP $ETH1_MASK $GW
if [ -n "$ETH2_IP" ]
then
- setup_interface "2" $ETH2_IP $ETH2_MASK $GW
+ setup_interface "2" $ETH2_IP $ETH2_MASK $GW
fi
echo $NAME > /etc/hostname
@@ -841,13 +841,6 @@ setup_apache2() {
clean_ipalias_config
setup_apache2_common
local ip=$1
-
- # Deprecated, functionality moved to Cs Python code
- # [ -f /etc/apache2/sites-available/default ] && sed -i -e "s/<VirtualHost.*>/<VirtualHost $ip:80>/" /etc/apache2/sites-available/default
- # [ -f /etc/apache2/sites-available/default-ssl ] && sed -i -e "s/<VirtualHost.*>/<VirtualHost $ip:443>/" /etc/apache2/sites-available/default-ssl
- # [ -f /etc/apache2/ports.conf ] && sed -i -e "s/Listen .*:80/Listen $ip:80/g" /etc/apache2/ports.conf
- # [ -f /etc/apache2/ports.conf ] && sed -i -e "s/Listen .*:443/Listen $ip:443/g" /etc/apache2/ports.conf
- # [ -f /etc/apache2/ports.conf ] && sed -i -e "s/NameVirtualHost .*:80/NameVirtualHost $ip:80/g" /etc/apache2/ports.conf
}
setup_aesni() {
@@ -885,7 +878,7 @@ setup_router() {
done
fi
else
- setup_common eth0 eth1
+ setup_common eth0 eth1
if [ -n "$EXTRA_PUBNICS" ]
then
for((i = 2; i < 2 + $EXTRA_PUBNICS; i++))
@@ -1090,19 +1083,19 @@ setup_dhcpsrvr() {
}
setup_storage_network() {
- if [ x"$STORAGE_IP" == "x" -o x"$STORAGE_NETMASK" == "x" ]
- then
- log_it "Incompleted parameters STORAGE_IP:$STORAGE_IP, STORAGE_NETMASK:$STORAGE_NETMASK, STORAGE_CIDR:$STORAGE_CIDR. Cannot setup storage network"
- return
- fi
-
- echo "" >> /etc/network/interfaces
- echo "auto eth3" >> /etc/network/interfaces
-
- setup_interface "3" "$STORAGE_IP" "$STORAGE_NETMASK"
+ if [ x"$STORAGE_IP" == "x" -o x"$STORAGE_NETMASK" == "x" ]
+ then
+ log_it "Incompleted parameters STORAGE_IP:$STORAGE_IP, STORAGE_NETMASK:$STORAGE_NETMASK, STORAGE_CIDR:$STORAGE_CIDR. Cannot setup storage network"
+ return
+ fi
+
+ echo "" >> /etc/network/interfaces
+ echo "auto eth3" >> /etc/network/interfaces
+
+ setup_interface "3" "$STORAGE_IP" "$STORAGE_NETMASK"
[ -n "$MTU" ] && ifconfig eth3 mtu $MTU && echo " mtu $MTU" >> /etc/network/interfaces
- #ip route add "$STORAGE_CIDR" via "$STORAGE_IP"
- log_it "Successfully setup storage network with STORAGE_IP:$STORAGE_IP, STORAGE_NETMASK:$STORAGE_NETMASK, STORAGE_CIDR:$STORAGE_CIDR"
+ #ip route add "$STORAGE_CIDR" via "$STORAGE_IP"
+ log_it "Successfully setup storage network with STORAGE_IP:$STORAGE_IP, STORAGE_NETMASK:$STORAGE_NETMASK, STORAGE_CIDR:$STORAGE_CIDR"
}
setup_system_rfc1918_internal() {
@@ -1277,10 +1270,10 @@ EOF
}
change_password() {
- if [ x"$VM_PASSWORD" != x"" ]
- then
- echo "root:$VM_PASSWORD" | chpasswd
- fi
+ if [ x"$VM_PASSWORD" != x"" ]
+ then
+ echo "root:$VM_PASSWORD" | chpasswd
+ fi
}
start() {
@@ -1301,50 +1294,52 @@ start() {
setup_router
if [ -x /opt/cloud/bin/update_config.py ]
then
- /opt/cloud/bin/update_config.py cmd_line.json
+ /opt/cloud/bin/update_config.py cmd_line.json
fi
- ;;
+ ;;
vpcrouter)
[ "$NAME" == "" ] && NAME=vpcrouter
setup_vpcrouter
if [ -x /opt/cloud/bin/update_config.py ]
then
- /opt/cloud/bin/update_config.py cmd_line.json
+ /opt/cloud/bin/update_config.py cmd_line.json
fi
- ;;
+ ;;
dhcpsrvr)
[ "$NAME" == "" ] && NAME=dhcpsrvr
setup_dhcpsrvr
if [ -x /opt/cloud/bin/update_config.py ]
then
- /opt/cloud/bin/update_config.py cmd_line.json
+ /opt/cloud/bin/update_config.py cmd_line.json
fi
- ;;
+ ;;
secstorage)
[ "$NAME" == "" ] && NAME=secstorage
setup_secstorage $hyp;
- ;;
+ ;;
consoleproxy)
[ "$NAME" == "" ] && NAME=consoleproxy
setup_console_proxy $hyp;
- ;;
+ ;;
elbvm)
[ "$NAME" == "" ] && NAME=elb
setup_elbvm
- ;;
+ ;;
ilbvm)
[ "$NAME" == "" ] && NAME=ilb
setup_ilbvm
- ;;
+ ;;
unknown)
[ "$NAME" == "" ] && NAME=systemvm
setup_default;
;;
esac
- if [ "$hyp" == "hyperv" ]; then
- # eject the systemvm.iso
+
+ if [ "$hyp" == "hyperv" ]; then
+ # eject the systemvm.iso
eject
fi
+
return 0
}
@@ -1446,25 +1441,25 @@ for i in $CMDLINE
;;
template)
TEMPLATE=$VALUE
- ;;
+ ;;
sshonguest)
SSHONGUEST=$VALUE
;;
name)
- NAME=$VALUE
- ;;
+ NAME=$VALUE
+ ;;
dhcprange)
DHCP_RANGE=$(echo $VALUE | tr ':' ',')
- ;;
+ ;;
bootproto)
BOOTPROTO=$VALUE
- ;;
+ ;;
type)
- TYPE=$VALUE
- ;;
+ TYPE=$VALUE
+ ;;
defaultroute)
- DEFAULTROUTE=$VALUE
- ;;
+ DEFAULTROUTE=$VALUE
+ ;;
redundant_router)
RROUTER=$VALUE
;;
@@ -1518,7 +1513,7 @@ done
echo -e "\n\t}\n}" >> ${CHEF_TMP_FILE}
if [ "$TYPE" != "unknown" ]
then
- mv ${CHEF_TMP_FILE} /var/cache/cloud/cmd_line.json
+ mv ${CHEF_TMP_FILE} /var/cache/cloud/cmd_line.json
fi
[ $ETH0_IP ] && LOCAL_ADDRS=$ETH0_IP
@@ -1529,37 +1524,37 @@ fi
case "$1" in
start)
- log_action_begin_msg "Executing cloud-early-config"
- log_it "Executing cloud-early-config"
- if start; then
- log_action_end_msg $?
- else
- log_action_end_msg $?
- fi
- ;;
+ log_action_begin_msg "Executing cloud-early-config"
+ log_it "Executing cloud-early-config"
+ if start; then
+ log_action_end_msg $?
+ else
+ log_action_end_msg $?
+ fi
+ ;;
stop)
- log_action_begin_msg "Stopping cloud-early-config"
- #Override old system's interface setting
- setup_default;
- log_action_end_msg 0
- ;;
+ log_action_begin_msg "Stopping cloud-early-config"
+ #Override old system's interface setting
+ setup_default;
+ log_action_end_msg 0
+ ;;
force-reload|restart)
- log_warning_msg "Running $0 is deprecated because it may not enable again some interfaces"
- log_action_begin_msg "Executing cloud-early-config"
- if start; then
- log_action_end_msg $?
- else
- log_action_end_msg $?
- fi
- ;;
+ log_warning_msg "Running $0 is deprecated because it may not enable again some interfaces"
+ log_action_begin_msg "Executing cloud-early-config"
+ if start; then
+ log_action_end_msg $?
+ else
+ log_action_end_msg $?
+ fi
+ ;;
*)
- echo "Usage: /etc/init.d/cloud-early-config {start|stop}"
- exit 1
- ;;
+ echo "Usage: /etc/init.d/cloud-early-config {start|stop}"
+ exit 1
+ ;;
esac
exit 0
diff --git a/systemvm/patches/debian/config/etc/rc.local b/systemvm/patches/debian/config/etc/rc.local
index c0b1939..a38c823 100755
--- a/systemvm/patches/debian/config/etc/rc.local
+++ b/systemvm/patches/debian/config/etc/rc.local
@@ -37,7 +37,6 @@ vpcrouter=$(echo "$CMDLINE" | grep -o type=vpcrouter)
if [ "$router" != "" ] || [ "$vpcrouter" != "" ]
then
- echo 1000000 > /proc/sys/net/ipv4/netfilter/ip_conntrack_max
echo 1000000 > /proc/sys/net/netfilter/nf_conntrack_max
echo 1000000 > /proc/sys/net/nf_conntrack_max
fi
@@ -61,4 +60,4 @@ ipv6="/etc/iptables/router_rules.v6"
if [ -e $ipv6 ]
then
iptables-restore < $ipv6
-fi
\ No newline at end of file
+fi
diff --git a/systemvm/patches/debian/config/etc/sysctl.conf b/systemvm/patches/debian/config/etc/sysctl.conf
index b8a8fe0..91baa5d 100644
--- a/systemvm/patches/debian/config/etc/sysctl.conf
+++ b/systemvm/patches/debian/config/etc/sysctl.conf
@@ -48,7 +48,6 @@ net.ipv4.tcp_syncookies = 1
# disable tcp time stamps
net.ipv4.tcp_timestamps = 0
-net.ipv4.netfilter.ip_conntrack_max = 1000000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_tw_buckets = 1000000
net.core.somaxconn = 65535
diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
index 67d6c23..6654ef7 100644
--- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh
+++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
@@ -39,10 +39,18 @@ function cleanup_dev() {
rm -f /lib/udev/rules.d/75-persistent-net-generator.rules
}
+function cleanup_misc() {
+ rm -f /var/log/*
+ rm -fr /var/log/installer
+ rm -f /root/.rnd
+ rm -f /home/cloud/cloud_scripts*
+}
+
function cleanup() {
cleanup_apt
cleanup_dhcp
cleanup_dev
+ cleanup_misc
}
return 2>/dev/null || cleanup
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
index 3a53b7b..1fb033c 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh
@@ -129,6 +129,8 @@ function configure_services() {
mkdir -p /var/cache/cloud
mkdir -p /usr/share/cloud
mkdir -p /usr/local/cloud
+
+ # Fix dnsmasq directory issue
mkdir -p /opt/tftpboot
# Fix haproxy directory issue
diff --git a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
index d02e5b4..8ac8aeb 100644
--- a/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
+++ b/tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
@@ -54,7 +54,7 @@ function install_packages() {
${apt_get} install \
rsyslog logrotate cron insserv net-tools ifupdown vim netbase iptables \
- openssh-server e2fsprogs isc-dhcp-client tcpdump socat wget \
+ openssh-server e2fsprogs tcpdump socat wget \
python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps \
inetutils-ping iputils-arping httping curl \
dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo \
--
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.