qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 6/7] nbd: disallow nbd-server-add before nbd-server-start
Date: Mon, 12 Nov 2012 15:22:06 +0100	[thread overview]
Message-ID: <1352730127-32685-7-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1352730127-32685-1-git-send-email-pbonzini@redhat.com>

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>
---
 blockdev-nbd.c | 5 +++++
 1 file modificato, 5 inserzioni(+)

diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index e362572..d1721a3 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;
-- 
1.7.12.1

  parent reply	other threads:[~2012-11-12 14:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-12 14:22 [Qemu-devel] [PULL 1.3 0/7] NBD updates for 2012-11-12 Paolo Bonzini
2012-11-12 14:22 ` [Qemu-devel] [PATCH 1/7] qemu-nbd: initialize main loop before block layer Paolo Bonzini
2012-11-12 14:22 ` [Qemu-devel] [PATCH 2/7] nbd: accept relative path to Unix socket Paolo Bonzini
2012-11-12 14:22 ` [Qemu-devel] [PATCH 3/7] nbd: accept URIs Paolo Bonzini
2012-11-12 14:22 ` [Qemu-devel] [PATCH 4/7] nbd: fix nbd_server_stop crash when no server was running Paolo Bonzini
2012-11-12 14:22 ` [Qemu-devel] [PATCH 5/7] nbd: force read-only export for read-only devices Paolo Bonzini
2012-11-12 14:22 ` Paolo Bonzini [this message]
2012-11-12 14:22 ` [Qemu-devel] [PATCH 7/7] hmp: add NBD server commands Paolo Bonzini
2012-11-13 10:20 ` [Qemu-devel] [PULL 1.3 0/7] NBD updates for 2012-11-12 Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352730127-32685-7-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).