From 90291d7c73ea73402e141832e48b2febefe48b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 2 Aug 2018 08:15:15 +0200 Subject: [PATCH] createiso: Use unique paths for breaking hardlinks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the data needs to be split into multiple ISOs, we need to make sure the paths are unique for each image. Otherwise all files will be copied into the same directory, and once the first image is finished, the whole staging dir is deleting. That obviously breaks the tasks that are still in progress. JIRA: COMPOSE-2610 Signed-off-by: Lubomír Sedlář --- pungi/paths.py | 9 ++++++--- pungi/phases/createiso.py | 12 +++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pungi/paths.py b/pungi/paths.py index b92d0b49..47b71297 100644 --- a/pungi/paths.py +++ b/pungi/paths.py @@ -287,13 +287,16 @@ class WorkPaths(object): makedirs(path) return path - def iso_staging_dir(self, arch, variant, create_dir=True): + def iso_staging_dir(self, arch, variant, filename, create_dir=True): """ Examples: - work/x86_64/Server/iso-staging-dir + work/x86_64/Server/iso-staging-dir/file.iso/ """ path = os.path.join( - self.topdir(arch, create_dir=create_dir), variant.uid, "iso-staging-dir" + self.topdir(arch, create_dir=create_dir), + variant.uid, + "iso-staging-dir", + filename ) if create_dir: makedirs(path) diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index 1f8f7a7f..aa39152a 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -208,7 +208,9 @@ class CreateIsoThread(WorkerThread): cmd["bootable"], cmd["disc_num"], cmd["disc_count"]) # Delete staging directory if present. - staging_dir = compose.paths.work.iso_staging_dir(arch, variant) + staging_dir = compose.paths.work.iso_staging_dir( + arch, variant, filename=os.path.basename(cmd["iso_path"]) + ) if os.path.exists(staging_dir): shutil.rmtree(staging_dir) @@ -451,8 +453,12 @@ def prepare_iso(compose, arch, variant, disc_num=1, disc_count=None, split_iso_d data = iso.get_graft_points([iso._paths_from_list(tree_dir, split_iso_data["files"]), iso_dir]) if compose.conf["createiso_break_hardlinks"]: - compose.log_debug("Breaking hardlinks for ISO for %s.%s" % (variant, arch)) - break_hardlinks(data, compose.paths.work.iso_staging_dir(arch, variant)) + compose.log_debug( + "Breaking hardlinks for ISO %s for %s.%s" % (filename, variant, arch) + ) + break_hardlinks( + data, compose.paths.work.iso_staging_dir(arch, variant, filename) + ) # TODO: /content /graft-points gp = "%s-graft-points" % iso_dir