Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Felix Seibert
xtreemfs_client
Commits
56cf83aa
Commit
56cf83aa
authored
Apr 10, 2018
by
Felix Seibert
Browse files
fix doc, make prints conditional on debug boolen parameter
parent
e317dbc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
xtreemfs_client/dataDistribution.py
View file @
56cf83aa
...
...
@@ -45,7 +45,7 @@ class DataDistribution(object):
def
get_osd_list
(
self
):
"""
get a list of all existing OSDs.
get a list of all existing OSD
uuid
s.
"""
osd_list
=
[]
for
osd_name
in
self
.
OSDs
.
keys
():
...
...
@@ -89,7 +89,8 @@ class DataDistribution(object):
osd_information
=
None
,
ratio_parameter
=
''
,
capacity
=
''
,
ignore_osd_capacities
=
True
,
random_osd_assignment
=
False
,
ignore_folder_sizes
=
False
):
ignore_folder_sizes
=
False
,
debug
=
False
):
# TODO update doc
"""
adds a list of folders to the data distribution.
...
...
@@ -108,14 +109,16 @@ class DataDistribution(object):
else
:
new_folders
.
append
(
folder
)
print
(
"dataDistribution: random_osd_assignment: "
+
str
(
random_osd_assignment
))
if
debug
:
print
(
"dataDistribution: random_osd_assignment: "
+
str
(
random_osd_assignment
))
osds_for_new_folders
=
[]
# totally random OSD assignment, even 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
:
print
(
"using totally random osd assignment"
)
if
debug
:
print
(
"using totally random osd assignment"
)
for
folder
in
new_folders
:
random_osd
=
random
.
choice
(
list
(
self
.
OSDs
.
values
()))
random_osd
.
add_folder
(
folder
.
id
,
folder
.
size
)
...
...
@@ -128,7 +131,8 @@ class DataDistribution(object):
if
osd_information
is
None
or
ratio_parameter
==
''
:
raise
ValueError
(
"ignore_osd_capacities=False is not possible if osd_information or capacity is"
"not given!"
)
print
(
"using random osd assignment, respecting osd capacities"
)
if
debug
:
print
(
"using random osd assignment, respecting osd capacities"
)
for
folder
in
new_folders
:
suitable_osds
=
[]
# list of OSDs with enough capacity
for
one_osd
in
self
.
OSDs
.
values
():
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment