Example #1
0
def collect_info():
    """
    get all other info (config, stats, etc)
    """
    collect_func_list = generate_collect_functions()
    # Make sure not to occupy all CPUs
    pool = multiprocessing.Pool(round(0.8 * multiprocessing.cpu_count()))
    # result here to store AsyncResult object returned from apply_async
    # Then calling get() method will catch exceptions like NameError, AttributeError, etc.
    # Otherwise parent process will not know these exceptions raised
    # Calling get() right after apply_async will be blocked until child process finished, so
    # need to append to a list firstly
    result_list = []
    for cf in collect_func_list:
        result = pool.apply_async(getattr(collect, cf))
        result_list.append(result)
    pool.close()
    pool.join()

    for result in result_list:
        try:
            result.get()
        except Exception as err:
            logger.error(str(err))

    logfile_list = []
    corosync_log = corosync.get_value('logging.logfile')
    if corosync_log:
        logfile_list.append(corosync_log)
    logfile_list += constants.EXTRA_LOGS.split()

    for l in logfile_list:
        if not os.path.isfile(l):
            continue
        if l == constants.HA_LOG and l != constants.HALOG_F:
            os.symlink(constants.HALOG_F, os.path.join(constants.WORKDIR, os.path.basename(l)))
            continue
        if is_our_log(l, constants.FROM_TIME, constants.TO_TIME) == 4:
            logger.debug("found irregular log file %s", l)
            outf = os.path.join(constants.WORKDIR, os.path.basename(l))
            shutil.copy2(l, constants.WORKDIR)
            log_size(l, outf+'.info')
            continue
        getstampproc = find_getstampproc(l)
        if getstampproc:
            constants.GET_STAMP_FUNC = getstampproc
            outf = os.path.join(constants.WORKDIR, os.path.basename(l))
            if dump_logset(l, constants.FROM_TIME, constants.TO_TIME, outf):
                log_size(l, outf+'.info')
        else:
            logger.warning("could not figure out the log format of %s", l)
Example #2
0
def step_impl(context):
    assert corosync.get_value('totem.transport') == 'udpu'
Example #3
0
def step_impl(context, votes):
    assert int(corosync.get_value("quorum.expected_votes")) == int(votes)
Example #4
0
def step_impl(context, transport_type):
    if transport_type == "multicast":
        assert corosync.get_value("totem.transport") != "udpu"
    if transport_type == "unicast":
        assert corosync.get_value("totem.transport") == "udpu"