Commit 01dbaa71 authored by Felix Seibert's avatar Felix Seibert
Browse files

fix error in command format logic

parent bc539792
......@@ -206,7 +206,7 @@ class OSDManager(object):
osd_for_folder = self.distribution.get_containing_osd(folder_id)
self.move_folder_to_osd(folder_id, osd_for_folder.uuid)
def fix_physical_layout_internally(self, repeat_delete_interval_secs=15, iteration=0, max_files_in_progress=10):
def fix_physical_layout_internally(self, repeat_delete_interval_secs=15, iteration=0, max_files_in_progress=10000):
"""
fixes the physical layout, such that it matches the data distribution described in self.distribution
we use the following strategy: first, determine which files needs to be moved to another OSD, and create three lists.
......@@ -260,12 +260,17 @@ class OSDManager(object):
# create a replica on the correct osd
create_command = div_util.create_create_replica_command(absolute_file_path, osd_for_file)
command_tuple_list.append((policy_command, create_command, delete_command))
# in python, strings are also booleans!!! :)
if policy_command or create_command or delete_command:
command_tuple_list.append((policy_command, create_command, delete_command))
# end of recursion condition
if len(command_tuple_list) == 0:
return
if self.debug:
print("number of files that need to be moved: " + str(len(command_tuple_list)))
# run commands the new way
random.shuffle(command_tuple_list)
......@@ -288,15 +293,10 @@ class OSDManager(object):
if len(command_tuple_list) == 0:
break
# run sublist of commands the old way
start_time = time.time()
if self.debug:
print("starting execution of " + str(len(change_policy_command_list)) + " change policy commands...")
print("commands: ")
for command in change_policy_command_list:
print(str(command))
print(str(datetime.datetime.now()))
errored_processes = div_util.run_commands(change_policy_command_list, max_processes_change_policy)
end_time = time.time()
......@@ -348,11 +348,12 @@ class OSDManager(object):
# check the return code. if it is one, the replica could not be deleted, so we try again later.
if process[2] != 0:
errored_deletions.append(process[0])
print("errored command: ")
print("command: " + str(process[0]))
print("stdoud: " + str(process[1][0]))
print("stderr: " + str(process[1][1]))
print("retcode: " + str(process[2]))
if self.debug:
print("errored command: ")
print("command: " + str(process[0]))
print("stdoud: " + str(process[1][0]))
print("stderr: " + str(process[1][1]))
print("retcode: " + str(process[2]))
if len(errored_deletions) == 0:
break
......
......@@ -20,15 +20,15 @@ def get_osd_uuids(path):
def create_replication_policy_command(absolute_file_path):
return ["xtfsutil", "-r", "RONLY", absolute_file_path]
return command_list_to_single_string(["xtfsutil", "-r", "RONLY", absolute_file_path])
def create_create_replica_command(absolute_file_path, new_osd):
return ["xtfsutil", "-a" + new_osd, "--full", absolute_file_path]
return command_list_to_single_string(["xtfsutil", "-a" + new_osd, "--full", absolute_file_path])
def create_delete_replica_command(absolute_file_path, osd):
return ["xtfsutil", "-d", osd, absolute_file_path]
return command_list_to_single_string(["xtfsutil", "-d", osd, absolute_file_path])
def command_list_to_single_string(command_list):
......
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