Revision 5fb7679c
b/qa/qa_rapi.py | ||
---|---|---|
890 | 890 |
return _rapi_client.GetOperatingSystems() |
891 | 891 |
|
892 | 892 |
|
893 |
def _InvokeMoveInstance(current_dest_inst, current_src_inst, rapi_pw_filename, |
|
894 |
joint_master, perform_checks, target_nodes=None): |
|
895 |
""" Invokes the move-instance tool for testing purposes. |
|
896 |
|
|
897 |
""" |
|
898 |
# Some uses of this test might require that RAPI-only commands are used, |
|
899 |
# and the checks are command-line based. |
|
900 |
if perform_checks: |
|
901 |
qa_utils.RunInstanceCheck(current_dest_inst, False) |
|
902 |
|
|
903 |
cmd = [ |
|
904 |
"../tools/move-instance", |
|
905 |
"--verbose", |
|
906 |
"--src-ca-file=%s" % _rapi_ca.name, |
|
907 |
"--src-username=%s" % _rapi_username, |
|
908 |
"--src-password-file=%s" % rapi_pw_filename, |
|
909 |
"--dest-instance-name=%s" % current_dest_inst, |
|
910 |
] |
|
911 |
|
|
912 |
if target_nodes: |
|
913 |
pnode, snode = target_nodes |
|
914 |
cmd.extend([ |
|
915 |
"--dest-primary-node=%s" % pnode, |
|
916 |
"--dest-secondary-node=%s" % snode, |
|
917 |
]) |
|
918 |
else: |
|
919 |
cmd.append("--iallocator=%s" % constants.IALLOC_HAIL) |
|
920 |
|
|
921 |
cmd.extend([ |
|
922 |
"--net=0:mac=%s" % constants.VALUE_GENERATE, |
|
923 |
joint_master, |
|
924 |
joint_master, |
|
925 |
current_src_inst, |
|
926 |
]) |
|
927 |
|
|
928 |
AssertEqual(StartLocalCommand(cmd).wait(), 0) |
|
929 |
|
|
930 |
if perform_checks: |
|
931 |
qa_utils.RunInstanceCheck(current_src_inst, False) |
|
932 |
qa_utils.RunInstanceCheck(current_dest_inst, True) |
|
933 |
|
|
934 |
|
|
893 | 935 |
def TestInterClusterInstanceMove(src_instance, dest_instance, |
894 | 936 |
inodes, tnode, perform_checks=True): |
895 | 937 |
"""Test tools/move-instance""" |
... | ... | |
911 | 953 |
assert len(inodes) == 2 |
912 | 954 |
snode = inodes[1] |
913 | 955 |
else: |
914 |
# instance is not redundant, but we still need to pass a node
|
|
956 |
# Instance is not redundant, but we still need to pass a node
|
|
915 | 957 |
# (which will be ignored) |
916 | 958 |
snode = tnode |
917 | 959 |
pnode = inodes[0] |
918 |
# note: pnode:snode are the *current* nodes, so we move it first to |
|
919 |
# tnode:pnode, then back to pnode:snode |
|
920 |
for current_src_inst, current_dest_inst, target_pnode, target_snode in \ |
|
921 |
[(src_instance.name, dest_instance.name, tnode.primary, pnode.primary), |
|
922 |
(dest_instance.name, src_instance.name, pnode.primary, snode.primary)]: |
|
923 |
cmd = [ |
|
924 |
"../tools/move-instance", |
|
925 |
"--verbose", |
|
926 |
"--src-ca-file=%s" % _rapi_ca.name, |
|
927 |
"--src-username=%s" % _rapi_username, |
|
928 |
"--src-password-file=%s" % rapi_pw_file.name, |
|
929 |
"--dest-instance-name=%s" % current_dest_inst, |
|
930 |
"--dest-primary-node=%s" % target_pnode, |
|
931 |
"--dest-secondary-node=%s" % target_snode, |
|
932 |
"--net=0:mac=%s" % constants.VALUE_GENERATE, |
|
933 |
master.primary, |
|
934 |
master.primary, |
|
935 |
current_src_inst, |
|
936 |
] |
|
937 |
|
|
938 |
# Some uses of this test might require that RAPI-only commands are used, |
|
939 |
# and the checks are command-line based. |
|
940 |
|
|
941 |
if perform_checks: |
|
942 |
qa_utils.RunInstanceCheck(current_dest_inst, False) |
|
943 | 960 |
|
944 |
AssertEqual(StartLocalCommand(cmd).wait(), 0) |
|
961 |
# pnode:snode are the *current* nodes, so we move it first to tnode:pnode |
|
962 |
_InvokeMoveInstance(dest_instance.name, src_instance.name, rapi_pw_file.name, |
|
963 |
master.primary, perform_checks, |
|
964 |
target_nodes=(tnode.primary, pnode.primary)) |
|
945 | 965 |
|
946 |
if perform_checks: |
|
947 |
qa_utils.RunInstanceCheck(current_src_inst, False) |
|
948 |
qa_utils.RunInstanceCheck(current_dest_inst, True) |
|
966 |
# And then back to pnode:snode |
|
967 |
_InvokeMoveInstance(src_instance.name, dest_instance.name, rapi_pw_file.name, |
|
968 |
master.primary, perform_checks, |
|
969 |
target_nodes=(pnode.primary, snode.primary)) |
Also available in: Unified diff