summaryrefslogtreecommitdiff
path: root/blockdev-nbd.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-11-12 14:25:17 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-11-12 14:38:29 +0100
commit17b6be4a7fc9db4f4c56908bab137d4c491471f1 (patch)
tree0dd312f683c3514895c264d8337604758b4215b8 /blockdev-nbd.c
parente644473445177671ec408dfdec705cf931657998 (diff)
downloadqemu-17b6be4a7fc9db4f4c56908bab137d4c491471f1.tar.gz
qemu-17b6be4a7fc9db4f4c56908bab137d4c491471f1.tar.bz2
qemu-17b6be4a7fc9db4f4c56908bab137d4c491471f1.zip
nbd: disallow nbd-server-add before nbd-server-start
It works nicely with the QMP commands, but it adds useless complication with HMP. In particular, see the following: (qemu) nbd_server_add -w scsi0-hd0 (qemu) nbd_server_start -a localhost:10809 NBD server already exporting device scsi0-hd0 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'blockdev-nbd.c')
-rw-r--r--blockdev-nbd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index e362572279..d1721a3e26 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -82,6 +82,11 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
NBDExport *exp;
NBDCloseNotifier *n;
+ if (server_fd == -1) {
+ error_setg(errp, "NBD server not running");
+ return;
+ }
+
if (nbd_export_find(device)) {
error_setg(errp, "NBD server already exporting device '%s'", device);
return;