From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuP7b-0002Ak-Qs for qemu-devel@nongnu.org; Thu, 05 Nov 2015 13:18:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuP7a-00061l-S8 for qemu-devel@nongnu.org; Thu, 05 Nov 2015 13:18:51 -0500 From: Kevin Wolf Date: Thu, 5 Nov 2015 19:17:56 +0100 Message-Id: <1446747485-6562-29-git-send-email-kwolf@redhat.com> In-Reply-To: <1446747485-6562-1-git-send-email-kwolf@redhat.com> References: <1446747485-6562-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 28/37] block: Disallow snapshots if the overlay doesn't support backing files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Alberto Garcia This addresses scenarios like this one: { 'execute': 'blockdev-add', 'arguments': { 'options': { 'driver': 'qcow2', 'node-name': 'new0', 'file': { 'driver': 'file', 'filename': 'new.qcow2', 'node-name': 'file0' } } } } { 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay': 'file0' } } Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- blockdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/blockdev.c b/blockdev.c index 2bf18a7..8749d78 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1668,6 +1668,11 @@ static void external_snapshot_prepare(BlkTransactionState *common, if (state->new_bs->backing != NULL) { error_setg(errp, "The snapshot already has a backing image"); + return; + } + + if (!state->new_bs->drv->supports_backing) { + error_setg(errp, "The snapshot does not support backing images"); } } -- 1.8.3.1