tests/migration: fix unix socket migration
authorHyman <huangy81@chinatelecom.cn>
Tue, 9 Mar 2021 16:00:59 +0000 (00:00 +0800)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 14 Jul 2021 13:15:52 +0000 (14:15 +0100)
The test aborts and error message as the following be throwed:
"No such file or directory: '/var/tmp/qemu-migrate-{pid}.migrate",
when the unix socket migration test nearly done. The reason is
qemu removes the unix socket file after migration before
guestperf.py script do it. So pre-check if the socket file exists
when removing it to prevent the guestperf program from aborting.

See also commit f9cc00346d3 ("tests/migration: fix unix socket batch
migration").

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Hyman <huangy81@chinatelecom.cn>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/migration/guestperf/engine.py

index 7c991c44074d174edf2be3e2bdcaa1f6a6ebba3f..87a6ab200908f6d0d4e581bd75b134e3f466e017 100644 (file)
@@ -423,7 +423,7 @@ class Engine(object):
             progress_history = ret[0]
             qemu_timings = ret[1]
             vcpu_timings = ret[2]
-            if uri[0:5] == "unix:":
+            if uri[0:5] == "unix:" and os.path.exists(uri[5:]):
                 os.remove(uri[5:])
 
             if os.path.exists(srcmonaddr):