Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
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
Exemplo n.º 4
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
Exemplo n.º 5
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