From 23be56d9f0801cbc065accf77a850bcc106c1e84 Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Fri, 8 Sep 2017 12:06:44 -0400 Subject: 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 --- apex/virtual/virtual_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'apex/virtual') 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' -- cgit 1.2.3-korg