qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/7] nbd: force read-only export for read-only devic


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 5/7] nbd: force read-only export for read-only devices
Date: Mon, 12 Nov 2012 15:22:05 +0100

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

Signed-off-by: Paolo Bonzini <address@hidden>
---
 blockdev-nbd.c | 7 +++++++
 1 file modificato, 7 inserzioni(+)

diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index 274fba6..e362572 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -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);
 
-- 
1.7.12.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]