diff options
-rw-r--r-- | blockdev-nbd.c | 5 |
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; |