Skip to content

Commit

Permalink
Merge pull request #106 from bkmetzler/rhel8.6
Browse files Browse the repository at this point in the history
Use nmcli connection reload to reload ifcfg files for NetworkManager
  • Loading branch information
bkmetzler committed May 18, 2022
2 parents 444db91 + 20e172d commit bfa43a0
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions novaagent/libs/centos.py
Expand Up @@ -192,12 +192,33 @@ def _restart_network_manager(self):
:rtype: Popen
:return: Popen of 'nmcli connection on'
"""
# We really don't care if we can't bring it down
try:
p = Popen(['nmcli', 'networking', 'off'])
p.wait()
except Exception:
pass
p = Popen(
['nmcli', 'connection', 'reload'],
stdout=PIPE,
stderr=PIPE,
stdin=PIPE
)
p.wait()
if p.returncode != 0:
log.error(
"Unable to reload network configurations from ifcfg "
"files with 'nmcli connection reload'"
)
return p

p = Popen(
['nmcli', 'networking', 'off'],
stdout=PIPE,
stderr=PIPE,
stdin=PIPE
)
p.wait()
if p.returncode != 0:
log.error(
"Unable to bring down networking with "
"'nmcli networking off'"
)
return p

p = Popen(
['nmcli', 'networking', 'on'],
Expand Down

0 comments on commit bfa43a0

Please sign in to comment.