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

fix deadlock in ReleaseAllVms() #509

Merged
merged 1 commit into from
Jan 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,18 @@ func (daemon *Daemon) DestroyAndKeepVm() error {
}

func (daemon *Daemon) ReleaseAllVms() error {
var (
err error = nil
)

err = daemon.PodList.Foreach(func(p *pod.XPod) error {
return p.Dissociate()
var remains = []*pod.XPod{}
daemon.PodList.Foreach(func(p *pod.XPod) error {
remains = append(remains, p)
return nil
})

return err
for _, p := range remains {
glog.V(1).Infof("try to dissociate %s", p.Id())
if err := p.Dissociate(); err != nil {
glog.Warningf("fail to dissociate %s: %v", p.Id(), err)
}
}
return nil
}

func (daemon *Daemon) Shutdown() error {
Expand Down