Blame SOURCES/kvm-qemu-img-Amendment-support-implies-create_opts.patch

1bdc94
From d43212510cea4b1eda20cb43f357473590d54ffd Mon Sep 17 00:00:00 2001
1bdc94
From: Max Reitz <mreitz@redhat.com>
1bdc94
Date: Mon, 18 Jun 2018 14:59:37 +0200
1bdc94
Subject: [PATCH 03/89] qemu-img: Amendment support implies create_opts
1bdc94
1bdc94
RH-Author: Max Reitz <mreitz@redhat.com>
1bdc94
Message-id: <20180618145943.4489-2-mreitz@redhat.com>
1bdc94
Patchwork-id: 80758
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 1/7] qemu-img: Amendment support implies create_opts
1bdc94
Bugzilla: 1537956
1bdc94
RH-Acked-by: John Snow <jsnow@redhat.com>
1bdc94
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
1bdc94
1bdc94
Instead of checking whether a driver has a non-NULL create_opts we
1bdc94
should check whether it supports image amendment in the first place.  If
1bdc94
it does, it must have create_opts.
1bdc94
1bdc94
On the other hand, if it does not have create_opts (so it does not
1bdc94
support amendment either), the error message "does not support any
1bdc94
options" is a bit useless.  Stating clearly that the driver has no
1bdc94
amendment support whatsoever is probably better.
1bdc94
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Reviewed-by: John Snow <jsnow@redhat.com>
1bdc94
Reviewed-by: Eric Blake <eblake@redhat.com>
1bdc94
Message-id: 20180509210023.20283-2-mreitz@redhat.com
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
(cherry picked from commit 1f996683ad908fd41c572221a63d9fc31ce04d07)
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 qemu-img.c | 7 +++++--
1bdc94
 1 file changed, 5 insertions(+), 2 deletions(-)
1bdc94
1bdc94
diff --git a/qemu-img.c b/qemu-img.c
1bdc94
index 60e45ec..2f7c491 100644
1bdc94
--- a/qemu-img.c
1bdc94
+++ b/qemu-img.c
1bdc94
@@ -3740,13 +3740,16 @@ static int img_amend(int argc, char **argv)
1bdc94
         goto out;
1bdc94
     }
1bdc94
 
1bdc94
-    if (!bs->drv->create_opts) {
1bdc94
-        error_report("Format driver '%s' does not support any options to amend",
1bdc94
+    if (!bs->drv->bdrv_amend_options) {
1bdc94
+        error_report("Format driver '%s' does not support option amendment",
1bdc94
                      fmt);
1bdc94
         ret = -1;
1bdc94
         goto out;
1bdc94
     }
1bdc94
 
1bdc94
+    /* Every driver supporting amendment must have create_opts */
1bdc94
+    assert(bs->drv->create_opts);
1bdc94
+
1bdc94
     create_opts = qemu_opts_append(create_opts, bs->drv->create_opts);
1bdc94
     opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
1bdc94
     qemu_opts_do_parse(opts, options, NULL, &err;;
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94