From 1215ed463c01ec411530e4d528d3d32f7607a457 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 22 Mar 2018 17:32:51 +0530 Subject: [PATCH 1/5] CLOUDSTACK-10341: Reduce template size, install nft This reduces systemvmtemplate size by 600MB and installs nftables, updates iptables. Signed-off-by: Rohit Yadav --- tools/appliance/systemvmtemplate/http/preseed.cfg | 10 +++++----- .../appliance/systemvmtemplate/scripts/apt_upgrade.sh | 3 +-- tools/appliance/systemvmtemplate/scripts/cleanup.sh | 2 ++ .../scripts/install_systemvm_packages.sh | 4 +++- tools/appliance/systemvmtemplate/template.json | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tools/appliance/systemvmtemplate/http/preseed.cfg b/tools/appliance/systemvmtemplate/http/preseed.cfg index cdb649a8f5d8..c886e5249405 100644 --- a/tools/appliance/systemvmtemplate/http/preseed.cfg +++ b/tools/appliance/systemvmtemplate/http/preseed.cfg @@ -54,28 +54,28 @@ d-i partman-auto/disk string /dev/vda d-i partman-auto/method string regular d-i partman-auto/expert_recipe string \ boot-root :: \ - 80 50 160 ext2 \ + 60 60 60 ext2 \ $primary{ } $bootable{ } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext2 } \ mountpoint{ /boot } \ . \ - 1200 40 1600 ext4 \ + 980 40 1100 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ . \ - 800 60 800 ext4 \ + 490 50 700 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /var } \ . \ - 100 90 200 ext4 \ + 80 90 100 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /tmp } \ . \ - 256 100 1024 linux-swap \ + 256 1000 512 linux-swap \ method{ swap } format{ } \ . diff --git a/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh index ac48b6b82497..b6de480c4e28 100644 --- a/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh +++ b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh @@ -23,7 +23,7 @@ set -x function fix_tune2fs() { for partition in $(blkid -o list | grep ext | awk '{print $1}') do - tune2fs -m 1 $partition + tune2fs -m 0 $partition tune2fs -c 3 $partition done fdisk -l @@ -55,7 +55,6 @@ function apt_upgrade() { apt-get -q -y update apt-get -q -y upgrade apt-get -q -y dist-upgrade - apt-get -y remove --purge linux-image-4.9.0-4-amd64 apt-get -y autoremove --purge apt-get autoclean apt-get clean diff --git a/tools/appliance/systemvmtemplate/scripts/cleanup.sh b/tools/appliance/systemvmtemplate/scripts/cleanup.sh index 444f205b4c6e..8f2408a325a3 100644 --- a/tools/appliance/systemvmtemplate/scripts/cleanup.sh +++ b/tools/appliance/systemvmtemplate/scripts/cleanup.sh @@ -60,6 +60,7 @@ function cleanup_misc() { # Docs and data files rm -fr /var/lib/apt/* rm -fr /var/cache/apt/* + rm -fr /var/cache/debconf/*old rm -fr /usr/share/doc rm -fr /usr/share/man rm -fr /usr/share/info @@ -67,6 +68,7 @@ function cleanup_misc() { rm -fr /usr/share/apache2/icons find /usr/share/locale -type f | grep -v en_US | xargs rm -fr find /usr/share/zoneinfo -type f | grep -v UTC | xargs rm -fr + rm -fr /tmp/* } function cleanup() { diff --git a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh index 9469e8af28ec..a5b1379b20a9 100644 --- a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh +++ b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh @@ -72,9 +72,11 @@ function install_packages() { strongswan libcharon-extra-plugins libstrongswan-extra-plugins \ virt-what open-vm-tools qemu-guest-agent hyperv-daemons + apt-get -q -y -t stretch-backports install nftables + apt-get -y autoremove --purge - apt-get autoclean apt-get clean + apt-get autoclean #32 bit architecture support:: not required for 32 bit template if [ "${arch}" != "i386" ]; then diff --git a/tools/appliance/systemvmtemplate/template.json b/tools/appliance/systemvmtemplate/template.json index da924289b1e3..8fe32309d372 100644 --- a/tools/appliance/systemvmtemplate/template.json +++ b/tools/appliance/systemvmtemplate/template.json @@ -32,7 +32,7 @@ [ "-m", "512M" ], [ "-smp", "cpus=1,maxcpus=1,cores=1" ] ], - "disk_size": 2400, + "disk_size": 1800, "format": "qcow2", "disk_interface": "virtio", From e8fa1ccd22d45187b76ee522d992043344b4684b Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Fri, 23 Mar 2018 12:28:03 +0530 Subject: [PATCH 2/5] Fix bug that fails to patch with provided release version Signed-off-by: Rohit Yadav --- tools/appliance/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh index 8b1032ecc8b2..ba6fe4dda1a2 100755 --- a/tools/appliance/build.sh +++ b/tools/appliance/build.sh @@ -195,7 +195,7 @@ function create_definition() { set +e if [ ! -z "${version}" ]; then sed ${sed_regex_option} -i -e "s/^CLOUDSTACK_RELEASE=.+/CLOUDSTACK_RELEASE=${version}/" \ - "${appliance_build_name}/configure_systemvm_services.sh" + "${appliance_build_name}/scripts/configure_systemvm_services.sh" fi set -e add_on_exit rm -rf "${appliance_build_name}" From ecece1b8d5d1d5602bc86fad0a2e635a6267179c Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Fri, 23 Mar 2018 23:24:40 +0530 Subject: [PATCH 3/5] Fix failure in one of the smoke tests, FAULT is not an acceptable state use UNKNOWN Signed-off-by: Rohit Yadav --- systemvm/debian/opt/cloud/bin/checkrouter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemvm/debian/opt/cloud/bin/checkrouter.sh b/systemvm/debian/opt/cloud/bin/checkrouter.sh index bb6c9f8a0f23..ab7b228296b9 100755 --- a/systemvm/debian/opt/cloud/bin/checkrouter.sh +++ b/systemvm/debian/opt/cloud/bin/checkrouter.sh @@ -20,7 +20,7 @@ STATUS=UNKNOWN if [ "$(systemctl is-active keepalived)" != "active" ] then - echo "Status: FAULT" + echo "Status: ${STATUS}" exit fi From 50d14d57d0f155a36479afdc9fd3a4d1f0d9e4af Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sat, 24 Mar 2018 00:06:56 +0530 Subject: [PATCH 4/5] Fix failing integration test Signed-off-by: Rohit Yadav --- systemvm/debian/opt/cloud/bin/checkrouter.sh | 2 +- test/integration/smoke/test_vpc_redundant.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/systemvm/debian/opt/cloud/bin/checkrouter.sh b/systemvm/debian/opt/cloud/bin/checkrouter.sh index ab7b228296b9..bb6c9f8a0f23 100755 --- a/systemvm/debian/opt/cloud/bin/checkrouter.sh +++ b/systemvm/debian/opt/cloud/bin/checkrouter.sh @@ -20,7 +20,7 @@ STATUS=UNKNOWN if [ "$(systemctl is-active keepalived)" != "active" ] then - echo "Status: ${STATUS}" + echo "Status: FAULT" exit fi diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py index 2fde8d992075..64b1fa677713 100644 --- a/test/integration/smoke/test_vpc_redundant.py +++ b/test/integration/smoke/test_vpc_redundant.py @@ -304,8 +304,8 @@ def wait_for_vrrp(self): time.sleep(3 * self.advert_int + 5) def check_routers_state(self,count=2, status_to_check="MASTER", expected_count=1, showall=False): - vals = ["MASTER", "BACKUP", "UNKNOWN"] - cnts = [0, 0, 0] + vals = ["MASTER", "BACKUP", "UNKNOWN", "FAULT"] + cnts = [0, 0, 0, 0] self.wait_for_vrrp() @@ -612,7 +612,8 @@ def test_04_rvpc_network_garbage_collector_nics(self): time.sleep(total_sleep * 3) - self.check_routers_state(status_to_check="BACKUP", expected_count=2) + # Router will be in FAULT state, i.e. keepalived is stopped + self.check_routers_state(status_to_check="FAULT", expected_count=2) self.start_vm() self.check_routers_state(status_to_check="MASTER") From a7d33a74df8e3a6b52afe9a58429e676b337195c Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sat, 24 Mar 2018 01:28:47 +0530 Subject: [PATCH 5/5] size fixes Signed-off-by: Rohit Yadav --- tools/appliance/systemvmtemplate/http/preseed.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/appliance/systemvmtemplate/http/preseed.cfg b/tools/appliance/systemvmtemplate/http/preseed.cfg index c886e5249405..65a573374a90 100644 --- a/tools/appliance/systemvmtemplate/http/preseed.cfg +++ b/tools/appliance/systemvmtemplate/http/preseed.cfg @@ -60,12 +60,12 @@ d-i partman-auto/expert_recipe string \ use_filesystem{ } filesystem{ ext2 } \ mountpoint{ /boot } \ . \ - 980 40 1100 ext4 \ + 975 40 1000 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ . \ - 490 50 700 ext4 \ + 480 50 700 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /var } \ @@ -75,7 +75,7 @@ d-i partman-auto/expert_recipe string \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /tmp } \ . \ - 256 1000 512 linux-swap \ + 256 1000 256 linux-swap \ method{ swap } format{ } \ .