Adjust the disk size estimates to match Anaconda
First is Anaconda uses 6k blocks per file for its estimate, and it fudges by 10% so adjust for those with an extra 10% of headroom just in case. Second is an Anaconda bug that won't allow it to do a kickstart install to a disk smaller than 3000 MB. There is a PR to fix it upstream, but for now the minimum size has to be 3000e9
This commit is contained in:
parent
5443c1cfea
commit
d6283f9540
@ -44,7 +44,7 @@ from pyanaconda.simpleconfig import SimpleConfigFile
|
||||
|
||||
# Use pykickstart to calculate disk image size
|
||||
from pykickstart.parser import KickstartParser
|
||||
from pykickstart.version import makeVersion, RHEL7
|
||||
from pykickstart.version import makeVersion
|
||||
|
||||
from pylorax.api.projects import projects_depsolve_with_size, dep_nevra
|
||||
from pylorax.api.projects import ProjectsError
|
||||
@ -239,7 +239,7 @@ def start_build(cfg, dnflock, gitlock, branch, recipe_name, compose_type, test_m
|
||||
ks_template = open(ks_template_path, "r").read()
|
||||
|
||||
# How much space will the packages in the default template take?
|
||||
ks_version = makeVersion(RHEL7)
|
||||
ks_version = makeVersion()
|
||||
ks = KickstartParser(ks_version, errorsAreFatal=False, missingIncludeIsFatal=False)
|
||||
ks.readKickstartFromString(ks_template+"\n%end\n")
|
||||
try:
|
||||
@ -251,8 +251,10 @@ def start_build(cfg, dnflock, gitlock, branch, recipe_name, compose_type, test_m
|
||||
raise RuntimeError("Problem depsolving %s: %s" % (recipe["name"], str(e)))
|
||||
log.debug("installed_size = %d, template_size=%d", installed_size, template_size)
|
||||
|
||||
# Minimum LMC disk size is 1GiB, and anaconda bumps the estimated size up by 35% (which doesn't always work).
|
||||
installed_size = max(1024**3, int((installed_size+template_size) * 1.4))
|
||||
# Minimum LMC disk size is 1GiB, and anaconda bumps the estimated size up by 10% (which doesn't always work).
|
||||
# XXX BUT Anaconda has a bug, it won't execute a kickstart on a disk smaller than 3000 MB
|
||||
# XXX There is an upstream patch pending, but until then, use that as the minimum
|
||||
installed_size = max(3e9, int((installed_size+template_size))) * 1.2
|
||||
log.debug("/ partition size = %d", installed_size)
|
||||
|
||||
# Create the results directory
|
||||
|
@ -209,7 +209,7 @@ def projects_depsolve(dbo, project_names):
|
||||
return sorted(map(pkg_to_dep, dbo.transaction.install_set), key=lambda p: p["name"].lower())
|
||||
|
||||
|
||||
def estimate_size(packages, block_size=4096):
|
||||
def estimate_size(packages, block_size=6144):
|
||||
"""Estimate the installed size of a package list
|
||||
|
||||
:param packages: The packages to be installed
|
||||
|
@ -333,7 +333,7 @@ def novirt_install(opts, disk_img, disk_size):
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
|
||||
args = ["--kickstart", opts.ks[0], "--cmdline"]
|
||||
args = ["--kickstart", opts.ks[0], "--cmdline", "--loglevel", "debug"]
|
||||
if opts.anaconda_args:
|
||||
for arg in opts.anaconda_args:
|
||||
args += arg.split(" ", 1)
|
||||
|
Loading…
Reference in New Issue
Block a user