From c8b4fabc37588d4ad6b341649f93b8e31d354876 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 31 Jul 2018 11:39:19 +0800 Subject: [PATCH] qemu: clear qmp state before wait for qemu process So that if there is any remaining state, we do not let it interfere with the new one. This should fix the occasional vm factory hang. Fixes: #535 Signed-off-by: Peng Tao --- virtcontainers/qemu.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/virtcontainers/qemu.go b/virtcontainers/qemu.go index 1d84fa88d7..8002110fd4 100644 --- a/virtcontainers/qemu.go +++ b/virtcontainers/qemu.go @@ -517,6 +517,8 @@ func (q *qemu) waitSandbox(timeout int) error { var ver *govmmQemu.QMPVersion var err error + // clear any possible old state before trying to connect again. + q.qmpShutdown() timeStart := time.Now() for { disconnectCh := make(chan struct{})