diff options
author | Tim Rozet <trozet@redhat.com> | 2017-09-08 12:06:44 -0400 |
---|---|---|
committer | Tim Rozet <trozet@redhat.com> | 2017-09-08 12:06:44 -0400 |
commit | 23be56d9f0801cbc065accf77a850bcc106c1e84 (patch) | |
tree | acce5c38c40eaee675bae8181d88b543716048fc | |
parent | 9ad2cd95cb811855cd6dbaf4789d9326ddd5b9b4 (diff) |
Restarts libvirtd after stopping firewalld
When stopping firewalld, libvirtd needs to be restarted in order for
libvirt to use/populate iptables with the NAT rules for the default
virsh network.
JIRA: APEX-510
Change-Id: Ia5b4515fd961baa70de58814e9eae4b397db28a7
Signed-off-by: Tim Rozet <trozet@redhat.com>
-rw-r--r-- | apex/virtual/virtual_utils.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apex/virtual/virtual_utils.py b/apex/virtual/virtual_utils.py index 4582dbc7..255d2c69 100644 --- a/apex/virtual/virtual_utils.py +++ b/apex/virtual/virtual_utils.py @@ -92,8 +92,11 @@ def host_setup(node): libvirt_sasl_username=False) # TODO(trozet): add support for firewalld - subprocess.call(['systemctl', 'stop', 'firewalld']) - + try: + subprocess.check_call(['systemctl', 'stop', 'firewalld']) + subprocess.check_call(['systemctl', 'restart', 'libvirtd']) + except subprocess.CalledProcessError: + logging.warning('Failed to stop firewalld and restart libvirtd') # iptables rule rule = iptc.Rule() rule.protocol = 'udp' |