From cb8edaf195060df2795a5aa1e6a883341b5af747 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 6 Nov 2020 18:59:55 +0100 Subject: system: T3048: add dynamic performance tuning daemon Add new CLI command "set system options performance " --- debian/control | 1 + interface-definitions/system-options.xml.in | 29 ++++++++++++++++++++++++----- src/conf_mode/system-options.py | 13 ++++++++++--- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/debian/control b/debian/control index cd05fa966..c5dda7883 100644 --- a/debian/control +++ b/debian/control @@ -106,6 +106,7 @@ Depends: telnet, tftpd-hpa, traceroute, + tuned, udp-broadcast-relay, usb-modeswitch, usbutils, diff --git a/interface-definitions/system-options.xml.in b/interface-definitions/system-options.xml.in index a5fec10db..297f5891e 100644 --- a/interface-definitions/system-options.xml.in +++ b/interface-definitions/system-options.xml.in @@ -38,11 +38,24 @@ Must be ignore, reboot, or poweroff - - - Reboot system on kernel panic - - + + + Tune system performance + + throughput latency + + + throughput + Tune for maximum network throughput + + + latency + Tune for low network latency + + + ^(throughput|latency)$ + + @@ -53,6 +66,12 @@ #include + + + Reboot system on kernel panic + + + Global options used for SSH client diff --git a/src/conf_mode/system-options.py b/src/conf_mode/system-options.py index 6ac35a4ab..188f5020c 100755 --- a/src/conf_mode/system-options.py +++ b/src/conf_mode/system-options.py @@ -21,7 +21,7 @@ from sys import exit from vyos.config import Config from vyos.template import render -from vyos.util import call +from vyos.util import cmd from vyos.validate import is_addr_assigned from vyos import ConfigError from vyos import airbag @@ -71,9 +71,9 @@ def generate(options): def apply(options): # Beep action if 'beep_if_fully_booted' in options.keys(): - call('systemctl enable vyos-beep.service') + cmd('systemctl enable vyos-beep.service') else: - call('systemctl disable vyos-beep.service') + cmd('systemctl disable vyos-beep.service') # Ctrl-Alt-Delete action if os.path.exists(systemd_action_file): @@ -100,6 +100,13 @@ def apply(options): else: f.write('0') + # tuned - performance tuning + if 'performance' in options: + cmd('systemctl enable vyos-beep.service') + cmd('tuned-adm profile network-{performance}'.format(**options)) + else: + cmd('systemctl disable vyos-beep.service') + if __name__ == '__main__': try: c = get_config() -- cgit v1.2.3