diff options
-rw-r--r-- | blockdev-nbd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/blockdev-nbd.c b/blockdev-nbd.c index b60b66d66c..18dc528761 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -91,6 +91,10 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable, error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } + if (!bdrv_is_inserted(bs)) { + error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); + return; + } if (!has_writable) { writable = false; |