linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andros@netapp.com
To: iisaman@netapp.com
Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson <dros@netapp.com>
Subject: [PATCH 3/6] PYNFS use loopback addresses for MDS<->DS communication
Date: Tue, 29 May 2012 17:57:56 -0400	[thread overview]
Message-ID: <1338328679-28837-4-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1338328679-28837-1-git-send-email-andros@netapp.com>

From: Weston Andros Adamson <dros@netapp.com>

if a loopback addresses is specified for a DS, use that address for MDS to DS
communication and remove it from the advertised addresses in getdeviceinfo
(it obviously would never work).

this is useful for testing network partitions - you can bring down / firewall
off an interface without breaking MDS<->DS communications.

an example dataservers.conf:

192.168.55.1:12345,127.0.0.1:12345/pynfs_mds
192.168.55.1:12346,127.0.0.1:12346/pynfs_mds

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
 nfs4.1/dataserver.py |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/nfs4.1/dataserver.py b/nfs4.1/dataserver.py
index 65e4f55..dd2a535 100644
--- a/nfs4.1/dataserver.py
+++ b/nfs4.1/dataserver.py
@@ -187,9 +187,27 @@ class DSDevice(object):
                     log.critical("Could not parse line: %r" % line)
                     sys.exit(1)
 
-                # for now, just use the last path for local connections
-                server, port = server_list[-1]
-                server_list = server_list[:-1]
+                # if there is a (IPv4) loopback address in the multipath list,
+                # use that as the connection to the DS, but dont advertise it
+                loopback_idx = -1
+                for i, serverport in enumerate(server_list):
+                    if serverport[0] == '127.0.0.1':
+                        loopback_idx = i
+                        break
+
+                if loopback_idx >= 0:
+                    print "Using loopback address for MDS->DS communication only"
+                    server_list = list(server_list)
+                    server, port = server_list.pop(loopback_idx)
+                else:
+                    # just use the last path for local connections
+                    server, port = server_list[-1]
+
+                if not server_list:
+                    log.critical("At least one non-loopback address must " +
+                                 "be specified for each DS")
+                    sys.exit(1)
+
                 print server, port, path
                 try:
                     log.info("Adding dataserver ip:%s port:%s path:%s" %
@@ -210,9 +228,7 @@ class DSDevice(object):
         index = 0
         for d in self.list:
             if d.active:
-                multipath = []
-                multipath.extend(d.get_multipath_netaddr4s())
-                multipath.append(d.get_netaddr4())
+                multipath = d.get_multipath_netaddr4s()
                 netaddrs.append(multipath)
                 stripe_indices.append(index)
                 index = index + 1
-- 
1.7.7.6


  parent reply	other threads:[~2012-06-01 21:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 21:57 [PATCH 0/6] PYNFS various patches andros
2012-05-29 21:57 ` [PATCH 1/6] PYNFS rpc drop fix andros
2012-05-29 21:57 ` [PATCH 2/6] PYNFS fix rpcgen andros
2012-05-29 21:57 ` andros [this message]
2012-06-01 21:57   ` [PATCH 3/6] PYNFS use loopback addresses for MDS<->DS communication Adamson, Dros
2012-05-29 21:57 ` [PATCH 4/6] PYNFS use requested iomode on layoutget andros
2012-05-29 21:57 ` [PATCH 5/6] PYNFS: add mdsthreshold to file layout server andros
2012-05-29 21:57 ` [PATCH 6/6] PYNFS implement FREE_STATEID and TEST_STATEID operations andros

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=1338328679-28837-4-git-send-email-andros@netapp.com \
    --to=andros@netapp.com \
    --cc=dros@netapp.com \
    --cc=iisaman@netapp.com \
    --cc=linux-nfs@vger.kernel.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).