Commit ca0b9efe authored by Felix Seibert's avatar Felix Seibert
Browse files

changed name of field

parent 94b56639
......@@ -287,7 +287,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
size_source = int(str(du_source.stdout).split()[0])
total_size_in_distribution = 0
for osd in x_man.dataDistribution.OSDs.values():
for osd in x_man.distribution.OSDs.values():
total_size_in_distribution += osd.totalFolderSize
self.assertNotEqual(size_source, total_size_in_distribution)
......@@ -299,7 +299,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
size_source = int(str(du_source.stdout).split()[0])
total_size_in_distribution = 0
for osd in x_man.dataDistribution.OSDs.values():
for osd in x_man.distribution.OSDs.values():
total_size_in_distribution += osd.totalFolderSize
self.assertEqual(size_source, total_size_in_distribution)
......@@ -312,14 +312,14 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
x_man_1.copy_folders(self.depth_2_dirs)
total_size_in_distribution_1 = 0
for osd in x_man_1.dataDistribution.OSDs.values():
for osd in x_man_1.distribution.OSDs.values():
total_size_in_distribution_1 += osd.totalFolderSize
managed_folder_2 = os.path.join(self.mount_point_2, self.path_on_mount_point)
x_man_2 = OSDManager.OSDManager(managed_folder_2)
total_size_in_distribution_2 = 0
for osd in x_man_2.dataDistribution.OSDs.values():
for osd in x_man_2.distribution.OSDs.values():
total_size_in_distribution_2 += osd.totalFolderSize
self.assertEqual(total_size_in_distribution_1, total_size_in_distribution_2)
......
......@@ -181,7 +181,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
size_source = int(str(du_source.stdout).split()[0])
total_size_in_distribution = 0
for osd in x_man.dataDistribution.osds.values():
for osd in x_man.distribution.osds.values():
total_size_in_distribution += osd.totalFolderSize
self.assertNotEqual(size_source, total_size_in_distribution)
......@@ -193,7 +193,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
size_source = int(str(du_source.stdout).split()[0])
total_size_in_distribution = 0
for osd in x_man.dataDistribution.osds.values():
for osd in x_man.distribution.osds.values():
total_size_in_distribution += osd.totalFolderSize
self.assertEqual(size_source, total_size_in_distribution)
......@@ -206,14 +206,14 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
x_man_1.copy_folders(self.depth_2_dirs)
total_size_in_distribution_1 = 0
for osd in x_man_1.dataDistribution.osds.values():
for osd in x_man_1.distribution.osds.values():
total_size_in_distribution_1 += osd.totalFolderSize
managed_folder_2 = os.path.join(self.mount_point_2, self.path_on_mount_point)
x_man_2 = OSDManager.OSDManager(managed_folder_2)
total_size_in_distribution_2 = 0
for osd in x_man_2.dataDistribution.osds.values():
for osd in x_man_2.distribution.osds.values():
total_size_in_distribution_2 += osd.totalFolderSize
self.assertEqual(total_size_in_distribution_1, total_size_in_distribution_2)
......
......@@ -54,11 +54,11 @@ class OSDManager(object):
self.osdSelectionPolicy = self.volume_information[2]
self.volumeAddress = self.volume_information[3]
self.dataDistribution = None
self.distribution = None
if not self.__read_configuration():
self.dataDistribution = dataDistribution.DataDistribution()
self.distribution = dataDistribution.DataDistribution()
self.dataDistribution.add_osd_list(osd_list)
self.distribution.add_osd_list(osd_list)
self.osdInformation = None
......@@ -93,7 +93,7 @@ class OSDManager(object):
self.pathToMountPoint = value_map['path_to_mount']
self.volumeName = value_map['volume_name']
self.osdSelectionPolicy = value_map['osd_selection_policy']
self.dataDistribution = value_map['data_distribution']
self.distribution = value_map['data_distribution']
self.volumeAddress = value_map['volume_address']
self.osdInformation = value_map['osd_information']
except KeyError as error:
......@@ -101,11 +101,11 @@ class OSDManager(object):
print('leaving in OSDManager field empty!')
def __read_configuration(self):
assert self.dataDistribution is None
assert self.distribution is None
path_to_config = os.path.join(self.managedFolder, self.configFile)
try:
f = open(path_to_config, "rb")
self.dataDistribution = pickle.load(f)
self.distribution = pickle.load(f)
return True
except IOError:
return False
......@@ -113,14 +113,14 @@ class OSDManager(object):
def __write_configuration(self):
path_to_config = os.path.join(self.managedFolder, self.configFile)
f = open(path_to_config, "wb")
pickle.dump(self.dataDistribution, f)
pickle.dump(self.distribution, f)
'''
create empty folders and assign OSDs.
'''
def create_empty_folders(self, folders):
average_size = int(self.dataDistribution.get_average_folder_size())
average_size = int(self.distribution.get_average_folder_size())
if average_size <= 0:
average_size = 1
......@@ -130,7 +130,7 @@ class OSDManager(object):
new_tile = folder.Folder(self.path_on_volume(input_folder), average_size, None)
tiles.append(new_tile)
new_tiles = self.dataDistribution.add_folders(tiles)
new_tiles = self.distribution.add_folders(tiles)
self.apply_osd_assignments(new_tiles)
......@@ -190,7 +190,7 @@ class OSDManager(object):
if remote_source is not None:
shutil.rmtree(sshfs_mount_dir)
new_assignments = self.dataDistribution.add_folders(new_folders)
new_assignments = self.distribution.add_folders(new_folders)
if apply_layout:
self.apply_osd_assignments(new_assignments)
elif self.debug:
......@@ -217,7 +217,7 @@ class OSDManager(object):
if not div_util.check_for_executable('xtfsutil'):
raise ExecutableNotFoundException("No xtfsutil found. Please make sure it is contained in your PATH.")
# step 1: add folder to new OSD, update data distribution and xtreemfs configuration
self.dataDistribution.assign_new_osd(folder_id, new_osd_id)
self.distribution.assign_new_osd(folder_id, new_osd_id)
if self.debug:
subprocess.run(["xtfsutil",
"--set-pattr", "1004.filenamePrefix", "--value",
......@@ -245,7 +245,7 @@ class OSDManager(object):
'''
def remove_folder(self, folder_id):
containing_osd = self.dataDistribution.get_containing_osd(folder_id)
containing_osd = self.distribution.get_containing_osd(folder_id)
if containing_osd is not None:
if not div_util.check_for_executable('xtfsutil'):
raise ExecutableNotFoundException("No xtfsutil found. Please make sure it is contained in your PATH.")
......@@ -292,7 +292,7 @@ class OSDManager(object):
folder_size_updates[folder_id] = folder_disk_size
for folder_for_update, size in folder_size_updates.items():
self.dataDistribution.update_folder(folder_for_update, size)
self.distribution.update_folder(folder_for_update, size)
self.__write_configuration()
......@@ -336,12 +336,12 @@ class OSDManager(object):
def __copy_data(self, input_folders, environment, remote_source):
if self.debug:
print('calling copy_data with: ', input_folders, environment, remote_source)
osd_list = self.dataDistribution.get_osd_list()
osd_list = self.distribution.get_osd_list()
osd_to_folders_map = {}
for osd in osd_list:
osd_to_folders_map[osd] = []
for input_folder in input_folders:
osd_for_tile = self.dataDistribution.get_containing_osd(input_folder.id).uuid
osd_for_tile = self.distribution.get_containing_osd(input_folder.id).uuid
osd_to_folders_map[osd_for_tile].append(input_folder)
if self.debug:
......@@ -529,7 +529,7 @@ class OSDManager(object):
representation = "pathToMountPoint: " + self.pathToMountPoint + " volumeName: " + self.volumeName + " pathOnVolume: " \
+ self.pathOnVolume
representation += ("\nconfigFile: " + self.configFile + "\n")
representation += self.dataDistribution.description()
representation += self.distribution.description()
return representation
......
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