Commit 855d726c authored by Felix Seibert's avatar Felix Seibert
Browse files

adding a get cointaining folder id method

parent 4ca5085b
......@@ -185,7 +185,8 @@ class OSDManager(object):
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))
osd_for_file = self.distribution.get_containing_osd(self.get_containing_folder_id(
self.path_on_volume(absolute_file_path)))
if self.debug:
print("absolute file path: " + str(absolute_file_path))
......@@ -631,7 +632,9 @@ class OSDManager(object):
print("Executing copy commands done.")
'''
creates a list of all folders, managed by this XtreemFS OSD manager, that have an assigned OSD.
creates a list of all folders, managed by this XtreemFS OSD manager, that have an assigned OSD
TODO this actually just returns a list of all level 2 subdirectories, independently of whether they are actually
assigned to some OSD or not. i think that this is not the expected behaviour.
'''
def get_assigned_folders(self):
......@@ -666,6 +669,18 @@ class OSDManager(object):
"manager!")
return os.path.join(self.volumeName, path[len(self.pathToMountPoint) + 1:])
'''
search for the assigned folder that is a prefix of the given path on volume
'''
def get_containing_folder_id(self, path_on_volume):
for osd in self.distribution.get_osd_list:
for a_folder in osd.folders:
if path_on_volume.startsWith(a_folder.id):
return a_folder.id
return None
def __str__(self):
representation = "pathToMountPoint: " + self.pathToMountPoint + " volumeName: " + self.volumeName + " pathOnVolume: " \
+ self.pathOnVolume
......
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