template-postprocess: fast path for file-reflink, like file

I don't know if any template currently hits this code path, even the
fedora-26-minimal root.img is large enough to be split into multiple
parts. Maybe Arch Linux?

Related to https://github.com/QubesOS/qubes-core-admin/pull/188
This commit is contained in:
Rusty Bird 2018-02-12 21:51:01 +00:00
parent 7f286766d0
commit e6466c3783
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -100,8 +100,9 @@ def import_root_img(vm, source_dir):
# and destination paths are the same # and destination paths are the same
vid = vm.volumes['root'].vid vid = vm.volumes['root'].vid
pool = vm.app.pools[vm.volumes['root'].pool] pool = vm.app.pools[vm.volumes['root'].pool]
if pool.driver == 'file' and root_path == os.path.join( if (pool.driver in ('file', 'file-reflink')
pool.config['dir_path'], vid + '.img'): and root_path == os.path.join(pool.config['dir_path'],
vid + '.img')):
vm.log.info('root.img already in place, do not re-import') vm.log.info('root.img already in place, do not re-import')
return return
with open(root_path, 'rb') as root_file: with open(root_path, 'rb') as root_file: