Repository: rucio/rucio

Issue:
Misleading warning in srm scheme 
Motivation
----------
The srm scheme currently requires space_token as  extended_attribute, however when space_token is not set, rucio complains about  extended_attributes and web_service_path not specfied.

Modification
------------
Happens in these lines: 
https://github.com/rucio/rucio/blob/5fa4bb25b6f5b75913773b65217a5fcde6e94f1c/lib/rucio/core/rse.py#L691-L692

Expected behavior
-----------------
Ideally , space_token would be an optional attribute,  and if not used, no spacetoken should be passed to FTS transfer job submission command.    See also  #574


Discussion:
Note - this is fixed in `next` but not in `master`.  So, I think this becomes a backport exercise.

Resolving patch:
diff --git a/lib/rucio/daemons/conveyor/common.py b/lib/rucio/daemons/conveyor/common.py
--- a/lib/rucio/daemons/conveyor/common.py
+++ b/lib/rucio/daemons/conveyor/common.py
@@ -6,7 +6,7 @@
 #
 # Authors:
 # - Vincent Garonne, <vincent.garonne@cern.ch>, 2012-2014
-# - Mario Lassnig, <mario.lassnig@cern.ch>, 2013-2015
+# - Mario Lassnig, <mario.lassnig@cern.ch>, 2013-2018
 # - Cedric Serfon, <cedric.serfon@cern.ch>, 2013-2016
 # - Wen Guan, <wen.guan@cern.ch>, 2014-2016
 # - Joaquin Bogado, <jbogadog@cern.ch>, 2016
@@ -168,7 +168,8 @@ def bulk_group_transfer(transfers, policy='rule', group_bulk=200, fts_source_str
                       'job_metadata': {'issuer': 'rucio'},  # finaly job_meta will like this. currently job_meta will equal file_meta to include request_id and etc.
                       'source_spacetoken': transfer['src_spacetoken'] if transfer['src_spacetoken'] else None,
                       'overwrite': transfer['overwrite'],
-                      'priority': 3}
+                      'priority': 3,
+                      's3alternate': True}
 
         if max_time_in_queue:
             if transfer['file_metadata']['activity'] in max_time_in_queue:
diff --git a/lib/rucio/rse/rsemanager.py b/lib/rucio/rse/rsemanager.py
--- a/lib/rucio/rse/rsemanager.py
+++ b/lib/rucio/rse/rsemanager.py
@@ -13,7 +13,8 @@
  - Cedric Serfon, <cedric.serfon@cern.ch>, 2013-2014, 2017
  - Wen Guan, <wen.guan@cern.ch>, 2014-2015
  - Martin Barisits, <martin.barisits@cern.ch>, 2017-2018
- - Tobias Wegner, <tobias.wegner@cern.ch>, 2017
+ - Tobias Wegner, <tobias.wegner@cern.ch>, 2017-2018
+ - Nicolo Magini, <nicolo.magini@cern.ch>, 2018
 '''
 
 import copy
@@ -311,7 +312,7 @@ def exists(rse_settings, files):
     return [gs, ret]
 
 
-def upload(rse_settings, lfns, source_dir=None, force_pfn=None):
+def upload(rse_settings, lfns, source_dir=None, force_pfn=None, force_scheme=None):
     """
         Uploads a file to the connected storage.
         Providing a list indicates the bulk mode.
@@ -321,6 +322,7 @@ def upload(rse_settings, lfns, source_dir=None, force_pfn=None):
                             If the 'filename' key is present, it will be used by Rucio as the actual name of the file on disk (separate from the Rucio 'name').
         :param source_dir:  path to the local directory including the source files
         :param force_pfn: use the given PFN -- can lead to dark data, use sparingly
+        :param force_scheme: use the given protocol scheme, overriding the protocol priority in the RSE description
 
         :returns: True/False for a single file or a dict object with 'scope:name' as keys and True or the exception as value for each file in bulk mode
 
@@ -332,9 +334,9 @@ def upload(rse_settings, lfns, source_dir=None, force_pfn=None):
     ret = {}
     gs = True  # gs represents the global status which indicates if every operation worked in bulk mode
 
-    protocol = create_protocol(rse_settings, 'write')
+    protocol = create_protocol(rse_settings, 'write', scheme=force_scheme)
     protocol.connect()
-    protocol_delete = create_protocol(rse_settings, 'delete')
+    protocol_delete = create_protocol(rse_settings, 'delete', scheme=force_scheme)
     protocol_delete.connect()
 
     lfns = [lfns] if not type(lfns) is list else lfns


Test patch: