Skip to content
Snippets Groups Projects
Commit e6444734 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

nbd: force read-only export for read-only devices


This is the desired behavior for HMP, but it is a better choice for QMP as well.

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent fc6467ea
No related branches found
No related tags found
No related merge requests found
......@@ -93,6 +93,13 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
return;
}
if (!has_writable) {
writable = true;
}
if (bdrv_is_read_only(bs)) {
writable = false;
}
exp = nbd_export_new(bs, 0, -1, writable ? 0 : NBD_FLAG_READ_ONLY,
nbd_server_put_ref);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment