Skip to content

Commit e1b320f

Browse files
cgwaltersfrantisekz
authored andcommitted
image: Use reflinks if available
Use `cp` since `shutil.copy` doesn't do reflinks: python/cpython#81338 reflinks are a lot more efficient. Signed-off-by: Colin Walters <[email protected]>
1 parent 8ff788f commit e1b320f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

testcloud/image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ def _handle_file_url(self, source_path, dest_path, copy=True):
205205
if source_path.endswith('.box'):
206206
dest_path = dest_path.replace('.qcow2', '.box')
207207
if copy:
208-
shutil.copy(source_path, dest_path)
208+
# We use `cp` since shutil.copy doesn't do reflinks: https://github.com/python/cpython/issues/81338
209+
subprocess.check_call(['cp', '-f', source_path, dest_path])
209210
else:
210211
subprocess.check_call(['ln', '-s', '-f', source_path, dest_path])
211212
if source_path.endswith('.xz'):

0 commit comments

Comments
 (0)