Skip to content

Commit 0546a66

Browse files
committed
[PLAT-18584] YNP doesn't correctly handle vm.swappiness setting
Summary: If vm.swappiness is already set in sysctl.conf, we should replace the line in file (because it could have incorrect value) Test Plan: provision instance with vm.swappiness=1 in cofigs Reviewers: anijhawan, vkumar Reviewed By: vkumar Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D46978
1 parent 359685c commit 0546a66

File tree

1 file changed

+3
-1
lines changed
  • managed/node-agent/resources/ynp/modules/provision/configure_os/templates

1 file changed

+3
-1
lines changed

managed/node-agent/resources/ynp/modules/provision/configure_os/templates/run.j2

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ ulimit -u {{ nproc_limit }}
5151

5252
# Configure kernel settings
5353
# Set and persist vm.swappiness
54-
if ! grep -q "^vm.swappiness=" /etc/sysctl.conf; then
54+
if ! grep -q "^vm.swappiness" /etc/sysctl.conf; then
5555
echo "vm.swappiness={{ vm_swappiness }}" >> /etc/sysctl.conf
56+
else
57+
sed -i "s/^vm.swappiness.*/vm.swappiness={{ vm_swappiness }}/" /etc/sysctl.conf
5658
fi
5759
sysctl -w vm.swappiness={{ vm_swappiness }}
5860

0 commit comments

Comments
 (0)