Skip to content

Commit

Permalink
Merge pull request kubevirt#2473 from kubevirt-bot/cherry-pick-2244-t…
Browse files Browse the repository at this point in the history
…o-release-0.13

[release-0.13] fix virt-launcher panic after migration cancellation on crio
  • Loading branch information
rmohr authored Sep 25, 2019
2 parents 4f54dd8 + 8c33c11 commit 50e3790
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/virt-launcher/virtwrap/cli/libvirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ func (l *LibvirtConnection) NewStream(flags libvirt.StreamFlags) (Stream, error)

func (l *LibvirtConnection) Close() (int, error) {
close(l.stop)
return l.Connect.Close()
if l.Connect != nil {
return l.Connect.Close()
} else {
return 0, nil
}
}

func (l *LibvirtConnection) DomainEventLifecycleRegister(callback libvirt.DomainEventLifecycleCallback) (err error) {
Expand Down Expand Up @@ -193,9 +197,12 @@ func (l *LibvirtConnection) installWatchdog(checkInterval time.Duration) {
return

case <-time.After(checkInterval):
l.reconnectIfNecessary()

alive, err := l.Connect.IsAlive()
var alive bool
var err error
err = l.reconnectIfNecessary()
if l.Connect != nil {
alive, err = l.Connect.IsAlive()
}

// If the connection is ok, continue
if alive {
Expand Down

0 comments on commit 50e3790

Please sign in to comment.