os-net-config throwing error when applying routes to interface/VLAN
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| os-net-config |
Critical
|
Dan Sneddon |
Bug Description
Fairly recent changes to os-net-config allow simple changes like IP, MTU, netmask, or routes to be changed on the fly without restarting the interface. However, route updates to interfaces and VLANs are still causing interfaces to be restarted due to an error.
The error encountered is:
Object "route add 172.33.9.0/26 via 172.20.1.59 dev vlan100" is unknown, try "ip help".
This can be duplicated by calling 'ip' with the parameters above passed as a string, such as:
# ip "route add 172.33.9.0/26 via 172.20.1.59 dev vlan100"
This appears to be due to an incorrect call to self.execute() where the command parameters are being passed as a string:
self.execute(
Instead, if we split the commands and pass it as a pointer to the list of args, that should work:
args = command.split()
self.execute(
Changed in os-net-config: | |
importance: | Undecided → Critical |
status: | New → In Progress |
assignee: | nobody → Dan Sneddon (dsneddon) |
Dan Sneddon (dsneddon) wrote : | #1 |
Fix proposed to branch: master
Review: https:/
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: master
commit e912b02c3bec61e
Author: Dan Sneddon <email address hidden>
Date: Fri Mar 8 15:46:34 2019 -0800
Fix os-net-config interface restarts when applying routes
There is a bug in the os-net-config code that applies updates to
existing routes. Instead of deleting routes that no longer exist
in the config and adding routes on the fly that do, the process
always fails so the interface gets restarted.
This change fixes the external call to "/sbin/ip", but also
fixes a bug where the name of the file containing the stored
routes was being passed incorrectly. This caused os-net-config
to always think there were no routes present, and to apply the
new route without deleting the old route. This can lead to an
error if the routes conflict.
Change-Id: I4315e9812c641a
Closes-bug: 1819212
Changed in os-net-config: | |
status: | In Progress → Fix Released |
Fix proposed to branch: stable/rocky
Review: https:/
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit 21dfd95bbe8268d
Author: Dan Sneddon <email address hidden>
Date: Fri Mar 8 15:46:34 2019 -0800
Fix os-net-config interface restarts when applying routes
There is a bug in the os-net-config code that applies updates to
existing routes. Instead of deleting routes that no longer exist
in the config and adding routes on the fly that do, the process
always fails so the interface gets restarted.
This change fixes the external call to "/sbin/ip", but also
fixes a bug where the name of the file containing the stored
routes was being passed incorrectly. This caused os-net-config
to always think there were no routes present, and to apply the
new route without deleting the old route. This can lead to an
error if the routes conflict.
Change-Id: I4315e9812c641a
Closes-bug: 1819212
(cherry picked from commit e912b02c3bec61e
tags: | added: in-stable-rocky |
Fix proposed to branch: stable/queens
Review: https:/
This issue was fixed in the openstack/
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit f26718f557f7bf8
Author: Dan Sneddon <email address hidden>
Date: Fri Mar 8 15:46:34 2019 -0800
Fix os-net-config interface restarts when applying routes
There is a bug in the os-net-config code that applies updates to
existing routes. Instead of deleting routes that no longer exist
in the config and adding routes on the fly that do, the process
always fails so the interface gets restarted.
This change fixes the external call to "/sbin/ip", but also
fixes a bug where the name of the file containing the stored
routes was being passed incorrectly. This caused os-net-config
to always think there were no routes present, and to apply the
new route without deleting the old route. This can lead to an
error if the routes conflict.
Change-Id: I4315e9812c641a
Closes-bug: 1819212
(cherry picked from commit e912b02c3bec61e
(cherry picked from commit 21dfd95bbe8268d
tags: | added: in-stable-queens |
This issue was fixed in the openstack/
This issue was fixed in the openstack/
It turns out that this is a compound bug with two code errors. The first is the command-line parameters being passed as a string instead of a pointer to the args. The second is an incorrect filename in checking existing routes. This code:
for interface in apply_routes:
logger. debug(' Applying routes for interface %s' % interface[0])
commands = self.iproute2_ route_commands( interface[ 0], interface[1])
is passing an interface name where it should be passing a filename. Here is the corrected code:
for interface in apply_routes:
logger. debug(' Applying routes for interface %s' % interface[0])
filename = self.root_dir + route_config_ path(interface[ 1])
commands = self.iproute2_ route_commands( interface[ 0], filename)