Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
qemu: only close tap fd on addnic failure
Browse files Browse the repository at this point in the history
It causes various bizarre CI failures mostly pulling image
failures.

Signed-off-by: Peng Tao <[email protected]>
  • Loading branch information
bergwolf committed Oct 13, 2017
1 parent 54ad407 commit 8292ffb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hypervisor/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,13 @@ func (qc *QemuContext) AddNic(ctx *hypervisor.VmContext, host *hypervisor.HostNi
go func() {
// close tap file if necessary
ev, ok := <-waitChan
syscall.Close(fd)
if !ok {
syscall.Close(fd)
close(result)
} else {
if _, ok := ev.(*hypervisor.DeviceFailed); ok {
syscall.Close(fd)
}
result <- ev
}
}()
Expand Down

0 comments on commit 8292ffb

Please sign in to comment.