ifcfg: don't restart ovs if --no-activate is specified

When --no-activate is specified, there is a chance that
openvswitch service will still be restarted if dpdk port
configuration file is changed. This adds a condition to
check activate and restart openvswitch only if activate
is true.

Change-Id: Ia5a6d04eb26cc3a6e10caacb8256d6e2d183239e
Closes-Bug: #1751955
(cherry picked from commit 9e3436262d)
This commit is contained in:
Zenghui Shi 2018-02-26 19:45:22 +08:00
parent 2c7c5e66a7
commit 91e3ac46ef
1 changed files with 9 additions and 9 deletions

View File

@ -948,15 +948,15 @@ class IfcfgNetConfig(os_net_config.NetConfig):
for oldname, newname in self.renamed_interfaces.iteritems():
self.ifrename(oldname, newname)
# DPDK initialization is done before running os-net-config, to make
# the DPDK ports available when enabled. DPDK Hotplug support is
# supported only in OvS 2.7 version. Until then, OvS needs to be
# restarted after adding a DPDK port. This change will be removed on
# migration to OvS 2.7 where DPDK Hotplug support is available.
if ovs_needs_restart:
msg = "Restart openvswitch"
self.execute(msg, '/usr/bin/systemctl',
'restart', 'openvswitch')
# DPDK initialization is done before running os-net-config, to make
# the DPDK ports available when enabled. DPDK Hotplug support is
# supported only in OvS 2.7 version. Until then, OvS needs to be
# restarted after adding a DPDK port. This change will be removed
# on migration to OvS 2.7 where DPDK Hotplug support is available.
if ovs_needs_restart:
msg = "Restart openvswitch"
self.execute(msg, '/usr/bin/systemctl',
'restart', 'openvswitch')
for location, data in update_files.iteritems():
self.write_config(location, data)