Beispiel #1
0
def NodeAdd(node, readd=False, group=None):
    if not readd and node.added:
        raise qa_error.Error("Node %s already in cluster" % node.primary)
    elif readd and not node.added:
        raise qa_error.Error("Node %s not yet in cluster" % node.primary)

    cmd = ["gnt-node", "add", "--no-ssh-key-check"]
    if node.secondary:
        cmd.append("--secondary-ip=%s" % node.secondary)
    if readd:
        cmd.append("--readd")
    if group is not None:
        cmd.extend(["--node-group", group])

    if not qa_config.GetModifySshSetup():
        cmd.append("--no-node-setup")

    cmd.append(node.primary)

    AssertCommand(cmd)

    if readd:
        AssertRedirectedCommand(["gnt-cluster", "verify"])

    if readd:
        assert node.added
    else:
        node.MarkAdded()
Beispiel #2
0
def TestNodeModify(node):
    """gnt-node modify"""

    # make sure enough master candidates will be available by disabling the
    # master candidate role first with --auto-promote
    AssertCommand([
        "gnt-node", "modify", "--master-candidate=no", "--auto-promote",
        node.primary
    ])

    # now it's save to force-remove the master candidate role
    for flag in ["master-candidate", "drained", "offline"]:
        for value in ["yes", "no"]:
            AssertCommand([
                "gnt-node", "modify", "--force",
                "--%s=%s" % (flag, value), node.primary
            ])

    AssertCommand(
        ["gnt-node", "modify", "--master-candidate=yes", node.primary])

    # Test setting secondary IP address
    AssertCommand([
        "gnt-node", "modify",
        "--secondary-ip=%s" % node.secondary, node.primary
    ])

    AssertRedirectedCommand(["gnt-cluster", "verify"])
Beispiel #3
0
def TestNodeModify(node):
    """gnt-node modify"""

    default_pool_size = 10
    nodes = qa_config.GetAllNodes()
    test_pool_size = len(nodes) - 1

    # Reduce the number of master candidates, because otherwise all
    # subsequent 'gnt-cluster verify' commands fail due to not enough
    # master candidates.
    AssertCommand(
        ["gnt-cluster", "modify",
         "--candidate-pool-size=%s" % test_pool_size])

    # make sure enough master candidates will be available by disabling the
    # master candidate role first with --auto-promote
    AssertCommand([
        "gnt-node", "modify", "--master-candidate=no", "--auto-promote",
        node.primary
    ])

    # now it's save to force-remove the master candidate role
    for flag in ["master-candidate", "drained", "offline"]:
        for value in ["yes", "no"]:
            AssertCommand([
                "gnt-node", "modify", "--force",
                "--%s=%s" % (flag, value), node.primary
            ])
            AssertCommand(["gnt-cluster", "verify"])

    AssertCommand(
        ["gnt-node", "modify", "--master-candidate=yes", node.primary])

    # Test setting secondary IP address
    AssertCommand([
        "gnt-node", "modify",
        "--secondary-ip=%s" % node.secondary, node.primary
    ])

    AssertRedirectedCommand(["gnt-cluster", "verify"])
    AssertCommand([
        "gnt-cluster", "modify",
        "--candidate-pool-size=%s" % default_pool_size
    ])

    # For test clusters with more nodes than the default pool size,
    # we now have too many master candidates. To readjust to the original
    # size, manually demote all nodes and rely on auto-promotion to adjust.
    if len(nodes) > default_pool_size:
        master = qa_config.GetMasterNode()
        for n in nodes:
            if n.primary != master.primary:
                AssertCommand([
                    "gnt-node", "modify", "--master-candidate=no",
                    "--auto-promote", n.primary
                ])
def TestNodeModify(node):
    """gnt-node modify"""

    default_pool_size = 10
    nodes = qa_config.GetAllNodes()
    test_pool_size = len(nodes) - 1

    # Reduce the number of master candidates, because otherwise all
    # subsequent 'gnt-cluster verify' commands fail due to not enough
    # master candidates.
    AssertCommand(
        ["gnt-cluster", "modify",
         "--candidate-pool-size=%s" % test_pool_size])

    # make sure enough master candidates will be available by disabling the
    # master candidate role first with --auto-promote
    AssertCommand([
        "gnt-node", "modify", "--master-candidate=no", "--auto-promote",
        node.primary
    ])

    # now it's save to force-remove the master candidate role
    for flag in ["master-candidate", "drained", "offline"]:
        for value in ["yes", "no"]:
            AssertCommand([
                "gnt-node", "modify", "--force",
                "--%s=%s" % (flag, value), node.primary
            ])
            AssertCommand(["gnt-cluster", "verify"])

    AssertCommand(
        ["gnt-node", "modify", "--master-candidate=yes", node.primary])

    # Test setting secondary IP address
    AssertCommand([
        "gnt-node", "modify",
        "--secondary-ip=%s" % node.secondary, node.primary
    ])

    AssertRedirectedCommand(["gnt-cluster", "verify"])
    AssertCommand([
        "gnt-cluster", "modify",
        "--candidate-pool-size=%s" % default_pool_size
    ])