Patchwork nbd-server-add: Fix the default for 'writable'

login
register
mail settings
Submitter Michal Privoznik
Date Nov. 28, 2012, 10:46 a.m.
Message ID <db00c89dd60757fa9b3be58894e3cbf0fdaa9517.1354099560.git.mprivozn@redhat.com>
Download mbox | patch
Permalink /patch/202429/
State New
Headers show

Comments

Michal Privoznik - Nov. 28, 2012, 10:46 a.m.
The documentation to this monitor command tells, that 'writable'
argument is optional and defaults to false. However, the code sets
true as the default. But since some applications may already been
using this, it's safer to fix the code and not documentation which
would break those applications.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 blockdev-nbd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Paolo Bonzini - Nov. 28, 2012, 10:48 a.m.
Il 28/11/2012 11:46, Michal Privoznik ha scritto:
> The documentation to this monitor command tells, that 'writable'
> argument is optional and defaults to false. However, the code sets
> true as the default. But since some applications may already been
> using this, it's safer to fix the code and not documentation which
> would break those applications.

Thanks, applied to nbd-next branch.

Paolo

Patch

diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index d1721a3..6b26bbf 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -99,7 +99,7 @@  void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
     }
 
     if (!has_writable) {
-        writable = true;
+        writable = false;
     }
     if (bdrv_is_read_only(bs)) {
         writable = false;