All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vladimir.sementsov-ogievskiy@openvz.org>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, hreitz@redhat.com, vsementsov@openvz.org,
	v.sementsov-og@mail.ru, qemu-devel@nongnu.org
Subject: [PATCH v5 32/45] iotests: add blockdev-add-transaction
Date: Thu, 31 Mar 2022 00:28:49 +0300	[thread overview]
Message-ID: <20220330212902.590099-33-vsementsov@openvz.org> (raw)
In-Reply-To: <20220330212902.590099-1-vsementsov@openvz.org>

Add a test for transaction support of blockdev-add.

Test is format-agnostic, so limit it to qcow2 to avoid extra test runs.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org>
---
 .../tests/blockdev-add-transaction            | 52 +++++++++++++++++++
 .../tests/blockdev-add-transaction.out        |  6 +++
 2 files changed, 58 insertions(+)
 create mode 100755 tests/qemu-iotests/tests/blockdev-add-transaction
 create mode 100644 tests/qemu-iotests/tests/blockdev-add-transaction.out

diff --git a/tests/qemu-iotests/tests/blockdev-add-transaction b/tests/qemu-iotests/tests/blockdev-add-transaction
new file mode 100755
index 0000000000..ce3c1c069b
--- /dev/null
+++ b/tests/qemu-iotests/tests/blockdev-add-transaction
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+#
+# Test blockdev-add transaction action
+#
+# Copyright (c) 2022 Virtuozzo International GmbH.
+#
+# 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/>.
+#
+
+import iotests
+from iotests import log
+
+iotests.script_initialize(supported_fmts=['qcow2'])
+
+with iotests.VM() as vm:
+    vm.launch()
+
+    # Use same node-name for nodes, neither one should appear.
+    vm.qmp_log('transaction', actions=[
+        {'type': 'blockdev-add',
+         'data': {'node-name': 'node0', 'driver': 'null-co',
+                  'size': 1024 * 1024}},
+        {'type': 'blockdev-add',
+         'data': {'node-name': 'node0', 'driver': 'null-co',
+                  'size': 1024 * 1024}}
+    ])
+
+    n = len(vm.qmp('query-named-block-nodes')['return'])
+    log(f'Created {n} nodes')
+
+    vm.qmp_log('transaction', actions=[
+        {'type': 'blockdev-add',
+         'data': {'node-name': 'node0', 'driver': 'null-co',
+                  'size': 1024 * 1024}},
+        {'type': 'blockdev-add',
+         'data': {'node-name': 'node1', 'driver': 'null-co',
+                  'size': 1024 * 1024}}
+    ])
+
+    n = len(vm.qmp('query-named-block-nodes')['return'])
+    log(f'Created {n} nodes')
diff --git a/tests/qemu-iotests/tests/blockdev-add-transaction.out b/tests/qemu-iotests/tests/blockdev-add-transaction.out
new file mode 100644
index 0000000000..7e6cd5a9a3
--- /dev/null
+++ b/tests/qemu-iotests/tests/blockdev-add-transaction.out
@@ -0,0 +1,6 @@
+{"execute": "transaction", "arguments": {"actions": [{"data": {"driver": "null-co", "node-name": "node0", "size": 1048576}, "type": "blockdev-add"}, {"data": {"driver": "null-co", "node-name": "node0", "size": 1048576}, "type": "blockdev-add"}]}}
+{"error": {"class": "GenericError", "desc": "Duplicate nodes with node-name='node0'"}}
+Created 0 nodes
+{"execute": "transaction", "arguments": {"actions": [{"data": {"driver": "null-co", "node-name": "node0", "size": 1048576}, "type": "blockdev-add"}, {"data": {"driver": "null-co", "node-name": "node1", "size": 1048576}, "type": "blockdev-add"}]}}
+{"return": {}}
+Created 2 nodes
-- 
2.35.1



  parent reply	other threads:[~2022-03-30 23:52 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 21:28 [PATCH v5 00/45] Transactional block-graph modifying API Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 01/45] block: BlockDriver: add .filtered_child_is_backing field Vladimir Sementsov-Ogievskiy
2022-06-07  9:57   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 02/45] block: introduce bdrv_open_file_child() helper Vladimir Sementsov-Ogievskiy
2022-06-07  9:57   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 03/45] block/blklogwrites: don't care to remove bs->file child on failure Vladimir Sementsov-Ogievskiy
2022-06-07 10:05   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 04/45] test-bdrv-graph-mod: update test_parallel_perm_update test case Vladimir Sementsov-Ogievskiy
2022-06-07 10:53   ` Hanna Reitz
2022-06-09 13:08     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 05/45] tests-bdrv-drain: bdrv_replace_test driver: declare supports_backing Vladimir Sementsov-Ogievskiy
2022-06-07 10:59   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 06/45] test-bdrv-graph-mod: fix filters to be filters Vladimir Sementsov-Ogievskiy
2022-06-07 11:22   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 07/45] block: document connection between child roles and bs->backing/bs->file Vladimir Sementsov-Ogievskiy
2022-06-07 12:11   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 08/45] block/snapshot: stress that we fallback to primary child Vladimir Sementsov-Ogievskiy
2022-06-07 13:42   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 09/45] Revert "block: Let replace_child_noperm free children" Vladimir Sementsov-Ogievskiy
2022-06-07 14:03   ` Hanna Reitz
2022-06-07 15:09     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 10/45] Revert "block: Let replace_child_tran keep indirect pointer" Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 11/45] Revert "block: Restructure remove_file_or_backing_child()" Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 12/45] Revert "block: Pass BdrvChild ** to replace_child_noperm" Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 13/45] block: Manipulate bs->file / bs->backing pointers in .attach/.detach Vladimir Sementsov-Ogievskiy
2022-06-07 15:55   ` Hanna Reitz
2022-06-09 13:40     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 14/45] block/snapshot: drop indirection around bdrv_snapshot_fallback_ptr Vladimir Sementsov-Ogievskiy
2022-06-07 15:58   ` Hanna Reitz
2022-06-09 14:44     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 15/45] block: refactor bdrv_remove_file_or_backing_child to bdrv_remove_child Vladimir Sementsov-Ogievskiy
2022-06-08 10:04   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 16/45] block: drop bdrv_detach_child() Vladimir Sementsov-Ogievskiy
2022-06-08 10:22   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 17/45] block: drop bdrv_remove_filter_or_cow_child Vladimir Sementsov-Ogievskiy
2022-06-08 10:40   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 18/45] block: bdrv_refresh_perms(): allow external tran Vladimir Sementsov-Ogievskiy
2022-06-08 10:57   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 19/45] block: refactor bdrv_list_refresh_perms to allow any list of nodes Vladimir Sementsov-Ogievskiy
2022-06-08 11:27   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 20/45] block: make permission update functions public Vladimir Sementsov-Ogievskiy
2022-06-08 11:31   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 21/45] block: add bdrv_try_set_aio_context_tran transaction action Vladimir Sementsov-Ogievskiy
2022-06-08 11:49   ` Hanna Reitz
2022-06-09 14:56     ` Vladimir Sementsov-Ogievskiy
2022-06-13  7:12       ` Hanna Reitz
2022-06-13  7:46   ` Hanna Reitz
2022-06-20 20:57     ` Vladimir Sementsov-Ogievskiy
2022-06-21 11:04       ` Hanna Reitz
2022-06-21 11:44         ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 22/45] block: implemet bdrv_unref_tran() Vladimir Sementsov-Ogievskiy
2022-06-13  9:07   ` Hanna Reitz
2022-06-20 21:16     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 23/45] blockdev: refactor transaction to use Transaction API Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 24/45] blockdev: transactions: rename some things Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 25/45] blockdev: qmp_transaction: refactor loop to classic for Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 26/45] blockdev: transaction: refactor handling transaction properties Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 27/45] blockdev: qmp_transaction: drop extra generic layer Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 28/45] qapi: block: add blockdev-del transaction action Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 29/45] block: introduce BDRV_O_NOPERM flag Vladimir Sementsov-Ogievskiy
2022-06-13  9:54   ` Hanna Reitz
2022-06-21 12:11     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 30/45] block: bdrv_insert_node(): use BDRV_O_NOPERM Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 31/45] qapi: block: add blockdev-add transaction action Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` Vladimir Sementsov-Ogievskiy [this message]
2022-03-30 21:28 ` [PATCH v5 33/45] block-backend: blk_root(): drop const specifier on return type Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 34/45] block/export: add blk_by_export_id() Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 35/45] block: make bdrv_find_child() function public Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 36/45] block: bdrv_replace_child_bs(): move to external transaction Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 37/45] qapi: add x-blockdev-replace command Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 38/45] qapi: add x-blockdev-replace transaction action Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 39/45] block: bdrv_get_xdbg_block_graph(): report export ids Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 40/45] iotests.py: qemu_img_create: use imgfmt by default Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 41/45] iotests.py: introduce VM.assert_edges_list() method Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 42/45] iotests.py: add VM.qmp_check() helper Vladimir Sementsov-Ogievskiy
2022-03-30 21:29 ` [PATCH v5 43/45] iotests: add filter-insertion Vladimir Sementsov-Ogievskiy
2022-03-30 21:29 ` [PATCH v5 44/45] block: bdrv_open_inherit: create BlockBackend only when necessary Vladimir Sementsov-Ogievskiy
2022-03-30 21:29 ` [PATCH v5 45/45] block/copy-before-write: correct permission scheme Vladimir Sementsov-Ogievskiy

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=20220330212902.590099-33-vsementsov@openvz.org \
    --to=vladimir.sementsov-ogievskiy@openvz.org \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=v.sementsov-og@mail.ru \
    --cc=vsementsov@openvz.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.