diff mbox

[v5,18/22] blkverify: Don't require protocol filename

Message ID 1386954633-28905-19-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz Dec. 13, 2013, 5:10 p.m. UTC
If the filename is not prefixed by "blkverify:" in
blkverify_parse_filename(), the blkverify driver was not selected
through that protocol prefix, but by an explicit command line (or QMP)
option (like driver=blkverify). Contrary to the current reaction, this
is no longer a problem; both images may be specified through the "test"
and "raw" options, respectively.

If a filename has been given, pass it as the test image filename.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/blkverify.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Kevin Wolf Dec. 13, 2013, 8:47 p.m. UTC | #1
Am 13.12.2013 um 18:10 hat Max Reitz geschrieben:
> If the filename is not prefixed by "blkverify:" in
> blkverify_parse_filename(), the blkverify driver was not selected
> through that protocol prefix, but by an explicit command line (or QMP)
> option (like driver=blkverify). Contrary to the current reaction, this
> is no longer a problem; both images may be specified through the "test"
> and "raw" options, respectively.
> 
> If a filename has been given, pass it as the test image filename.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>

Same comment as for blkdebug.

Kevin
diff mbox

Patch

diff --git a/block/blkverify.c b/block/blkverify.c
index 8bf81b5..a903680 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -78,7 +78,11 @@  static void blkverify_parse_filename(const char *filename, QDict *options,
 
     /* Parse the blkverify: prefix */
     if (!strstart(filename, "blkverify:", &filename)) {
-        error_setg(errp, "File name string must start with 'blkverify:'");
+        /* There was no prefix; therefore, all options have to be already
+           present in the QDict; if a filename is given, pass it */
+        if (filename) {
+            qdict_put(options, "x-image", qstring_from_str(filename));
+        }
         return;
     }