From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmKGw-0007iJ-KY for qemu-devel@nongnu.org; Tue, 20 Sep 2016 08:35:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmKGr-0003DB-BN for qemu-devel@nongnu.org; Tue, 20 Sep 2016 08:35:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmKGr-0003C6-5P for qemu-devel@nongnu.org; Tue, 20 Sep 2016 08:35:33 -0400 References: <20160920123126.5400.29283.stgit@PASHA-ISP.def.inno> <20160920123138.5400.67174.stgit@PASHA-ISP.def.inno> From: Paolo Bonzini Message-ID: <8ebdaf52-f7f9-c6ac-3a85-3149b2e55346@redhat.com> Date: Tue, 20 Sep 2016 14:35:28 +0200 MIME-Version: 1.0 In-Reply-To: <20160920123138.5400.67174.stgit@PASHA-ISP.def.inno> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/8] block: set snapshot option for block devices in blkreplay module List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, jasowang@redhat.com, quintela@redhat.com, mst@redhat.com On 20/09/2016 14:31, Pavel Dovgalyuk wrote: > /* Open the image file */ > bs->file = bdrv_open_child(NULL, options, "image", > @@ -40,6 +112,43 @@ static int blkreplay_open(BlockDriverState *bs, QDict *options, int flags, > goto fail; > } > > + opts = qemu_opts_create(&blkreplay_runtime_opts, NULL, 0, &error_abort); > + qemu_opts_absorb_qdict(opts, options, &local_err); > + if (local_err) { > + ret = -EINVAL; > + goto fail; > + } > + > + /* Prepare options QDict for the overlay file */ > + qdict_put(snapshot_options, "file.driver", > + qstring_from_str("file")); > + qdict_put(snapshot_options, "driver", > + qstring_from_str("qcow2")); > + > + snapshot = qemu_opt_get(opts, "overlay"); > + if (snapshot) { > + qdict_put(snapshot_options, "file.filename", > + qstring_from_str(snapshot)); > + } else { > + char tmp_filename[PATH_MAX + 1]; > + ret = get_tmp_filename(tmp_filename, PATH_MAX + 1); > + if (ret < 0) { > + error_setg_errno(errp, -ret, "Could not get temporary filename"); > + goto fail; > + } No, this is unnecessary. The image is unused in this case, so you can specify the overlay as image=foo.qcow2. Paolo