Skip to content
Snippets Groups Projects
Commit 46f889ed authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Completed recall method (to be tested) + minor changes.

parent 61037bcb
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,9 @@ class RetrieveExecutor(TaskExecutor): ...@@ -46,7 +46,9 @@ class RetrieveExecutor(TaskExecutor):
fileList.append(srcPath) fileList.append(srcPath)
self.dbConn.disconnect() self.dbConn.disconnect()
if fileList: if fileList:
self.tapeClient.connect()
self.tapeClient.recall(fileList) self.tapeClient.recall(fileList)
self.tapeClient.disconnect()
def retrieveData(self): def retrieveData(self):
self.dbConn.connect() self.dbConn.connect()
...@@ -62,11 +64,11 @@ class RetrieveExecutor(TaskExecutor): ...@@ -62,11 +64,11 @@ class RetrieveExecutor(TaskExecutor):
out.write(f"osRelParentPath: {osRelParentPath}\n") out.write(f"osRelParentPath: {osRelParentPath}\n")
destPath = self.storageRetrievePath.replace("{username}", username) + osRelParentPath destPath = self.storageRetrievePath.replace("{username}", username) + osRelParentPath
out.write(f"destPath: {destPath}\n\n") out.write(f"destPath: {destPath}\n\n")
if storageType == "cold": #if storageType == "cold":
#srcPathPrefix = self.tapeStorageBasePath.replace("{username}", self.username) #srcPathPrefix = self.tapeStorageBasePath.replace("{username}", self.username)
# TO BE DONE # TO BE DONE
pass # pass
else: #else:
os.makedirs(destPath, exist_ok = True) os.makedirs(destPath, exist_ok = True)
sp = subprocess.run(["rsync", "-av", srcPath, destPath], capture_output = True) sp = subprocess.run(["rsync", "-av", srcPath, destPath], capture_output = True)
out.write(f"rsync stdout: {sp.stdout}") out.write(f"rsync stdout: {sp.stdout}")
......
...@@ -73,8 +73,13 @@ class TapeClient(object): ...@@ -73,8 +73,13 @@ class TapeClient(object):
def recall(self, fileList): def recall(self, fileList):
#TODO #TODO
cmd = "eeadm recall" tmp = str(uuid.uuid1().hex) + "-vos_recall.tmp"
tmp = str(uuid.uuid1().hex) + ".tmp" fp = open(tmp, "a")
for f in fileList:
fp.write(f"{f}\n")
fp.close()
self.copy("./" + tmp, "/tmp/" + tmp)
cmd = "eeadm recall /tmp/" + tmp
stdin, stdout, stderr = self.client.exec_command(cmd) stdin, stdout, stderr = self.client.exec_command(cmd)
def recallChecksumFiles(self, dirName): def recallChecksumFiles(self, dirName):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment