public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu 2/3] block/zeroinit: support using as blockdev driver
Date: Thu, 26 Jun 2025 18:04:38 +0200	[thread overview]
Message-ID: <20250626160504.330350-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250626160504.330350-1-f.ebner@proxmox.com>

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 block/zeroinit.c     | 12 +++++++++---
 qapi/block-core.json |  5 +++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/block/zeroinit.c b/block/zeroinit.c
index f9d513db15..036edb17f5 100644
--- a/block/zeroinit.c
+++ b/block/zeroinit.c
@@ -66,6 +66,7 @@ static int zeroinit_open(BlockDriverState *bs, QDict *options, int flags,
     QemuOpts *opts;
     Error *local_err = NULL;
     int ret;
+    const char *next = NULL;
 
     s->extents = 0;
 
@@ -77,9 +78,14 @@ static int zeroinit_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
 
-    /* Open the raw file */
-    ret = bdrv_open_file_child(qemu_opt_get(opts, "x-next"), options, "next",
-                               bs, &local_err);
+
+    next = qemu_opt_get(opts, "x-next");
+
+    if (next) {
+        ret = bdrv_open_file_child(next, options, "next", bs, &local_err);
+    } else { /* when opened as a blockdev, there is no 'next' option */
+        ret = bdrv_open_file_child(NULL, options, "file", bs, &local_err);
+    }
     if (ret < 0) {
         error_propagate(errp, local_err);
         goto fail;
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 2fb51215f2..f8ed564cf0 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -3586,7 +3586,7 @@
             { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' },
             { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' },
             { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' },
-            'vmdk', 'vpc', 'vvfat' ] }
+            'vmdk', 'vpc', 'vvfat', 'zeroinit' ] }
 
 ##
 # @BlockdevOptionsFile:
@@ -5172,7 +5172,8 @@
                       'if': 'CONFIG_BLKIO' },
       'vmdk':       'BlockdevOptionsGenericCOWFormat',
       'vpc':        'BlockdevOptionsGenericFormat',
-      'vvfat':      'BlockdevOptionsVVFAT'
+      'vvfat':      'BlockdevOptionsVVFAT',
+      'zeroinit':   'BlockdevOptionsGenericFormat'
   } }
 
 ##
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-06-26 16:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26 16:04 [pve-devel] [PATCH-SERIES qemu 0/3] prepartion for blockdev Fiona Ebner
2025-06-26 16:04 ` [pve-devel] [PATCH qemu 1/3] PVE backup: prepare for the switch to using blockdev rather than drive Fiona Ebner
2025-06-26 16:04 ` Fiona Ebner [this message]
2025-06-26 16:04 ` [pve-devel] [PATCH qemu 3/3] blockdev: query file child QMP command Fiona Ebner
2025-06-30 12:43   ` Fabian Grünbichler
2025-06-30 14:23     ` Fiona Ebner
2025-06-27 15:51 ` [pve-devel] [PATCH qemu 4/4] block/alloc-track: support using as blockdev driver Fiona Ebner

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=20250626160504.330350-3-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal