createiso: Use unique paths for breaking hardlinks
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ář <lsedlar@redhat.com>
This commit is contained in:
parent
4d4c6555e2
commit
90291d7c73
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user