Skip to content

Commit

Permalink
Merge pull request #5773 from yafu-1/unix_sock
Browse files Browse the repository at this point in the history
Connect to virtqemud socket file with modular daemon mode
  • Loading branch information
chloerh authored Jul 15, 2024
2 parents edf7e56 + 1db0d5a commit 0230c4b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libvirt/tests/src/daemon/conf_file/libvirtd_conf/unix_sock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from virttest import data_dir
from virttest import utils_config
from virttest import utils_libvirtd
from virttest import utils_split_daemons

from virttest import libvirt_version

Expand Down Expand Up @@ -95,6 +96,7 @@ def check_unix_sock(group, perms, path, readonly=False):

result = virsh.net_define(xml_path, uri=uri, ignore_status=True)
logging.debug('Result of virsh test run is:\n %s' % result)
process.run("ls -lZ /run/libvirt/", shell=True, ignore_status=True)
try:
if result.exit_status and not readonly:
logging.error('Error encountered when running virsh net-define '
Expand Down Expand Up @@ -123,12 +125,16 @@ def check_all_unix_sock(group, ro_perms, rw_perms, root_path):
:param root_path: Absolute path of the directory that target file in.
:return : True if success or False if any test fails.
"""
rw_path = os.path.join(root_path, 'libvirt-sock')
if utils_split_daemons.is_modular_daemon():
rw_path = os.path.join(root_path, 'virtqemud-sock')
ro_path = os.path.join(root_path, 'virtqemud-sock-ro')
else:
rw_path = os.path.join(root_path, 'libvirt-sock')
ro_path = os.path.join(root_path, 'libvirt-sock-ro')
logging.debug("Checking read-write socket file %s" % rw_path)
if not check_unix_sock(group, rw_perms, rw_path):
return False

ro_path = os.path.join(root_path, 'libvirt-sock-ro')
logging.debug("Checking read-only socket file %s" % ro_path)
return check_unix_sock(group, ro_perms, ro_path, readonly=True)

Expand Down

0 comments on commit 0230c4b

Please sign in to comment.