예제 #1
0
def __post_hw_setup_reboot(boot_conf, hb_conf, user):
    """
    Rebooting nodes with FPGAs or GPUs
    :param boot_conf: the snaps-boot dict
    :param hb_conf: the adrenaline conf dict
    :param user: the node's ssh user
    """
    logger.debug('Rebooting nodes with and FPGA or GPU')

    hosts = config_utils.get_minion_node_ips(boot_conf, hb_conf)

    reboot_hosts = set()
    for host in hosts:
        try:
            ansible_utils.apply_playbook(consts.HAS_GPU_BOOT_PB, [host], user)
            logger.info('GPU located on host [%s]', host)
            reboot_hosts.add(host)
        except:
            logger.info('GPU not found on host [%s]', host)
            pass

        try:
            ansible_utils.apply_playbook(consts.HAS_FPGA_BOOT_PB, [host], user)
            logger.info('FPGA located on host [%s]', host)
            reboot_hosts.add(host)
        except:
            logger.info('FPGA not found on host [%s]', host)
            pass

    if len(reboot_hosts) > 0:
        logger.info('Rebooting nodes - %s', reboot_hosts)
        ansible_utils.apply_playbook(consts.REBOOT_NODE, reboot_hosts, user)
예제 #2
0
def __setup_fpga(boot_conf, hb_conf, user):
    """
    Installing FPGA packages
    :param boot_conf: the snaps-boot dict
    :param hb_conf: the adrenaline conf dict
    :param user: the node's ssh user
    """
    logger.info('Configuring fpga setup for the nodes')

    hosts = config_utils.get_minion_node_ips(boot_conf, hb_conf)
    ansible_utils.apply_playbook(consts.SETUP_FPGA_BOOT_PB, hosts, user)

    logger.info('Completed fpga setup')
예제 #3
0
def __setup_ovs_dpdk(boot_conf, hb_conf, user):
    """
    Installing ovs dpdk packages
    :param hb_conf: the adrenaline conf dict
    """
    logger.debug('__setup_ovs_dpdk')
    ovs_dpdk_enabled = hb_conf['enable_ovs_dpdk']
    if ovs_dpdk_enabled == 'true':
        logger.info('setting up ovs-dpdk')
        hosts = config_utils.get_minion_node_ips(boot_conf, hb_conf)
        ansible_utils.apply_playbook(consts.SETUP_OVS_DPDK_PB, hosts, user)
        logger.info('Completed ovs-dpdk')
    else:
        logger.info('ovs-dpdk:disabled:No reason to install ovs-dpdk')
예제 #4
0
    def test_get_minion_node_ips(self):
        """
        Exercises the config_utils.get_master_node_ips() function
        """
        boot_conf_file = pkg_resources.resource_filename(
            'tests.deployment.boot.conf', 'boot.yaml')
        boot_conf = file_utils.read_yaml(boot_conf_file)
        hb_conf_file = pkg_resources.resource_filename(
            'tests.deployment.kubernetes.conf', 'k8s.yaml')
        hb_conf = file_utils.read_yaml(hb_conf_file)

        minion_ips = config_utils.get_minion_node_ips(boot_conf, hb_conf)
        self.assertEqual(1, len(minion_ips))
        self.assertTrue('10.0.0.12' in minion_ips)
예제 #5
0
def __setup_gpu(boot_conf, hb_conf, user):
    """
    Installing GPU packages
    :param boot_conf: the snaps-boot dict
    :param hb_conf: the adrenaline conf dict
    :param user: the node's ssh user
    """
    logger.info('Configuring gpu setup for the nodes')

    hosts = config_utils.get_minion_node_ips(boot_conf, hb_conf)
    provision_dict = boot_conf['PROVISION']
    proxy_dict = provision_dict.get('NODE_PROXY')
    ansible_utils.apply_playbook(consts.SETUP_GPU_BOOT_PB,
                                 hosts,
                                 user,
                                 variables=proxy_dict)

    logger.info('Completed gpu setup')