Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T3501: Allow using more than one tuned profile #4179

Open
wants to merge 2 commits into
base: current
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- include start from include/version/system-version.xml.i -->
<syntaxVersion component='system' version='27'></syntaxVersion>
<syntaxVersion component='system' version='28'></syntaxVersion>
<!-- include end -->
21 changes: 17 additions & 4 deletions interface-definitions/system_option.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,32 @@
<properties>
<help>Tune system performance</help>
<completionHelp>
<list>throughput latency</list>
<list>network-throughput network-latency powersave virtual-host virtual-guest</list>
</completionHelp>
<valueHelp>
<format>throughput</format>
<format>network-throughput</format>
<description>Tune for maximum network throughput</description>
</valueHelp>
<valueHelp>
<format>latency</format>
<format>network-latency</format>
<description>Tune for low network latency</description>
</valueHelp>
<valueHelp>
<format>powersave</format>
<description>Tune for low power consumption</description>
</valueHelp>
<valueHelp>
<format>virtual-guest</format>
<description>Tune for running inside a virtual guest</description>
</valueHelp>
<valueHelp>
<format>virtual-host</format>
<description>Tune for running KVM guests</description>
</valueHelp>
<constraint>
<regex>(throughput|latency)</regex>
<regex>(network-throughput|network-latency|powersave|virtual-guest|virtual-host)</regex>
</constraint>
<multi/>
</properties>
</leafNode>
<node name="http-client">
Expand Down
2 changes: 1 addition & 1 deletion smoketest/config-tests/dialup-router-wireguard-ipv6
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ set system login user vyos authentication encrypted-password '$6$2Ta6TWHd/U$NmrX
set system login user vyos authentication plaintext-password ''
set system name-server '172.16.254.30'
set system option ctrl-alt-delete 'ignore'
set system option performance 'latency'
set system option performance 'network-latency'
set system option reboot-on-panic
set system option startup-beep
set system syslog global facility all level 'debug'
Expand Down
2 changes: 1 addition & 1 deletion smoketest/configs/dialup-router-wireguard-ipv6
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ system {
}
option {
ctrl-alt-delete ignore
performance latency
performance network-latency
reboot-on-panic
startup-beep
}
Expand Down
38 changes: 33 additions & 5 deletions smoketest/scripts/cli/test_system_option.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

base_path = ['system', 'option']


class TestSystemOption(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
self.cli_delete(base_path)
Expand Down Expand Up @@ -67,11 +68,38 @@ def test_performance(self):
gc_thresh2 = '262000'
gc_thresh3 = '524000'

self.cli_set(['system', 'sysctl', 'parameter', 'net.ipv4.neigh.default.gc_thresh1', 'value', gc_thresh1])
self.cli_set(['system', 'sysctl', 'parameter', 'net.ipv4.neigh.default.gc_thresh2', 'value', gc_thresh2])
self.cli_set(['system', 'sysctl', 'parameter', 'net.ipv4.neigh.default.gc_thresh3', 'value', gc_thresh3])

self.cli_set(base_path + ['performance', 'throughput'])
self.cli_set(
[
'system',
'sysctl',
'parameter',
'net.ipv4.neigh.default.gc_thresh1',
'value',
gc_thresh1,
]
)
self.cli_set(
[
'system',
'sysctl',
'parameter',
'net.ipv4.neigh.default.gc_thresh2',
'value',
gc_thresh2,
]
)
self.cli_set(
[
'system',
'sysctl',
'parameter',
'net.ipv4.neigh.default.gc_thresh3',
'value',
gc_thresh3,
]
)

self.cli_set(base_path + ['performance', 'network-throughput'])
self.cli_commit()

self.assertTrue(is_systemd_service_active(tuned_service))
Expand Down
3 changes: 2 additions & 1 deletion src/conf_mode/system_option.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ def apply(options):
# wait until daemon has started before sending configuration
while not is_systemd_service_running('tuned.service'):
sleep(0.250)
cmd('tuned-adm profile network-{performance}'.format(**options))
performance = ' '.join(options['performance'])
cmd(f'tuned-adm profile {performance}')
else:
cmd('systemctl stop tuned.service')

Expand Down
33 changes: 33 additions & 0 deletions src/migration-scripts/system/27-to-28
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2023-2024 VyOS maintainers and contributors <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library. If not, see <http://www.gnu.org/licenses/>.

# rename 'system option performance' leaf nodes to new names

from vyos.configtree import ConfigTree

base = ['system', 'option', 'performance']

def migrate(config: ConfigTree) -> None:
if not config.exists(base):
return

replace = {
'throughput' : 'network-throughput',
'latency' : 'network-latency'
}

for old_name, new_name in replace.items():
if config.return_value(base) == old_name:
config.set(base, new_name)
Loading