2013/1/30 Bernardo Dal Seno <[email protected]>:
>    if qa_config.TestEnabled("instance-replace-disks"):
> -    othernode = qa_config.AcquireNode(exclude=[pnode, snode])
> +    othernodes = qa_config.AcquireManyNodes(len(inodes) - 1, exclude=inodes)

Can you please explain in a comment the logic behind the calculation
for the number of nodes?

>    if qa_config.TestEnabled("instance-recreate-disks"):
> -    othernode1 = qa_config.AcquireNode(exclude=[pnode, snode])
>      try:
> -      othernode2 = qa_config.AcquireNode(exclude=[pnode, snode, othernode1])
> +      acquirednodes = qa_config.AcquireManyNodes(len(inodes), exclude=inodes)
> +      othernodes = acquirednodes
>      except qa_error.OutOfNodesError:
> -      # Let's reuse one of the nodes if the cluster is not big enough
> -      othernode2 = pnode
> +      if len(inodes) > 1:
> +        # If the cluster is not big enough, let's reuse some of the nodes, 
> but
> +        # with different roles. In this way, we can test a DRBD instance 
> even on
> +        # a 3-node cluster.

Please either mention this change of logic in the commit message or
even move it to a new patch.

> +        acquirednodes = [qa_config.AcquireNode(exclude=inodes)]
> +        othernodes = acquirednodes + inodes[:-1]
> +      else:
> +        raise

>  @InstanceCheck(None, INST_UP, RETURN_VALUE)
> -def TestInstanceAddWithDrbdDisk(node, node2):
> +def TestInstanceAddWithDrbdDisk(nodes):
>    """gnt-instance add -t drbd"""
> -  return _DiskTest("%s:%s" % (node["primary"], node2["primary"]),
> +  assert len(nodes) == 2
> +  return _DiskTest("%s:%s" % (nodes[0]["primary"], nodes[1]["primary"]),

":".join(map(operator.itemgetter("primary"), nodes)), no?

>                     "drbd")

Michael

Reply via email to