If an image is opened with driver-specific options then attempting to use snapshot_blkdev will fail with "Driver specified twice".
The reason is that bs->filename is replaced with a full JSON object by bdrv_refresh_filename() when such options are present: -drive if=virtio,file=hd0.qcow2,lazy-refcounts=on (qemu) info block virtio0: json:{"lazy-refcounts": "on", "driver": "qcow2", "file": {"driver": "file", "filename": "hd0.qcow2"}} (qcow2) A snapshot of that image will try to inherit its options, and that includes parsing its filename when it is in the "json:" format. Since the JSON object includes a driver name, it will clash with the one requested by the user in snapshot_blkdev, producing the aforementioned error. Signed-off-by: Alberto Garcia <be...@igalia.com> --- block.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block.c b/block.c index d088ee0..b09de04 100644 --- a/block.c +++ b/block.c @@ -1014,6 +1014,12 @@ static int bdrv_fill_options(QDict **options, const char **pfilename, return -EINVAL; } + /* We shouldn't use the driver from the filename if there is + * one explicitly specified already */ + if (drv) { + qdict_del(json_options, "driver"); + } + /* Options given in the filename have lower priority than options * specified directly */ qdict_join(*options, json_options, false); -- 2.5.0