Restarts libvirtd after stopping firewalld 11/41411/1
authorTim Rozet <trozet@redhat.com>
Fri, 8 Sep 2017 16:06:44 +0000 (12:06 -0400)
committerTim Rozet <trozet@redhat.com>
Fri, 8 Sep 2017 16:06:44 +0000 (12:06 -0400)
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>
apex/virtual/virtual_utils.py

index 4582dbc..255d2c6 100644 (file)
@@ -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'