提交 17b6be4a 编写于 作者: P Paolo Bonzini

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: NPaolo Bonzini <pbonzini@redhat.com>
上级 e6444734
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册