Commit 6fb5ce63 authored by Felix Seibert's avatar Felix Seibert
Browse files

fixing within-volume external physical layout fix

parent 90a67c65
......@@ -438,6 +438,47 @@ class OSDManager(object):
if execute_copy:
self.__copy_data(new_folders, environment, remote_source)
def __generate_move_commands_slurm(self, osd_to_folders_map, tmp_dir=None):
if self.debug:
print("Using SLURM mode for moving folders...")
if tmp_dir is None:
tmp_dir = os.path.join(self.pathToMountPoint, self.volumeName, '.tmp_move_folder')
os.makedirs(tmp_dir, exist_ok=True)
slurm_hosts = div_util.get_slurm_hosts()
if self.debug:
print('slurm_hosts: ', slurm_hosts)
osd_to_host_map = div_util.get_osd_to_hostname_map(self.volume_information[1], slurm_hosts)
if self.debug:
print('osd_to_host_map: ', osd_to_host_map)
command_list = []
host_name = ""
# command = ""
for key in osd_to_folders_map.keys():
if host_name == "":
host_name = osd_to_host_map[key]
command = ""
for move_folder in osd_to_folders_map[key]:
folder_path = os.path.join(self.pathToMountPoint, move_folder.folder_id)
folder_tmp_path = os.path.join(tmp_dir, move_folder.folder_id)
command += "srun -N1-1 --nodelist=" + host_name
command += " move " + folder_path
command += " " + tmp_dir
command += " ;"
command += " move " + folder_tmp_path
command += " " + folder_path + " ; "
if len(osd_to_folders_map[key]) > 0:
command_list.append(command)
# command_list.append(command)
return command_list
'''
moves a folder from one OSD to another OSD. you may specify a temporary folder.
'''
......@@ -479,8 +520,10 @@ class OSDManager(object):
for file in files:
current_file_path = os.path.join(root, file)
copied_file_path = os.path.join(tmp_dir, file)
shutil.move(current_file_path, copied_file_path)
shutil.move(copied_file_path, current_file_path)
shutil.copy(current_file_path, copied_file_path)
os.remove(current_file_path)
shutil.copy(copied_file_path, os.path.split(current_file_path)[0])
os.remove(copied_file_path)
shutil.rmtree(tmp_dir, ignore_errors=True)
......
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