Adds required dependency for pxelinux.0 > 4.x

Change-Id: Ibb3ca337d6fb760da72bead6a64226bb68ed58f5
This commit is contained in:
Andrei V. Ostapenko 2016-12-26 16:20:52 +02:00 committed by Andrii Ostapenko
parent e0a67eee06
commit 7aaa9d97d2
2 changed files with 31 additions and 7 deletions

View File

@ -52,10 +52,6 @@ CONF.register_opts([
cfg.StrOpt('ramdisk_key',
default='bareon_key',
help='Name of private ssh key to access ramdisk'),
# NOTE(oberezovskyi): path from Centos 7 taken as default
cfg.StrOpt('pxelinux',
default='/usr/share/syslinux/pxelinux.0',
help='Path to pxelinux.0 file'),
cfg.IntOpt('stub_webserver_port',
default=8011,
help='The port used by stub webserver')
@ -64,6 +60,14 @@ CONF.import_opt('ramdisk_func_test_workdir', 'ramdisk_func_test.utils')
LOG = logging.getLogger(__name__)
PXELINUX_PATH = (
('/usr/lib/PXELINUX/pxelinux.0',
'/usr/lib/syslinux/modules/bios/ldlinux.c32',),
('/usr/share/syslinux/pxelinux.0', '/usr/share/syslinux/ldlinux.c32'),
('/usr/share/syslinux/pxelinux.0',),
('/usr/lib/syslinux/pxelinux.0',),
)
class Environment(object):
_loaded_config = object() # to fail comparison with None
@ -154,9 +158,25 @@ class Environment(object):
LOG.info("Setting up PXE configuration/images")
tftp_root = self.network.tftp_root
img_build = CONF.image_build_dir
utils.copy_file(CONF.pxelinux, tftp_root)
utils.copy_file(os.path.join(img_build, CONF.kernel), tftp_root)
utils.copy_file(os.path.join(img_build, CONF.ramdisk), tftp_root)
for paths in PXELINUX_PATH:
paths_flat = "', '".join(paths)
LOG.info("Looking for boot program files in '%s'", paths_flat)
for path in paths:
if not os.path.exists(path):
LOG.info("File %s not found. Trying next paths option...",
path)
break
else:
LOG.info("Boot program files found in: '%s'", paths_flat)
for path in paths:
utils.copy_file(path, tftp_root)
break
else:
raise exception.PXELinuxNotFound()
for img in (CONF.kernel, CONF.ramdisk):
utils.copy_file(os.path.join(img_build, img), tftp_root)
def add_pxe_config_for_current_node(self):
LOG.info("Setting up PXE configuration file for node {0}".format(

View File

@ -79,3 +79,7 @@ class NonZeroCmdRetCode(RamDiskTestException):
class VacantNetworkNotFound(RamDiskTestException):
_msg = "Cannot find free libvirt net in %(head)s."
class PXELinuxNotFound(RamDiskTestException):
_msg = "Network boot program files not found in any known location."