From patchwork Tue Jan 14 19:12:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 310851 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E77212C0091 for ; Wed, 15 Jan 2014 06:12:53 +1100 (EST) Received: from localhost ([::1]:50218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W39Pv-0003RI-Fs for incoming@patchwork.ozlabs.org; Tue, 14 Jan 2014 14:12:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W39Pc-0003R7-4u for qemu-devel@nongnu.org; Tue, 14 Jan 2014 14:12:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W39PT-0007sN-7b for qemu-devel@nongnu.org; Tue, 14 Jan 2014 14:12:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W39PS-0007r5-TZ for qemu-devel@nongnu.org; Tue, 14 Jan 2014 14:12:23 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0EJCL7U015736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 Jan 2014 14:12:22 -0500 Received: from localhost (ovpn-112-26.phx2.redhat.com [10.3.112.26]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0EJCJbX032161 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 14 Jan 2014 14:12:20 -0500 From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 14 Jan 2014 14:12:19 -0500 Message-Id: <2fb3ea05d2e1ee06d578a0f2c53f56df1661401c.1389726691.git.jcody@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH] block: do not allow read-only=on and snapshot=on to be used together X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Having both read-only=on and snapshot=on together does not make sense; currently, the read-only argument is effectively ignored for the temporary snapshot. To prevent confusion, disallow the usage of both 'snapshot=on' and 'read-only=on'. Signed-off-by: Jeff Cody Reviewed-by: Eric Blake --- blockdev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/blockdev.c b/blockdev.c index e457494..845ff8a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -352,6 +352,13 @@ static DriveInfo *blockdev_init(QDict *bs_opts, /* extract parameters */ snapshot = qemu_opt_get_bool(opts, "snapshot", 0); ro = qemu_opt_get_bool(opts, "read-only", 0); + + /* having ro and snapshot together does not make sense */ + if (ro && snapshot) { + error_setg(errp, "invalid option combination: read-only and snapshot"); + goto early_err; + } + copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false); file = qemu_opt_get(opts, "file");