diff mbox series

[2/2] iotests: Test creating overlay when guest running

Message ID 20171215080446.10671-3-famz@redhat.com
State New
Headers show
Series block: Fix qemu-img creating overlay when guest running | expand

Commit Message

Fam Zheng Dec. 15, 2017, 8:04 a.m. UTC
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/qemu-iotests/153     | 4 ++++
 tests/qemu-iotests/153.out | 3 +++
 2 files changed, 7 insertions(+)

Comments

Eric Blake Dec. 15, 2017, 7:49 p.m. UTC | #1
On 12/15/2017 02:04 AM, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  tests/qemu-iotests/153     | 4 ++++
>  tests/qemu-iotests/153.out | 3 +++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
> index fa25eb24bd..22cb9c69a7 100755
> --- a/tests/qemu-iotests/153
> +++ b/tests/qemu-iotests/153
> @@ -32,6 +32,7 @@ _cleanup()
>  {
>      _cleanup_test_img
>      rm -f "${TEST_IMG}.base"
> +    rm -f "${TEST_IMG}.overlay"
>      rm -f "${TEST_IMG}.convert"

Conflicts with the series to clean up iotests to run in a per-test
directory with automatic cleanup, but the resolution is obvious.
Kevin Wolf Dec. 22, 2017, 12:47 p.m. UTC | #2
Am 15.12.2017 um 09:04 hat Fam Zheng geschrieben:
> Signed-off-by: Fam Zheng <famz@redhat.com>

The updated test case passes even without your fix. I can reproduce the
problem manually and verify that patch 1 fixes it, but the test case
seems ineffective.

And having a closer look at the test, this is because the running VM
opened its images read-only.

Kevin
diff mbox series

Patch

diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
index fa25eb24bd..22cb9c69a7 100755
--- a/tests/qemu-iotests/153
+++ b/tests/qemu-iotests/153
@@ -32,6 +32,7 @@  _cleanup()
 {
     _cleanup_test_img
     rm -f "${TEST_IMG}.base"
+    rm -f "${TEST_IMG}.overlay"
     rm -f "${TEST_IMG}.convert"
     rm -f "${TEST_IMG}.a"
     rm -f "${TEST_IMG}.b"
@@ -218,6 +219,9 @@  _send_qemu_cmd $QEMU_HANDLE \
 
 _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512'
 
+echo "Creating overlay with qemu-img when the guest is running should be allowed"
+_run_cmd $QEMU_IMG create -f $IMGFMT -b "${TEST_IMG}" "${TEST_IMG}.overlay"
+
 echo "Closing the other"
 _send_qemu_cmd $QEMU_HANDLE \
     "{ 'execute': 'human-monitor-command',
diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out
index 5b917b177c..8131180c49 100644
--- a/tests/qemu-iotests/153.out
+++ b/tests/qemu-iotests/153.out
@@ -390,6 +390,9 @@  _qemu_img_wrapper info TEST_DIR/t.qcow2
 _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512
 can't open device TEST_DIR/t.qcow2: Failed to get "write" lock
 Is another process using the image?
+Creating overlay with qemu-img when the guest is running should be allowed
+
+_qemu_img_wrapper create -f qcow2 -b TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.overlay
 Closing the other
 
 _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512