From f3834c37a88f9df633dabcb2009ff702ce7966e9 Mon Sep 17 00:00:00 2001 From: Aihua Liang Date: Tue, 3 Sep 2024 11:23:40 +0800 Subject: [PATCH] blockdev_snapshot_data_file: support raw elimination When applied raw format elimination, can't get the correct filename for the data_file raw image. Signed-off-by: Aihua Liang --- qemu/tests/blockdev_snapshot_data_file.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qemu/tests/blockdev_snapshot_data_file.py b/qemu/tests/blockdev_snapshot_data_file.py index bb8001979f..7238ef43c3 100644 --- a/qemu/tests/blockdev_snapshot_data_file.py +++ b/qemu/tests/blockdev_snapshot_data_file.py @@ -2,6 +2,7 @@ from virttest import error_context from virttest import data_dir +from virttest.qemu_capabilities import Flags from provider import backup_utils from provider.blockdev_snapshot_base import BlockDevSnapshotTest @@ -32,8 +33,14 @@ def check_data_file_in_block_info(self): data_file_tag = self.params["image_data_file_%s" % self.snapshot_tag] data_file_image = self.get_image_by_tag(data_file_tag) data_file = eval(filename.lstrip("json:"))["data-file"] - if data_file["file"]["filename"] != data_file_image.image_filename: - self.test.fail("data-file info is not as expected: %s" % data_file_image) + if self.main_vm.check_capability( + Flags.BLOCKJOB_BACKING_MASK_PROTOCOL): + data_filename = data_file["filename"] + else: + data_filename = data_file["file"]["filename"] + if data_filename != data_file_image.image_filename: + self.test.fail("data-file info is not as expected: %s" + % data_file_image.image_filename) break else: self.test.fail("Data-file option not included in block info")