All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Bartos <nick@pistoncloud.com>
To: ceph-devel@vger.kernel.org
Subject: Re: [PATCH] Statically binding ports for ceph-osd
Date: Tue, 10 Apr 2012 12:56:53 -0700	[thread overview]
Message-ID: <CAPud5_7B8DG4hnVTqBnw7aHuJf8CJnPUjo3ZUfOjDPo89rqvSQ@mail.gmail.com> (raw)
In-Reply-To: <CAPud5_4Fhjxwb2AjznBNPif8gLUrsJYqtkLX5OzBLMA1JAvw3g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

After doing some more looking at the code, it appears that this option
is not supported.  I created a small patch (attached) which adds the
functionality.  Is there any way we could get this, or something like
this, applied upstream?  I think this is important functionality for
firewalled environments, and seems like a simple fix since all the
other services (including ones for ceph-mon and ceph-mds) already
allow you to specify a static port.


On Mon, Apr 9, 2012 at 5:27 PM, Nick Bartos <nick@pistoncloud.com> wrote:
> I'm trying to get ceph-osd's listening ports to be set statically for
> firewall reasons.  I am able to get 2 of the 3 ports set statically,
> however the 3rd one is still getting set dynamically.
>
> I am using:
>
> [osd.48]
>    host = 172.16.0.13
>    cluster addr = 172.16.0.13:6944
>    public addr = 172.16.0.13:6945
>
> The daemon will successfully bind to 6944 and 6945, but also binds to
> 6800.  What additional option do I need?  I started looking at the
> code and thought "hb addr = 172.16.0.13:6946" would do it, but
> specifying that option seems to have no effect (or at least does not
> achieve the desired result).

[-- Attachment #2: ceph-0.41-osd_hb_port.patch --]
[-- Type: application/octet-stream, Size: 1367 bytes --]

diff -U3 -r ceph-0.41.orig/src/ceph_osd.cc ceph-0.41/src/ceph_osd.cc
--- ceph-0.41.orig/src/ceph_osd.cc	2012-01-27 12:35:39.000000000 -0800
+++ ceph-0.41/src/ceph_osd.cc	2012-04-10 09:57:08.600817954 -0700
@@ -307,7 +307,11 @@
   // hb should bind to same ip as cluster_addr (if specified)
   entity_addr_t hb_addr = g_conf->cluster_addr;
   if (!hb_addr.is_blank_ip())
-    hb_addr.set_port(0);
+    // Only use osd_hb_port if it's a valid port.
+    if (g_conf->osd_hb_port > 0 && g_conf->osd_hb_port < 65536)
+        hb_addr.set_port(g_conf->osd_hb_port);
+    else
+        hb_addr.set_port(0);
   r = messenger_hbout->bind(hb_addr, getpid());
   if (r < 0)
     exit(1);
diff -U3 -r ceph-0.41.orig/src/common/config_opts.h ceph-0.41/src/common/config_opts.h
--- ceph-0.41.orig/src/common/config_opts.h	2012-01-23 10:24:35.000000000 -0800
+++ ceph-0.41/src/common/config_opts.h	2012-04-10 09:46:42.409428811 -0700
@@ -295,6 +295,7 @@
 OPTION(osd_max_notify_timeout, OPT_U32, 30) // max notify timeout in seconds
 OPTION(osd_kill_backfill_at, OPT_INT, 0)
 OPTION(osd_min_pg_log_entries, OPT_U32, 1000) // number of entries to keep in the pg log when trimming it
+OPTION(osd_hb_port, OPT_INT, 0)
 OPTION(filestore, OPT_BOOL, false)
 OPTION(filestore_max_sync_interval, OPT_DOUBLE, 5)    // seconds
 OPTION(filestore_min_sync_interval, OPT_DOUBLE, .01)  // seconds

  reply	other threads:[~2012-04-10 19:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10  0:27 Nick Bartos
2012-04-10 19:56 ` Nick Bartos [this message]
2012-04-10 23:16   ` [PATCH] " Greg Farnum
2012-04-10 23:45     ` Nick Bartos
2012-04-10 23:51       ` Greg Farnum
2012-04-10 23:51       ` Sage Weil
2012-04-11  0:13         ` Nick Bartos
2012-04-11 17:13           ` Greg Farnum
2012-04-12 18:42     ` Tommi Virtanen

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=CAPud5_7B8DG4hnVTqBnw7aHuJf8CJnPUjo3ZUfOjDPo89rqvSQ@mail.gmail.com \
    --to=nick@pistoncloud.com \
    --cc=ceph-devel@vger.kernel.org \
    --subject='Re: [PATCH] Statically binding ports for ceph-osd' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.