39 |
39 |
import qa_error
|
40 |
40 |
import qa_group
|
41 |
41 |
import qa_instance
|
|
42 |
import qa_iptables
|
42 |
43 |
import qa_monitoring
|
43 |
44 |
import qa_network
|
44 |
45 |
import qa_node
|
... | ... | |
577 |
578 |
node.Release()
|
578 |
579 |
|
579 |
580 |
|
|
581 |
def RunCustomSshPortTests():
|
|
582 |
"""Test accessing nodes with custom SSH ports.
|
|
583 |
|
|
584 |
This requires removing nodes, adding them to a new group, and then undoing
|
|
585 |
the change.
|
|
586 |
"""
|
|
587 |
if not qa_config.TestEnabled("group-custom-ssh-port"):
|
|
588 |
return
|
|
589 |
|
|
590 |
port = 211
|
|
591 |
master = qa_config.GetMasterNode()
|
|
592 |
with qa_config.AcquireManyNodesCtx(1, exclude=master) as nodes:
|
|
593 |
for node in nodes:
|
|
594 |
qa_node.NodeRemove(node)
|
|
595 |
with qa_iptables.RulesContext(nodes) as r:
|
|
596 |
with qa_group.NewGroupCtx() as group:
|
|
597 |
qa_group.ModifyGroupSshPort(r, group, nodes, port)
|
|
598 |
|
|
599 |
for node in nodes:
|
|
600 |
qa_node.NodeAdd(node, group=group)
|
|
601 |
|
|
602 |
# Make sure that the cluster doesn't have any pre-existing problem
|
|
603 |
qa_cluster.AssertClusterVerify()
|
|
604 |
|
|
605 |
# Create and allocate instances
|
|
606 |
instance1 = qa_instance.TestInstanceAddWithPlainDisk(nodes)
|
|
607 |
try:
|
|
608 |
instance2 = qa_instance.TestInstanceAddWithPlainDisk(nodes)
|
|
609 |
try:
|
|
610 |
# cluster-verify checks that disks are allocated correctly
|
|
611 |
qa_cluster.AssertClusterVerify()
|
|
612 |
|
|
613 |
# Remove instances
|
|
614 |
qa_instance.TestInstanceRemove(instance2)
|
|
615 |
qa_instance.TestInstanceRemove(instance1)
|
|
616 |
finally:
|
|
617 |
instance2.Release()
|
|
618 |
finally:
|
|
619 |
instance1.Release()
|
|
620 |
|
|
621 |
for node in nodes:
|
|
622 |
qa_node.NodeRemove(node)
|
|
623 |
|
|
624 |
for node in nodes:
|
|
625 |
qa_node.NodeAdd(node)
|
|
626 |
|
|
627 |
qa_cluster.AssertClusterVerify()
|
|
628 |
|
|
629 |
|
580 |
630 |
def _BuildSpecDict(par, mn, st, mx):
|
581 |
631 |
return {
|
582 |
632 |
constants.ISPECS_MINMAX: [{
|
... | ... | |
866 |
916 |
RunTestIf(["cluster-instance-policy", "instance-add-plain-disk"],
|
867 |
917 |
TestIPolicyPlainInstance)
|
868 |
918 |
|
|
919 |
RunCustomSshPortTests()
|
|
920 |
|
869 |
921 |
RunTestIf(
|
870 |
922 |
"instance-add-restricted-by-disktemplates",
|
871 |
923 |
qa_instance.TestInstanceCreationRestrictedByDiskTemplates)
|