Re: [PATCH 3/6] PYNFS use loopback addresses for MDS<->DS communication

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I gave this to Fred some time ago.  This patch is a hack that only works when the MDS and all data servers are run on the same host.

It's easy enough to use aliases on an interface and bring those down, but the ordering problem remains: 
The pynfs MDS <-> DS backchannel uses the first address in the address list and most clients (including linux) will use the first address that works when communicating with data servers, so bringing down the alias that the DS is communicating on will also break the pynfs backchannel.

I'll rework the patch to allow this testing on both localhost and across hosts.

-dros
 
On May 29, 2012, at 5:57 PM, <andros@xxxxxxxxxx>
 <andros@xxxxxxxxxx> wrote:

> From: Weston Andros Adamson <dros@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
> 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
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux