Commit 9afa6268 authored by Felix Seibert's avatar Felix Seibert
Browse files

refactor function order

parent ef5fe0a5
......@@ -62,6 +62,17 @@ class DataDistribution(object):
return checked_osd
return None
def assign_new_osd(self, folder_id, new_osd):
"""
assign folder_id to new_osd. if folder_id already is assigned to an OSD, this old assignment is deleted.
"""
old_osd = self.get_containing_osd(folder_id)
if old_osd is None:
self.OSDs[new_osd].add_folder(folder_id, self.get_average_folder_size())
else:
self.OSDs[new_osd].add_folder(folder_id, self.OSDs[old_osd.uuid].folders[folder_id])
self.OSDs[old_osd.uuid].remove_folder(folder_id)
def get_average_folder_size(self):
"""
get the average folder size of all folders of all OSDs.
......@@ -75,17 +86,6 @@ class DataDistribution(object):
return 0
return total_size / total_number_of_folders
def assign_new_osd(self, folder_id, new_osd):
"""
assign folder_id to new_osd. if folder_id already is assigned to an OSD, this old assignment is deleted.
"""
old_osd = self.get_containing_osd(folder_id)
if old_osd is None:
self.OSDs[new_osd].add_folder(folder_id, self.get_average_folder_size())
else:
self.OSDs[new_osd].add_folder(folder_id, self.OSDs[old_osd.uuid].folders[folder_id])
self.OSDs[old_osd.uuid].remove_folder(folder_id)
def add_folders(self, folders,
osd_information=None, ratio_parameter='', capacity='',
ignore_osd_capacities=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