Exemplo n.º 1
0
    def testSplitInstanceNoForce(self):
        (node, group) = self._BuildSplitInstanceSituation()
        op = opcodes.OpGroupAssignNodes(group_name=group.name,
                                        nodes=[node.name])

        self.ExecOpCodeExpectOpExecError(
            op, "instances get split by this change and --force was not given")
Exemplo n.º 2
0
def AssignNodes(opts, args):
  """Assign nodes to a group.

  @param opts: the command line options selected by the user
  @type args: list
  @param args: args[0]: group to assign nodes to; args[1:]: nodes to assign
  @rtype: int
  @return: the desired exit code

  """
  group_name = args[0]
  node_names = args[1:]

  op = opcodes.OpGroupAssignNodes(group_name=group_name, nodes=node_names,
                                  force=opts.force)
  SubmitOrSend(op, opts)
Exemplo n.º 3
0
    def testSplitInstanceForce(self):
        (node, group) = self._BuildSplitInstanceSituation()

        node2 = self.cfg.AddNewNode(group=group)
        self.cfg.AddNewInstance(disk_template=constants.DT_DRBD8,
                                primary_node=self.master,
                                secondary_node=node2)

        op = opcodes.OpGroupAssignNodes(group_name=group.name,
                                        nodes=[node.name],
                                        force=True)

        self.ExecOpCode(op)

        self.mcpu.assertLogContainsRegex("will split the following instances")
        self.mcpu.assertLogContainsRegex(
            "instances continue to be split across groups")
Exemplo n.º 4
0
    def __init__(self, methodName='runTest'):
        super(TestLUGroupAssignNodes, self).__init__(methodName)

        self.op = opcodes.OpGroupAssignNodes(group_name="default", nodes=[])