Blame SOURCES/kvm-qemu-iotests-Test-for-loading-VM-state-from-qcow2.patch

218e99
From 50513a8391e05285c27241e1cf781ff1370972bf Mon Sep 17 00:00:00 2001
218e99
From: Max Reitz <mreitz@redhat.com>
218e99
Date: Fri, 1 Nov 2013 14:23:17 +0100
218e99
Subject: [PATCH 29/81] qemu-iotests: Test for loading VM state from qcow2
218e99
218e99
RH-Author: Max Reitz <mreitz@redhat.com>
218e99
Message-id: <1383315797-30938-4-git-send-email-mreitz@redhat.com>
218e99
Patchwork-id: 55218
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH 3/3] qemu-iotests: Test for loading VM state from qcow2
218e99
Bugzilla: 1025740
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
218e99
218e99
BZ: 1025740
218e99
218e99
Add a test for saving a VM state from a qcow2 image and loading it back
218e99
(with having restarted qemu in between); this should work without any
218e99
problems.
218e99
218e99
Signed-off-by: Max Reitz <mreitz@redhat.com>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
(cherry picked from commit ab6f2bbb2871db8a7ed2457328e864cdf2e2fc82)
218e99
218e99
Signed-off-by: Max Reitz <mreitz@redhat.com>
218e99
218e99
Conflicts:
218e99
	tests/qemu-iotests/group
218e99
218e99
Conflicts because upstream contains more test in the group file.
218e99
---
218e99
 tests/qemu-iotests/068     | 65 ++++++++++++++++++++++++++++++++++++++++++++++
218e99
 tests/qemu-iotests/068.out | 11 ++++++++
218e99
 tests/qemu-iotests/group   |  1 +
218e99
 3 files changed, 77 insertions(+)
218e99
 create mode 100755 tests/qemu-iotests/068
218e99
 create mode 100644 tests/qemu-iotests/068.out
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 tests/qemu-iotests/068     |   65 ++++++++++++++++++++++++++++++++++++++++++++
218e99
 tests/qemu-iotests/068.out |   11 +++++++
218e99
 tests/qemu-iotests/group   |    1 +
218e99
 3 files changed, 77 insertions(+), 0 deletions(-)
218e99
 create mode 100755 tests/qemu-iotests/068
218e99
 create mode 100644 tests/qemu-iotests/068.out
218e99
218e99
diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
218e99
new file mode 100755
218e99
index 0000000..b72e555
218e99
--- /dev/null
218e99
+++ b/tests/qemu-iotests/068
218e99
@@ -0,0 +1,65 @@
218e99
+#!/bin/bash
218e99
+#
218e99
+# Test case for loading a saved VM state from a qcow2 image
218e99
+#
218e99
+# Copyright (C) 2013 Red Hat, Inc.
218e99
+#
218e99
+# This program is free software; you can redistribute it and/or modify
218e99
+# it under the terms of the GNU General Public License as published by
218e99
+# the Free Software Foundation; either version 2 of the License, or
218e99
+# (at your option) any later version.
218e99
+#
218e99
+# This program is distributed in the hope that it will be useful,
218e99
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
218e99
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
218e99
+# GNU General Public License for more details.
218e99
+#
218e99
+# You should have received a copy of the GNU General Public License
218e99
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
218e99
+#
218e99
+
218e99
+# creator
218e99
+owner=mreitz@redhat.com
218e99
+
218e99
+seq="$(basename $0)"
218e99
+echo "QA output created by $seq"
218e99
+
218e99
+here="$PWD"
218e99
+tmp=/tmp/$$
218e99
+status=1	# failure is the default!
218e99
+
218e99
+_cleanup()
218e99
+{
218e99
+	_cleanup_test_img
218e99
+}
218e99
+trap "_cleanup; exit \$status" 0 1 2 3 15
218e99
+
218e99
+# get standard environment, filters and checks
218e99
+. ./common.rc
218e99
+. ./common.filter
218e99
+
218e99
+# This tests qocw2-specific low-level functionality
218e99
+_supported_fmt qcow2
218e99
+_supported_proto generic
218e99
+_supported_os Linux
218e99
+
218e99
+IMGOPTS="compat=1.1"
218e99
+IMG_SIZE=128K
218e99
+
218e99
+echo
218e99
+echo "=== Saving and reloading a VM state to/from a qcow2 image ==="
218e99
+echo
218e99
+_make_test_img $IMG_SIZE
218e99
+# Give qemu some time to boot before saving the VM state
218e99
+bash -c 'sleep 1; echo -e "savevm 0\nquit"' |\
218e99
+    $QEMU -nographic -monitor stdio -serial none -hda "$TEST_IMG" |\
218e99
+    _filter_qemu
218e99
+# Now try to continue from that VM state (this should just work)
218e99
+echo quit |\
218e99
+    $QEMU -nographic -monitor stdio -serial none -hda "$TEST_IMG" -loadvm 0 |\
218e99
+    _filter_qemu
218e99
+
218e99
+# success, all done
218e99
+echo "*** done"
218e99
+rm -f $seq.full
218e99
+status=0
218e99
diff --git a/tests/qemu-iotests/068.out b/tests/qemu-iotests/068.out
218e99
new file mode 100644
218e99
index 0000000..abe35a9
218e99
--- /dev/null
218e99
+++ b/tests/qemu-iotests/068.out
218e99
@@ -0,0 +1,11 @@
218e99
+QA output created by 068
218e99
+
218e99
+=== Saving and reloading a VM state to/from a qcow2 image ===
218e99
+
218e99
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 
218e99
+QEMU X.Y.Z monitor - type 'help' for more information
218e99
+(qemu) s?[K?[Dsa?[K?[D?[Dsav?[K?[D?[D?[Dsave?[K?[D?[D?[D?[Dsavev?[K?[D?[D?[D?[D?[Dsavevm?[K?[D?[D?[D?[D?[D?[Dsavevm ?[K?[D?[D?[D?[D?[D?[D?[Dsavevm 0?[K
218e99
+(qemu) q?[K?[Dqu?[K?[D?[Dqui?[K?[D?[D?[Dquit?[K
218e99
+QEMU X.Y.Z monitor - type 'help' for more information
218e99
+(qemu) q?[K?[Dqu?[K?[D?[Dqui?[K?[D?[D?[Dquit?[K
218e99
+*** done
218e99
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
218e99
index 3b1d042..1017a19 100644
218e99
--- a/tests/qemu-iotests/group
218e99
+++ b/tests/qemu-iotests/group
218e99
@@ -61,3 +61,4 @@
218e99
 052 rw auto backing
218e99
 053 rw auto
218e99
 059 rw auto
218e99
+068 rw auto
218e99
-- 
218e99
1.7.1
218e99