[Bug 2070318] Re: netplan does not quote values passed to ovs-vsctl when needed
Launchpad Bug Tracker
2070318 at bugs.launchpad.net
Thu Nov 7 23:14:57 UTC 2024
This bug was fixed in the package netplan.io - 1.1.1-1
---------------
netplan.io (1.1.1-1) unstable; urgency=medium
* New upstream release: 1.1.1
- NM: add support for stable-ssid MAC option !524 (LP: #2084234)
- wpa_supplicant: add ExecReload to the service unit !523
- Create snippet files for single-sourcing repetitive instructions !505
- doc: Add initial 'Cryptography' section !517
- Several code cleanup & fixes for TiCS !507
- tests: ethernets: Add ipv6-address-generation integration tests !509
- cli: drop python-netifaces !503 (LP: #2065870, LP: #2017585)
- parse-nm: account for veth and dummy when checking for virtual types !513
- Avoid dependency on dbus-python !511
- tests: Improve vrf/wireguard modprobe check inside containers !510
- tests:ethernets: avoid flaky test_ip6_eui64 results !514
- ovs: quote external-ids and other-config values !512 (LP: #2070318)
- Handle implicit conversions !496
- Use more permissive umask for .service units !516 (LP: #2072486)
- Revert "apply: make sure that networkd is restarted when needed" !518
(LP: #2078009)
- Handling encoding issues on netplan status !521 (LP: #2079975)
- include: fix apidoc warnings about undocumented parameters
* d/patches: Drop patches, applied upstream
* d/control: Drop python3-{dbus,netifaces} dependencies, not needed anymore
* d/{rules,control}: Utilize dh-python
-- Lukas Märdian <slyon at debian.org> Wed, 16 Oct 2024 09:46:10 +0200
** Changed in: netplan.io (Ubuntu)
Status: New => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to netplan.io in Ubuntu.
Matching subscriptions: foundations-bugs
https://bugs.launchpad.net/bugs/2070318
Title:
netplan does not quote values passed to ovs-vsctl when needed
Status in Netplan:
Fix Committed
Status in netplan.io package in Ubuntu:
Fix Released
Status in netplan.io source package in Jammy:
New
Status in netplan.io source package in Noble:
New
Status in netplan.io source package in Oracular:
New
Bug description:
TL;DR: some values need to be quoted when passing them to ovs-vsctl
during `netplan apply` handling, otherwise OVSDB will error out.
When running `netplan apply` after setting a complex option like
```
openvswitch:
external-ids:
ovn-cms-options: "card-serial-number=MT42424242N8,enable-chassis-as-gw"
```
the first time everything works well. But any follow-up invocations
will break with an error like this when netplan tries to clean the
options it remembers about up:
['/usr/bin/ovs-vsctl', 'remove', 'Open_vSwitch', '.', 'external-ids',
'ovn-cms-options', 'card-serial-number=MT42424242N8,enable-chassis-as-
gw']' returned non-zero exit status 1.
Properly quoted values are passed in correctly without an error:
sudo ovs-vsctl remove Open_vSwitch . external-ids ovn-cms-
options='"card-serial-number=MT42424242N8,enable-chassis-as-gw"'
--
OVSDB does not limit string value contents so long as they are properly escaped:
https://man7.org/linux/man-pages/man5/ovs-vswitchd.conf.db.5.html
"external_ids: map of string-string pairs"
https://man7.org/linux/man-pages/man8/ovn-controller.8.html
"external_ids:ovn-cms-options A list of options that will be consumed by the CMS Plugin and which specific to this particular chassis. An example would be: cms_option1,cms_option2:foo."
Complex usages of external_ids:ovn-cms-options (including the ones containing the equal sign) are well-documented in different projects, e.g.: https://docs.openstack.org/neutron/latest/admin/ovn/availability_zones.html
```
ovs-vsctl set Open_vSwitch . external-ids:ovn-cms-options="enable-chassis-as-gw,availability-zones=az-0:az-1:az-2"
```
--
Detailed info:
$ apt policy netplan.io
netplan.io:
Installed: 0.106.1-7ubuntu0.22.04.2
Candidate: 0.106.1-7ubuntu0.22.04.2
Version table:
*** 0.106.1-7ubuntu0.22.04.2 500
500 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 Packages
100 /var/lib/dpkg/status
0.104-0ubuntu2 500
500 http://ports.ubuntu.com/ubuntu-ports jammy/main arm64 Packages
$ cat /etc/netplan/60-mlnx.yaml
network:
ethernets:
# ...
bridges:
br-provider:
openvswitch: {}
openvswitch:
external-ids:
# ...
ovn-cms-options: "card-serial-number=MT42424242N8,enable-chassis-as-gw"
# ...
renderer: networkd
version: 2
$ sudo ovs-vsctl list open
# ...
external_ids : {hostname=bf3, "netplan/external-ids/hostname"=bf3, "netplan/external-ids/ovn-cms-options"="card-serial-number=MT42424242N8,enable-chassis-as-gw", ovn-cms-options="card-serial-number=MT42424242N8,enable-chassis-as-gw", rundir="/var/run/openvswitch", system-id="bf3"}
# ...
ovs_version : "3.3.0"
# ...
system_type : ubuntu
system_version : "22.04"
$ sudo netplan apply
ovs-vsctl: card-serial-number=MT42424242N8,enable-chassis-as-gw: unexpected "=" parsing set of 1 or more strings
Traceback (most recent call last):
File "/usr/sbin/netplan", line 23, in <module>
netplan.main()
File "/usr/share/netplan/netplan/cli/core.py", line 56, in main
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 243, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 63, in run
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 243, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 169, in command_apply
NetplanApply.process_ovs_cleanup(config_manager, old_files_ovs, restart_ovs, exit_on_error)
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 411, in process_ovs_cleanup
apply_ovs_cleanup(config_manager, ovs_old, ovs_current)
File "/usr/share/netplan/netplan/cli/ovs.py", line 179, in apply_ovs_cleanup
clear_setting(t, iface, setting, val)
File "/usr/share/netplan/netplan/cli/ovs.py", line 107, in clear_setting
_del_dict(type, iface, split[1], split[2], value)
File "/usr/share/netplan/netplan/cli/ovs.py", line 60, in _del_dict
subprocess.check_call([OPENVSWITCH_OVS_VSCTL, 'remove', type, iface, column, key, _escape_colon(value)])
File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/ovs-vsctl', 'remove', 'Open_vSwitch', '.', 'external-ids', 'ovn-cms-options', 'card-serial-number=MT42424242N8,enable-chassis-as-gw']' returned non-zero exit status 1.
The OVS code that errors out during parsing:
https://github.com/openvswitch/ovs/blob/2f196c80e7165150d956fc50de0db58b8964ee2e/lib/ovsdb-data.c#L1623-L1633
https://github.com/openvswitch/ovs/blob/2f196c80e7165150d956fc50de0db58b8964ee2e/lib/ovsdb-data.c#L2561-L2567
To make netplan forget about the option and remove the values set:
sudo ovs-vsctl remove open . external-ids netplan/external-ids/ovn-cms-options
# after the command above ^ netplan apply works again
sudo ovs-vsctl remove Open_vSwitch . external-ids ovn-cms-options='"card-serial-number=MT42424242N8,enable-chassis-as-gw"'
To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/2070318/+subscriptions
More information about the foundations-bugs
mailing list