diff --git a/qemu/tests/blockdev_commit_stop_cont.py b/qemu/tests/blockdev_commit_stop_cont.py new file mode 100644 index 0000000000000000000000000000000000000000..d6da526b3876c8b580b4411d227fb55a914a8904 --- /dev/null +++ b/qemu/tests/blockdev_commit_stop_cont.py @@ -0,0 +1,41 @@ +from provider import backup_utils +from provider import job_utils + +from provider.blockdev_commit_base import BlockDevCommitTest + + +class BlockdevCommitStopCont(BlockDevCommitTest): + + def commit_snapshots(self): + device = self.params.get("device_tag") + device_params = self.params.object_params(device) + snapshot_tags = device_params["snapshot_tags"].split() + self.device_node = self.get_node_name(device) + options = ["base-node", "top-node", "speed"] + arguments = self.params.copy_from_keys(options) + arguments["base-node"] = self.get_node_name(device) + arguments["top-node"] = self.get_node_name(snapshot_tags[-2]) + device = self.get_node_name(snapshot_tags[-1]) + commit_cmd = backup_utils.block_commit_qmp_cmd + cmd, args = commit_cmd(device, **arguments) + self.main_vm.pause() + self.main_vm.monitor.cmd(cmd, args) + job_id = args.get("job-id", device) + self.main_vm.resume() + job_utils.wait_until_block_job_completed(self.main_vm, job_id) + + +def run(test, params, env): + """ + Block commit base Test + + 1. boot guest with system disk + 2. create 4 snapshots and save file in each snapshot + 3. stop vm + 4. commit snapshot 3 to base + 5. resume vm + 6. verify files's md5 after commit + """ + + block_test = BlockdevCommitStopCont(test, params, env) + block_test.run_test() diff --git a/qemu/tests/cfg/blockdev_commit_stop_cont.cfg b/qemu/tests/cfg/blockdev_commit_stop_cont.cfg new file mode 100644 index 0000000000000000000000000000000000000000..bfb9b2896b913e054246915011d5c04910833989 --- /dev/null +++ b/qemu/tests/cfg/blockdev_commit_stop_cont.cfg @@ -0,0 +1,27 @@ +- blockdev_commit_stop_cont: + type = blockdev_commit_stop_cont + virt_test_type = qemu + only Linux + start_vm = yes + kill_vm = yes + storage_pools = default + storage_type_default = "directory" + storage_pool = default + snapshot_tags = sn1 sn2 sn3 sn4 + + image_name_sn1 = sn1 + image_format_sn1 = qcow2 + + image_name_sn2 = sn2 + image_format_sn2 = qcow2 + + image_name_sn3 = sn3 + image_format_sn3 = qcow2 + + image_name_sn4 = sn4 + image_format_sn4 = qcow2 + + device_tag = "image1" + rebase_mode = unsafe + mount_point = "/tmp" + qemu_force_use_drive_expression = no