From 23090112fa693c56c7bf78c62f5b051dfc7c6c82 Mon Sep 17 00:00:00 2001
From: Cristiano Urban <cristiano.urban@inaf.it>
Date: Thu, 13 Apr 2023 13:28:14 +0200
Subject: [PATCH] Added selected pool to logs on migrate operation.

Signed-off-by: Cristiano Urban <cristiano.urban@inaf.it>
---
 transfer_service/tape_client.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/transfer_service/tape_client.py b/transfer_service/tape_client.py
index 626b523..7bbe583 100644
--- a/transfer_service/tape_client.py
+++ b/transfer_service/tape_client.py
@@ -37,7 +37,7 @@ class TapeClient(object):
         self.scp = None
         self.taskList = []
         self.poolList = []
-    
+
     def connect(self):
         """Connects to the tape library frontend."""
         try:
@@ -50,7 +50,7 @@ class TapeClient(object):
         except Exception:
             self.logger.exception("Unable to establish SSH connection with tape library frontend.")
             raise
-    
+
     def getPoolList(self):
         """Returns a list of 'TapePool' objects."""
         cmd = f"{self.EEADM} pool list --json"
@@ -92,7 +92,7 @@ class TapeClient(object):
                 return self.poolList.copy()
             else:
                 raise TapeClientException(cmd, exitCode, stderr)
-    
+
     def getTaskList(self):
         """Returns the whole task list."""
         cmd = f"{self.EEADM} task list --json"
@@ -125,7 +125,7 @@ class TapeClient(object):
                 return self.taskList.copy()
             else:
                 raise TapeClientException(cmd, exitCode, stderr)
-            
+
     def copy(self, srcPath, destPath):
         """Copies files/dirs recursively by passing their absolute paths."""
         try:
@@ -144,15 +144,15 @@ class TapeClient(object):
                 raise ScpInvalidFileException
         finally:
             self.scp.close()
-        
+
     def migrate(self, fileList, tapePool, jobId):
         """
-        Migrates to tape all files whose absolute path is 
+        Migrates to tape all files whose absolute path is
         contained in 'fileList'.
-        A tape pool and a VOSpace jobId are also required 
+        A tape pool and a VOSpace jobId are also required
         as parameters.
         """
-        self.logger.info("Starting MIGRATE operation...")
+        self.logger.info(f"Starting MIGRATE operation (tape pool = '{tapePool}')...")
         migrateFileList = f"vos_migrate-{jobId}.lst"
         try:
             fp = open(migrateFileList, "a")
@@ -178,10 +178,10 @@ class TapeClient(object):
                     self.logger.error("MIGRATE operation FAILED.")
                     raise TapeClientException(cmd, exitCode, stderr)
                 return exitCode
-    
-    def recall(self, fileList, jobId): 
+
+    def recall(self, fileList, jobId):
         """
-        Recalls from tape all files whose absolute path is 
+        Recalls from tape all files whose absolute path is
         contained in 'fileList'.
         A VOSpace job ID is also required as parameter.
         """
@@ -211,10 +211,10 @@ class TapeClient(object):
                     self.logger.error("RECALL operation FAILED.")
                     raise TapeClientException(cmd, exitCode, stderr)
                 return exitCode
-    
+
     def recallChecksumFiles(self, dirName):
         """
-        Recursively recalls from tape all the checksum files related to 
+        Recursively recalls from tape all the checksum files related to
         the 'dirName' directory.
         """
         self.logger.info("Starting RECALL_CHECKSUM operation...")
@@ -232,7 +232,7 @@ class TapeClient(object):
                 self.logger.error("RECALL_CHECKSUM operation FAILED.")
                 raise TapeClientException(cmd, exitCode, stderr)
             return exitCode
-    
+
     def disconnect(self):
         """Performs a cleanup and closes the connection."""
         self.taskList.clear()
@@ -254,7 +254,7 @@ class TapeClient(object):
         used = res[2]
         available = res[3]
         return ( total, used, available)
-        
+
 
 # Test
 #tc = TapeClient("192.168.56.101", 22, "root", "ibm")
-- 
GitLab