You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pa...@apache.org on 2019/01/09 15:34:41 UTC
[cloudstack] 04/09: STILL BETA
This is an automated email from the ASF dual-hosted git repository.
paul_a pushed a commit to branch remove_dump_snapshot
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 9b22947f8c721200affdb4c889b75b9325e2a33e
Author: Paul Angus <pa...@shapeblue.com>
AuthorDate: Sat Dec 22 21:29:02 2018 +0000
STILL BETA
---
.../etc/systemd/system/cloud-early-config.service | 5 +--
.../etc/systemd/system/cloud-postinit.service | 13 -------
.../debian/opt/cloud/bin/setup/cloud-early-config | 17 ++++++++-
systemvm/debian/opt/cloud/bin/setup/common.sh | 6 +--
.../debian/opt/cloud/bin/setup/consoleproxy.sh | 14 ++-----
systemvm/debian/opt/cloud/bin/setup/postinit.sh | 43 ++++++++++++----------
systemvm/debian/opt/cloud/bin/setup/secstorage.sh | 4 +-
.../scripts/configure_systemvm_services.sh | 4 ++
8 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/systemvm/debian/etc/systemd/system/cloud-early-config.service b/systemvm/debian/etc/systemd/system/cloud-early-config.service
index 50f0f2b..a7e2f59 100644
--- a/systemvm/debian/etc/systemd/system/cloud-early-config.service
+++ b/systemvm/debian/etc/systemd/system/cloud-early-config.service
@@ -2,10 +2,9 @@
Description=CloudStack post-boot patching service using cmdline
DefaultDependencies=no
-Before=network-pre.target
-Wants=network-pre.target
+Before=sshd.service
-Requires=local-fs.target
+Requires=local-fs.target network-pre.target
After=local-fs.target
[Install]
diff --git a/systemvm/debian/etc/systemd/system/cloud-postinit.service b/systemvm/debian/etc/systemd/system/cloud-postinit.service
deleted file mode 100644
index 1671757..0000000
--- a/systemvm/debian/etc/systemd/system/cloud-postinit.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=CloudStack post-patching init script
-After=cloud-early-config.service network.target local-fs.target
-Before=ssh.service
-
-[Install]
-WantedBy=multi-user.target
-
-[Service]
-Type=oneshot
-ExecStart=/opt/cloud/bin/setup/postinit.sh
-RemainAfterExit=no
-TimeoutStartSec=10min
diff --git a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
index f1162b5..c54ed36 100755
--- a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
+++ b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
@@ -23,7 +23,8 @@ CMDLINE=/var/cache/cloud/cmdline
# Clear boot up flag, it would be created by rc.local after boot up done
mkdir -p /var/cache/cloud
-rm -f /var/cache/cloud/boot_up_done
+rm -f /var/cache/cloud/enabled_svcs
+rm -f /var/cache/cloud/disabled_svcs
[ -x /sbin/ifup ] || exit 0
@@ -240,6 +241,15 @@ HYPERVISOR=$(</etc/cloudstack-agent_detected_hypervisor)
esac
}
+add_cache_backpressure() {
+ # set cache back pressure based on amount of physical memory 100 is default
+ physmem=$(free|awk '/^Mem:/{print $2}')
+ if [ $((physmem)) -lt 409600 ]; then
+ sed -i "/^vm.vfs_cache_pressure/ c\vm.vfs_cache_pressure = 200" /etc/sysctl.conf
+ else
+ sed -i "/^vm.vfs_cache_pressure/ c\vm.vfs_cache_pressure = 100" /etc/sysctl.conf
+ fi
+}
start() {
log_it "Executing cloud-early-config"
@@ -259,6 +269,7 @@ start() {
get_systemvm_type
patch
sync
+ add_cache_backpressure
sysctl -p
log_it "Starting Virtual Guest Services for $HYPERVISOR"
@@ -272,6 +283,10 @@ start() {
else
/opt/cloud/bin/setup/default.sh
fi
+
+ log_it "Running postinit to start services"
+
+ /opt/cloud/bin/setup/postinit.sh
log_it "Finished setting up systemvm"
diff --git a/systemvm/debian/opt/cloud/bin/setup/common.sh b/systemvm/debian/opt/cloud/bin/setup/common.sh
index 110800a..6784d15 100755
--- a/systemvm/debian/opt/cloud/bin/setup/common.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/common.sh
@@ -583,14 +583,14 @@ setup_ntp() {
}
routing_svcs() {
- echo "haproxy apache2" > /var/cache/cloud/enabled_svcs
+ echo "cloud haproxy apache2" > /var/cache/cloud/enabled_svcs
echo "nfs-common portmap" > /var/cache/cloud/disabled_svcs
if [ "$RROUTER" -eq "1" ]
then
- echo "keepalived conntrackd" >> /var/cache/cloud/enabled_svcs
+ echo "cloud keepalived conntrackd" >> /var/cache/cloud/enabled_svcs
echo "dnsmasq" >> /var/cache/cloud/disabled_svcs
else
- echo "dnsmasq" >> /var/cache/cloud/enabled_svcs
+ echo "cloud dnsmasq" >> /var/cache/cloud/enabled_svcs
echo "keepalived conntrackd " >> /var/cache/cloud/disabled_svcs
fi
}
diff --git a/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh b/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh
index c20fed2..7260fcb 100755
--- a/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/consoleproxy.sh
@@ -18,11 +18,6 @@
. /opt/cloud/bin/setup/common.sh
-consoleproxy_svcs() {
- echo "haproxy dnsmasq apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
- mkdir -p /var/log/cloud
-}
-
setup_console_proxy() {
log_it "Setting up console proxy system vm"
setup_common eth0 eth1 eth2
@@ -44,16 +39,13 @@ setup_console_proxy() {
setup_sshd $ETH0_IP "eth0"
fi
+ mkdir -p /var/log/cloud
disable_rpfilter
enable_fwding 0
enable_irqbalance 0
rm -f /etc/logrotate.d/cloud
+ echo "cloud" > /var/cache/cloud/enabled_svcs
+
}
-consoleproxy_svcs
-if [ $? -gt 0 ]
-then
- log_it "Failed to execute consoleproxy_svcs"
- exit 1
-fi
setup_console_proxy
diff --git a/systemvm/debian/opt/cloud/bin/setup/postinit.sh b/systemvm/debian/opt/cloud/bin/setup/postinit.sh
index fdb2111..668199b 100755
--- a/systemvm/debian/opt/cloud/bin/setup/postinit.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/postinit.sh
@@ -21,15 +21,6 @@
# Eject cdrom if any
eject || true
-# set cache back pressure based on amount of physical memory 100 is default
-physmem=$(free|awk '/^Mem:/{print $2}')
-if [ $((physmem)) -lt 409600 ]; then
- sed -i "/^vm.vfs_cache_pressure/ c\vm.vfs_cache_pressure = 200" /etc/sysctl.conf
-else
- sed -i "/^vm.vfs_cache_pressure/ c\vm.vfs_cache_pressure = 100" /etc/sysctl.conf
-fi
-sysctl -p
-
# Restart journald for setting changes to apply
systemctl restart systemd-journald
@@ -45,15 +36,19 @@ fi
[ ! -f /var/cache/cloud/enabled_svcs ] && touch /var/cache/cloud/enabled_svcs
for svc in $(cat /var/cache/cloud/enabled_svcs)
-do
- systemctl enable --now --no-block $svc
-done
+if [[ "$svc" != "cloud" ]]
+then
+ do
+ systemctl start --no-block $svc
+ done
+fi
-[ ! -f /var/cache/cloud/disabled_svcs ] && touch /var/cache/cloud/disabled_svcs
-for svc in $(cat /var/cache/cloud/disabled_svcs)
-do
- systemctl disable --now --no-block $svc
-done
+#not required - all services disabled by default
+#[ ! -f /var/cache/cloud/disabled_svcs ] && touch /var/cache/cloud/disabled_svcs
+#for svc in $(cat /var/cache/cloud/disabled_svcs)
+#do
+# systemctl disable --now --no-block $svc
+#done
# Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist
ipv4="/etc/iptables/rules.v4"
@@ -68,9 +63,17 @@ then
ip6tables-restore < $ipv6
fi
-# Enable SSH
-systemctl enable --now --no-block ssh
+# Start SSH
+systemctl start ssh
date > /var/cache/cloud/boot_up_done
-systemctl start cloud
+# explicitly start cloud service
+
+for svc in $(cat /var/cache/cloud/enabled_svcs)
+if [[ "$svc" == "cloud" ]]
+then
+ do
+ systemctl start --no-block $svc
+ done
+fi
diff --git a/systemvm/debian/opt/cloud/bin/setup/secstorage.sh b/systemvm/debian/opt/cloud/bin/setup/secstorage.sh
index 8d5440a..b363661 100755
--- a/systemvm/debian/opt/cloud/bin/setup/secstorage.sh
+++ b/systemvm/debian/opt/cloud/bin/setup/secstorage.sh
@@ -19,14 +19,14 @@
. /opt/cloud/bin/setup/common.sh
secstorage_svcs() {
- echo "apache2 nfs-common portmap" > /var/cache/cloud/enabled_svcs
+ echo "cloud apache2 nfs-common portmap" > /var/cache/cloud/enabled_svcs
echo "conntrackd keepalived haproxy dnsmasq" > /var/cache/cloud/disabled_svcs
mkdir -p /var/log/cloud
}
setup_secstorage() {
log_it "Setting up secondary storage system vm"
- sysctl vm.min_free_kbytes=8192
+ #sysctl vm.min_free_kbytes=8192
setup_common eth0 eth1 eth2
setup_storage_network
diff --git a/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh b/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh
index cd4812e..8432bb1 100644
--- a/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh
+++ b/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh
@@ -109,6 +109,10 @@ function configure_services() {
systemctl disable x11-common
systemctl disable xl2tpd
systemctl disable vgauth
+ systemctl disable sshd
+ systemctl disable nfs-common
+ systemctl disable portmap
+
# Disable guest services which will selectively be started based on hypervisor
systemctl disable open-vm-tools