[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] block: do not allow read-only=on and snapshot=on to
From: |
Jeff Cody |
Subject: |
[Qemu-devel] [PATCH] block: do not allow read-only=on and snapshot=on to be used together |
Date: |
Tue, 14 Jan 2014 14:12:19 -0500 |
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 <address@hidden>
---
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");
--
1.8.3.1
- [Qemu-devel] [PATCH] block: do not allow read-only=on and snapshot=on to be used together,
Jeff Cody <=