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 <bergwolf@gmail.com>
This commit is contained in:
Peng Tao 2018-07-31 11:39:19 +08:00
parent f4a7712795
commit c8b4fabc37

View File

@ -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{})