Skip to content

Commit

Permalink
npiv: update the check result of negative test
Browse files Browse the repository at this point in the history
Signed-off-by: Meina Li <[email protected]>
  • Loading branch information
meinaLi committed Sep 21, 2023
1 parent 3d1a6fb commit 198640c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libvirt/tests/src/npiv/npiv_virtual_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,13 @@ def run(test, params, env):
# Check disk in VM
output = session.cmd_status_output('mkfs.ext4 -F %s' % new_disk)
logging.debug("mkfs.ext4 the disk in vm, result: %s", output[1])
if not check_vm_disk(session, new_disk, readonly):
raise exceptions.TestFail("Failed check the disk in vm.")
if readonly == "yes":
if "Operation not permitted" in str(output):
logging.debug("Can't write readonly disk in vm")
return
else:
test.fail("A readonly virtual disk operated as "
"a non-readonly disk.")
session.cmd_status_output('umount %s' % new_disk)
# Detach disk
dev_detach_status = virsh.detach_device(vm_name, disk_xml, debug=True)
Expand Down

0 comments on commit 198640c

Please sign in to comment.