Commit 93f2172b authored by Felix Seibert's avatar Felix Seibert
Browse files

optional random seed specification for random assignment

parent 5db4700d
......@@ -307,7 +307,7 @@ class OSDManager(object):
self.__write_configuration()
def copy_folders(self, folders, environment='LOCAL', remote_source=None, sshfs_mount_dir='/tmp/sshfs_tmp_mnt',
apply_layout=True, execute_copy=True, random_osd_assignment=False):
apply_layout=True, execute_copy=True, random_osd_assignment=False, random_seed=None):
"""
copy a list of given folders into the managed folder, assigning OSDs to new folders and updating
self.dataDistribution
......@@ -369,7 +369,8 @@ class OSDManager(object):
if self.debug:
print("OSDManager: random_osd_assignment: " + str(random_osd_assignment))
new_assignments = self.distribution.add_folders(new_folders, random_osd_assignment=random_osd_assignment)
new_assignments = self.distribution.add_folders(new_folders, random_osd_assignment=random_osd_assignment,
random_seed=random_seed)
if apply_layout:
self.apply_osd_assignments(new_assignments)
elif self.debug:
......
......@@ -38,6 +38,7 @@ parser.add_argument("--remote-source", "-r", nargs=1,
'The remote host must be reachable via ssh without password.')
parser.add_argument("--random-layout", "-x", action='store_const', const=True, default=False)
parser.add_argument("--random-osd-assignment", action='store_const', const=True, default=False)
parser.add_argument("--random-seed", nargs=1)
parser.add_argument("--environment", "-e", choices=['LOCAL', 'SLURM', 'HU_CLUSTER'], default='LOCAL')
parser.add_argument("--print", "-p", action='store_const', const=True, default=False,
......@@ -90,7 +91,7 @@ if args.copy:
folders = args.source_folders[0].split(',')
x_man.copy_folders(folders, environment=args.environment, apply_layout=(not args.random_layout),
remote_source=args.remote_source[0], random_osd_assignment=args.random_osd_assignment,
execute_copy=(not args.dont_execute_copy))
random_seed=args.random_seed[0], execute_copy=(not args.dont_execute_copy))
elif args.new_folders:
if len(args.source_folders) == 0:
......
......@@ -208,7 +208,8 @@ class DataDistribution(object):
ignore_osd_capacities=True,
random_osd_assignment=False,
ignore_folder_sizes=False,
debug=False):
debug=False,
random_seed=None):
"""
adds a list of folders to the data distribution.
if not specified otherwise, the assignments are calculated using the LPT algorithm.
......@@ -242,6 +243,9 @@ class DataDistribution(object):
# this information must be returned
osds_for_new_folders = []
if random_osd_assignment:
random.seed(random_seed)
# totally random OSD assignment, ignoring OSD capacities
# (might lead to I/O errors when too many groups are assigned to an OSD)
if random_osd_assignment and ignore_osd_capacities and not ignore_folder_sizes:
......
Markdown is supported
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