Skip to content

Commit

Permalink
Merge 4227eab into b899a67
Browse files Browse the repository at this point in the history
  • Loading branch information
bessonc committed Oct 21, 2019
2 parents b899a67 + 4227eab commit c7aa90a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/pylorax/api/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from pylorax.api.projects import ProjectsError
from pylorax.api.recipes import read_recipe_and_id
from pylorax.api.timestamp import TS_CREATED, write_timestamp
from pylorax.imgutils import default_image_name
from pylorax.imgutils import default_image_name, estimate_size
from pylorax.sysutils import joinpaths


Expand Down Expand Up @@ -402,10 +402,16 @@ def start_build(cfg, yumlock, gitlock, branch, recipe_name, compose_type, test_m
except ProjectsError as e:
log.error("start_build depsolve: %s", str(e))
raise RuntimeError("Problem depsolving %s: %s" % (recipe["name"], str(e)))
log.debug("installed_size = %d, template_size=%d", installed_size, template_size)

# Anaconda also stores the metadata on the disk once it is partitioned, try to take this into account by
# adding the size of the lorax-composer metadata storage.
with yumlock.lock:
metadata_size = estimate_size(yumlock.yb.conf.installroot)

log.debug("installed_size = %d, template_size=%d, metadata_size=%d", installed_size, template_size, metadata_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))
installed_size = max(1024**3, int((installed_size+template_size+metadata_size) * 1.4))
log.debug("/ partition size = %d", installed_size)

# Create the results directory
Expand Down
2 changes: 2 additions & 0 deletions src/pylorax/api/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ def estimate_size(packages, block_size=4096):
for p in packages:
installed_size += len(p.po.filelist) * block_size
installed_size += p.po.installedsize
# also count the RPM package size (yum cache)
installed_size += ((p.po.size / block_size) + 1) * block_size
return installed_size

def projects_depsolve_with_size(yb, projects, groups, with_core=True):
Expand Down

0 comments on commit c7aa90a

Please sign in to comment.