[ACT][PATCH] UBUNTU: SAUCE: ubuntu_lttng_smoke_test: create swap not only for Azure

Po-Hsu Lin po-hsu.lin at canonical.com
Wed Jun 16 09:26:14 UTC 2021


BugLink: https://bugs.launchpad.net/bugs/1803118
         https://bugs.launchpad.net/bugs/1926962

The OOM issue while trying to build this DKMS module on smaller
instances can be found on other clouds (AWS / GCP) as well.
Apart from that we will run generic kernel on these clouds, therefore
using swap file just for Azure cloud kernel is not enough.

Remove the if statement so that other variants can benefit from this.

Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
---
 .../ubuntu_lttng_smoke_test.py                | 31 +++++++++----------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py b/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
index 059604b7..6c012072 100755
--- a/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
+++ b/ubuntu_lttng_smoke_test/ubuntu_lttng_smoke_test.py
@@ -30,23 +30,22 @@ class ubuntu_lttng_smoke_test(test.test):
         self.results = utils.system_output(cmd, retain_output=True, ignore_status=True)
 
     def initialize(self):
-        # Special case for Azure nodes lp: 1791032
         # Some nodes with small ram will need the swap to build lttng dkms
-        if platform.uname()[2].split('-')[-1] == 'azure':
-            mem_gb = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024.**3)
-            df_gb = os.statvfs('/').f_bsize * os.statvfs('/').f_bavail / (1024.**3)
-            cmd = 'swapon --show'
-            swapon = utils.system_output(cmd)
-            if mem_gb < 3.0 and df_gb > 4.0 and swapon == '':
-                swap_file = '/tmp/swapfile'
-                cmd = 'fallocate -l 2G %s' % swap_file
-                utils.system(cmd)
-                cmd = 'chmod 600 %s' % swap_file
-                utils.system(cmd)
-                cmd = 'mkswap %s' % swap_file
-                utils.system(cmd)
-                cmd = 'swapon %s' % swap_file
-                utils.system(cmd)
+        # Issue begins from Azure cloud (lp:1791032) and can be found on others (lp:1803118 / lp:1926962)
+        mem_gb = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024.**3)
+        df_gb = os.statvfs('/').f_bsize * os.statvfs('/').f_bavail / (1024.**3)
+        cmd = 'swapon --show'
+        swapon = utils.system_output(cmd)
+        if mem_gb < 3.0 and df_gb > 4.0 and swapon == '':
+            swap_file = '/tmp/swapfile'
+            cmd = 'fallocate -l 2G %s' % swap_file
+            utils.system(cmd)
+            cmd = 'chmod 600 %s' % swap_file
+            utils.system(cmd)
+            cmd = 'mkswap %s' % swap_file
+            utils.system(cmd)
+            cmd = 'swapon %s' % swap_file
+            utils.system(cmd)
 
         self.install_required_pkgs()
         self.job.require_gcc()
-- 
2.25.1




More information about the kernel-team mailing list