Skip to content

Commit 7145321

Browse files
committed
door: add zone awareness to nfs, xrootd, and ftp doors
1 parent 9243096 commit 7145321

3 files changed

Lines changed: 33 additions & 5 deletions

File tree

modules/dcache-ftp/src/main/java/org/dcache/ftp/door/AbstractFtpDoorV1.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
226226
import org.dcache.auth.attributes.Restrictions;
227227
import org.dcache.auth.attributes.RootDirectory;
228228
import org.dcache.cells.CellStub;
229+
import org.dcache.cells.ZoneAware;
229230
import org.dcache.ftp.TransferMode;
230231
import org.dcache.ftp.proxy.ActiveAdapter;
231232
import org.dcache.ftp.proxy.PassiveConnectionHandler;
@@ -348,7 +349,7 @@ public ClientAbortException(int code, String reply) {
348349

349350
public abstract class AbstractFtpDoorV1
350351
implements LineBasedInterpreter, CellMessageReceiver, CellCommandListener,
351-
CellInfoProvider, CellMessageSender, CellIdentityAware {
352+
CellInfoProvider, CellMessageSender, CellIdentityAware, ZoneAware {
352353

353354
private static final long MINIMUM_PERFORMANCE_MARKER_PERIOD = 2;
354355
private static final long MAXIMUM_PERFORMANCE_MARKER_PERIOD = TimeUnit.MINUTES.toSeconds(5);
@@ -377,6 +378,8 @@ public abstract class AbstractFtpDoorV1
377378
private boolean _logAbortedTransfers;
378379
private final List<TimerTask> _activeTimerTasks = synchronizedList(new ArrayList<>());
379380

381+
Optional<String> _zone;
382+
380383
private enum WorkAround {
381384
/* If globus-url-copy is organising a third-party copy then it will
382385
* issue a QUIT command to the destination endpoint before
@@ -433,6 +436,10 @@ private enum WorkAround {
433436
REQUEST_MD5_WHEN_UPLOADING_FILES
434437
}
435438

439+
@Override
440+
public void setZone(Optional<String> zone) {
441+
_zone = zone;
442+
}
436443

437444
/**
438445
* Simple class to allow easy accumulation of space usage.
@@ -3445,6 +3452,7 @@ private void retrieve(String file, long offset, long size,
34453452
delayedPassive,
34463453
protocolFamily,
34473454
version);
3455+
transfer.setZone(_zone);
34483456
try {
34493457
LOGGER.info("retrieve user={}", getUser());
34503458
LOGGER.info("retrieve addr={}", _remoteSocketAddress);
@@ -3558,6 +3566,7 @@ private void store(String file, Mode mode, TransferMode xferMode,
35583566
delayedPassive,
35593567
protocolFamily,
35603568
version);
3569+
transfer.setZone(_zone);
35613570
try {
35623571
LOGGER.info("store receiving with mode {}", xferMode);
35633572

modules/dcache-nfs/src/main/java/org/dcache/chimera/nfsv41/door/NFSv41Door.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
import org.dcache.auth.attributes.Restrictions;
9090
import org.dcache.cells.CellStub;
9191
import org.dcache.cells.CuratorFrameworkAware;
92+
import org.dcache.cells.ZoneAware;
9293
import org.dcache.chimera.ChimeraFsException;
9394
import org.dcache.chimera.FsInode;
9495
import org.dcache.chimera.FsInodeType;
@@ -196,7 +197,7 @@
196197

197198
public class NFSv41Door extends AbstractCellComponent implements
198199
NFSv41DeviceManager, CellCommandListener,
199-
CellMessageReceiver, CellInfoProvider, CuratorFrameworkAware {
200+
CellMessageReceiver, CellInfoProvider, CuratorFrameworkAware, ZoneAware {
200201

201202
private static final Logger _log = LoggerFactory.getLogger(NFSv41Door.class);
202203

@@ -221,7 +222,6 @@ public class NFSv41Door extends AbstractCellComponent implements
221222
*/
222223
private final Map<stateid4, NfsTransfer> _transfers = new ConcurrentHashMap<>();
223224

224-
225225
/**
226226
* Record that binds NFS client with a file handle.
227227
*/
@@ -270,6 +270,8 @@ public record OpenFile(clientid4 clientid, Inode inode) {}
270270

271271
private String _ioQueue;
272272

273+
private Optional<String> _zone;
274+
273275
/**
274276
* TCP port number to bind.
275277
*/
@@ -490,6 +492,11 @@ public void setEnableTls(boolean enableTls) {
490492
_enableTls = enableTls;
491493
}
492494

495+
@Override
496+
public void setZone(Optional<String> zone) {
497+
_zone = zone;
498+
}
499+
493500
public VirtualFileSystem wrapWithMonitoring(VirtualFileSystem inner) {
494501
MonitoringVfs monitor = new MonitoringVfs();
495502
monitor.setInner(inner);
@@ -837,7 +844,7 @@ public Layout layoutGet(CompoundContext context, LAYOUTGET4args args)
837844
:
838845
new ReadTransfer(_pnfsHandler, client, layoutType, layoutState, nfsInode,
839846
context.getRpcCall().getCredential().getSubject());
840-
847+
transfer.setZone(_zone);
841848
_transfers.put(layoutStateid, transfer);
842849
layoutStates.put(ioKey, layoutStateid);
843850

@@ -859,6 +866,7 @@ public Layout layoutGet(CompoundContext context, LAYOUTGET4args args)
859866

860867
} else {
861868
// keep debug context in sync
869+
transfer.setZone(_zone);
862870
transfer.restoreSession();
863871
layoutState = transfer.getStateid();
864872
NDC.push(pnfsId.toString());

modules/dcache-xrootd/src/main/java/org/dcache/xrootd/door/XrootdDoor.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
import org.dcache.auth.attributes.Restriction;
103103
import org.dcache.cells.CellStub;
104104
import org.dcache.cells.MessageCallback;
105+
import org.dcache.cells.ZoneAware;
105106
import org.dcache.namespace.ACLPermissionHandler;
106107
import org.dcache.namespace.ChainedPermissionHandler;
107108
import org.dcache.namespace.CreateOption;
@@ -150,7 +151,7 @@
150151
public class XrootdDoor
151152
extends AbstractCellComponent
152153
implements CellMessageReceiver,
153-
CellCommandListener, CellInfoProvider {
154+
CellCommandListener, CellInfoProvider, ZoneAware {
154155

155156
public static final String XROOTD_PROTOCOL_STRING = "Xrootd";
156157
public static final String XROOTD_PROTOCOL_VERSION =
@@ -225,6 +226,8 @@ public class XrootdDoor
225226
private int proxyResponseTimeoutInSeconds;
226227
private InetAddress _internalAddress;
227228

229+
private Optional<String> _zone;
230+
228231
private UnionLoginStrategy.AccessLevel anonymousUserAccess = AccessLevel.NONE;
229232

230233
@Autowired(required = false)
@@ -304,6 +307,11 @@ public void setProxyTimerExecutor(ScheduledExecutorService proxyTimerExecutor) {
304307
this.proxyTimerExecutor = proxyTimerExecutor;
305308
}
306309

310+
@Override
311+
public void setZone(Optional<String> zone){
312+
_zone = zone;
313+
}
314+
307315
/**
308316
* Converts a colon separated list of paths to a List of FsPath.
309317
*/
@@ -496,6 +504,7 @@ public synchronized void finished(CacheException error) {
496504
}
497505
}
498506
};
507+
transfer.setZone(_zone);
499508
transfer.setCellAddress(getCellAddress());
500509
transfer.setPoolManagerStub(_poolManagerStub);
501510
transfer.setPoolStub(_poolStub);
@@ -546,6 +555,7 @@ private InetSocketAddress getMatchingLocalAddress(InetSocketAddress local)
546555
int handle = transfer.getFileHandle();
547556

548557
InetSocketAddress address = null;
558+
transfer.setZone(_zone);
549559
_transfers.put(handle, transfer);
550560
String explanation = "unspecified problem";
551561
try {
@@ -624,6 +634,7 @@ private FsPath getUploadPath(Subject subject, Restriction restriction,
624634
subject, restriction, opaque);
625635

626636
transfer.setOverwriteAllowed(overwrite);
637+
transfer.setZone(_zone);
627638

628639
/*
629640
* If this is a destination door/server and the session

0 commit comments

Comments
 (0)