Received: from eggs.gnu.org ([2001:4830:134:3::10]:49378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjjFB-00011N-01 for qemu-devel@nongnu.org; Wed, 07 Oct 2015 03:34:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjjF9-0005MZ-QV for qemu-devel@nongnu.org; Wed, 07 Oct 2015 03:34:32 -0400 Date: Wed, 7 Oct 2015 09:34:21 +0200 From: Kevin Wolf Message-ID: <20151007073421.GB4337@noname.redhat.com> References: <8cc989a360a5fe38839144946c878fb9f8c6a6d5.1442928283.git.berto@igalia.com> <20151006153007.GC24770@noname.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v6 3/4] block: add a 'blockdev-snapshot' QMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz Am 06.10.2015 um 17:49 hat Alberto Garcia geschrieben: > On Tue 06 Oct 2015 05:30:07 PM CEST, Kevin Wolf wrote: > >> - options = qdict_new(); > >> - if (has_snapshot_node_name) { > >> - qdict_put(options, "node-name", > >> - qstring_from_str(snapshot_node_name)); > >> + if (snapshot_node_name && bdrv_find_node(snapshot_node_name)) { > >> + error_setg(errp, "New snapshot node name already exists"); > >> + return; > >> + } > > > > Preexisting, but shouldn't we use bdrv_lookup_bs() here (because devices > > and node names share a namespace)? > > I think you're right, good catch! > > >> + if (state->new_bs->blk != NULL) { > >> + error_setg(errp, "The snapshot is already in use by %s", > >> + blk_name(state->new_bs->blk)); > >> + return; > >> + } > > > > Is it even possible yet to create a root BDS without a BB? > > It is possible with Max's series, on which mine depends. > > http://patchwork.ozlabs.org/patch/519375/ Okay. I missed this dependency, it doesn't seem to be very explicit in the cover letter. > >> + if (bdrv_op_is_blocked(state->new_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, > >> + errp)) { > >> + return; > >> + } > >> + > >> + if (state->new_bs->backing_hd != NULL) { > >> + error_setg(errp, "The snapshot already has a backing image"); > >> } > > > > The error cases after bdrv_open() should probably bdrv_unref() the > > node. > > I don't think it's necessary, external_snapshot_abort() already takes > care of that. Sorry for the noise, you're right. I was confused by bdrv_reopen() transactions working differently: There, abort isn't called for the queue entry that has failed prepare, but here it is. Kevin