qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lin Ma <lma@suse.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, mreitz@redhat.com, kwolf@redhat.com
Subject: [Qemu-devel] [PATCH] raw: Disable probing if image format is given by driver-specific options
Date: Mon, 22 Jan 2018 15:21:02 +0800	[thread overview]
Message-ID: <20180122072102.4141-1-lma@suse.com> (raw)

If the user specifies image format through driver-specific options, The
format probing should be prohibited and the warning message should not
be printed.

e.g.:
$ qemu-system-x86_64 ... -drive file.file.filename=disk0.raw,file.driver=raw ...
WARNING: Image format was not specified for 'disk0.raw' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, ...

Signed-off-by: Lin Ma <lma@suse.com>
---
 blockdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index 29d569a24e..ef4c167235 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -529,6 +529,8 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
             goto early_err;
         }
         qdict_put_str(bs_opts, "driver", buf);
+    } else if (qdict_haskey(bs_opts, "file.driver")) {
+        qdict_put_str(bs_opts, "driver", qdict_get_str(bs_opts, "file.driver"));
     }
 
     on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
-- 
2.15.1

             reply	other threads:[~2018-01-22  7:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22  7:21 Lin Ma [this message]
2018-01-22 16:45 ` [Qemu-devel] [PATCH] raw: Disable probing if image format is given by driver-specific options Max Reitz
2018-01-23  3:05   ` Lin Ma

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=20180122072102.4141-1-lma@suse.com \
    --to=lma@suse.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).