Skip to content

Commit a2fb36d

Browse files
committed
CLOUDSTACK-10013: Migrate systemvmtemplate to Debian9
SystemVM changes to work on Debian 9 - Migrate away from chkconfig to systemctl - Remove xenstore-utils override deb pkg - Fix runlevel in sysv scripts for systemd Signed-off-by: Rohit Yadav <[email protected]>
1 parent a4cecd2 commit a2fb36d

File tree

15 files changed

+158
-774
lines changed

15 files changed

+158
-774
lines changed

systemvm/patches/debian/buildsystemvm.sh

Lines changed: 0 additions & 577 deletions
This file was deleted.

systemvm/patches/debian/config/etc/init.d/cloud

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Required-Stop: $local_fs
66
# Should-Start:
77
# Should-Stop:
8-
# Default-Start:
8+
# Default-Start: 3 4 5
99
# Default-Stop: 0 1 6
1010
# Short-Description: Start up the CloudStack cloud service
1111
### END INIT INFO

systemvm/patches/debian/config/etc/init.d/cloud-early-config

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ mkdir -p /var/lib/haproxy
3838
# Clear boot up flag, it would be created by rc.local after boot up done
3939
rm -f /var/cache/cloud/boot_up_done
4040

41+
# Randomize cloud password so only ssh login is allowed
42+
echo "cloud:`openssl rand -base64 32`" | chpasswd
43+
4144
[ -x /sbin/ifup ] || exit 0
4245

4346
. /lib/lsb/init-functions
@@ -807,7 +810,7 @@ setup_sshd(){
807810

808811
setup_vpc_apache2() {
809812
log_it "Setting up apache web server for VPC"
810-
chkconfig apache2 off
813+
systemctl disable apache2
811814
clean_ipalias_config
812815
setup_apache2_common
813816
}
@@ -942,7 +945,7 @@ setup_router() {
942945
disable_rpfilter_domR
943946
enable_fwding 1
944947
enable_rpsrfs 1
945-
chkconfig nfs-common off
948+
systemctl disable nfs-common
946949
cp /etc/iptables/iptables-router /etc/iptables/rules.v4
947950
#for old templates
948951
cp /etc/iptables/iptables-router /etc/iptables/rules
@@ -1082,7 +1085,7 @@ setup_dhcpsrvr() {
10821085
enable_svc cloud-passwd-srvr 1
10831086
enable_svc cloud 0
10841087
enable_fwding 0
1085-
chkconfig nfs-common off
1088+
systemctl disable nfs-common
10861089

10871090
cp /etc/iptables/iptables-router /etc/iptables/rules.v4
10881091
cp /etc/iptables/iptables-router /etc/iptables/rules
@@ -1238,7 +1241,7 @@ setup_console_proxy() {
12381241
enable_svc dnsmasq 0
12391242
enable_svc cloud-passwd-srvr 0
12401243
enable_svc cloud 1
1241-
chkconfig nfs-common off
1244+
systemctl disable nfs-common
12421245
rm /etc/logrotate.d/cloud
12431246
}
12441247

@@ -1266,8 +1269,8 @@ setup_elbvm() {
12661269
enable_svc dnsmasq 0
12671270
enable_svc cloud-passwd-srvr 0
12681271
enable_svc cloud 0
1269-
chkconfig nfs-common off
1270-
chkconfig portmap off
1272+
systemctl disable nfs-common
1273+
systemctl disable portmap
12711274
}
12721275

12731276
setup_ilbvm() {
@@ -1289,8 +1292,8 @@ setup_ilbvm() {
12891292
enable_svc dnsmasq 0
12901293
enable_svc cloud-passwd-srvr 0
12911294
enable_svc cloud 0
1292-
chkconfig nfs-common off
1293-
chkconfig portmap off
1295+
systemctl disable nfs-common
1296+
systemctl disable portmap
12941297
}
12951298

12961299
setup_default() {

systemvm/patches/debian/config/etc/init.d/cloud-passwd-srvr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Provides: cloud-passwd-srvr
44
# Required-Start: mountkernfs $local_fs cloud-early-config iptables-persistent
55
# Required-Stop: $local_fs
6-
# Should-Start:
7-
# Should-Stop:
8-
# Default-Start:
9-
# Default-Stop: 0 6
6+
# Should-Start:
7+
# Should-Stop
8+
# Default-Start: 3 4 5
9+
# Default-Stop: 0 1 6
1010
# Short-Description: Web server that sends passwords to User VMs
1111
### END INIT INFO
1212
# Licensed to the Apache Software Foundation (ASF) under one

systemvm/patches/debian/config/opt/cloud/bin/patchsystemvm.sh

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,34 @@ patch_console_proxy() {
3333
}
3434

3535
consoleproxy_svcs() {
36-
chkconfig cloud on
37-
chkconfig postinit on
38-
chkconfig cloud-passwd-srvr off
39-
chkconfig haproxy off ;
40-
chkconfig dnsmasq off
41-
chkconfig ssh on
42-
chkconfig apache2 off
43-
chkconfig nfs-common off
44-
chkconfig portmap off
45-
chkconfig keepalived off
46-
chkconfig conntrackd off
36+
systemctl enable cloud
37+
systemctl enable postinit
38+
systemctl disable cloud-passwd-srvr
39+
systemctl disable haproxy
40+
systemctl disable dnsmasq
41+
systemctl enable ssh
42+
systemctl disable apache2
43+
systemctl disable nfs-common
44+
systemctl disable portmap
45+
systemctl disable keepalived
46+
systemctl disable conntrackd
4747
echo "cloud postinit ssh" > /var/cache/cloud/enabled_svcs
4848
echo "cloud-passwd-srvr haproxy dnsmasq apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
4949
mkdir -p /var/log/cloud
5050
}
5151

5252
secstorage_svcs() {
53-
chkconfig cloud on
54-
chkconfig postinit on
55-
chkconfig cloud-passwd-srvr off
56-
chkconfig haproxy off ;
57-
chkconfig dnsmasq off
58-
chkconfig portmap on
59-
chkconfig nfs-common on
60-
chkconfig ssh on
61-
chkconfig apache2 off
62-
chkconfig keepalived off
63-
chkconfig conntrackd off
53+
systemctl enable cloud on
54+
systemctl enable postinit on
55+
systemctl disable cloud-passwd-srvr
56+
systemctl disable haproxy
57+
systemctl disable dnsmasq
58+
systemctl enable portmap
59+
systemctl enable nfs-common
60+
systemctl enable ssh
61+
systemctl disable apache2
62+
systemctl disable keepalived
63+
systemctl disable conntrackd
6464
echo "cloud postinit ssh nfs-common portmap" > /var/cache/cloud/enabled_svcs
6565
echo "cloud-passwd-srvr haproxy dnsmasq" > /var/cache/cloud/disabled_svcs
6666
mkdir -p /var/log/cloud
@@ -69,67 +69,67 @@ secstorage_svcs() {
6969
routing_svcs() {
7070
grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
7171
RROUTER=$?
72-
chkconfig cloud off
73-
chkconfig haproxy on ;
74-
chkconfig ssh on
75-
chkconfig nfs-common off
76-
chkconfig portmap off
72+
systemctl disable cloud
73+
systemctl disable haproxy
74+
systemctl enable ssh
75+
systemctl disable nfs-common
76+
systemctl disable portmap
7777
echo "ssh haproxy apache2" > /var/cache/cloud/enabled_svcs
7878
echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs
7979
if [ $RROUTER -eq 0 ]
8080
then
81-
chkconfig dnsmasq off
82-
chkconfig cloud-passwd-srvr off
83-
chkconfig keepalived on
84-
chkconfig conntrackd on
85-
chkconfig postinit on
81+
systemctl disable dnsmasq
82+
systemctl disable cloud-passwd-srvr
83+
systemctl enable keepalived
84+
systemctl enable conntrackd
85+
systemctl enable postinit
8686
echo "keepalived conntrackd postinit" >> /var/cache/cloud/enabled_svcs
8787
echo "dnsmasq cloud-passwd-srvr" >> /var/cache/cloud/disabled_svcs
8888
else
89-
chkconfig dnsmasq on
90-
chkconfig cloud-passwd-srvr on
91-
chkconfig keepalived off
92-
chkconfig conntrackd off
89+
systemctl enable dnsmasq
90+
systemctl enable cloud-passwd-srvr
91+
systemctl disable keepalived
92+
systemctl disable conntrackd
9393
echo "dnsmasq cloud-passwd-srvr " >> /var/cache/cloud/enabled_svcs
9494
echo "keepalived conntrackd " >> /var/cache/cloud/disabled_svcs
9595
fi
9696
}
9797

9898
dhcpsrvr_svcs() {
99-
chkconfig cloud off
100-
chkconfig cloud-passwd-srvr on ;
101-
chkconfig haproxy off ;
102-
chkconfig dnsmasq on
103-
chkconfig ssh on
104-
chkconfig nfs-common off
105-
chkconfig portmap off
106-
chkconfig keepalived off
107-
chkconfig conntrackd off
99+
systemctl disable cloud
100+
systemctl enable cloud-passwd-srvr
101+
systemctl disable haproxy
102+
systemctl enable dnsmasq
103+
systemctl enable ssh
104+
systemctl disable nfs-common
105+
systemctl disable portmap
106+
systemctl disable keepalived
107+
systemctl disable conntrackd
108108
echo "ssh dnsmasq cloud-passwd-srvr apache2" > /var/cache/cloud/enabled_svcs
109109
echo "cloud nfs-common haproxy portmap" > /var/cache/cloud/disabled_svcs
110110
}
111111

112112
elbvm_svcs() {
113-
chkconfig cloud off
114-
chkconfig haproxy on ;
115-
chkconfig ssh on
116-
chkconfig nfs-common off
117-
chkconfig portmap off
118-
chkconfig keepalived off
119-
chkconfig conntrackd off
113+
systemctl disable cloud
114+
systemctl disable haproxy
115+
systemctl enable ssh
116+
systemctl disable nfs-common
117+
systemctl disable portmap
118+
systemctl disable keepalived
119+
systemctl disable conntrackd
120120
echo "ssh haproxy" > /var/cache/cloud/enabled_svcs
121121
echo "cloud dnsmasq cloud-passwd-srvr apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
122122
}
123123

124124

125125
ilbvm_svcs() {
126-
chkconfig cloud off
127-
chkconfig haproxy on ;
128-
chkconfig ssh on
129-
chkconfig nfs-common off
130-
chkconfig portmap off
131-
chkconfig keepalived off
132-
chkconfig conntrackd off
126+
systemctl disable cloud
127+
systemctl enable haproxy
128+
systemctl enable ssh
129+
systemctl disable nfs-common
130+
systemctl disable portmap
131+
systemctl disable keepalived
132+
systemctl disable conntrackd
133133
echo "ssh haproxy" > /var/cache/cloud/enabled_svcs
134134
echo "cloud dnsmasq cloud-passwd-srvr apache2 nfs-common portmap" > /var/cache/cloud/disabled_svcs
135135
}

tools/appliance/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ function main() {
594594
add_on_exit veewee_destroy
595595
veewee_build
596596
save_mac_address
597-
veewee_halt
597+
veewee_halt || true
598598
retry 10 check_appliance_shutdown
599599
retry 10 check_appliance_disk_ready
600600
retry 10 remove_shares

tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,23 @@ function add_backports() {
2323
sed -i '/cdrom/d' /etc/apt/sources.list
2424
sed -i '/deb-src/d' /etc/apt/sources.list
2525
sed -i '/backports/d' /etc/apt/sources.list
26-
echo 'deb http://http.debian.net/debian wheezy-backports main' >> /etc/apt/sources.list
26+
echo 'deb http://http.debian.net/debian stretch-backports main' >> /etc/apt/sources.list
2727
}
2828

2929
function apt_upgrade() {
3030
DEBIAN_FRONTEND=noninteractive
3131
DEBIAN_PRIORITY=critical
3232

33+
# Setup sudo
34+
echo 'cloud ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/cloud
35+
3336
add_backports
3437

3538
rm -fv /root/*.iso
3639
apt-get -y autoremove
3740
apt-get autoclean
38-
apt-get -q -y --force-yes update
39-
apt-get -q -y --force-yes upgrade
41+
apt-get -q -y update
42+
apt-get -q -y upgrade
4043

4144
df -h
4245
}

tools/appliance/definitions/systemvmtemplate/authorized_keys.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ set -x
2525
key='ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvFu3MLSPphFRBR1yM7nBukXWS9gPdAXfqq9cfC8ZqQN9ybi531aj44CybZ4BVT4kLfzbAs7+7nJeSIpPHxjv9XFqbxjIxoFeGYkj7s0RrJgtsEmvAAubZ3mYboUAYUivMgnJFLnv4VqyAbpjix6CfECUiU4ygwo24F3F6bAmhl4Vo1R5TSUdDIX876YePJTFtuVkLl4lu/+xw1QRWrgaSFosGICT37IKY7RjE79Ozb0GjNHyJPPgVAGkUVO4LawroL9dYOBlzdHpmqqA9Kc44oQBpvcU7s1+ezRTt7fZNnP7TG9ninZtrvnP4qmwAc4iUJ7N1bwh0mCblnoTfZ28hw== anthony@mobl-ant'
2626
mkdir -p /root/.ssh
2727
chmod 644 /root/.ssh
28+
#touch /root/.ssh/authorized_keys
2829
echo ${key} > /root/.ssh/authorized_keys
2930
chmod 600 /root/.ssh/authorized_keys

tools/appliance/definitions/systemvmtemplate/build_time.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

tools/appliance/definitions/systemvmtemplate/cleanup.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ set -e
2020
set -x
2121

2222
function cleanup_apt() {
23-
#apt-get -y remove linux-headers-$(uname -r) build-essential
2423
apt-get -y remove dictionaries-common busybox
2524
apt-get -y autoremove
2625
apt-get autoclean

0 commit comments

Comments
 (0)