def do_status(self, context): ''' Quick cluster health status. Corosync status, DRBD status... ''' stack = utils.cluster_stack() if not stack: err_buf.error( "No supported cluster stack found (tried heartbeat|openais|corosync)" ) if utils.cluster_stack() == 'corosync': print "Services:" for svc in ["corosync", "pacemaker"]: info = utils.service_info(svc) if info: print "%-16s %s" % (svc, info) else: print "%-16s unknown" % (svc) rc, outp = utils.get_stdout(['corosync-cfgtool', '-s'], shell=False) if rc == 0: print "" print outp else: print "Failed to get corosync status"
def _call_delnode(self, node): "Remove node (how depends on cluster stack)" rc = True if utils.cluster_stack() == "heartbeat": cmd = (self.hb_delnode % node) else: ec, s = utils.get_stdout("%s -p" % self.crm_node) if not s: common_err('%s -p could not list any nodes (rc=%d)' % (self.crm_node, ec)) rc = False else: partition_l = s.split() if node in partition_l: common_err("according to %s, node %s is still active" % (self.crm_node, node)) rc = False cmd = "%s --force -R %s" % (self.crm_node, node) if not rc: if config.core.force: common_info('proceeding with node %s removal' % node) else: return False ec = utils.ext_cmd(cmd) if ec != 0: common_warn('"%s" failed, rc=%d' % (cmd, ec)) return False return True
def do_status(self, context): ''' Quick cluster health status. Corosync status, DRBD status... ''' stack = utils.cluster_stack() if not stack: err_buf.error("No supported cluster stack found (tried heartbeat|openais|corosync)") if utils.cluster_stack() == 'corosync': print "Services:" for svc in ["corosync", "pacemaker"]: info = utils.service_info(svc) if info: print "%-16s %s" % (svc, info) else: print "%-16s unknown" % (svc) rc, outp = utils.get_stdout(['corosync-cfgtool', '-s'], shell=False) if rc == 0: print "" print outp else: print "Failed to get corosync status"
def requires(self): stack = utils.cluster_stack() if len(stack) > 0 and stack != 'corosync': err_buf.warning("Unsupported cluster stack %s detected." % (stack)) return False return True
def requires(self): stack = utils.cluster_stack() if len(stack) > 0 and stack != 'corosync': err_buf.warning("Unsupported cluster stack %s detected." % (stack)) return False return corosync.check_tools()
def is_corosync_stack(): return utils.cluster_stack() == 'corosync'