qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] block/nbd: Reject port parameter without host
Date: Wed,  3 Feb 2016 17:33:15 +0100	[thread overview]
Message-ID: <1454517196-4560-2-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1454517196-4560-1-git-send-email-mreitz@redhat.com>

This is better than the generic block layer finding out later that the
port parameter has not been used.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/nbd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block/nbd.c b/block/nbd.c
index 1a90bc7..063c403 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -201,6 +201,10 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, char **export,
         }
         return NULL;
     }
+    if (qdict_haskey(options, "port") && !qdict_haskey(options, "host")) {
+        error_setg(errp, "port may not be used without host.");
+        return NULL;
+    }
 
     saddr = g_new0(SocketAddress, 1);
 
-- 
2.7.0

  reply	other threads:[~2016-02-03 16:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 16:33 [Qemu-devel] [PATCH 0/2] qapi: Allow blockdev-add for NBD Max Reitz
2016-02-03 16:33 ` Max Reitz [this message]
2016-02-03 16:38   ` [Qemu-devel] [PATCH 1/2] block/nbd: Reject port parameter without host Eric Blake
2016-02-03 16:39     ` Max Reitz
2016-02-03 16:33 ` [Qemu-devel] [PATCH 2/2] qapi: Allow blockdev-add for NBD Max Reitz
2016-02-03 16:48   ` Eric Blake
2016-02-03 17:00     ` Max Reitz
2016-02-04 11:58     ` Paolo Bonzini
2016-02-03 17:06   ` Daniel P. Berrange
2016-02-03 17:16     ` Max Reitz
2016-02-04 12:01       ` Paolo Bonzini
2016-02-04 13:08     ` Kevin Wolf
2016-02-04 13:19       ` Daniel P. Berrange

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=1454517196-4560-2-git-send-email-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).