From 2495c9ddaa0e7bde9b93e62b02ac146791ff1f21 Mon Sep 17 00:00:00 2001 From: Bob Fournier Date: Mon, 24 Sep 2018 16:30:14 -0400 Subject: [PATCH] Restart ivs/nvfswitch after config file is updated This change - https://review.openstack.org/#/c/561609/, removed the restart of ivs/nvfswitch to avoid network interruptions. However, when a change is made to the config file then ivs/nvfswitch must be restarted in order to pick up the change. Closes-Bug: #1794182 Change-Id: I8f879072799cef29c09ddc74bd71069dd168ec88 --- os_net_config/impl_ifcfg.py | 12 ++++++++++-- ...-ivs-nvfswitch-after-change-0825ea78aae8f138.yaml | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/restart-ivs-nvfswitch-after-change-0825ea78aae8f138.yaml diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 00f5530a..9c8c1f2a 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -1110,13 +1110,21 @@ class IfcfgNetConfig(os_net_config.NetConfig): if ivs_uplinks or ivs_interfaces: location = ivs_config_path() data = self.generate_ivs_config(ivs_uplinks, ivs_interfaces) - self.write_config(location, data) + if (utils.diff(location, data)): + self.write_config(location, data) + msg = "Restart ivs" + self.execute(msg, '/usr/bin/systemctl', + 'restart', 'ivs') if nfvswitch_interfaces or nfvswitch_internal_ifaces: location = nfvswitch_config_path() data = self.generate_nfvswitch_config(nfvswitch_interfaces, nfvswitch_internal_ifaces) - self.write_config(location, data) + if (utils.diff(location, data)): + self.write_config(location, data) + msg = "Restart nfvswitch" + self.execute(msg, '/usr/bin/systemctl', + 'restart', 'nfvswitch') if activate: for linux_team in restart_linux_teams: diff --git a/releasenotes/notes/restart-ivs-nvfswitch-after-change-0825ea78aae8f138.yaml b/releasenotes/notes/restart-ivs-nvfswitch-after-change-0825ea78aae8f138.yaml new file mode 100644 index 00000000..57fd2b72 --- /dev/null +++ b/releasenotes/notes/restart-ivs-nvfswitch-after-change-0825ea78aae8f138.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - When the ivs interface (or nfvswitch) configuration changes, + ivs (or nvfswitch) needs to be restarted in order to pick + up the new configuration.