diff --git a/castor/scheduler/diskmanager/activitycontrol.py b/castor/scheduler/diskmanager/activitycontrol.py index 53312ac21118c400efe3065b6643fb22d7f10b4a..855d4543a9480b5f1563d17a60fabd1095a47a0a 100644 --- a/castor/scheduler/diskmanager/activitycontrol.py +++ b/castor/scheduler/diskmanager/activitycontrol.py @@ -42,13 +42,15 @@ def signBase64(content, RSAKey): signature = signer.sign(contentHash) return base64.b64encode(signature) -def buildXrootURL(self, diskserver, path, transferType): +def buildXrootURL(self, diskserver, path, transferId, transferType): '''Builds a xroot valid url for the given path on the given diskserver''' # base url and key parameter url = 'root://'+diskserver+':1095//' + path + '?' - opaque_dict = {'castor2fs.pfn1' : path, + opaque_dict = {'castor.pfn1' : path, + 'castor.pfn2' : '0:' + self.config.getValue('DiskManager', 'MoverHandlerPort', 15511) \ + + ':' + transferId, 'castor.txtype' : transferType, - 'castor2fs.exptime' : str(int(time.time()) + 3600)} + 'castor.exptime' : str(int(time.time()) + 3600)} # signature part try: @@ -57,10 +59,11 @@ def buildXrootURL(self, diskserver, path, transferType): '/opt/xrootd/keys/key.pem') key = RSA.importKey(open(keyFile, 'r').read()) # sign opaque part obtained by concatenating the values - opaque_token = ''.join([opaque_dict['castor2fs.pfn1'], + opaque_token = ''.join([opaque_dict['castor.pfn1'], + opaque_dict['castor.pfn2'], opaque_dict['castor.txtype'], "0", # accessop - opaque_dict['castor2fs.exptime']]) + opaque_dict['castor.exptime']]) signature = signBase64(opaque_token, key) opaque = "" @@ -118,8 +121,8 @@ class ActivityControlThread(threading.Thread): # build command line transferType = 'd2d' + D2DTransferType.toStr(transfer.replicationType) srcDS, srcPath = srcDcPath.split(':', 1) - cmdLine = ['xrdcp', buildXrootURL(self, srcDS, srcPath, transferType), \ - buildXrootURL(self, 'localhost', destDcPath, transferType)] + cmdLine = ['xrdcp', buildXrootURL(self, srcDS, srcPath, transfer.transferId, transferType), \ + buildXrootURL(self, 'localhost', destDcPath, transfer.transferId, transferType)] # "Transfer starting" message dlf.write(msgs.TRANSFERSTARTING, subreqid=transfer.transferId, reqid=transfer.reqId, fileId=transfer.fileId, diff --git a/castor/tape/tapeserver/file/DiskFile.cpp b/castor/tape/tapeserver/file/DiskFile.cpp index ac3853dec5342f3074cf746c7671f774a35c8dea..56c359fb161de89fe6467ca1e73c3c48f623c140 100644 --- a/castor/tape/tapeserver/file/DiskFile.cpp +++ b/castor/tape/tapeserver/file/DiskFile.cpp @@ -388,11 +388,11 @@ XrootC2FSReadFile::XrootC2FSReadFile(const std::string &url, using XrdCl::OpenFlags; m_signedURL = m_URL; // Turn the bare URL into a Castor URL, by adding opaque tags: - // ?castor2fs.pfn1=/srv/castor/... (duplication of the path in practice) + // ?castor.pfn1=/srv/castor/... (duplication of the path in practice) // ?castor.txtype=tape - // ?castor2fs.pool=xxx optional ceph pool - // ?castor2fs.exptime=(unix time) - // ?castor2fs.signature= + // ?castor.pool=xxx optional ceph pool + // ?castor.exptime=(unix time) + // ?castor.signature= //Find the path part of the url. It is the first occurence of "//" // after the inital [x]root:// const std::string scheme = "root://"; @@ -416,12 +416,12 @@ XrootC2FSReadFile::XrootC2FSReadFile(const std::string &url, std::string signature = CryptoPPSigner::sign(signatureBlock.str(), xrootPrivateKey); std::stringstream opaqueBloc; - opaqueBloc << "?castor2fs.pfn1=" << path; + opaqueBloc << "?castor.pfn1=" << path; if (pool.size()) - opaqueBloc << "&castor2fs.pool=" << pool; + opaqueBloc << "&castor.pool=" << pool; opaqueBloc << "&castor.txtype=tape"; - opaqueBloc << "&castor2fs.exptime=" << expTime; - opaqueBloc << "&castor2fs.signature=" << signature; + opaqueBloc << "&castor.exptime=" << expTime; + opaqueBloc << "&castor.signature=" << signature; m_signedURL = m_URL + opaqueBloc.str(); // ... and finally open the file @@ -479,10 +479,10 @@ XrootC2FSWriteFile::XrootC2FSWriteFile(const std::string &url, m_URL=url; m_signedURL = m_URL; // Turn the bare URL into a Castor URL, by adding opaque tags: - // ?castor2fs.pfn1=/srv/castor/... (duplication of the path in practice) - // ?castor2fs.pool=xxx optional ceph pool - // ?castor2fs.exptime=(unix time) - // ?castor2fs.signature= + // ?castor.pfn1=/srv/castor/... (duplication of the path in practice) + // ?castor.pool=xxx optional ceph pool + // ?castor.exptime=(unix time) + // ?castor.signature= //Find the path part of the url. It is the first occurence of "//" // after the inital [x]root:// const std::string scheme = "root://"; @@ -506,12 +506,12 @@ XrootC2FSWriteFile::XrootC2FSWriteFile(const std::string &url, std::string signature = CryptoPPSigner::sign(signatureBlock.str(), xrootPrivateKey); std::stringstream opaqueBloc; - opaqueBloc << "?castor2fs.pfn1=" << path; + opaqueBloc << "?castor.pfn1=" << path; if (pool.size()) - opaqueBloc << "&castor2fs.pool=" << pool; + opaqueBloc << "&castor.pool=" << pool; opaqueBloc << "&castor.txtype=tape"; - opaqueBloc << "&castor2fs.exptime=" << expTime; - opaqueBloc << "&castor2fs.signature=" << signature; + opaqueBloc << "&castor.exptime=" << expTime; + opaqueBloc << "&castor.signature=" << signature; m_signedURL = m_URL + opaqueBloc.str(); XrootClEx::throwOnError(m_xrootFile.Open(m_signedURL, OpenFlags::Delete),