Commit 0a20301b authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Fixed usgae of protocol by creating a protocol property in the D2DTransfer object

parent 09cf85bf
......@@ -299,11 +299,10 @@ class LocalQueue(Queue.Queue):
self.lock.acquire()
try:
for qTransfer in self.queueingTransfers.values():
protocol = qTransfer.transfer.protocol
if qTransfer.transfer.transferType in (TransferType.D2DSRC, TransferType.D2DDST):
protocol = TransferType.toStr(qTransfer.transfer.transferType)
user = 'stage'
else:
protocol = qTransfer.transfer.protocol
try:
user = pwd.getpwuid(qTransfer.transfer.euid)[0]
except KeyError:
......@@ -332,10 +331,6 @@ class LocalQueue(Queue.Queue):
self.lock.acquire()
try:
for transferId, qTransfer in self.queueingTransfers.items():
if qTransfer.transfer.transferType in (TransferType.D2DSRC, TransferType.D2DDST):
protocol = TransferType.toStr(qTransfer.transfer.transferType)
else:
protocol = qTransfer.transfer.protocol
if qTransfer.transfer.transferType == TransferType.STD:
try:
user = pwd.getpwuid(qTransfer.transfer.euid)[0]
......@@ -344,7 +339,7 @@ class LocalQueue(Queue.Queue):
else:
user = 'stage'
if not reqUser or user == reqUser:
res.append((transferId, qTransfer.transfer.fileId, qTransfer.scheduler, user, 'PEND', protocol, qTransfer.transfer.creationTime, None))
res.append((transferId, qTransfer.transfer.fileId, qTransfer.scheduler, user, 'PEND', qTransfer.transfer.protocol, qTransfer.transfer.creationTime, None))
n = n + 1
if n >= 100: # give up with full listing if too many transfers
break
......
......@@ -303,10 +303,7 @@ class RunningTransfersSet(object):
self.lock.acquire()
try:
for rTransfer in self.transfers:
if rTransfer.transfer.transferType in (TransferType.D2DDST, TransferType.D2DSRC):
n = n + self.config.getValue('DiskManager', TransferType.toStr(rTransfer.transfer.transferType) + 'Weight', 1, int)
else:
n = n + self.config.getValue('DiskManager', rTransfer.transfer.protocol+'Weight', 1, int)
n = n + self.config.getValue('DiskManager', rTransfer.transfer.protocol+'Weight', 1, int)
finally:
self.lock.release()
# and now tape transfers
......@@ -451,13 +448,9 @@ class RunningTransfersSet(object):
try:
for rTransfer in self.transfers:
transfer = rTransfer.transfer
try:
protocol = transfer.protocol
except AttributeError:
protocol = TransferType.toStr(transferType)
if not reqUser or transfer.user == transfer.user:
res.append((transfer.transferId, transfer.fileId, rTransfer.scheduler,
transfer.user, 'RUN', protocol, transfer.creationTime,
transfer.user, 'RUN', transfer.protocol, transfer.creationTime,
rTransfer.startTime))
finally:
self.lock.release()
......
......@@ -252,6 +252,12 @@ class D2DTransfer(BaseTransfer):
svcClassName, creationTime, transferType, diskServer, mountPoint)
self.isSrcRunning = isSrcRunning
@property
def protocol(self):
'''get protocol name, either taking the actual protocol member or building one from the transferType'''
return TransferType.toStr(self.transferType)
class TapeTransfer(object):
'''little container describing a tape transfer'''
def __init__(self, transferType, startTime, clientHost, fileId, mountPoint, lastTimeViewed):
......
......@@ -444,14 +444,10 @@ class ServerQueue(dict):
for diskServer in self.transfersLocations[(transferId, transferType)]:
# get information about the transfer
transfer = self[diskServer][transferId]
try:
protocol = transfer.protocol
except AttributeError:
protocol = TransferType.toStr(transferType)
# add the transfer to list of results
res.append((transferId, transfer.fileId, socket.getfqdn(),
transfer.user, 'PEND', diskpool, diskServer,
protocol, transfer.creationTime, None))
transfer.protocol, transfer.creationTime, None))
finally:
self.lock.release()
return res
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment