Revision 66743fe3 qa/qa_rapi.py
b/qa/qa_rapi.py | ||
---|---|---|
818 | 818 |
|
819 | 819 |
|
820 | 820 |
def TestInterClusterInstanceMove(src_instance, dest_instance, |
821 |
inodes, tnode): |
|
821 |
inodes, tnode, perform_checks=True):
|
|
822 | 822 |
"""Test tools/move-instance""" |
823 | 823 |
master = qa_config.GetMasterNode() |
824 | 824 |
|
... | ... | |
826 | 826 |
rapi_pw_file.write(_rapi_password) |
827 | 827 |
rapi_pw_file.flush() |
828 | 828 |
|
829 |
dest_instance.SetDiskTemplate(src_instance.disk_template) |
|
829 |
# Needed only if checks are to be performed |
|
830 |
if perform_checks: |
|
831 |
dest_instance.SetDiskTemplate(src_instance.disk_template) |
|
830 | 832 |
|
831 | 833 |
# TODO: Run some instance tests before moving back |
832 | 834 |
|
... | ... | |
842 | 844 |
pnode = inodes[0] |
843 | 845 |
# note: pnode:snode are the *current* nodes, so we move it first to |
844 | 846 |
# tnode:pnode, then back to pnode:snode |
845 |
for si, di, pn, sn in [(src_instance.name, dest_instance.name, |
|
846 |
tnode.primary, pnode.primary), |
|
847 |
(dest_instance.name, src_instance.name, |
|
848 |
pnode.primary, snode.primary)]: |
|
847 |
for current_src_inst, current_dest_inst, target_pnode, target_snode in \ |
|
848 |
[(src_instance.name, dest_instance.name, tnode.primary, pnode.primary), |
|
849 |
(dest_instance.name, src_instance.name, pnode.primary, snode.primary)]: |
|
849 | 850 |
cmd = [ |
850 | 851 |
"../tools/move-instance", |
851 | 852 |
"--verbose", |
852 | 853 |
"--src-ca-file=%s" % _rapi_ca.name, |
853 | 854 |
"--src-username=%s" % _rapi_username, |
854 | 855 |
"--src-password-file=%s" % rapi_pw_file.name, |
855 |
"--dest-instance-name=%s" % di,
|
|
856 |
"--dest-primary-node=%s" % pn,
|
|
857 |
"--dest-secondary-node=%s" % sn,
|
|
856 |
"--dest-instance-name=%s" % current_dest_inst,
|
|
857 |
"--dest-primary-node=%s" % target_pnode,
|
|
858 |
"--dest-secondary-node=%s" % target_snode,
|
|
858 | 859 |
"--net=0:mac=%s" % constants.VALUE_GENERATE, |
859 | 860 |
master.primary, |
860 | 861 |
master.primary, |
861 |
si,
|
|
862 |
current_src_inst,
|
|
862 | 863 |
] |
863 | 864 |
|
864 |
qa_utils.RunInstanceCheck(di, False) |
|
865 |
# Some uses of this test might require that RAPI-only commands are used, |
|
866 |
# and the checks are command-line based. |
|
867 |
|
|
868 |
if perform_checks: |
|
869 |
qa_utils.RunInstanceCheck(current_dest_inst, False) |
|
870 |
|
|
865 | 871 |
AssertEqual(StartLocalCommand(cmd).wait(), 0) |
866 |
qa_utils.RunInstanceCheck(si, False) |
|
867 |
qa_utils.RunInstanceCheck(di, True) |
|
872 |
|
|
873 |
if perform_checks: |
|
874 |
qa_utils.RunInstanceCheck(current_src_inst, False) |
|
875 |
qa_utils.RunInstanceCheck(current_dest_inst, True) |
Also available in: Unified diff