All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: [PULL 19/30] iotests: Backup with different source/target size
Date: Fri,  8 May 2020 14:41:24 +0200	[thread overview]
Message-ID: <20200508124135.252565-20-kwolf@redhat.com> (raw)
In-Reply-To: <20200508124135.252565-1-kwolf@redhat.com>

This tests that the backup job catches situations where the target node
has a different size than the source node. It must also forbid resize
operations when the job is already running.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200430142755.315494-5-kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/055     | 41 ++++++++++++++++++++++++++++++++++++--
 tests/qemu-iotests/055.out |  4 ++--
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055
index e250f798f9..7f8e630de3 100755
--- a/tests/qemu-iotests/055
+++ b/tests/qemu-iotests/055
@@ -48,8 +48,10 @@ class TestSingleDrive(iotests.QMPTestCase):
     def setUp(self):
         qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(image_len))
 
-        self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
-        self.vm.add_drive(blockdev_target_img, interface="none")
+        self.vm = iotests.VM()
+        self.vm.add_drive('blkdebug::' + test_img, 'node-name=source')
+        self.vm.add_drive(blockdev_target_img, 'node-name=target',
+                          interface="none")
         if iotests.qemu_default_machine == 'pc':
             self.vm.add_drive(None, 'media=cdrom', 'ide')
         self.vm.launch()
@@ -112,6 +114,41 @@ class TestSingleDrive(iotests.QMPTestCase):
     def test_pause_blockdev_backup(self):
         self.do_test_pause('blockdev-backup', 'drive1', blockdev_target_img)
 
+    def do_test_resize_blockdev_backup(self, device, node):
+        def pre_finalize():
+            result = self.vm.qmp('block_resize', device=device, size=65536)
+            self.assert_qmp(result, 'error/class', 'GenericError')
+
+            result = self.vm.qmp('block_resize', node_name=node, size=65536)
+            self.assert_qmp(result, 'error/class', 'GenericError')
+
+        result = self.vm.qmp('blockdev-backup', job_id='job0', device='drive0',
+                             target='drive1', sync='full', auto_finalize=False,
+                             auto_dismiss=False)
+        self.assert_qmp(result, 'return', {})
+
+        self.vm.run_job('job0', auto_finalize=False, pre_finalize=pre_finalize)
+
+    def test_source_resize_blockdev_backup(self):
+        self.do_test_resize_blockdev_backup('drive0', 'source')
+
+    def test_target_resize_blockdev_backup(self):
+        self.do_test_resize_blockdev_backup('drive1', 'target')
+
+    def do_test_target_size(self, size):
+        result = self.vm.qmp('block_resize', device='drive1', size=size)
+        self.assert_qmp(result, 'return', {})
+
+        result = self.vm.qmp('blockdev-backup', job_id='job0', device='drive0',
+                             target='drive1', sync='full')
+        self.assert_qmp(result, 'error/class', 'GenericError')
+
+    def test_small_target(self):
+        self.do_test_target_size(image_len // 2)
+
+    def test_large_target(self):
+        self.do_test_target_size(image_len * 2)
+
     def test_medium_not_found(self):
         if iotests.qemu_default_machine != 'pc':
             return
diff --git a/tests/qemu-iotests/055.out b/tests/qemu-iotests/055.out
index 5c26d15c0d..0a5e9583a4 100644
--- a/tests/qemu-iotests/055.out
+++ b/tests/qemu-iotests/055.out
@@ -1,5 +1,5 @@
-....................................
+........................................
 ----------------------------------------------------------------------
-Ran 36 tests
+Ran 40 tests
 
 OK
-- 
2.25.3



  parent reply	other threads:[~2020-05-08 12:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 12:41 [PULL 00/30] Block layer patches Kevin Wolf
2020-05-08 12:41 ` [PULL 01/30] iotests: handle tmpfs Kevin Wolf
2020-05-08 12:41 ` [PULL 02/30] iotests/082: require bochs Kevin Wolf
2020-05-08 12:41 ` [PULL 03/30] iotests/148: use skip_if_unsupported Kevin Wolf
2020-05-08 12:41 ` [PULL 04/30] iotests/041: drop self.assert_no_active_block_jobs() Kevin Wolf
2020-05-08 12:41 ` [PULL 05/30] iotests/055: refactor compressed backup to vmdk Kevin Wolf
2020-05-08 12:41 ` [PULL 06/30] iotests/055: skip vmdk target tests if vmdk is not whitelisted Kevin Wolf
2020-05-08 12:41 ` [PULL 07/30] iotests/109: mark required formats as required to support whitelisting Kevin Wolf
2020-05-08 12:41 ` [PULL 08/30] iotests/113: mark bochs " Kevin Wolf
2020-05-08 12:41 ` [PULL 09/30] qcow2: Avoid integer wraparound in qcow2_co_truncate() Kevin Wolf
2020-05-08 12:41 ` [PULL 10/30] vmdk: Rename VmdkMetaData.valid to new_allocation Kevin Wolf
2020-05-08 12:41 ` [PULL 11/30] vmdk: Fix zero cluster allocation Kevin Wolf
2020-05-08 12:41 ` [PULL 12/30] vmdk: Fix partial overwrite of zero cluster Kevin Wolf
2020-05-08 12:41 ` [PULL 13/30] vmdk: Don't update L2 table for zero write on " Kevin Wolf
2020-05-08 12:41 ` [PULL 14/30] vmdk: Flush only once in vmdk_L2update() Kevin Wolf
2020-05-08 12:41 ` [PULL 15/30] iotests: vmdk: Enable zeroed_grained=on by default Kevin Wolf
2020-05-08 12:41 ` [PULL 16/30] iotests/283: Use consistent size for source and target Kevin Wolf
2020-05-08 12:41 ` [PULL 17/30] backup: Improve error for bdrv_getlength() failure Kevin Wolf
2020-05-08 12:41 ` [PULL 18/30] backup: Make sure that source and target size match Kevin Wolf
2020-05-08 12:41 ` Kevin Wolf [this message]
2020-05-08 12:41 ` [PULL 20/30] iotests/055: Use cache.no-flush for vmdk target Kevin Wolf
2020-05-08 12:41 ` [PULL 21/30] qcow2: Fix preallocation on block devices Kevin Wolf
2020-05-08 12:41 ` [PULL 22/30] gluster: Drop useless has_zero_init callback Kevin Wolf
2020-05-08 12:41 ` [PULL 23/30] file-win32: Support BDRV_REQ_ZERO_WRITE for truncate Kevin Wolf
2020-05-08 12:41 ` [PULL 24/30] nfs: " Kevin Wolf
2020-05-08 12:41 ` [PULL 25/30] rbd: " Kevin Wolf
2020-05-08 12:41 ` [PULL 26/30] sheepdog: " Kevin Wolf
2020-05-08 12:41 ` [PULL 27/30] ssh: " Kevin Wolf
2020-05-08 12:41 ` [PULL 28/30] parallels: Rework truncation logic Kevin Wolf
2020-05-08 12:41 ` [PULL 29/30] vhdx: " Kevin Wolf
2020-05-08 12:41 ` [PULL 30/30] block: Drop unused .bdrv_has_zero_init_truncate Kevin Wolf
2020-05-08 15:10 ` [PULL 00/30] Block layer patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508124135.252565-20-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.