Make sbuild nice to it's host

StarlingX build tools consume excessive cpu and io which can starve
non-build services, including kubernetes and calico. This results in
timeouts, restarts, and general instability of calico and kubernetes
which in turn can the build to fail. This affect is observed on the
main StarlingX build server.

The major build steps should employ 'nice' and 'ionice' to ensure
that critical services on the build host are not starved for cpu or io.

Closes-bug: 2095512
Change-Id: Id228c43188812df373a17602336ae7a61c5569a6
Signed-off-by: Scott Little <scott.little@windriver.com>
(cherry picked from commit f360849703b54612f497c3516a96f6cef32799ed)
This commit is contained in:
Scott Little 2025-01-22 15:41:41 -05:00
parent 6e16428c26
commit a997e11c7f

View File

@ -335,7 +335,8 @@ class Debbuilder(object):
response['msg'] = 'fail to create log file'
else:
chroot_suffix = '--chroot-suffix=-' + user
chroot_cmd = ' '.join(['sbuild-createchroot', chroot_suffix,
chroot_cmd = ' '.join(['nice', '-n', '15', 'ionice', '-c', '3',
'sbuild-createchroot', chroot_suffix,
'--include=apt-transport-https,ca-certificates,eatmydata',
'--command-prefix=eatmydata',
self.attrs['dist'], parent_chroot_dir])
@ -817,7 +818,8 @@ class Debbuilder(object):
response['msg'] = dsc + ' does not exist'
return response
bcommand = ' '.join([BUILD_ENGINE, '-d', self.attrs['dist']])
bcommand = ' '.join(['nice', '-n', '15', 'ionice', '-c', '3',
BUILD_ENGINE, '-d', self.attrs['dist']])
dsc_build_dir = os.path.dirname(dsc)
chroot = self.chroots_pool.acquire(needed_size=size, allow_tmpfs=allow_tmpfs)
self.chroots_pool.show()