Skip to content

Commit 58906cd

Browse files
author
Alexander Rogovskiy
committed
feat: add "remoteonly" value to the SE Access option
It's the same as "remote", but prevents using the protocol in local context (e.g. to upload data from some site's WNs to the local SE). This may be useful for sites with different storage infrastructure for local and remote transfers.
1 parent 0cfeeeb commit 58906cd

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

docs/source/AdministratorGuide/Resources/storage.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ DIRAC provides an abstraction of a SE interface that allows to access different
2020
# The name of the DIRAC Plugin module to be used for implementation
2121
# of the access protocol
2222
PluginName = SRM2
23-
# Flag specifying the access type (local/remote)
23+
# Flag specifying the access type (local/remote/remoteonly)
2424
Access = remote
2525
# Protocol name
2626
Protocol = srm
@@ -50,6 +50,7 @@ Configuration options are:
5050
* ``UseCatalogURL``: default ``False``. If ``True``, use the url stored in the catalog instead of regenerating it
5151
* ``ChecksumType``: default ``ADLER32``. NOT ACTIVE !
5252
* ``Alias``: when set to the name of another storage element, it instanciates the other SE instead.
53+
* ``Access``: Can be ``local``, ``remote`` or ``remoteonly``. Options specify that the protocol can be used in local (e.g. upload from a WN to local SE), remote+local or remote context.
5354
* ``ReadAccess``: default ``True``. Allowed for Read if no RSS enabled (:ref:`activateRSS`)
5455
* ``WriteAccess``: default ``True``. Allowed for Write if no RSS enabled
5556
* ``CheckAccess``: default ``True``. Allowed for Check if no RSS enabled

src/DIRAC/Resources/Storage/StorageElement.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,10 @@ def __filterPlugins(self, methodName, protocols=None, inputProtocol=None):
11531153
# Determine whether to use this storage object
11541154
pluginParameters = plugin.getParameters()
11551155
isProxyPlugin = pluginParameters.get("PluginName") == "Proxy"
1156+
try:
1157+
isRemoteOnly = pluginParameters.get("Access").lower() == "remoteonly"
1158+
except AttributeError:
1159+
isRemoteOnly = False
11561160

11571161
if not pluginParameters:
11581162
log.debug("Failed to get storage parameters.", f"{self.name} {protocolSection}")
@@ -1167,6 +1171,10 @@ def __filterPlugins(self, methodName, protocols=None, inputProtocol=None):
11671171
log.debug(f"Plugin {protocolSection} not allowed for {methodName}.")
11681172
continue
11691173

1174+
# If protocol is remote only and the context is local, skip it.
1175+
if isRemoteOnly and localSE:
1176+
continue
1177+
11701178
# If we are attempting a putFile and we know the inputProtocol
11711179
if methodName == "putFile" and inputProtocol:
11721180
if inputProtocol not in pluginParameters["InputProtocols"]:

src/DIRAC/Resources/Storage/StorageFactory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,14 @@ def _getConfigStorageProtocols(self, storageName, derivedStorageName=None, seCon
333333
for protocolSectionName, protocolDict in self.protocols.items():
334334
# Now update the local and remote protocol lists.
335335
# A warning will be given if the Access option is not set to local or remote.
336-
if protocolDict["Access"].lower() == "remote":
336+
if protocolDict["Access"].lower() in ("remote", "remoteonly"):
337337
self.remoteProtocolSections.append(protocolSectionName)
338338
elif protocolDict["Access"].lower() == "local":
339339
self.localProtocolSections.append(protocolSectionName)
340340
else:
341341
errStr = (
342342
"StorageFactory.__getProtocolDetails: The 'Access' option \
343-
for %s:%s is neither 'local' or 'remote'."
343+
for %s:%s is not 'local', 'remote' or 'remoteonly'."
344344
% (storageName, protocolSectionName)
345345
)
346346
gLogger.warn(errStr)

0 commit comments

Comments
 (0)