qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, vsementsov@virtuozzo.com,
	jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com,
	den@openvz.org
Subject: [PATCH 2/3] block: allow filters to be reopened without .bdrv_reopen_prepare
Date: Thu, 11 Mar 2021 18:15:04 +0300	[thread overview]
Message-ID: <20210311151505.206534-3-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20210311151505.206534-1-vsementsov@virtuozzo.com>

We are going to drop inherits_from logic, so every child will be
recursively reopened including filters. Let's assume that by default
filters do nothing on reopen prepare.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block.c                | 23 +++++++++++++----------
 tests/qemu-iotests/245 |  5 ++---
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/block.c b/block.c
index 2daff6d29a..815396f460 100644
--- a/block.c
+++ b/block.c
@@ -4189,7 +4189,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
         goto error;
     }
 
-    if (drv->bdrv_reopen_prepare) {
+    if (drv->bdrv_reopen_prepare || drv->is_filter) {
         /*
          * If a driver-specific option is missing, it means that we
          * should reset it to its default value.
@@ -4201,16 +4201,19 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
             goto error;
         }
 
-        ret = drv->bdrv_reopen_prepare(reopen_state, queue, &local_err);
-        if (ret) {
-            if (local_err != NULL) {
-                error_propagate(errp, local_err);
-            } else {
-                bdrv_refresh_filename(reopen_state->bs);
-                error_setg(errp, "failed while preparing to reopen image '%s'",
-                           reopen_state->bs->filename);
+        if (drv->bdrv_reopen_prepare) {
+            ret = drv->bdrv_reopen_prepare(reopen_state, queue, &local_err);
+            if (ret) {
+                if (local_err != NULL) {
+                    error_propagate(errp, local_err);
+                } else {
+                    bdrv_refresh_filename(reopen_state->bs);
+                    error_setg(errp,
+                               "failed while preparing to reopen image '%s'",
+                               reopen_state->bs->filename);
+                }
+                goto error;
             }
-            goto error;
         }
     } else {
         /* It is currently mandatory to have a bdrv_reopen_prepare()
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
index 11104b9208..a7c70213dd 100755
--- a/tests/qemu-iotests/245
+++ b/tests/qemu-iotests/245
@@ -524,9 +524,8 @@ class TestBlockdevReopen(iotests.QMPTestCase):
         result = self.vm.qmp('blockdev-add', conv_keys = False, **bvopts)
         self.assert_qmp(result, 'return', {})
 
-        # blkverify doesn't currently allow reopening. TODO: implement this
-        self.reopen(bvopts, {}, "Block format 'blkverify' used by node 'bv'" +
-                    " does not support reopening files")
+        # blkverify allows reopening
+        self.reopen(bvopts, {})
 
         # Illegal: hd0 is a child of the blkverify node
         self.reopen(opts[0], {'backing': 'bv'},
-- 
2.29.2



  parent reply	other threads:[~2021-03-11 16:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 15:15 [PATCH RFC 0/3] block: drop inherits_from Vladimir Sementsov-Ogievskiy
2021-03-11 15:15 ` [PATCH 1/3] block/commit: keep reference on commit_top_bs Vladimir Sementsov-Ogievskiy
2021-03-11 15:15 ` Vladimir Sementsov-Ogievskiy [this message]
2021-03-11 15:15 ` [PATCH 3/3] block: drop inherits_from logic Vladimir Sementsov-Ogievskiy
2021-03-11 17:09 ` [PATCH RFC 0/3] block: drop inherits_from Kevin Wolf
2021-03-11 17:28   ` 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=20210311151505.206534-3-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).