Change call of fuel-agent bootstrap building
All log information is passed to the CLI Change-Id: Ic375a43011aad6629ea055e833bd0f4f72be15d7 Closes-Bug: #1524240
This commit is contained in:
parent
2f18b7596b
commit
06bd5bc228
|
@ -21,7 +21,9 @@ import tarfile
|
|||
import tempfile
|
||||
import yaml
|
||||
|
||||
from fuel_agent import manager
|
||||
from fuel_agent.utils import utils
|
||||
from oslo_config import cfg
|
||||
|
||||
from fuel_bootstrap import consts
|
||||
from fuel_bootstrap import errors
|
||||
|
@ -142,17 +144,13 @@ def make_bootstrap(data=None):
|
|||
|
||||
LOG.info("Try to build image with data:\n%s", yaml.safe_dump(bootdata))
|
||||
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
f.write(yaml.safe_dump(bootdata))
|
||||
f.flush()
|
||||
|
||||
opts = ['fa_mkbootstrap', '--nouse-syslog', '--data_driver',
|
||||
'bootstrap_build_image', '--nodebug', '-v',
|
||||
'--input_data_file', f.name]
|
||||
if data.get('image_build_dir'):
|
||||
opts.extend(['--image_build_dir', data['image_build_dir']])
|
||||
|
||||
utils.execute(*opts)
|
||||
OSLO_CONF = cfg.CONF
|
||||
OSLO_CONF(['--data_driver', 'bootstrap_build_image'], project='fuel-agent')
|
||||
mngr = manager.Manager(bootdata)
|
||||
LOG.info("Build process is in progress. Usually it takes 15-20 minutes."
|
||||
" It depends on your internet connection and hardware"
|
||||
" performance.")
|
||||
mngr.do_mkbootstrap()
|
||||
|
||||
return bootdata['bootstrap']['uuid'], bootdata['output']
|
||||
|
||||
|
|
|
@ -615,7 +615,7 @@ def recompress_initramfs(chroot, compress='xz', initrd_mask='initrd*'):
|
|||
add_env_vars = {'TMPDIR': '/tmp',
|
||||
'TMP': '/tmp'}
|
||||
|
||||
LOG.info('Changing initramfs compression type to: %s', compress)
|
||||
LOG.debug('Changing initramfs compression type to: %s', compress)
|
||||
utils.execute(
|
||||
'sed', '-i', 's/^COMPRESS=.*/COMPRESS={0}/'.format(compress),
|
||||
os.path.join(chroot, 'etc/initramfs-tools/initramfs.conf'))
|
||||
|
@ -626,6 +626,7 @@ def recompress_initramfs(chroot, compress='xz', initrd_mask='initrd*'):
|
|||
remove_files('/', initrds)
|
||||
|
||||
env_vars.update(add_env_vars)
|
||||
LOG.info('Building initramfs')
|
||||
cmds = ['chroot', chroot, 'update-initramfs -v -c -k all']
|
||||
utils.execute(*cmds,
|
||||
env_variables=env_vars, logged=True)
|
||||
|
@ -662,8 +663,7 @@ def restore_resolv_conf(chroot):
|
|||
for conf_name in ('resolv.conf', 'hosts'):
|
||||
dst_conf_name = os.path.join(c_etc, conf_name)
|
||||
if os.path.isfile(dst_conf_name + '.bak'):
|
||||
LOG.info('Restoring default {0} inside chroot'.
|
||||
format(conf_name))
|
||||
LOG.debug('Restoring default %s inside chroot', conf_name)
|
||||
shutil.move(dst_conf_name + '.bak', dst_conf_name)
|
||||
|
||||
|
||||
|
@ -751,6 +751,7 @@ def run_mksquashfs(chroot, output_name=None, compression_algorithm='xz'):
|
|||
# run mksquashfs
|
||||
chroot_squash = os.path.join('/mnt/dst/' + temp)
|
||||
long_squash = os.path.join(chroot, 'mnt/dst/{0}'.format(temp))
|
||||
LOG.info('Building squashfs')
|
||||
utils.execute(
|
||||
'chroot', chroot, 'mksquashfs', '/mnt/src',
|
||||
chroot_squash,
|
||||
|
|
Loading…
Reference in New Issue