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

fix format and remove unused code

parent 163c8049
......@@ -45,11 +45,12 @@ class TestDataDistribution(unittest.TestCase):
ignore_osd_capacities=True)
osds_felix = distribution_felix.get_osd_list()
osds_felix_total_folder_sizes = list(map(lambda x: distribution_felix.OSDs[x].total_folder_size, osds_felix))
osds_felix_total_folder_sizes = list(
map(lambda x: distribution_felix.OSDs[x].total_folder_size, osds_felix))
osds_farouk = distribution_farouk.get_osd_list()
osds_farouk_total_folder_sizes = list(map(lambda x: distribution_farouk.OSDs[x].total_folder_size, osds_farouk))
osds_farouk_total_folder_sizes = list(
map(lambda x: distribution_farouk.OSDs[x].total_folder_size, osds_farouk))
if osds_felix_total_folder_sizes[0] != osds_farouk_total_folder_sizes[0]:
felix_and_farouk_different = True
......@@ -70,7 +71,7 @@ class TestDataDistribution(unittest.TestCase):
random_osd_assignment=True,
ignore_osd_capacities=False)
except ValueError:
return # expect value error
return # expect value error
self.fail("expect value error!")
def test_random_distribution_respecting_capacities(self):
......
......@@ -2,12 +2,7 @@ import argparse
import sys
#import .xtreemfs_client.OSDManager as OSDManager
#import .xtreemfs_client.verify as verify
#from .OSDManager import OSDManager
from xtreemfs_client import OSDManager
#from .xtreemfs_client import verify
from xtreemfs_client import verify
"""
......@@ -52,7 +47,7 @@ parser.add_argument("--debug", "-d", action='store_const', const=True, default=F
parser.add_argument("--verify", "-v", action='store_const', const=True, default=False)
parser.add_argument("--create-from-existing-files", action='store_const',const=True, default=False,
parser.add_argument("--create-from-existing-files", action='store_const', const=True, default=False,
help='creates a data distribution based on the files already present,'
'and changes the physical location of files to match the locations prescribed by the '
'distribution.')
......
......@@ -134,7 +134,7 @@ class DataDistribution(object):
if debug:
print("using random osd assignment, respecting osd capacities")
for folder in new_folders:
suitable_osds = [] # list of OSDs with enough capacity
suitable_osds = [] # list of OSDs with enough capacity
for one_osd in self.OSDs.values():
if osd_information[one_osd.uuid][capacity] - one_osd.total_folder_size - folder.size >= 0:
suitable_osds.append(one_osd)
......@@ -168,7 +168,7 @@ class DataDistribution(object):
least_used_osd = None
for one_osd in self.OSDs.values():
if (least_used_osd is None) or \
one_osd.total_folder_size / osd_ratios[one_osd.uuid] \
one_osd.total_folder_size / osd_ratios[one_osd.uuid] \
<= least_used_osd.total_folder_size / osd_ratios[least_used_osd.uuid]:
least_used_osd = one_osd
least_used_osd.add_folder(folder.id, folder.size)
......
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