1818 utils_iptables ,
1919 utils_misc ,
2020 utils_net ,
21+ utils_sys ,
2122 utils_test ,
2223)
2324
@@ -372,6 +373,7 @@ def do_migration(
372373 {"func": <function domjobabort at 0x7f5835cd08c8>,
373374 "before_pause": "no"}
374375 ]
376+ :param virsh_opt: str, virsh options
375377 :param args: dictionary used by func,
376378 'func_param' is mandatory for func parameter.
377379 If no real func_param, none is requested.
@@ -709,7 +711,7 @@ def _do_orderly_migration(
709711 raise exceptions .TestFail ()
710712
711713 LOG .info ("Checking migration result..." )
712- self .check_result (self .ret , args )
714+ self .check_result (self .ret , args , vms )
713715
714716 def cleanup_dest_vm (self , vm , srcuri , desturi ):
715717 """
@@ -830,17 +832,19 @@ def update_virsh_migrate_extra_args(self, params):
830832 extra_args .update ({"err_msg" : params .get ("err_msg" )})
831833 return extra_args
832834
833- def check_result (self , result , params ):
835+ def check_result (self , result , params , vms ):
834836 """
835837 Check if the migration result is as expected
836838
837839 :param result: the output of migration
838840 :param params: the parameters dict
839- :raise: test.fail if test is failed
841+ :param vms: vm instances
842+ :raise: exceptions.TestFail if test is failed
840843 """
841844 status_error = "yes" == params .get ("status_error" , "no" )
842845 err_msg = params .get ("err_msg" )
843846 if not result :
847+ utils_sys .get_qemu_log (vms , type = "both" , params = params )
844848 raise exceptions .TestError ("No migration result is returned." )
845849
846850 LOG .info ("Migration out: %s" , result .stdout_text .strip ())
@@ -849,6 +853,7 @@ def check_result(self, result, params):
849853 if status_error : # Migration should fail
850854 if err_msg : # Special error messages are expected
851855 if not re .search (err_msg , result .stderr_text .strip ()):
856+ utils_sys .get_qemu_log (vms , type = "both" , params = params )
852857 raise exceptions .TestFail (
853858 "Can not find the expected "
854859 "patterns '%s' in output '%s'"
@@ -863,6 +868,7 @@ def check_result(self, result, params):
863868 raise exceptions .TestFail ("Migration success is unexpected result" )
864869 else :
865870 if int (result .exit_status ) != 0 :
871+ utils_sys .get_qemu_log (vms , type = "both" , params = params )
866872 raise exceptions .TestFail (result .stderr_text .strip ())
867873
868874 def do_cancel (self , sig = signal .SIGKILL ):
0 commit comments