From f061d62c162281839adbed7ab09171fca8672e0c Mon Sep 17 00:00:00 2001 From: lcheng Date: Wed, 27 Sep 2023 11:43:00 +0800 Subject: [PATCH] Debug unix connection case Signed-off-by: lcheng --- virttest/utils_conn.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/virttest/utils_conn.py b/virttest/utils_conn.py index 37fa5fef78..9fb8ee8d8a 100644 --- a/virttest/utils_conn.py +++ b/virttest/utils_conn.py @@ -11,6 +11,7 @@ from aexpect import remote from avocado.core import exceptions +from avocado.utils import distro from avocado.utils import path from avocado.utils import process @@ -1948,8 +1949,8 @@ def conn_recover(self): runner("systemctl start virtqemud") else: runner("systemctl daemon-reload") - runner("systemctl stop libvirtd.socket") runner("systemctl stop libvirtd") + runner("systemctl stop libvirtd.socket") runner("systemctl start libvirtd.socket") runner("systemctl reset-failed libvirtd") runner("systemctl start libvirtd") @@ -2139,10 +2140,20 @@ def conn_setup(self): runner("systemctl daemon-reload") runner("systemctl stop libvirtd") runner("systemctl stop libvirtd.socket") - runner("systemctl start libvirtd.socket") + runner("systemctl start libvirtd.socket", ignore_status=True) + runner("journalctl -u libvirtd.socket", ignore_status=True) utils_misc.wait_for( lambda: process.system('systemctl status libvirtd.socket', ignore_status=True, shell=True) == 0, 10) + if process.system('systemctl status libvirtd.socket', ignore_status=True, shell=True): + # On RHEL 8, SELinux is preventing systemd from create + # access on the sock_file libvirt-sock. We can generate + # a local policy module to allow this access. + if distro.detect().name == 'rhel' and int(distro.detect().version) == 8: + process.run("ausearch -c 'systemd' --raw | audit2allow -M my-systemd", + ignore_status=True, shell=True) + process.run("semodule -X 300 -i my-systemd.pp", ignore_status=True, shell=True) + runner("systemctl start libvirtd.socket") runner("systemctl reset-failed libvirtd") runner("systemctl start libvirtd") current_session.close()