Commit 4ca5085b authored by Felix Seibert's avatar Felix Seibert
Browse files

resticting moved files to files within one of the assigned folders

parent 884ad02d
......@@ -178,30 +178,34 @@ class OSDManager(object):
create_replica_command_list = []
delete_replica_command_list = []
for directory in os.walk(self.managedFolder):
for filename in directory[2]:
absolute_file_path = os.path.join(directory[0], filename)
osd_of_file = div_util.get_osd_uuid(absolute_file_path)
osd_for_file = self.distribution.get_containing_osd(self.path_on_volume(absolute_file_path))
if self.debug:
print("absolute file path: " + str(absolute_file_path))
print("osd_of_file: " + str(osd_of_file))
print("osd_for_file: " + str(osd_for_file))
if osd_of_file != osd_for_file:
# create replication commands
# collect replication commands
# run replication commands - handle errors if new replica is not complete yet
# if no replication is used (otherwise than for moving the files from osd to osd),
# we should reset the replication policy to none
policy_command = div_util.create_replication_policy_command(absolute_file_path)
create_command = div_util.create_create_replica_command(absolute_file_path, osd_for_file)
delete_command = div_util.create_delete_replica_command(absolute_file_path, osd_of_file)
change_policy_command_list.append(div_util.command_list_to_single_string(policy_command))
create_replica_command_list.append(div_util.command_list_to_single_string(create_command))
delete_replica_command_list.append(div_util.command_list_to_single_string(delete_command))
managed_folders = self.get_assigned_folders()
for managed_folder in managed_folders:
for directory in os.walk(managed_folder):
for filename in directory[2]:
absolute_file_path = os.path.join(directory[0], filename)
osd_of_file = div_util.get_osd_uuid(absolute_file_path)
osd_for_file = self.distribution.get_containing_osd(self.path_on_volume(absolute_file_path))
if self.debug:
print("absolute file path: " + str(absolute_file_path))
print("osd_of_file: " + str(osd_of_file))
print("osd_for_file: " + str(osd_for_file))
print("path on volume: " + self.path_on_volume(absolute_file_path))
if osd_of_file != osd_for_file:
# create replication commands
# collect replication commands
# run replication commands - handle errors if new replica is not complete yet
# if no replication is used (otherwise than for moving the files from osd to osd),
# we should reset the replication policy to none
policy_command = div_util.create_replication_policy_command(absolute_file_path)
create_command = div_util.create_create_replica_command(absolute_file_path, osd_for_file)
delete_command = div_util.create_delete_replica_command(absolute_file_path, osd_of_file)
change_policy_command_list.append(div_util.command_list_to_single_string(policy_command))
create_replica_command_list.append(div_util.command_list_to_single_string(create_command))
delete_replica_command_list.append(div_util.command_list_to_single_string(delete_command))
processes = div_util.run_commands(change_policy_command_list)
if self.debug:
......
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