Exemplo n.º 1
0
    def __enter__(self):
        PreservePacemakerCorosyncState.lock.acquire()

        try:
            self.pacemaker_is_running = pacemaker_running()
            self.corosync_is_running = corosync_running()

            start_corosync()
            start_pacemaker()
        except:
            PreservePacemakerCorosyncState.lock.release()
            raise
Exemplo n.º 2
0
    def _scan(self):
        """Respond to poll.  Only return if has valid data"""

        result = {}

        raw_output = self._read_crm_mon_as_xml()
        if raw_output:
            result["crm_info"] = self._parse_crm_as_xml(raw_output)
        else:
            result["crm_info"] = None

        result["state"] = {}
        result["state"]["corosync"] = "started" if corosync_running() else "stopped"
        result["state"]["pacemaker"] = "started" if pacemaker_running() else "stopped"

        return result