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 <jc...@redhat.com> --- 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