def __setup_build_server(boot_conf):
    """
    This function is responsible for creating the DHCP server and starting the
    PXE boot process
    :param boot_conf: boot configuration dict
    """
    rebar_utils.install_config_drp(consts.REBAR_SESSION, boot_conf)
Exemple #2
0
 def test_setup_dhcp_service(self, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10,
                             m11, m12):
     """
     Tests the rebar_utils.
     :return:
     """
     conf_file = pkg_resources.resource_filename('tests.conf', 'hosts.yaml')
     conf = file_utils.read_yaml(conf_file)
     rebar_utils.install_config_drp(None, conf)
Exemple #3
0
def deploy(boot_conf, hb_conf, user, os_env_file=None, boot_timeout=1800):
    """
    Installs and sets up PXE bootable machines with and OS and network
    configuration
    :param boot_conf: boot configuration dict
    :param hb_conf: adrenaline configuration dict
    :param user: the sudo user used to apply the playbook
    :param os_env_file: when environment is on OpenStack, this file is required
    :param boot_timeout: number of seconds to wait for PXE booting to complete
    :raises: Exception should snaps-boot fail to execute successfully
    """

    # Install and setup Digital Rebar
    # add post_script file to boot_conf dict
    ps_file = pkg_resources.resource_filename(
        'snaps_adrenaline.deployment.boot', 'post_script')
    pxe_config = boot_conf['PROVISION']['TFTP']['pxe_server_configuration']
    pxe_config['ubuntu']['post_script_location'] = ps_file

    rebar_utils.install_config_drp(consts.REBAR_SESSION, boot_conf)

    # Reboot for pxelinux.0 download and installation
    if os_env_file:
        __reboot_openstack_nodes(os_env_file)
    else:
        if boot_conf['PROVISION'].get('HYPERVISOR'):
            __reboot_libvirt_nodes(boot_conf)
        else:
            ipmi_utils.reboot_pxe(boot_conf)

    __block_until_complete(boot_conf, boot_timeout, suspend=450)

    if not os_env_file:
        try:
            pxe_utils.static_ip_configure(boot_conf)
        except Exception as e:
            logger.warn(
                'Unexpected exception configuring NICs trying once'
                ' more again in 60 seconds - [%s]', e)
            time.sleep(60)
            pxe_utils.static_ip_configure(boot_conf)
    else:
        # TODO - make the default MTU setting configurable for OpenStack
        __override_default_mtu(boot_conf)

    __setup_gpu(boot_conf, hb_conf, user)
    __setup_fpga(boot_conf, hb_conf, user)
    __post_hw_setup_reboot(boot_conf, hb_conf, user)
Exemple #4
0
def __run(arguments):
    """
     This will launch the provisioning of Bare metat & IaaS.
     There is pxe based configuration defined to provision the bare metal.
     For IaaS provisioning different deployment models are supported.
     Relevant conf files related to PXE based Hw provisioning & Openstack based
     IaaS must be present in ./conf folder.
     :param arguments: This expects command line options to be entered by user
                       for relavant operations.
     :return: To the OS
    """

    log_level = logging.INFO
    if arguments.log_level != 'INFO':
        log_level = logging.DEBUG
    logging.basicConfig(stream=sys.stdout, level=log_level)

    logger.info('Launching Operation Starts ........')

    user = getpass.getuser()
    logger.info('Running as user %s', user)

    config_filepath = os.path.expanduser(arguments.config)
    logger.info('Reading configuration file [%s]', config_filepath)
    config = file_utils.read_yaml(config_filepath)

    prv_config = config.get('PROVISION')
    if not prv_config:
        raise Exception('Missing top-level config member PROVISION')
    logger.debug('PROVISION configuration %s', prv_config)

    # TODO/FIXME - Hardcoding of user/pass should be configurable
    drp_config = prv_config.get('digitalRebar')
    if drp_config:
        logger.info('Rebar configuration %s', drp_config)
        user = drp_config.get('user', 'rocketskates')
        password = drp_config.get('password', 'r0cketsk8ts')
    else:
        user = '******'
        password = '******'

    # TODO/FIXME - DRP host and port should be configurable
    rebar_session = HttpSession('https://localhost:8092', user, password)

    if arguments.hardware is not ARG_NOT_SET:
        rebar_utils.install_config_drp(rebar_session, config)

    if arguments.provisionClean is not ARG_NOT_SET:
        rebar_utils.cleanup_drp(rebar_session, config)

    if arguments.staticIPCleanup is not ARG_NOT_SET:
        # Do we really need to support this function?
        pxe_utils.static_ip_cleanup(config)

    if arguments.staticIPConfigure is not ARG_NOT_SET:
        # Is this something that we should do with cloud-init or other means
        # immediately after the OS is laid down?
        pxe_utils.static_ip_configure(config)

    if arguments.boot is not ARG_NOT_SET:
        ipmi_utils.reboot_pxe(config)

    if arguments.bootd is not ARG_NOT_SET:
        # This power cycles the nodes
        ipmi_utils.reboot_disk(config)
    if arguments.setIsolCpus is not ARG_NOT_SET:
        # This operation is unclear
        pxe_utils.set_isol_cpus(config)
    if arguments.delIsolCpus is not ARG_NOT_SET:
        # This operation is unclear
        pxe_utils.del_isol_cpus(config)
    logger.info('Completed operation successfully')