From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id B4C4462159
 for <pve-devel@lists.proxmox.com>; Fri, 11 Feb 2022 10:25:10 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 9F30E263C6
 for <pve-devel@lists.proxmox.com>; Fri, 11 Feb 2022 10:24:40 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id C1B8A263B4
 for <pve-devel@lists.proxmox.com>; Fri, 11 Feb 2022 10:24:39 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9590446DF0
 for <pve-devel@lists.proxmox.com>; Fri, 11 Feb 2022 10:24:39 +0100 (CET)
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Fri, 11 Feb 2022 10:24:34 +0100
Message-Id: <20220211092435.84731-2-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20220211092435.84731-1-f.ebner@proxmox.com>
References: <20220211092435.84731-1-f.ebner@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.136 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: [pve-devel] [PATCH v2 qemu 2/3] fix getopt-string when introducing
 -n option for qemu-img dd
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Fri, 11 Feb 2022 09:25:10 -0000

The colon after U is wrong, because it doesn't take an argument.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

New in v2.

 ...PVE-Up-qemu-img-dd-add-n-skip_create.patch | 64 +++++++++++++++++--
 1 file changed, 60 insertions(+), 4 deletions(-)

diff --git a/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch
index 7a86db2..f086107 100644
--- a/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch
+++ b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch
@@ -4,12 +4,68 @@ Date: Mon, 6 Apr 2020 12:16:42 +0200
 Subject: [PATCH] PVE: [Up] qemu-img dd: add -n skip_create
 
 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
+[FE: fix getopt-string + add documentation]
+Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
 ---
- qemu-img.c | 23 ++++++++++++++---------
- 1 file changed, 14 insertions(+), 9 deletions(-)
+ docs/tools/qemu-img.rst | 11 ++++++++++-
+ qemu-img-cmds.hx        |  4 ++--
+ qemu-img.c              | 23 ++++++++++++++---------
+ 3 files changed, 26 insertions(+), 12 deletions(-)
 
+diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
+index d663dd92bd..a49badb158 100644
+--- a/docs/tools/qemu-img.rst
++++ b/docs/tools/qemu-img.rst
+@@ -208,6 +208,10 @@ Parameters to convert subcommand:
+ 
+ Parameters to dd subcommand:
+ 
++.. option:: -n
++
++  Skip the creation of the target volume
++
+ .. program:: qemu-img-dd
+ 
+ .. option:: bs=BLOCK_SIZE
+@@ -488,7 +492,7 @@ Command description:
+   it doesn't need to be specified separately in this case.
+ 
+ 
+-.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] if=INPUT of=OUTPUT
++.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [-n] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] if=INPUT of=OUTPUT
+ 
+   dd copies from *INPUT* file to *OUTPUT* file converting it from
+   *FMT* format to *OUTPUT_FMT* format.
+@@ -499,6 +503,11 @@ Command description:
+ 
+   The size syntax is similar to :manpage:`dd(1)`'s size syntax.
+ 
++  If the ``-n`` option is specified, the target volume creation will be
++  skipped. This is useful for formats such as ``rbd`` if the target
++  volume has already been created with site specific options that cannot
++  be supplied through ``qemu-img``.
++
+ .. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [-U] FILENAME
+ 
+   Give information about the disk image *FILENAME*. Use it in
+diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
+index 0b2999f3ab..f3b2b1b4de 100644
+--- a/qemu-img-cmds.hx
++++ b/qemu-img-cmds.hx
+@@ -58,9 +58,9 @@ SRST
+ ERST
+ 
+ DEF("dd", img_dd,
+-    "dd [--image-opts] [-U] [-f fmt] [-O output_fmt] [bs=block_size] [count=blocks] [skip=blocks] [osize=output_size] if=input of=output")
++    "dd [--image-opts] [-U] [-f fmt] [-O output_fmt] [-n] [bs=block_size] [count=blocks] [skip=blocks] [osize=output_size] if=input of=output")
+ SRST
+-.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] [osize=OUTPUT_SIZE] if=INPUT of=OUTPUT
++.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [-n] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] [osize=OUTPUT_SIZE] if=INPUT of=OUTPUT
+ ERST
+ 
+ DEF("info", img_info,
 diff --git a/qemu-img.c b/qemu-img.c
-index d9e8a8c4d4..6e1fbd5820 100644
+index d9e8a8c4d4..015d6d2ce4 100644
 --- a/qemu-img.c
 +++ b/qemu-img.c
 @@ -4930,7 +4930,7 @@ static int img_dd(int argc, char **argv)
@@ -26,7 +82,7 @@ index d9e8a8c4d4..6e1fbd5820 100644
      };
  
 -    while ((c = getopt_long(argc, argv, ":hf:O:U", long_options, NULL))) {
-+    while ((c = getopt_long(argc, argv, ":hf:O:U:n", long_options, NULL))) {
++    while ((c = getopt_long(argc, argv, ":hf:O:Un", long_options, NULL))) {
          if (c == EOF) {
              break;
          }
-- 
2.30.2