qemu-kvm/kvm-iotests-Test-external-snapshot-with-VM-state.patch

190 lines
7.4 KiB
Diff
Raw Normal View History

* Fri Feb 14 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.2.0-10.el8 - kvm-i386-Resolve-CPU-models-to-v1-by-default.patch [bz#1779078 bz#1787291 bz#1779078 bz#1779078] - kvm-iotests-Support-job-complete-in-run_job.patch [bz#1781637] - kvm-iotests-Create-VM.blockdev_create.patch [bz#1781637] - kvm-block-Activate-recursively-even-for-already-active-n.patch [bz#1781637] - kvm-hmp-Allow-using-qdev-ID-for-qemu-io-command.patch [bz#1781637] - kvm-iotests-Test-external-snapshot-with-VM-state.patch [bz#1781637] - kvm-iotests.py-Let-wait_migration-wait-even-more.patch [bz#1781637] - kvm-blockdev-fix-coding-style-issues-in-drive_backup_pre.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-unify-qmp_drive_backup-and-drive-backup-tra.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-unify-qmp_blockdev_backup-and-blockdev-back.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-honor-bdrv_try_set_aio_context-context-requ.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-backup-top-Begin-drain-earlier.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-block-backup-top-Don-t-acquire-context-while-droppin.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-Acquire-AioContext-on-dirty-bitmap-function.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-Return-bs-to-the-proper-context-on-snapshot.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-iotests-Test-handling-of-AioContexts-with-some-block.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-target-arm-monitor-query-cpu-model-expansion-crashed.patch [bz#1801320] - kvm-docs-arm-cpu-features-Make-kvm-no-adjvtime-comment-c.patch [bz#1801320] - Resolves: bz#1745606 (Qemu hang when do incremental live backup in transaction mode without bitmap) - Resolves: bz#1746217 (Src qemu hang when do storage vm migration during guest installation) - Resolves: bz#1773517 (Src qemu hang when do storage vm migration with dataplane enable) - Resolves: bz#1779036 (Qemu coredump when do snapshot in transaction mode with one snapshot path not exist) - Resolves: bz#1779078 (RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm)) - Resolves: bz#1781637 (qemu crashed when do mem and disk snapshot) - Resolves: bz#1782111 (Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)) - Resolves: bz#1782175 (Qemu core dump when add persistent bitmap(data plane enable)) - Resolves: bz#1783965 (Qemu core dump when do backup with sync: bitmap and no bitmap provided) - Resolves: bz#1787291 (RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm) [rhel-8.1.0.z]) - Resolves: bz#1801320 (aarch64: backport query-cpu-model-expansion and adjvtime document fixes)
2020-02-14 03:03:11 +00:00
From 38b0cff9703fc740c30f5874973ac1be88f94d9f Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Fri, 7 Feb 2020 11:24:03 +0000
Subject: [PATCH 06/18] iotests: Test external snapshot with VM state
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <20200207112404.25198-6-kwolf@redhat.com>
Patchwork-id: 93752
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 5/6] iotests: Test external snapshot with VM state
Bugzilla: 1781637
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
This tests creating an external snapshot with VM state (which results in
an active overlay over an inactive backing file, which is also the root
node of an inactive BlockBackend), re-activating the images and
performing some operations to test that the re-activation worked as
intended.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit f62f08ab7a9d902da70078992248ec5c98f652ad)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
tests/qemu-iotests/280 | 83 ++++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/280.out | 50 ++++++++++++++++++++++++++++
tests/qemu-iotests/group | 1 +
3 files changed, 134 insertions(+)
create mode 100755 tests/qemu-iotests/280
create mode 100644 tests/qemu-iotests/280.out
diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280
new file mode 100755
index 0000000..0b1fa8e
--- /dev/null
+++ b/tests/qemu-iotests/280
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2019 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Creator/Owner: Kevin Wolf <kwolf@redhat.com>
+#
+# Test migration to file for taking an external snapshot with VM state.
+
+import iotests
+import os
+
+iotests.verify_image_format(supported_fmts=['qcow2'])
+iotests.verify_protocol(supported=['file'])
+iotests.verify_platform(['linux'])
+
+with iotests.FilePath('base') as base_path , \
+ iotests.FilePath('top') as top_path, \
+ iotests.VM() as vm:
+
+ iotests.qemu_img_log('create', '-f', iotests.imgfmt, base_path, '64M')
+
+ iotests.log('=== Launch VM ===')
+ vm.add_object('iothread,id=iothread0')
+ vm.add_blockdev('file,filename=%s,node-name=base-file' % (base_path))
+ vm.add_blockdev('%s,file=base-file,node-name=base-fmt' % (iotests.imgfmt))
+ vm.add_device('virtio-blk,drive=base-fmt,iothread=iothread0,id=vda')
+ vm.launch()
+
+ vm.enable_migration_events('VM')
+
+ iotests.log('\n=== Migrate to file ===')
+ vm.qmp_log('migrate', uri='exec:cat > /dev/null')
+
+ with iotests.Timeout(3, 'Migration does not complete'):
+ vm.wait_migration()
+
+ iotests.log('\nVM is now stopped:')
+ iotests.log(vm.qmp('query-migrate')['return']['status'])
+ vm.qmp_log('query-status')
+
+ iotests.log('\n=== Create a snapshot of the disk image ===')
+ vm.blockdev_create({
+ 'driver': 'file',
+ 'filename': top_path,
+ 'size': 0,
+ })
+ vm.qmp_log('blockdev-add', node_name='top-file',
+ driver='file', filename=top_path,
+ filters=[iotests.filter_qmp_testfiles])
+
+ vm.blockdev_create({
+ 'driver': iotests.imgfmt,
+ 'file': 'top-file',
+ 'size': 1024 * 1024,
+ })
+ vm.qmp_log('blockdev-add', node_name='top-fmt',
+ driver=iotests.imgfmt, file='top-file')
+
+ vm.qmp_log('blockdev-snapshot', node='base-fmt', overlay='top-fmt')
+
+ iotests.log('\n=== Resume the VM and simulate a write request ===')
+ vm.qmp_log('cont')
+ iotests.log(vm.hmp_qemu_io('-d vda/virtio-backend', 'write 4k 4k'))
+
+ iotests.log('\n=== Commit it to the backing file ===')
+ result = vm.qmp_log('block-commit', job_id='job0', auto_dismiss=False,
+ device='top-fmt', top_node='top-fmt',
+ filters=[iotests.filter_qmp_testfiles])
+ if 'return' in result:
+ vm.run_job('job0')
diff --git a/tests/qemu-iotests/280.out b/tests/qemu-iotests/280.out
new file mode 100644
index 0000000..5d382fa
--- /dev/null
+++ b/tests/qemu-iotests/280.out
@@ -0,0 +1,50 @@
+Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16
+
+=== Launch VM ===
+Enabling migration QMP events on VM...
+{"return": {}}
+
+=== Migrate to file ===
+{"execute": "migrate", "arguments": {"uri": "exec:cat > /dev/null"}}
+{"return": {}}
+{"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+
+VM is now stopped:
+completed
+{"execute": "query-status", "arguments": {}}
+{"return": {"running": false, "singlestep": false, "status": "postmigrate"}}
+
+=== Create a snapshot of the disk image ===
+{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-top", "size": 0}}}
+{"return": {}}
+{"execute": "job-dismiss", "arguments": {"id": "job0"}}
+{"return": {}}
+
+{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-top", "node-name": "top-file"}}
+{"return": {}}
+{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "qcow2", "file": "top-file", "size": 1048576}}}
+{"return": {}}
+{"execute": "job-dismiss", "arguments": {"id": "job0"}}
+{"return": {}}
+
+{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": "top-file", "node-name": "top-fmt"}}
+{"return": {}}
+{"execute": "blockdev-snapshot", "arguments": {"node": "base-fmt", "overlay": "top-fmt"}}
+{"return": {}}
+
+=== Resume the VM and simulate a write request ===
+{"execute": "cont", "arguments": {}}
+{"return": {}}
+{"return": ""}
+
+=== Commit it to the backing file ===
+{"execute": "block-commit", "arguments": {"auto-dismiss": false, "device": "top-fmt", "job-id": "job0", "top-node": "top-fmt"}}
+{"return": {}}
+{"execute": "job-complete", "arguments": {"id": "job0"}}
+{"return": {}}
+{"data": {"device": "job0", "len": 65536, "offset": 65536, "speed": 0, "type": "commit"}, "event": "BLOCK_JOB_READY", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+{"data": {"device": "job0", "len": 65536, "offset": 65536, "speed": 0, "type": "commit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+{"execute": "job-dismiss", "arguments": {"id": "job0"}}
+{"return": {}}
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 06cc734..01301cd 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -286,3 +286,4 @@
272 rw
273 backing quick
277 rw quick
+280 rw migration quick
--
1.8.3.1