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
6fb5ce63
Commit
6fb5ce63
authored
Mar 26, 2018
by
Felix Seibert
Browse files
fixing within-volume external physical layout fix
parent
90a67c65
Changes
1
Hide whitespace changes
Inline
Side-by-side
xtreemfs_client/OSDManager.py
View file @
6fb5ce63
...
...
@@ -438,6 +438,47 @@ class OSDManager(object):
if
execute_copy
:
self
.
__copy_data
(
new_folders
,
environment
,
remote_source
)
def
__generate_move_commands_slurm
(
self
,
osd_to_folders_map
,
tmp_dir
=
None
):
if
self
.
debug
:
print
(
"Using SLURM mode for moving folders..."
)
if
tmp_dir
is
None
:
tmp_dir
=
os
.
path
.
join
(
self
.
pathToMountPoint
,
self
.
volumeName
,
'.tmp_move_folder'
)
os
.
makedirs
(
tmp_dir
,
exist_ok
=
True
)
slurm_hosts
=
div_util
.
get_slurm_hosts
()
if
self
.
debug
:
print
(
'slurm_hosts: '
,
slurm_hosts
)
osd_to_host_map
=
div_util
.
get_osd_to_hostname_map
(
self
.
volume_information
[
1
],
slurm_hosts
)
if
self
.
debug
:
print
(
'osd_to_host_map: '
,
osd_to_host_map
)
command_list
=
[]
host_name
=
""
# command = ""
for
key
in
osd_to_folders_map
.
keys
():
if
host_name
==
""
:
host_name
=
osd_to_host_map
[
key
]
command
=
""
for
move_folder
in
osd_to_folders_map
[
key
]:
folder_path
=
os
.
path
.
join
(
self
.
pathToMountPoint
,
move_folder
.
folder_id
)
folder_tmp_path
=
os
.
path
.
join
(
tmp_dir
,
move_folder
.
folder_id
)
command
+=
"srun -N1-1 --nodelist="
+
host_name
command
+=
" move "
+
folder_path
command
+=
" "
+
tmp_dir
command
+=
" ;"
command
+=
" move "
+
folder_tmp_path
command
+=
" "
+
folder_path
+
" ; "
if
len
(
osd_to_folders_map
[
key
])
>
0
:
command_list
.
append
(
command
)
# command_list.append(command)
return
command_list
'''
moves a folder from one OSD to another OSD. you may specify a temporary folder.
'''
...
...
@@ -479,8 +520,10 @@ class OSDManager(object):
for
file
in
files
:
current_file_path
=
os
.
path
.
join
(
root
,
file
)
copied_file_path
=
os
.
path
.
join
(
tmp_dir
,
file
)
shutil
.
move
(
current_file_path
,
copied_file_path
)
shutil
.
move
(
copied_file_path
,
current_file_path
)
shutil
.
copy
(
current_file_path
,
copied_file_path
)
os
.
remove
(
current_file_path
)
shutil
.
copy
(
copied_file_path
,
os
.
path
.
split
(
current_file_path
)[
0
])
os
.
remove
(
copied_file_path
)
shutil
.
rmtree
(
tmp_dir
,
ignore_errors
=
True
)
...
...
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