def do_delete(self, context, node): 'usage: delete <node>' if not utils.is_name_sane(node): return False if not xmlutil.is_our_node(node): common_err("node %s not found in the CIB" % node) return False if not self._call_delnode(node): return False if utils.ext_cmd(self.node_delete % node) != 0 or \ utils.ext_cmd(self.node_delete_status % node) != 0: common_err("%s removed from membership, but not from CIB!" % node) return False common_info("node %s deleted" % node) return True
def do_migrate(self, context, rsc, *args): """usage: migrate <rsc> [<node>] [<lifetime>] [force]""" if not utils.is_name_sane(rsc): return False node = None argl = list(args) force = "force" in utils.fetch_opts(argl, ["force"]) lifetime = utils.fetch_lifetime_opt(argl) if len(argl) > 0: node = argl[0] if not xmlutil.is_our_node(node): context.fatal_error("Not our node: " + node) opts = '' if node: opts = "--node='%s'" % node if lifetime: opts = "%s --lifetime='%s'" % (opts, lifetime) if force or config.core.force: opts = "%s --force" % opts return utils.ext_cmd(self.rsc_migrate % (rsc, opts)) == 0
def do_standby(self, context, *args): 'usage: standby [<node>] [<lifetime>]' argl = list(args) node = None lifetime = utils.fetch_lifetime_opt(argl, iso8601=False) if not argl: node = utils.this_node() elif len(argl) == 1: node = args[0] if not xmlutil.is_our_node(node): common_err("%s: node name not recognized" % node) return False else: syntax_err(args, context=context.get_command_name()) return False opts = '' if lifetime: opts = "--lifetime='%s'" % lifetime else: opts = "--lifetime='forever'" return utils.ext_cmd(self.node_standby % (node, "on", opts)) == 0
def do_migrate(self, context, *args): """usage: migrate <rsc> [<node>] [<lifetime>] [force]""" argl = list(args) rsc = argl[0] if not utils.is_name_sane(rsc): return False del argl[0] node = None opt_l = utils.fetch_opts(argl, ["force"]) lifetime = utils.fetch_lifetime_opt(argl) if len(argl) == 1: if xmlutil.is_our_node(argl[0]): node = argl[0] else: context.fatal_error("Not our node: " + argl[0]) opts = '' if node: opts = "--node='%s'" % node if lifetime: opts = "%s --lifetime='%s'" % (opts, lifetime) if "force" in opt_l or config.core.force: opts = "%s --force" % opts return utils.ext_cmd(self.rsc_migrate % (rsc, opts)) == 0