diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-11-06 18:59:55 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-11-06 18:59:55 +0100 |
commit | cb8edaf195060df2795a5aa1e6a883341b5af747 (patch) | |
tree | f69439ec4719f650c3fb91800fda15e9eb54216c | |
parent | 10a23cd803c0784cbdd80daff6750f02c982df4f (diff) | |
download | vyos-1x-cb8edaf195060df2795a5aa1e6a883341b5af747.tar.gz vyos-1x-cb8edaf195060df2795a5aa1e6a883341b5af747.zip |
system: T3048: add dynamic performance tuning daemon
Add new CLI command "set system options performance <latency | throughput>"
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | interface-definitions/system-options.xml.in | 29 | ||||
-rwxr-xr-x | 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 @@ <constraintErrorMessage>Must be ignore, reboot, or poweroff</constraintErrorMessage> </properties> </leafNode> - <leafNode name="reboot-on-panic"> - <properties> - <help>Reboot system on kernel panic</help> - <valueless/> - </properties> + <leafNode name="performance"> + <properties> + <help>Tune system performance</help> + <completionHelp> + <list>throughput latency</list> + </completionHelp> + <valueHelp> + <format>throughput</format> + <description>Tune for maximum network throughput</description> + </valueHelp> + <valueHelp> + <format>latency</format> + <description>Tune for low network latency</description> + </valueHelp> + <constraint> + <regex>^(throughput|latency)$</regex> + </constraint> + </properties> </leafNode> <node name="http-client"> <properties> @@ -53,6 +66,12 @@ #include <include/source-address-ipv4-ipv6.xml.i> </children> </node> + <leafNode name="reboot-on-panic"> + <properties> + <help>Reboot system on kernel panic</help> + <valueless/> + </properties> + </leafNode> <node name="ssh-client"> <properties> <help>Global options used for SSH client</help> 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() |