|
| 1 | +# Copyright VyOS maintainers and contributors < [email protected]> |
| 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 | +# Delete 'vpp settings interface ethX xdp-options no-syscall-lock' |
| 17 | +# since it is set automatically |
| 18 | + |
| 19 | +from vyos.configtree import ConfigTree |
| 20 | + |
| 21 | +base = ['vpp', 'settings', 'interface'] |
| 22 | + |
| 23 | +def migrate(config: ConfigTree) -> None: |
| 24 | + if not config.exists(base): |
| 25 | + # Nothing to do |
| 26 | + return |
| 27 | + |
| 28 | + for iface_name in config.list_nodes(base): |
| 29 | + xdp_options_base = base + [iface_name, 'xdp-options'] |
| 30 | + if config.exists(xdp_options_base + ['no-syscall-lock']): |
| 31 | + # Delete no-syscall-lock option from configuration |
| 32 | + config.delete(xdp_options_base + ['no-syscall-lock']) |
| 33 | + if config.exists(xdp_options_base) and len(config.list_nodes(xdp_options_base)) == 0: |
| 34 | + config.delete(xdp_options_base) |
0 commit comments