Skip to content

Commit

Permalink
nbd: disallow nbd-server-add before nbd-server-start
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bonzini committed Nov 12, 2012
1 parent e644473 commit 17b6be4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blockdev-nbd.c
Expand Up @@ -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;
Expand Down

0 comments on commit 17b6be4

Please sign in to comment.