示例#1
0
文件: env.py 项目: HideoYamauchi/pcs
    def _get_wait_timeout(self, wait):
        if wait is False:
            return False

        if wait not in self.__timeout_cache:
            if not self.is_cib_live:
                raise LibraryError(reports.wait_for_idle_not_live_cluster())
            ensure_wait_for_idle_support(self.cmd_runner())
            self.__timeout_cache[wait] = get_valid_timeout_seconds(wait)
        return self.__timeout_cache[wait]
示例#2
0
    def _get_wait_timeout(self, wait):
        if wait is False:
            return False

        if wait not in self.__timeout_cache:
            if not self.is_cib_live:
                raise LibraryError(reports.wait_for_idle_not_live_cluster())
            ensure_wait_for_idle_support(self.cmd_runner())
            self.__timeout_cache[wait] = get_valid_timeout_seconds(wait)
        return self.__timeout_cache[wait]
示例#3
0
文件: cluster.py 项目: bashims/pcs
def _get_validated_wait_timeout(report_processor, wait, start):
    try:
        if wait is False:
            return False
        if not start:
            report_processor.report(
                reports.wait_for_node_startup_without_start())
        return get_valid_timeout_seconds(wait)
    except LibraryError as e:
        report_processor.report_list(e.args)
    return None
示例#4
0
文件: env.py 项目: zht750808/pcs
    def get_wait_timeout(self, wait):
        if wait is False:
            return False

        if wait not in self.__timeout_cache:
            if not self.is_cib_live:
                raise LibraryError(
                    ReportItem.error(
                        reports.messages.WaitForIdleNotLiveCluster()))
            self.__timeout_cache[wait] = get_valid_timeout_seconds(wait)
        return self.__timeout_cache[wait]
示例#5
0
文件: env.py 项目: vvidic/pcs
def _wait_type_to_int(wait: WaitType) -> int:
    """
    Convert WaitType to int.

    wait -- wait value. If False, it means wait is disabled, therefore -1
        is returned. If None, wait is enabled without timeout, therefore 0
        is returned. If string representing timeout or positive integer,
        wait is enabled with timeout, therefore number of seconds is
        retuned. Otherwise a LibraryError is raised.
    """
    if wait is False:
        return -1
    wait_timeout = get_valid_timeout_seconds(wait)
    if wait_timeout is None:
        return 0
    return wait_timeout