Skip to content

Commit

Permalink
Merge pull request autotest#5460 from smitterl/fix_domfstrim
Browse files Browse the repository at this point in the history
domfstrim: grant guest agent SELinux permissions
  • Loading branch information
dzhengfy authored Mar 12, 2024
2 parents 8d128ee + 387bc56 commit 3b8809c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libvirt/tests/src/virsh_cmd/domain/virsh_domfstrim.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
logging = log.getLogger('avocado.' + __name__)


def try_set_selinux_label(session):
"""
Per default selinux will block the guest agent
from trimming the device. Try to set label for this test
:param session: VM console session
"""
session.cmd_output("setsebool -P virt_qemu_ga_read_nonsecurity_files on")


def run(test, params, env):
"""
Test domfstrim command, make sure that all supported options work well
Expand Down Expand Up @@ -100,6 +110,7 @@ def recompose_xml(vm_name, scsi_disk):
if not vm.is_alive():
vm.start()
session = vm.wait_for_login()
try_set_selinux_label(session)
bef_list = session.cmd_output("fdisk -l|grep ^/dev|"
"cut -d' ' -f1").split("\n")
session.close()
Expand Down

0 comments on commit 3b8809c

Please sign in to comment.