Skip to content

Commit 6c5fa76

Browse files
committed
T3501: Allow using more than one tuned profile
1 parent ceb64f3 commit 6c5fa76

File tree

7 files changed

+56
-9
lines changed

7 files changed

+56
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<!-- include start from include/version/system-version.xml.i -->
2-
<syntaxVersion component='system' version='27'></syntaxVersion>
2+
<syntaxVersion component='system' version='28'></syntaxVersion>
33
<!-- include end -->

interface-definitions/system_option.xml.in

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,32 @@
149149
<properties>
150150
<help>Tune system performance</help>
151151
<completionHelp>
152-
<list>throughput latency</list>
152+
<list>network-throughput network-latency powersave virtual-host virtual-guest</list>
153153
</completionHelp>
154154
<valueHelp>
155-
<format>throughput</format>
155+
<format>network-throughput</format>
156156
<description>Tune for maximum network throughput</description>
157157
</valueHelp>
158158
<valueHelp>
159-
<format>latency</format>
159+
<format>network-latency</format>
160160
<description>Tune for low network latency</description>
161161
</valueHelp>
162+
<valueHelp>
163+
<format>powersave</format>
164+
<description>Tune for low power consumption</description>
165+
</valueHelp>
166+
<valueHelp>
167+
<format>virtual-guest</format>
168+
<description>Tune for running inside a virtual guest</description>
169+
</valueHelp>
170+
<valueHelp>
171+
<format>virtual-host</format>
172+
<description>Tune for running KVM guests</description>
173+
</valueHelp>
162174
<constraint>
163-
<regex>(throughput|latency)</regex>
175+
<regex>(network-throughput|network-latency|powersave|virtual-guest|virtual-host)</regex>
164176
</constraint>
177+
<multi/>
165178
</properties>
166179
</leafNode>
167180
<node name="http-client">

smoketest/config-tests/dialup-router-wireguard-ipv6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ set system login user vyos authentication encrypted-password '$6$2Ta6TWHd/U$NmrX
688688
set system login user vyos authentication plaintext-password ''
689689
set system name-server '172.16.254.30'
690690
set system option ctrl-alt-delete 'ignore'
691-
set system option performance 'latency'
691+
set system option performance 'network-latency'
692692
set system option reboot-on-panic
693693
set system option startup-beep
694694
set system syslog global facility all level 'debug'

smoketest/configs/dialup-router-wireguard-ipv6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ system {
14701470
}
14711471
option {
14721472
ctrl-alt-delete ignore
1473-
performance latency
1473+
performance network-latency
14741474
reboot-on-panic
14751475
startup-beep
14761476
}

smoketest/scripts/cli/test_system_option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_performance(self):
7171
self.cli_set(['system', 'sysctl', 'parameter', 'net.ipv4.neigh.default.gc_thresh2', 'value', gc_thresh2])
7272
self.cli_set(['system', 'sysctl', 'parameter', 'net.ipv4.neigh.default.gc_thresh3', 'value', gc_thresh3])
7373

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

7777
self.assertTrue(is_systemd_service_active(tuned_service))

src/conf_mode/system_option.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ def apply(options):
171171
# wait until daemon has started before sending configuration
172172
while not is_systemd_service_running('tuned.service'):
173173
sleep(0.250)
174-
cmd('tuned-adm profile network-{performance}'.format(**options))
174+
performance = ' '.join(options['performance'])
175+
cmd(f'tuned-adm profile {performance}')
175176
else:
176177
cmd('systemctl stop tuned.service')
177178

src/migration-scripts/system/27-to-28

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023-2024 VyOS maintainers and contributors <maintainers@vyos.io>
2+
#
3+
# This library is free software; you can redistribute it and/or
4+
# modify it under the terms of the GNU Lesser General Public
5+
# License as published by the Free Software Foundation; either
6+
# version 2.1 of the License, or (at your option) any later version.
7+
#
8+
# This library is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
# Lesser General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Lesser General Public License
14+
# along with this library. If not, see <http://www.gnu.org/licenses/>.
15+
16+
# rename 'system option performance' leaf nodes to new names
17+
18+
from vyos.configtree import ConfigTree
19+
20+
base = ['system', 'option', 'performance']
21+
22+
def migrate(config: ConfigTree) -> None:
23+
if not config.exists(base):
24+
return
25+
26+
replace = {
27+
'throughput' : 'network-throughput',
28+
'latency' : 'network-latency'
29+
}
30+
31+
for old_name, new_name in replace.items():
32+
if config.return_value(base) == old_name:
33+
config.set(base, new_name)

0 commit comments

Comments
 (0)