From c9506d2b2bb6f2376041314287f8cf010e6204f1 Mon Sep 17 00:00:00 2001 From: Meina Li Date: Thu, 21 Sep 2023 03:53:06 -0400 Subject: [PATCH] npiv: update the check result of negative test Signed-off-by: Meina Li --- libvirt/tests/src/npiv/npiv_virtual_disk.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libvirt/tests/src/npiv/npiv_virtual_disk.py b/libvirt/tests/src/npiv/npiv_virtual_disk.py index 445df683c9..53ec9fc695 100644 --- a/libvirt/tests/src/npiv/npiv_virtual_disk.py +++ b/libvirt/tests/src/npiv/npiv_virtual_disk.py @@ -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)