@@ -382,6 +382,10 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
return;
}
}
+
+ if (!qemu_opt_get_bool(opts, "lock-image", false)) {
+ *bdrv_flags |= BDRV_O_NO_LOCK;
+ }
}
/* disk I/O throttling */
@@ -4249,6 +4253,10 @@ QemuOptsList qemu_common_drive_opts = {
.type = QEMU_OPT_BOOL,
.help = "whether to account for failed I/O operations "
"in the statistics",
+ },{
+ .name = "lock-image",
+ .type = QEMU_OPT_BOOL,
+ .help = "whether to lock the image (default: on)",
},
{ /* end of list */ }
},
@@ -4278,6 +4286,10 @@ static QemuOptsList qemu_root_bds_opts = {
.name = "detect-zeroes",
.type = QEMU_OPT_STRING,
.help = "try to optimize zero writes (off, on, unmap)",
+ },{
+ .name = "lock-image",
+ .type = QEMU_OPT_BOOL,
+ .help = "whether to lock the image (default: on)",
},
{ /* end of list */ }
},
Honor the locking switch specified in CLI or QMP, and set the open flags for the image accordingly. Signed-off-by: Fam Zheng <famz@redhat.com> --- blockdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)