Generate Ironic bootstrap with fuel-bootstrap

Use fuel-bootstrap instead of deprecated fuel-bootstrap-image-builder

Related-Bug: #1527587
Depends-On: Ic332428ed311d3dad0b599189498153c55af7b30
Change-Id: I2459d7ae466d9b89a50a0299c6edec012a23f71b
This commit is contained in:
vsaienko 2015-12-21 18:16:50 +02:00
parent bad4d014df
commit 00bf06f431
4 changed files with 48 additions and 13 deletions

View File

@ -457,3 +457,19 @@ TASK_ROLES = Enum(
OVERRIDE_CONFIG_BASE_PATH = '/etc/hiera/override/configuration/'
TASK_CROSS_DEPENDENCY = '2.0.0'
IRONIC_BOOTSTRAP_PKGS = ('openssh-server',
'ntp',
'fuel-agent',
'ubuntu-minimal',
'live-boot',
'wget',
'live-boot-initramfs-tools',
'squashfs-tools',
'linux-firmware',
'msmtp-mta',
'hpsa-dkms',
'i40e-dkms',
'linux-firmware-nonfree',
'xz-utils',
'linux-headers-generic')

View File

@ -249,17 +249,26 @@ def make_ironic_bootstrap_task(uids, cid):
extra_conf_files = "/usr/share/ironic-fa-bootstrap-configs/"
ssh_keys = "/var/lib/fuel/keys/{0}/ironic/ironic.pub".format(cid)
ironic_bootstrap_pkgs = ' '.join(
"--package '{0}'".format(pkg) for pkg in consts.IRONIC_BOOTSTRAP_PKGS)
bootstrap_path = "/var/www/nailgun/bootstrap/ironic/{cid}/".format(
cid=cid)
return make_shell_task(uids, {
'parameters': {
'cmd': (
"BOOTSTRAP_FUEL_PKGS='openssh-server ntp fuel-agent' "
"EXTRA_CONF_FILES='{extra_conf_files}' "
"DESTDIR='/var/www/nailgun/bootstrap/ironic/{cid}' "
"BOOTSTRAP_SSH_KEYS='{bootstrap_ssh_keys}' "
'fuel-bootstrap-image ').format(
"test -e {bootstrap_path}* || "
"(fuel-bootstrap build {ironic_bootstrap_pkgs} "
"--root-ssh-authorized-file {bootstrap_ssh_keys} "
"--output-dir {bootstrap_path} "
"--extra-dir {extra_conf_files} --no-compress "
'--no-default-extra-dirs --no-default-packages)').format(
cid=cid,
extra_conf_files=extra_conf_files,
bootstrap_ssh_keys=ssh_keys),
bootstrap_ssh_keys=ssh_keys,
ironic_bootstrap_pkgs=ironic_bootstrap_pkgs,
bootstrap_path=bootstrap_path),
'timeout': settings.PROVISIONING_IMAGES_BUILD_TIMEOUT,
'retries': 1}})

View File

@ -375,7 +375,7 @@ class TestProvisioningSerializer80(BaseIntegrationTest):
self.assertTrue(filter(
lambda task: all([
'fuel-bootstrap-image' in task['parameters']['cmd'],
'fuel-bootstrap' in task['parameters']['cmd'],
'ironic.pub' in task['parameters']['cmd']]),
serialized_info['pre_provision']))

View File

@ -21,6 +21,8 @@ import requests
from oslo_serialization import jsonutils
from nailgun.consts import IRONIC_BOOTSTRAP_PKGS
from nailgun.test import base
from nailgun.orchestrator import tasks_templates
@ -192,6 +194,8 @@ class TestMakeTask(base.BaseTestCase):
def test_make_ironic_bootstrap_task(self):
cid = 123
bootstrap_path = "/var/www/nailgun/bootstrap/ironic/{cid}/".format(
cid=cid)
result = tasks_templates.make_ironic_bootstrap_task(
[1, 2, 3],
@ -200,20 +204,26 @@ class TestMakeTask(base.BaseTestCase):
extra_conf_files = "/usr/share/ironic-fa-bootstrap-configs/"
ssh_keys = "/var/lib/fuel/keys/{0}/ironic/ironic.pub".format(cid)
ironic_bootstrap_pkgs = ' '.join(
"--package '{0}'".format(pkg) for pkg in IRONIC_BOOTSTRAP_PKGS)
self.assertEqual(result, {
'id': None,
'type': 'shell',
'uids': [1, 2, 3],
'parameters': {
'cmd': (
"BOOTSTRAP_FUEL_PKGS='openssh-server ntp fuel-agent' "
"EXTRA_CONF_FILES='{extra_conf_files}' "
"DESTDIR='/var/www/nailgun/bootstrap/ironic/{cid}' "
"BOOTSTRAP_SSH_KEYS='{bootstrap_ssh_keys}' "
'fuel-bootstrap-image ').format(
"test -e {bootstrap_path}* || "
"(fuel-bootstrap build {ironic_bootstrap_pkgs} "
"--root-ssh-authorized-file {bootstrap_ssh_keys} "
"--output-dir {bootstrap_path} "
"--extra-dir {extra_conf_files} --no-compress "
'--no-default-extra-dirs --no-default-packages)').format(
cid=cid,
extra_conf_files=extra_conf_files,
bootstrap_ssh_keys=ssh_keys),
bootstrap_ssh_keys=ssh_keys,
ironic_bootstrap_pkgs=ironic_bootstrap_pkgs,
bootstrap_path=bootstrap_path),
'timeout': settings.PROVISIONING_IMAGES_BUILD_TIMEOUT,
'retries': 1,
'interval': 1,