Example #1
0
def infrasim_init(node_type="dell_r730",
                  skip_installation=True,
                  force=False,
                  config_file=None,
                  entry=None):
    if check_existing_workspace():
        if not force:
            raise WorkspaceExisting("There is node workspace existing.\n"
                                    "If you want to remove it, please run:\n"
                                    "\"infrasim init -f \"")

        if force:
            destroy_existing_nodes()
            create_infrasim_directories()

    if not skip_installation:
        install_all_packages(force, entry)
        config_library_link()
        update_bridge_cfg()

    if config_file:
        if os.path.exists(config_file):
            shutil.copy2(config_file, config.infrasim_etc)
        else:
            raise Exception("{} not found.".format(config_file))
    else:
        init_infrasim_conf(node_type)

    # record infrasim environment
    get_environment()

    get_socat()
    get_ipmi()
    get_qemu()
Example #2
0
def infrasim_init(node_type="dell_r730", skip_installation=True, force=False, target_home=None, config_file=None):
    if check_existing_workspace():
        if not force:
            raise WorkspaceExisting("There is node workspace existing.\n"
                                    "If you want to remove it, please run:\n"
                                    "\"infrasim init -f \"")

        if force:
            destroy_existing_nodes()
            create_infrasim_directories()

    if not skip_installation:
        install_packages()
        config_library_link()
        update_bridge_cfg()

    if config_file:
        if os.path.exists(config_file):
            shutil.copy2(config_file, config.infrasim_etc)
        else:
            raise Exception("{} not found.".format(config_file))
    else:
        init_infrasim_conf(node_type)

    # record infrasim environment
    get_environment()

    get_socat()
    get_ipmi()
    get_qemu()
Example #3
0
def infrasim_init(node_type="quanta_d51", skip_installation=False, target_home=None, config_file=None):
    try:
        create_infrasim_directories()
        if not skip_installation:
            install_packages()
            update_bridge_cfg()
            config_library_link()

        if config_file:
            if os.path.exists(config_file):
                shutil.copy2(config_file, config.infrasim_etc)
            else:
                raise Exception("{} not found.".format(config_file))
        else:
            init_infrasim_conf(node_type)

        get_socat()
        get_ipmi()
        get_qemu()
        print "Infrasim init OK"
    except CommandNotFound as e:
        print "command:{} not found\n" \
              "Infrasim init failed".format(e.value)
    except CommandRunFailed as e:
        print "command:{} run failed\n" \
              "Infrasim init failed".format(e.value)
Example #4
0
def update_bridge_cfg():
    qemu_sys_prefix = os.path.dirname(get_qemu()).replace('bin', '')
    bridge_conf_loc = os.path.join(qemu_sys_prefix, "etc/qemu")
    if not os.path.exists(bridge_conf_loc):
        os.mkdir(bridge_conf_loc)
    bridge_conf = os.path.join(qemu_sys_prefix, bridge_conf_loc, "bridge.conf")
    with open(bridge_conf, "w") as f:
        f.write("allow all")
Example #5
0
def update_bridge_cfg():
    qemu_sys_prefix = os.path.dirname(get_qemu()).replace('bin', '')
    bridge_conf_loc = os.path.join(qemu_sys_prefix, "etc/qemu")
    if not os.path.exists(bridge_conf_loc):
        os.mkdir(bridge_conf_loc)
    bridge_conf = os.path.join(qemu_sys_prefix, bridge_conf_loc, "bridge.conf")
    with open(bridge_conf, "w") as f:
        f.write("allow all")
def test_qemu_exist():
    try:
        qemu.get_qemu()
        assert True
    except:
        assert False
Example #7
0
def test_qemu_exist():
    try:
        qemu.get_qemu()
        assert True
    except:
        assert False